Recent

Author Topic: file 'FileName' has no debug symbols  (Read 606 times)

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
file 'FileName' has no debug symbols
« on: July 13, 2019, 12:38:29 am »
Hello all,
Has anyone been able to debug a program successfully using Lazarus and GDB on OSes other than Windows, Linux or Mac?

I seem to be getting the above error file 'xxxx' has no debug symbols when I try to debug a simple program in my OpenBSD Lazarus installation, (Yes my project is in debug mode).
I can debug this same program with the same setup on Windows and Linux.

Any hints all?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5630
    • wiki
Re: file 'FileName' has no debug symbols
« Reply #1 on: July 13, 2019, 01:40:10 am »
I havent tried it. So just a blind guess from me.

Have you tried "Stabs" vs "Dwarf"?
Also "external debug info" on/off?

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
Re: file 'FileName' has no debug symbols
« Reply #2 on: July 13, 2019, 07:39:37 am »
I havent tried it. So just a blind guess from me.

Have you tried "Stabs" vs "Dwarf"?
Also "external debug info" on/off?

Yes, I have tried these options.

440bx

  • Hero Member
  • *****
  • Posts: 1123
Re: file 'FileName' has no debug symbols
« Reply #3 on: July 13, 2019, 08:33:18 am »
Hello all,
Has anyone been able to debug a program successfully using Lazarus and GDB on OSes other than Windows, Linux or Mac?

I seem to be getting the above error file 'xxxx' has no debug symbols when I try to debug a simple program in my OpenBSD Lazarus installation, (Yes my project is in debug mode).
I can debug this same program with the same setup on Windows and Linux.

Any hints all?
Another blind guess/idea...

have you tried running objdump on the resulting executable ? ... objdump should tell you if the executable contains debug info or not... the presence or absence of debug symbols would be a good thing to ascertain.

using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 8901
Re: file 'FileName' has no debug symbols
« Reply #4 on: July 13, 2019, 09:23:58 am »
Well, marcov seems to know more about the bsd flavors. Ask him. It is probably stabs vs dwarf but which versions to use? I have no clue. I have a couple of vmś running bsd's but I hardly need them.

Aside: when debugging seems an issue, I use instrumentation, like - mostly - inserting asserts (and using the default() intrinsic). That comes a long way very often. BSD's are a lot stricter than most nixes.
Also note: e.g. openbsd has a couple of features that may interfere with the usual debugging, See https://man.openbsd.org/malloc_conceal.3  This may or may not be related.
« Last Edit: July 13, 2019, 09:37:33 am by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
Re: file 'FileName' has no debug symbols
« Reply #5 on: July 13, 2019, 10:29:47 am »
Another blind guess/idea...

have you tried running objdump on the resulting executable ? ... objdump should tell you if the executable contains debug info or not... the presence or absence of debug symbols would be a good thing to ascertain.

Output from objdump (had to use the external debug info off switch when compiling the binary in Lazarus).

also, the funny thing is that the binary runs fine so am shocked why it says

Code: Pascal  [Select]
  1. objdump: CryptoLib: Invalid bfd target

Code: Pascal  [Select]
  1. Xor-el# objdump -debugging CryptoLib      
  2.  
  3. objdump: CryptoLib: Invalid bfd target
  4.  
  5. Xor-el# objdump --debugging CryptoLib
  6.  
  7.  
  8.  
  9. CryptoLib:     file format elf64-x86-64
  10.  
  11.  
  12.  
  13. objdump: CryptoLib: no recognized debugging information
  14.  
  15. Xor-el# objdump --header CryptoLib | grep debug
  16.  
  17. 27 .debug_aranges 000820d0  0000000000000000  0000000000000000  01494ce0  2**0
  18.  
  19. 28 .debug_info   03192f54  0000000000000000  0000000000000000  01516db0  2**0
  20.  
  21. 29 .debug_abbrev 0005e4a4  0000000000000000  0000000000000000  046a9d04  2**0
  22.  
  23. 30 .debug_line   002789dd  0000000000000000  0000000000000000  047081a8  2**0
  24.  
  25. 31 .debug_frame  001d5cc8  0000000000000000  0000000000000000  04980b88  2**3
  26.  
  27. Xor-el#
  28.  

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
Re: file 'FileName' has no debug symbols
« Reply #6 on: July 13, 2019, 10:31:59 am »
Well, marcov seems to know more about the bsd flavors. Ask him. It is probably stabs vs dwarf but which versions to use? I have no clue.

Thanks Thaddy, will ask him, meanwhile I have tried the whole debug info configurations yet unfortunately no progress.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7434
Re: file 'FileName' has no debug symbols
« Reply #7 on: July 13, 2019, 12:49:02 pm »
Is OpenBSD LLVM nowadays? If so try switching to GNU LD.

I haven't done much BSD in the last two years, though I'm planning to start again (to fix freebsd for llvm)

Are you working with trunk/3.2?  Nikolai and Pierre did a lot of work on it for openbsd
« Last Edit: July 13, 2019, 12:56:10 pm by marcov »

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
Re: file 'FileName' has no debug symbols
« Reply #8 on: July 13, 2019, 12:55:33 pm »
Is OpenBSD LLVM nowadays? If so try switching to GNU LD.
Thanks for replying. Any hints on how to do this please?
Forgive me but am a BSD newbie.
Also yes, I am working with 3.2.0 Fixes.

Quote
haven't done much BSD in the last two years, though I'm planning to start again (to fix freebsd for llvm)

go marcov, go marcov  :)
« Last Edit: July 13, 2019, 02:01:46 pm by Xor-el »

440bx

  • Hero Member
  • *****
  • Posts: 1123
Re: file 'FileName' has no debug symbols
« Reply #9 on: July 13, 2019, 05:01:08 pm »
Output from objdump (had to use the external debug info off switch when compiling the binary in Lazarus).

also, the funny thing is that the binary runs fine so am shocked why it says

Code: Pascal  [Select]
  1. objdump: CryptoLib: Invalid bfd target
the bfd is the in memory debug symbol table objdump creates.  The fact that it cannot create it is most likely the result of an incorrect (or downright missing) reference to the symbol tables contained in the exe.

The reason the binary runs fine is because the debugging info is not needed to run the executable.  The debug info could be a complete mess and the OS would not be bothered to care but, a debugger that wants to use that information would definitely care a great deal.

The next thing you should do is, compile/build directly with the compiler from a command line, IOW, no Lazarus involved and re-run objdump on the exe produced directly by the compiler.

if objdump is "happy" with the exe then gdb will likely be happy too and, it would indicate that some setting in Lazarus is causing the debug info to be emitted incorrectly (or not emitted at all.)

if compiling directly yields the same result as what you posted then, the most likely reason is, the compiler is outputting invalid references to the debug symbol tables contained in the exe.

using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7434
Re: file 'FileName' has no debug symbols
« Reply #10 on: July 13, 2019, 07:33:43 pm »
Is OpenBSD LLVM nowadays? If so try switching to GNU LD.
Thanks for replying. Any hints on how to do this please?
Forgive me but am a BSD newbie.

Check if "/usr/bin/ld" is a symlink and if so change it to gnu ld (usually gld, or more often, ld.bfd)


Also yes, I am working with 3.2.0 Fixes.

Quote
haven't done much BSD in the last two years, though I'm planning to start again (to fix freebsd for llvm)

go marcov, go marcov  :)
[/quote]

Xor-el

  • Sr. Member
  • ****
  • Posts: 371
Re: file 'FileName' has no debug symbols
« Reply #11 on: July 13, 2019, 08:41:37 pm »

Check if "/usr/bin/ld" is a symlink and if so change it to gnu ld (usually gld, or more often, ld.bfd)

 haven't done much BSD in the last two years, though I'm planning to start again (to fix freebsd for llvm)

I just checked those files now and no they are not symlinks, they are real files. the files are ld and  ld.bfd

any other ideas please?  :'(

trev

  • Full Member
  • ***
  • Posts: 198
Re: file 'FileName' has no debug symbols
« Reply #12 on: July 14, 2019, 12:22:54 am »
Quote
OpenBSD - Oct 23, 2018; 6:42am HEADS UP: amd64 has switched to lld
The amd64 architecture has now switched to LLVM's lld linker as the default ld(1).

I read that announcement from the OpenBSD ports mailing list as meaning that ld was switched to lld. You could try mv'ing ld to ld.lld and symlinking ld.bfd to ld.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)