Recent

Author Topic: Backtrace code  (Read 4218 times)

z0rr0

  • New Member
  • *
  • Posts: 48
Backtrace code
« on: July 18, 2017, 01:57:29 pm »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Backtrace code
« Reply #1 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.

z0rr0

  • New Member
  • *
  • Posts: 48
Re: Backtrace code
« Reply #2 on: July 18, 2017, 02:27:40 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.

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

z0rr0

  • New Member
  • *
  • Posts: 48
Re: Backtrace code
« Reply #3 on: July 22, 2017, 12:33:57 pm »
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? 

« Last Edit: July 22, 2017, 01:46:33 pm by z0rr0 »

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Backtrace code
« Reply #4 on: July 22, 2017, 08:50:59 pm »
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.

z0rr0

  • New Member
  • *
  • Posts: 48
Re: Backtrace code
« Reply #5 on: July 22, 2017, 08:59:46 pm »
Hi, thanks for the aid but I think you did not answer my question, or did you?

z0rr0

  • New Member
  • *
  • Posts: 48
Re: Backtrace code
« Reply #6 on: July 28, 2017, 12:25:30 pm »
Hello, it is taking time but I am getting some progress. First backtrace in Toro.


 

TinyPortal © 2005-2018