[Lazarus] Trying FPDebug
Martin Frb
lazarus at mfriebe.de
Wed Jan 9 12:04:14 CET 2019
On 09/01/2019 11:20, Joost van der Sluis via lazarus wrote:
> Op 09-01-19 om 09:40 schreef Dennis via lazarus:
>> When I tried to debug with fpdebug, it asked me
>>
>> Which one should I choose?
>
> I saw this screen also, and was quite confused. As far as I know fpc
> uses Dwarf as default now. But Martin probably had a reason to add this.
Fpc 3.0.4 with -g on win 32bit => stabs
The IDE makes no assumption what -g means. So it asks. It also asks, if
you have no debug info switched on at all. (Despite that is only the
project, and packages might have dbg info...)
>
> Select -gw3. It basically means that the compiler is allowed to use
> Dwarf-3 specific functions. (In practice: proper string indexing, so
> 1-based instead of 0-based.) Older versions of Gdb did not handle
> those properly.
New versions of gdb still crash with PAnsiString under dwarf3 (But thatĀ
is gdb and off topic)
>
> Otoh, it could be that Martin added work-arounds for the string issues
> with Dwarf-2. But this all has to be tested. ;)
Only for cases that can be detected => that is short string
AnsiString are handled as pchar => #0 terminatedĀ (there is on diff in
the dbg info, so not possible to determine)
AnsiString[n] returns 2 results: 0 and 1 based
>
> So I would say, use the newest version, Dwarf 3, -gw3.
Yes Dwarf 3 is recommended for fpdebug (You also get the benefit of
identifiers NOT being all uppercased)
A few notes:
Evaluating of local var and param while paused on procedure/function
begin or end line may cause crashes. (especially with Dwarf 3)
This applies to Locals/Watches/Evaluate/... views.
Currently the problem is know for variable len type data (string/dyn
array), including structures containing such types.
See https://bugs.freepascal.org/view.php?id=34746
A *workaround *(for currently known cases) is present. (r59895)
(Any Dwarf version) Strings and Arrays are limited to a max len of 5000
/ 3000. Currently this is not configurable. Sometimes less. Nested
arrays are limited to just the first few items.
This is partly an "out of mem" protection, and also a limit needed by
the lldb-fp debugger for Mac (reading huge mem takes long time)
PChar, WideStrings, (maybe AnsiString in Dwarf 2) may be cut off, even
if below there max len limit. The Debugger sees WideString as PWideCHar
and has to guess how far to look for the terminating #0. The guess is
adjusted in steps, and may miss the correct len
=> For WideString fpc does not yet use the dwarf3 encoding with length.
With Dwarf 2 all strings are #0 terminated (strings are pchar). Except
shortstring, which are encoded as record, but recognized by fpdebug and
displayed correctly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190109/b2e654dc/attachment.html>
More information about the lazarus
mailing list