<div dir="ltr"><div><div><div><div>Thanks Michael and Jonas for the answers.<br><br></div>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).<br><br></div>The problem with gathering just addresses is that they change with every build (and I ship daily builds). <br>Anyway I could try that, but I still need the base address, and I have no clue how to obtain that in FPC. <br></div>Is there any easy way to find it?<br></div><div>Probably reading it from /proc/pid/maps in unix platforms could work...<br><br><br></div><div>Another question, I thought about a idea for platform independent way to support line info.<br></div><div><br></div><div>Could the compiler generate a internal table/array that mapped all functions addresses to strings?<br></div><div><br>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.<br><br></div><div>procedure init_debuginfo();<br></div><div>begin<br></div><div> register_debug_address(@unitX_funcA, 'unitX', 'funcA');<br> register_debug_address(@unitX_funcB, 'unitX', 'funcB');<br> register_debug_address(@unitY_funcA, 'unitY', 'funcA');<br></div><div>// all other functions/methods/procedures in the whole program ... <br></div><div>end;<br><br><br></div><div>Probably not as simple of that, it might need more info (range of the functions address, not just starting point).<br></div><div>Then calling BackTraceStrFunc() would look up the address using the table built before. <br></div><div><br></div>Even though this would just be useful to print routine names and not lines, would this work?</div>