Forum > FPC development

Backtrace code

(1/2) > >>

z0rr0:
Hello everyone, I am trying to port the code for backtrace, e.g., GetLineInfo(), to my freepascal kernel in order to print a backtrace when an exception happens. The drawback is that I am not sure where this source is. I think it is the unit lnfodwrf.pp however I am not sure. From the code, it seems that this unit is opening the executable to get the debug section, is this correct? is it not getting the name of the symbols from memory? In my case, the debug symbols must be taken from memory since there is no disk access. Is there any code that does get the name of symbols from an address by getting those from memory? 

Thanks, Matias.     

marcov:
All your assumptions are correct.

But afaik sections with debug info are generally not loaded into memory, so there is no code (or way) to get them from memory.

z0rr0:

--- Quote from: marcov on July 18, 2017, 02:23:35 pm ---All your assumptions are correct.

But afaik sections with debug info are generally not loaded into memory, so there is no code (or way) to get them from memory.

--- End quote ---

Thanks marcov, this means that I have to create such a code somehow ...

z0rr0:
Hi, I see that the unit look for the .debug_aranges in the executable. However, I am not able to find that section. I can find other sections like .debug_info or .debug_line. Am I missing something? It is needed to add some flag to make this section appear? 

SymbolicFrank:
Try debugging many threads. The line of code highlighted is generally somewhere around the one that is currently executed. Or not.

The problem is in gdb, which isn't really up to the task asked from it.

A dedicated debugger is high on the list of free pascal improvements, but it will stay there until someone really wants one and creates it.

Most improvements are directly related to getting the current project done, debugging is only seen as a necessary evil.

Navigation

[0] Message Index

[#] Next page

Go to full version