[fpc-devel] Status of debug line info

Sergio Flores relfos at gmail.com
Tue Jun 23 15:23:51 CEST 2015


Thanks Michael and Jonas for the answers.

I was trying to get lineinfo to work in the crash reporter since I've seen
some comercial games doing the same (reporting a stack dump with
lines/filename.cpp).

The problem with gathering just addresses is that they change with every
build (and I ship daily builds).
Anyway I could try that, but I still need the base address, and I have no
clue how to obtain that in FPC.
Is there any easy way to find it?
Probably reading it from /proc/pid/maps in unix platforms could work...


Another question, I thought about a idea for platform independent way to
support line info.

Could the compiler generate a internal table/array that mapped all
functions addresses to strings?

Let's say a additional-Gsomething  flag is added for this, then a special
internal function would be generated, and called at run-time, before units
initialization. The function would just build a huge table of adress
associations, like this.

procedure init_debuginfo();
begin
  register_debug_address(@unitX_funcA, 'unitX', 'funcA');
  register_debug_address(@unitX_funcB, 'unitX', 'funcB');
  register_debug_address(@unitY_funcA, 'unitY', 'funcA');
// all other functions/methods/procedures in the whole program ...
end;


Probably not as simple of that, it might need more info (range of the
functions address, not just starting point).
Then calling BackTraceStrFunc() would look up the address using the table
built before.

Even though this would just be useful to print routine names and not lines,
would this work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150623/86ddafc4/attachment.html>


More information about the fpc-devel mailing list