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)

debug1.png (159.6 KB ) - added by DigitalBox98 13 days ago.
Initial run working OK (source displayed)
debug2.png (145.3 KB ) - added by DigitalBox98 13 days ago.
Putting breaking in the AboutDialog is not attached to the source code for an unknown reason
debug3.png (292.3 KB ) - added by DigitalBox98 13 days ago.
Once the breakpoint is reached, no source code is diplayed
debug4.png (94.6 KB ) - added by DigitalBox98 13 days ago.
The application source code is no more found by the Debugger
SimpleApp.zip (9.8 KB ) - added by DigitalBox98 13 days ago.
SimpleApp source code to reproduce the issue
SimpleOpenGLCube.zip (2.8 KB ) - added by DigitalBox98 13 days ago.
Example where Debugger is working without any issue

Download all attachments as: .zip

Change History (17)

by DigitalBox98, 13 days ago

Attachment: debug1.png added

Initial run working OK (source displayed)

by DigitalBox98, 13 days ago

Attachment: debug2.png added

Putting breaking in the AboutDialog is not attached to the source code for an unknown reason

by DigitalBox98, 13 days ago

Attachment: debug3.png added

Once the breakpoint is reached, no source code is diplayed

by DigitalBox98, 13 days ago

Attachment: debug4.png added

The application source code is no more found by the Debugger

by DigitalBox98, 13 days ago

Attachment: SimpleApp.zip added

SimpleApp source code to reproduce the issue

by DigitalBox98, 13 days ago

Attachment: SimpleOpenGLCube.zip added

Example where Debugger is working without any issue

comment:1 by waddlesplash, 13 days ago

Component: ApplicationsApplications/Debugger
Owner: changed from nobody to anevilyak

comment:2 by DigitalBox98, 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.

Last edited 9 days ago by DigitalBox98 (previous) (diff)

comment:3 by nephele, 9 days ago

I'm confused, the issue is still present, no?

comment:4 by anevilyak, 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 waddlesplash, 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:6 by anevilyak, 8 days ago

What DWARF version? I definitely had this working fine for DWARF 4.

comment:7 by waddlesplash, 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 DigitalBox98, 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 DigitalBox98, 6 days ago

I confirm there's an issue with the SimpleApp.zip

To reproduce it's quite simple :

  1. Compile the program by launching the script :

./compile

  1. File is having debug info :

file ./App

  1. Launch Debugger on it :

Debugger ./App

  1. 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())
  2. 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 pulkomandy, 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 anevilyak, 3 days ago

It was, that's what webkit did back when I fixed a bunch of issues to get that working.

Note: See TracTickets for help on using tickets.