Opened 13 days ago
Last modified 3 days ago
#19243 new bug
Debugger didn't retrieve the source code from debuging info
Reported by: | DigitalBox98 | Owned by: | anevilyak |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Applications/Debugger | Version: | R1/beta5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86-64 |
Description
In some situations, the Debugger is not able to retrieve the source code of the program.
In the example attached, putting the break point in the About dialog part is not attaching it in the source code. The breakpoint is working however the source code is not more displayed after that.
Attached example : SimpleOpenGLCube : working example (Debugger is able to work with the source code) SimpleApp : example where Debugger is not able to retrieve the source code once the main is runned
Attachments (6)
Change History (17)
by , 13 days ago
Attachment: | debug1.png added |
---|
by , 13 days ago
Attachment: | debug2.png added |
---|
Putting breaking in the AboutDialog is not attached to the source code for an unknown reason
by , 13 days ago
Attachment: | debug3.png added |
---|
Once the breakpoint is reached, no source code is diplayed
by , 13 days ago
Attachment: | debug4.png added |
---|
The application source code is no more found by the Debugger
by , 13 days ago
Attachment: | SimpleOpenGLCube.zip added |
---|
Example where Debugger is working without any issue
comment:1 by , 13 days ago
Component: | Applications → Applications/Debugger |
---|---|
Owner: | changed from | to
comment:2 by , 9 days ago
I'm closing this ticket as it's more relative to the build phase : if directory is not referenced in the debug infos, we can manually indicates to Debugger where to look for?.
comment:4 by , 8 days ago
From the description it's a bit unclear what the problem is ; the problem with source file location is it depends a lot on exactly what the compiler embeds in the DIE ; in some cases I've seen gcc only embed a relative path e.g. src/abc/def/file.cpp
or sometimes even with ..
. In cases such as this the debugger has no way of knowing what the base path for locating those is supposed to be, so it has to rely on the working directory the binary is run from to try to find them. If the problem is that it's displaying disassembly and giving you the option to locate the source file, that sounds like working as designed, because that's the most it can do given the info it has, but if it's either displaying nothing at all, or disassembly with no option to help it find the file, then that's an issue. Clarification needed.
comment:5 by , 8 days ago
Somehow GDB manages to figure this out much more of the time than Debugger is, so clearly there's some way to make it work.
Automatic finding of source code basically never works for me in Debugger at present. A lot of the time it actually displays the absolute path the compiler was run from (e.g. "/boot/home/Desktop/haiku/generated/") combined with the source filename (e.g. "File.cpp") without the intermediate path (e.g. "../src/kits/storage"). That sounds to me like some DWARF information is being ignored or misused.
comment:7 by , 8 days ago
Whatever the default is with our GCC 13. I think we tried to set DWARF 4 but may get DWARF 5 for certain things.
comment:8 by , 8 days ago
I need to double check again this specific case when I have access to the machine where Haiku is installed.
SimpleApp.zip should contain all the details to reproduce the issue : execute "compile" script and then launch Debugger ./MyApp to check if it's possible to access the source code when debugging (like breakpoint in the About part)
comment:9 by , 6 days ago
I confirm there's an issue with the SimpleApp.zip
To reproduce it's quite simple :
- Compile the program by launching the script :
./compile
- File is having debug info :
file ./App
- Launch Debugger on it :
Debugger ./App
- First issue : the main() from App.cpp is not displayed in the Debugger, instead the source code WindowApp.cpp is displayed (this cpp file has nothing to do with the main())
- Second issue : click on "Run" then "Debug" button, the message "Source file unavailable" is displayed and it's impossible to attach the corresponding source file in the Debugger (I've tried to click on the "Source file unavailable" line in order to change it...)
Let me know if you need more details.
comment:10 by , 3 days ago
What DWARF version? I definitely had this working fine for DWARF 4.
In case that matters, there were changes in Haiku build system some time ago. Before these changes, the compiler was passed absolute paths to sourcefiles, and these paths ended up directly in the debug info. Now, we pass relative paths on the command line, and these get in the debug info instead.
Was Debugger also tested with this use of the compiler?
comment:11 by , 3 days ago
It was, that's what webkit did back when I fixed a bunch of issues to get that working.
Initial run working OK (source displayed)