Recent

Author Topic: FreeBSD source and line numbers not included in back traces  (Read 1940 times)

Bogen85

  • Hero Member
  • *****
  • Posts: 595
FreeBSD source and line numbers not included in back traces
« on: January 20, 2023, 03:10:40 am »
On Linux I can use -gl and any -gw setting and get source and line included in exception back traces.

I tried each -gw setting on FreeBSD but I'm not getting those.

-gh does work on FreeBSD.

If I leave out a free I get a stack trace from the heap dumper that includes source and line.
I'm not sure why it would include them there, but not in exception back traces.

I'm using mainline FPC.
3.3.1-12345-g06a7610a35
« Last Edit: January 20, 2023, 03:44:03 am by Bogen85 »

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: FreeBSD source and line numbers not included in back traces
« Reply #1 on: January 20, 2023, 03:11:40 am »
FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64
« Last Edit: January 20, 2023, 03:44:15 am by Bogen85 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9900
  • Debugger - SynEdit - and more
    • wiki
Re: FreeBSD source and line numbers not included in back traces
« Reply #2 on: January 20, 2023, 11:56:21 am »
What about -gl -gs ?

if  "-gs" stabs is still supported....

Afaik, there are 2 units, that read debug info from the exe, and translate addresses.

lineinfo  // for stabs, if supported
lnfodwrf // for dwarf

However, they must support the file format for each OS....

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: FreeBSD source and line numbers not included in back traces
« Reply #3 on: January 20, 2023, 03:34:05 pm »
What about -gl -gs ?

if  "-gs" stabs is still supported....

Afaik, there are 2 units, that read debug info from the exe, and translate addresses.

lineinfo  // for stabs, if supported
lnfodwrf // for dwarf

However, they must support the file format for each OS....

Not supported for FreeBSD.


It recognizes -gw (and -gw2 -gw3 -gw4) but they do not have an effect. Only addresses are printed, no line numbers.
Code: Text  [Select][+][-]
  1. $ fpc -vewnh -Sewnh -gl -gw noop
  2. Hint: Start of reading config file /home/dev/fpc_usr/lib/fpc/etc/fpc.cfg
  3. Hint: End of reading config file /home/dev/fpc_usr/lib/fpc/etc/fpc.cfg
  4. Free Pascal Compiler version 3.3.1 [2023/01/19] for x86_64
  5. Copyright (c) 1993-2023 by Florian Klaempfl and others
  6. Target OS: FreeBSD for x86-64
  7. Compiling noop.pas
  8. Linking noop
  9. /usr/local/bin/ld.bfd: warning: /home/dev/fpc_usr/lib/fpc/3.3.1/units/x86_64-freebsd/rtl/prt0.o: missing .note.GNU-stack section implies executable stack
  10. /usr/local/bin/ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
  11. 4 lines compiled, 0.1 sec
  12. 2 hint(s) issued

But it does not like -gs

Code: Text  [Select][+][-]
  1. $ fpc -vewnh -Sewnh -gl -gs noop
  2. Hint: Start of reading config file /home/dev/fpc_usr/lib/fpc/etc/fpc.cfg
  3. Hint: End of reading config file /home/dev/fpc_usr/lib/fpc/etc/fpc.cfg
  4. Free Pascal Compiler version 3.3.1 [2023/01/19] for x86_64
  5. Copyright (c) 1993-2023 by Florian Klaempfl and others
  6. Warning: (treated as error) The selected debug format is not supported on the current target, not changing the current setting
  7. Target OS: FreeBSD for x86-64
  8. Compiling noop.pas
  9. noop.pas(5) Fatal: There were 1 errors compiling module, stopping
  10. Fatal: Compilation aborted
  11. Error: /home/dev/fpc_usr/lib/fpc/3.3.1/ppcx64 returned an error exitcode[code]

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9900
  • Debugger - SynEdit - and more
    • wiki
Re: FreeBSD source and line numbers not included in back traces
« Reply #4 on: January 20, 2023, 03:39:41 pm »
Then I guess InfoDwrf is broken for FreeBsd, and needs to be fixed.

It was (or maybe still is) the same for Mac when I last checked about 6 to 9 month ago.

---
You could try and see, if an external debug info file makes any diff. I do doubt it will.

-----------
There should be ways using gdb to map the addresses to line numbers.

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: FreeBSD source and line numbers not included in back traces
« Reply #5 on: January 20, 2023, 04:32:12 pm »
It does not have an effect.

I've being using -Xg on Linux to generate a separate debug file and that works.

On FreeBSD the file is not generated.

 

TinyPortal © 2005-2018