[fpc-devel] Status of debug line info

Michael Van Canneyt michael at freepascal.org
Mon Jun 22 13:06:59 CEST 2015



On Mon, 22 Jun 2015, Sergio Flores wrote:

> Some time ago I already talked a bit about it, but let's discuss this again.
> 
> I have developed a very complex game with FPC, that includes a crash log reporting (by mail).
> Recently a update did introduce some weird bug, and I keep receiving reports by mail.
> Sadly, except the ones that come from Windows users, the others have a stack dump that just has addresses.
> 
> Please correct if I'm wrong, but it seems that line info is not working in those 3 major platforms:
> 
> - Android
> - iOS
> - OSX
> 
> From what I gathered last time, both iOS and OSX need fpc support for DWARF debug info, and thats why they not work (again, I
> not 100% sure if I'm correct).

FPC does support DWARF info.

There is a bug/shortcoming in the lineinfo unit for DWARF that may cause the problems you are seeing, 
but we are aware of this. (please check the bugtracker, it's a recent bug).

> Now, about Android, which actually is more important for me now, I did some investigation and experiments.
> 
> I asked FPC to generate a map file for Android (via -Xm) and noticed that all addresses there are way different than the
> addresses in the stack dumps. This makes sense, because when the .SO file that contains pascal code is loaded in Android, it
> gets reallocated, so the addresses in the .map file are just relative addresses.
> 
> Question 1:
> Is it possible that this is a simple problem caused by FPC not calculating the base address correctly and thus not finding the
> routine/line info?
> If yes, anyone can point to the right place so I can try to look at it.
> 
> Question 2:
> Related to question 1, but more broad. Can anyone give me a fast resume how line info actually works in FPC. What files in FPC
> source should I look at in case I want to add support for example for line info in Android/OSX/iOS?

This support exists.

> 
> Question 3:
> I also found this C library that converts crashes that happen in native code to proper Java exceptions with a neat stack dump of
> the native code. I though I might try using this for now,  but it requires some compile flags that I dont know if I can pass to
> FPC.
>
>   LOCAL_CFLAGS := -funwind-tables -Wl,--no-merge-exidx-entries
> Is it possible to pass the flags?

No, they look like C compiler flags, not linker flags.

Michael.


More information about the fpc-devel mailing list