Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-01

Stacktrace using Dwarf vs Stabs (maybe an RTFM question).

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

Currently I use stabs as default type for debug info. However it seems that dwarf is now supposed to be the preferred setting?

Here I deliberately crash a program.
(Lazarus 1.5, fpc 2.6.4, win32 on win7-64)

The stacktrace output is:

Stabs (-gs):
1 div 0 = TApplication.HandleException Division by zero Stack trace:
$0042AC6D PROC10, line 477 of main.pp
$0042ACC8 PROC9, line 482 of main.pp
$0042ACD8 PROC8, line 487 of main.pp
$0042ACE8 PROC7, line 492 of main.pp
$0042ACF8 PROC6, line 497 of main.pp
$0042AD08 PROC5, line 502 of main.pp
$0042AD18 PROC4, line 507 of main.pp
$0042AD28 PROC3, line 512 of main.pp
$0042AD38 PROC2, line 517 of main.pp
$0042AD48 PROC1, line 522 of main.pp
$0042AD61 TFORM1__BUTTON6CLICK, line 527 of main.pp

Dwarf (-gw2)
1 div 0 = TApplication.HandleException Division by zero Stack trace:
$0042B56D line 477 of main.pp
$0042B5C8 line 482 of main.pp
$0042B5D8 line 487 of main.pp
$0042B5E8 line 492 of main.pp
$0042B5F8 line 497 of main.pp
$0042B608 line 502 of main.pp
$0042B618 line 507 of main.pp
$0042B628 line 512 of main.pp
$0042B638 line 517 of main.pp
$0042B648 line 522 of main.pp
$0042B661 line 527 of main.pp
$0052BF3E

I prefer the fact that stabs puts in the procedurenames in the backtrace, where dwarf doesn not.
The dwarf stacktrace is not very usefull in this way to me.

Did I miss some configuration option to let dwarf put in the procedurenames?

Bart

Reply by email

Martin Frb
to Bart
Bart wrote 14 lines
Hi, Currently I use stabs as default type for debug info. However it seems that dwarf is now supposed to be the preferred setting? Here I deliberately crash a program. (Lazarus 1.5, fpc 2.6.4, win32 on win7-64) The stacktrace output is: Stabs (-gs): 1 div 0 = TApplication.HandleException Division by zero Stack trace: $0042AC6D PROC10, line 477 of main.pp

...

Dwarf (-gw2) 1 div 0 = TApplication.HandleException Division by zero Stack trace: $0042B56D line 477 of main.pp

....

Show quoted text 7 lines
I prefer the fact that stabs puts in the procedurenames in the backtrace, where dwarf doesn not. The dwarf stacktrace is not very usefull in this way to me. Did I miss some configuration option to let dwarf put in the procedurenames?

This is with -gl ?

IN this case it is an fpc question, as this stacktrace is not done by the debugger, but by your app itself.

This is implemented in the units lineinfo and infodwarf (or similar). Both part of fpc.

Just as a note. If you ship your app, you can strip debug info, but keep an identical build with debug info for yourself. If a user sends you a trace (addresses only / no line numbers), you can use "LeakView" (used to be Tools menu, now "View" > "leaks and traces"): Paste the raw stack trace, press "resolve" and select your unstripped copy of the exe.

Of course you can also paste a trace that has line numbers.

Reply by email

Bart
to Martin Frb
Martin Frb wrote 7 lines
This is with -gl ? IN this case it is an fpc question, as this stacktrace is not done by the debugger, but by your app itself. This is implemented in the units lineinfo and infodwarf (or similar). Both part of fpc.

OK, I see.

When running in gdb the output in fact is similar for stabs and dwarf: Program received signal SIGFPE, Arithmetic exception. 0x00428fcd in PROC10 () at main.pp:480
480 writeln(X div Y);
(gdb) bt
#0 0x00428fcd in PROC10 () at main.pp:480
#1 0x00429028 in PROC9 () at main.pp:485
#2 0x00429038 in PROC8 () at main.pp:490
#3 0x00429048 in PROC7 () at main.pp:495
#4 0x00429058 in PROC6 () at main.pp:500
#5 0x00429068 in PROC5 () at main.pp:505
#6 0x00429078 in PROC4 () at main.pp:510
#7 0x00429088 in PROC3 () at main.pp:515
#8 0x00429098 in PROC2 () at main.pp:520
#9 0x004290a8 in PROC1 () at main.pp:525

Not sure why fpc did not include procedure names in the output of dwarf then.

Bart

Reply by email

Graeme Geldenhuys
to Bart: Currently I use stabs as default type for debug info. However it seems that dwarf is now…
Bart wrote
Did I miss some configuration option to let dwarf put in the procedurenames?

No, it is a bug (or something not yet implemented in FPC+DWARF). I believe I reported this a few years ago already. Search Mantis and you will probably find my report.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email