Forum > Debugger
FpDebug question(s)
440bx:
Hello,
For the time being, these questions are mostly a matter of curiousity.
First one is, can FpDebug dynamically load an external file (.dbg) when execution goes into dll code ? e.g, a Windows program goes into user32, ntdll or some other system dll.
In MS Visual Studio, when execution goes into a system dll, VS uses the debug information stored in the dll to download the appropriate symbols (or load them from the local cache), how much work and how complicated would it be to enable Lazarus to load external .dbg files on demand based on the dll's stored debug information ? presume that there is a .dbg file whose name is the guid found in the dll's debug descriptor (to enable unambiguous identification.)
Thank you for your help.
Martin_fr:
First of all => that is talking about dbg files with DWARF info. Since FpDebug only loads dwarf. (Happy to accept merge request for other formats, but currently not on my list).
If they are on the disk, they should be found. Though I haven't tested that. I know FpDebug loads the dwarf if it is inside the library itself. It uses the same loading code, and that code supports dbg files (on the disk).
If they point elsewhere, I would probably deal with that via a callback hook to the IDE, and let the IDE download them (if the user enabled that option). Shouldn't be to complicated.
The relevant code in is the FpImageReader[Elf|Pe]. (IIRC).
System dll on windows usually don't have dwarf info. They use a different format. (afaik)
440bx:
--- Quote from: Martin_fr on September 30, 2024, 10:59:03 pm ---First of all => that is talking about dbg files with DWARF info. Since FpDebug only loads dwarf. (Happy to accept merge request for other formats, but currently not on my list).
--- End quote ---
Yes. I am also definitely limiting the considerations to DWARF info. Implementing PDB processing requires too many dependencies on proprietary MS technologies which, I believe would not be beneficial to Lazarus.
--- Quote from: Martin_fr on September 30, 2024, 10:59:03 pm ---If they are on the disk, they should be found. Though I haven't tested that. I know FpDebug loads the dwarf if it is inside the library itself. It uses the same loading code, and that code supports dbg files (on the disk).
--- End quote ---
I'd like to test FpDebug's ability to load an external disk based .dbg file (I don't care about other possible locations.) Do you have any suggestions as to how I should go about doing that ? thank you in advance.
--- Quote from: Martin_fr on September 30, 2024, 10:59:03 pm ---The relevant code in is the FpImageReader[Elf|Pe]. (IIRC).
--- End quote ---
Good to know. I'll have look at it. Thank you.
--- Quote from: Martin_fr on September 30, 2024, 10:59:03 pm ---System dll on windows usually don't have dwarf info. They use a different format. (afaik)
--- End quote ---
Yes, they use the MS proprietary PDB format but, there is nothing that prevents writing a program to create DWARF symbols for them ;)
Martin_fr:
Well FpDebug expects a "gnu_debuglink" section that has the link to the filename. TDbgImageReader.LoadGnuDebugLink
Fpc created that if you compile something with external debug info. (it has a crc to check that it is up to date)
FpDebug looks in the path of the exe, and in <exepath>/.debug/
I haven't investigated what .so files off the linux kernel contain. I know gdb has some download ability for them. But I know no details about that.
**If** the are the same format, and if you have them
TElfDbgSource.Create calls the LoadGnuDebugLink => just hardcode name and location
440bx:
--- Quote from: Martin_fr on October 01, 2024, 07:53:00 am ---Well FpDebug expects a "gnu_debuglink" section that has the link to the filename. TDbgImageReader.LoadGnuDebugLink
Fpc created that if you compile something with external debug info. (it has a crc to check that it is up to date)
FpDebug looks in the path of the exe, and in <exepath>/.debug/
--- End quote ---
Very useful information. Thank you Martin.
Navigation
[0] Message Index
[#] Next page