Recent

Author Topic: [SOLVED] - How to know at run-time if $DEBUGINFO is on?  (Read 663 times)

garlar27

  • Hero Member
  • *****
  • Posts: 606
Re: [SOLVED] - How to know at run-time if $DEBUGINFO is on?
« Reply #15 on: September 10, 2019, 10:00:18 pm »
I've never tried dwarf myself.

Damn!!! There are a lot of things I didn't try with Lazarus, like QT and KDE, dwarf, stabs, and the fpc debugger (I don't remember the name), etc

So many toys, so little time.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5567
    • wiki
Re: [SOLVED] - How to know at run-time if $DEBUGINFO is on?
« Reply #16 on: September 10, 2019, 10:48:47 pm »
IF you do 64 bit, you probably use dwarf, as fpc only supports that.

Project Options > Debugger
You can choose between: Stabs, Dwarf, Dwarf (with sets), Dwarf3

They are just different ways, how fpc encodes info for the debugger.
This can affect how watches/locals are displayed.

Generally I recommend "Dwarf (with sets)" .

If you have a gdb version 8 or later, you can dare to try dwarf3
it keeps the casing (upper/lower) of how your vars are spelled. Its great. But it has a marginal added risk of crashing gdb (IIRC ^Ansistring, can do that)....


Dwarf3 works very well in fpdebug.
FpDebug is however still work in progress...

There is the package LazDebuggerFpGdbmi (note the FP in the name). Then set your debugger to "gdb with fpdebug".
And your project to use dwarf 3.
That is the best of both worlds....

------------
Just to add
dwarf vs stabs

I: Integer will be mostly the same.

Pchar vs String may vary depending on dwarf/stabs gdb/fpdebug => but none is perfect.

Deep nested structures array/record mix => may not be watchable with stabs. (due to hidden pointers, etc). dwarf3/fpdebug will do those best.

« Last Edit: September 10, 2019, 11:10:45 pm by Martin_fr »

garlar27

  • Hero Member
  • *****
  • Posts: 606
Re: [SOLVED] - How to know at run-time if $DEBUGINFO is on?
« Reply #17 on: September 11, 2019, 12:23:15 am »
Thankyou Martin_fr!!!

avra

  • Hero Member
  • *****
  • Posts: 1662
    • Additional info
Re: How to know at run-time if $DEBUGINFO is on?
« Reply #18 on: September 11, 2019, 12:48:23 am »
This always works:
Code: Pascal  [Select]
  1. // put in main unit
  2. var
  3.   DebugInfo:Boolean = {$ifopt D+}true{$else}false{$endif};  
  4. begin
  5. end.
Nice  ;)
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5567
    • wiki
Re: [SOLVED] - How to know at run-time if $DEBUGINFO is on?
« Reply #19 on: September 11, 2019, 01:02:44 am »
Ok, I applied a fix to leaks and traces.
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/leakview/leakinfo.pas?root=lazarus&r1=61856&r2=61855&pathrev=61856

This allows pasting address-only traces.

Using an exe that was compiled with dwarf, the resolve button works in Lazarus trunk. But for some reason not in 2.0 fixes (at least not for my particular test)