Reputation: 483
I am trying to debug a certain program called xdf with gdb but when i run gdb xdf, i get the following error:
"/home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf": not in executable format: File format not recognized
The program is symbolically linked and the output of file /home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf
is:
/home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf: symbolic link to ../../ftools/x86_64-pc-linux-gnu-libc2.27/bin/xdf
The solution given here gdb error not in executable format: File format not recognized says that it is because the gdb installed is a 32 bit version and the program is 64 bit. However, my gdb installation is 64 bit. This is confirmed by the following:
This GDB was configured as "x86_64-linux-gnu".
Upvotes: 2
Views: 6315
Reputation: 213375
the output of
file /home/nealti...
In general, you almost always should use file -L /home/...
instead -- that command will dereference any symbolic links, and tell you what the file is after resolving all the symlinks.
POSIX shell script, ASCII text executable
You are trying to debug a shell script. GDB has no idea how to do that.
You need to look inside that shell script (with an editor of your choice), find out what actual binary it eventually invokes, and debug that.
The wrapper shell scripts typically look something like this:
#!/bin/sh
... some code to figure out installation directory (e.g. INSTALL_DIR)
export LD_LIBRARY_PATH="$INSTALL_DIR/lib64:..."
# Now invoke the binary:
exec "$INSTALL_DIR/bin/xdf.exe" "$@"
What you'll want to do is replace the last line with:
exec /usr/bin/gdb --args "$INSTALL_DIR/bin/xdf.exe" "$@"
and run your xdf
shell script normally. It will now invoke gdb auto-magically.
Upvotes: 2
Reputation: 52326
You're trying to use GDB on a shell script. Just like it's trying to tell you, GDB doesn't know what to do with that.
Upvotes: 3