[fpc-pascal] Debug information

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Sep 11 19:30:55 CEST 2012


Rainer Stratmann wrote:
> Am Tuesday 11 September 2012 18:14:57 schrieb Mark Morgan Lloyd:
>> Martin wrote:
>>> On 11/09/2012 10:28, Rainer Stratmann wrote:
>>>> I found out that there is no line information shown (-gl) if an error
>>>> occurs
>>>> (more or less shortly) after the program loads a dynamic library.
>>>>
>>>> This same behaviour happens with fpc version 2.4.2-0 and 2.6.0.
>>>>
>>>> If no library is loaded line information is shown.
>>>> The error adresses are the same in both cases.
>> How is the library being loaded: using FPC's dynlibs unit?
> Yes.
>> If using dynlibs, is the problem immediately after loading the library
>> (.so) or is it on a call of an entry point in the library?
> Immediately after loading the library.

In which case I presume that you could comment out the calls to the 
entry points in the library and duplicate the problem (have you tried 
this?). Does the recently-added GetLoadError() function tell you 
anything useful?

>> Is the DLL successfully called, does it exit predictably, and does the
>> stack recover to the state it was on entry (i.e. without an extra or
>> missing word)?
> 
> The program restarts some times and there is no error.

If it's specifically something that happens at load time then below 
probably isn't relevant.

> Stack recovery I don't know. I think it will be ok. How can I see that?

Inline assembler to dump esp and ebp.

> I use loadlibrary and freelibrary.
> There are only 3 functions/procedures calling from the program. (init_proc, 
> loop_proc, exit_proc).
> The library calls back a procedure (add a key to a keybuffer) but in this 
> procedure there is no error.
> I tried safeloadlibrary but the same thing.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list