Recent

Author Topic: bug somewhere...  (Read 756 times)

440bx

  • Hero Member
  • *****
  • Posts: 4029
bug somewhere...
« on: December 01, 2022, 04:40:01 am »
Hello,

This may not be a problem in FPC but, just in case...

compile the following trivial file with debugging information (dwarf 2 with sets) obtaining a 64 bit executable:
Code: Pascal  [Select][+][-]
  1. {$APPTYPE CONSOLE}
  2.  
  3. program _HelloWorld;
  4.  
  5.  
  6. begin
  7.   writeln('Hello world');
  8.  
  9.   readln;
  10. end.
  11.  
executing the (presumed) current version (v2.39) of objdump --dwarf HelloWorld.exe causes objdump to declare "file format not recognized"  while version 2.24 of objdump processes the file without complaint.

It seems likely that the problem resides in objdump.exe but, it is also possible that the problem may be in the way dwarf debugging information is structured.  For this reason, I figured I'd mention the problem, just in case.

Also in case it might be useful, here is the output from v2.39 using that executable:
Code: Text  [Select][+][-]
  1. [D:\binutils-build\binutils\.libs]objdump.exe --dwarf h:\dev\Dwarf\Tests\HelloWorld\HelloWorld64d.exe
  2. objdump.exe: h:\dev\Dwarf\Tests\HelloWorld\HelloWorld64d.exe: file format not recognized
  3.  
  4. [D:\binutils-build\binutils\.libs]objdump.exe --version
  5. GNU objdump (GNU Binutils) 2.39
  6. Copyright (C) 2022 Free Software Foundation, Inc.
  7. This program is free software; you may redistribute it under the terms of
  8. the GNU General Public License version 3 or (at your option) any later version.
  9. This program has absolutely no warranty.
  10.  

v2.24 of objdump processes the command without any complaints whatsoever.

NOTE: the result obtained is the same using v3.0.4 and v3.3.1 (trunk) of FPC thus further suggesting that the bug may be in objdump and not in FPC.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4029
Re: bug somewhere...
« Reply #1 on: December 01, 2022, 07:01:54 pm »
Just in case someone may be interested....

Figured out the cause of the problem.  The problem is caused by the fact that the 32bit version of objdump.exe, for some reason, doesn't handle 64bit PE files.

Once the example program is compiled for 32bit then the 32bit version of objdump, dumps it fine.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018