GDB: problem debugging 32 bit binary on 64 bit machine

Jan Kratochvil
Wed Nov 30 22:00:00 GMT 2011

On Wed, 30 Nov 2011 14:35:14 +0100, Jeff Kenton wrote:
> This sounds like the basic problem.  Building the 32 bit
> target_gdbarch is easy.  What's the best way (place in the code) to
> detect 32 bit vs. 64 bit binaries and switch between different
> gdbarch's?

I do not understand the context.  The current GDB switches target_gdbarch
right during execution of "./gdb ./gdb", at:

#0  deprecated_target_gdbarch_select_hack (new_gdbarch=0x2071110) at gdbarch.c:4294
#1  in set_gdbarch_from_file (abfd=0x206c990) at arch-utils.c:559
#2  in exec_file_attach (filename=0x7fffffffde00 "./gdb", from_tty=1) at exec.c:294
#3  in catch_command_errors (command=0x488ab7 <exec_file_attach>, arg=0x7fffffffde00 "./gdb", from_tty=1, mask=6) at exceptions.c:531
#4  in captured_main (data=0x7fffffffd9e0) at ./main.c:850
#5  in catch_errors (func=0x4873f6 <captured_main>, func_args=0x7fffffffd9e0, errstring=0xe6ede7 "", mask=6) at exceptions.c:504
#6  in gdb_main (args=0x7fffffffd9e0) at ./main.c:953
#7  in main (argc=2, argv=0x7fffffffdae8) at gdb.c:35


More information about the Gdb mailing list