PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Debug build Win32 Console is good but Win64 Console = No symbol table  (Read 412 times)

Bruce Huber

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 15

Same code, just using FBx32 and FBx64 to build it as their respective console applications.

Using the standard compiler options set by the WinFBE build choices.

Both versions compile and run with no errors.

But the x64 version does not have a symbol table attached.

==================
EDIT: Just noticed the first GDB error line:
"D:\FreeBASIC\00_BRUCE\PCG32_FULL/pcg__small-test.exe": NOT IN EXECUTABLE FORMAT: File format not recognized
So symbol table is just a symptom of the problem...
Note: The .EXE DOES run when executed from a command line.

So, still need to figure out how to solve the problem of fbc x64 generating an .EXE that GDB can't load.
==================
EDIT_2: Compiling with fbc.exe x64 from command line exhibits the same issue.
==================

The compiler output shows that the x32 version compiles straight to ASM, whereas the x64 compiles to a C program and then is compiled to ASM with gcc.

32-bit compiler output and gdb launch:
Code: [Select]
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win32 (32bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
standalone
target:       win32, 486, 32bit
compiling:    D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.bas -o D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.asm (main module)
assembling:   D:\FreeBASIC\bin\win32\as.exe --32 "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.asm" -o "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.o"
compiling rc:               D:\FreeBASIC\bin\win32\GoRC.exe /ni /nw /o /fo "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.obj" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.rc"
linking:      D:\FreeBASIC\bin\win32\ld.exe -m i386pe -o "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.exe" -subsystem console "D:\FreeBASIC\lib\win32\fbextra.x" --stack 1048576,1048576 -L "D:\FreeBASIC\lib\win32" -L "." "D:\FreeBASIC\lib\win32\crt2.o" "D:\FreeBASIC\lib\win32\crtbegin.o" "D:\FreeBASIC\lib\win32\fbrt0.o" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.o" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.obj" "-(" -lfb -lgcc -lmsvcrt -lkernel32 -luser32 -lmingw32 -lmingwex -lmoldname -lgcc_eh "-)" "D:\FreeBASIC\lib\win32\crtend.o"


D:\FreeBASIC\00_BRUCE\PCG32_FULL>gdb.exe pcg__small-test.exe
GNU gdb (GDB) 7.6.1
...
Reading symbols from D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.exe...done.
(gdb) start
Temporary breakpoint 1 at 0x403a0c: file D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.bas, line 5.
Starting program: D:\FreeBASIC\00_BRUCE\PCG32_FULL/pcg__small-test.exe
[New Thread 23440.0x16d4]
[New Thread 23440.0x6894]

Temporary breakpoint 1, main (__FB_ARGC__=<error reading variable>, __FB_ARGV__=<error reading variable>)
    at D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.bas:5
5       dim num_of_rounds as long = 5
(gdb)


64-bit compiler output and gdb launch:
Code: [Select]
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win64 (64bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
compiling:    D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.bas -o D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.c (main module)
compiling C:  D:\FreeBASICx64\bin\win64\gcc.exe -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -g -masm=intel "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.c" -o "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.asm"
assembling:   D:\FreeBASICx64\bin\win64\as.exe --64 "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.asm" -o "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.o"
compiling rc:               D:\FreeBASICx64\bin\win64\GoRC.exe /ni /nw /o /machine X64 /fo "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.obj" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.rc"
linking:      D:\FreeBASICx64\bin\win64\ld.exe -m i386pep -o "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.exe" -subsystem console "D:\FreeBASICx64\lib\win64\fbextra.x" --stack 1048576,1048576 -L "D:\FreeBASICx64\lib\win64" -L "." "D:\FreeBASICx64\lib\win64\crt2.o" "D:\FreeBASICx64\lib\win64\crtbegin.o" "D:\FreeBASICx64\lib\win64\fbrt0.o" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\pcg__small-test.o" "D:\FreeBASIC\00_BRUCE\PCG32_FULL\resource.obj" "-(" -lfb -lgcc -lmsvcrt -lkernel32 -luser32 -lmingw32 -lmingwex -lmoldname -lgcc_eh "-)" "D:\FreeBASICx64\lib\win64\crtend.o"


D:\FreeBASIC\00_BRUCE\PCG32_FULL>gdb.exe pcg__small-test.exe
GNU gdb (GDB) 7.6.1
...
"D:\FreeBASIC\00_BRUCE\PCG32_FULL/pcg__small-test.exe": not in executable format: File format not recognized
(gdb) start
No symbol table loaded.  Use the "file" command.
(gdb)

Is the x64 debug build missing some additional options necessary to include the symbol tables?

If so, are they just something I can add to the x64 compiler switch options?

Thanks,
Bruce
« Last Edit: December 08, 2017, 04:59:31 PM by Bruce Huber »
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8247
  • Windows 10
    • PlanetSquires Software
Re: Debug build Win32 Console is good but Win64 Console = No symbol table
« Reply #1 on: December 08, 2017, 11:16:58 PM »

Hmmm... that's interesting. I haven't done testing on this yet to duplicate what you are seeing but it is odd that the 64 bit produced exe by gcc would not be okay in gdb. You are using the "-g" compiler switch in both cases, right?
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Bruce Huber

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 15
Re: Debug build Win32 Console is good but Win64 Console = No symbol table
« Reply #2 on: December 09, 2017, 12:04:30 AM »

I've left the default WinFBE compiler options in place for both the Win32 and Win64 Console Build configurations:

    -g -exx -s console

* I don't see a -g option in the Win32 compile output (first post).
    - But it ends up with a Win32 Symbol Table and GDB loads it with no problem.
* I do see a -g option on the 'Compiling C:' line of the Win64 compile output (first post).
    - But still have the 'not in executable format' issue when loading into GDB.
    - And, therefore, GDB sees no Win64 symbol table.
* Note: I don't see a -exx option show up in either the Win32 or Win64 compile output.

I've also run the fbc.exe (x64 version) command line compile with the -g option.
    - But same (bad) result as when WinFBE runs it.

I've also tried the -gddb option with both compile methods... but this FBx64 build of GCC won't take it.

Also, since there is no gdb.exe in the FBx64 release, I'm assuming that there is no specific GDBx64 build that is necessary.  I'm using the gdb.exe that's in the FBx32 release.

Logged

Bruce Huber

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 15
Re: Debug build Win32 Console is good but Win64 Console = No symbol table
« Reply #3 on: December 09, 2017, 12:10:17 AM »

Since I'm seeing this behavior even with the fbc.exe x64 version from the command line...
If you guys can duplicate the problem on your systems (so I can make sure I don't have something wrong over here)...
Then I'll take this and repost it on the FB forum to see if we can find an answer there.

Thanks,
Bruce
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8247
  • Windows 10
    • PlanetSquires Software
Re: Debug build Win32 Console is good but Win64 Console = No symbol table
« Reply #4 on: December 09, 2017, 01:32:11 PM »

Hi Bruce, I was able to duplicate the problem.

I then downloaded a more recent version of GDB 64 bit from TDM-GCC and it was able to load the exe and symbol table no problem. No errors. Here is the link http://sourceforge.net/projects/tdm-gcc/files/GDB/gdb-7.9.1-tdm64-2.zip/download

As you can see, it is version 7.9.1. There is a version 8.01 out but I could not quickly find a Windows build of it.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Bruce Huber

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 15
Re: Debug build Win32 Console is good but Win64 Console = No symbol table
« Reply #5 on: December 09, 2017, 07:24:42 PM »

Thanks a lot, Paul!  I did not think to see if the problem was caused by GDB itself.  Everything is good now.
Logged