LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   gdb "not in executable format: File format not recognized" (http://www.linuxquestions.org/questions/programming-9/gdb-not-in-executable-format-file-format-not-recognized-216723/)

tcma 08-12-2004 12:23 PM

gdb "not in executable format: File format not recognized"
 
$ gdb snmptrap
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"..."/home/tcma/net-snmp-5.1.1/apps/snmptrap": not in executable format: File format not recognized

I compiled my program with the "-g" debug option:
CFLAGS = -g -O2 -Dlinux
Why I have this error?

Linux version 2.6.7-gentoo-r11 (root@rose) (gcc version 3.4.1 (Gentoo Linux 3.4.1, ssp-3.4-2, pie-8.7.6.3))

kev82 08-12-2004 01:21 PM

what is the output of

file /home/tcma/net-snmp-5.1.1/apps/snmptrap

tcma 08-12-2004 02:02 PM

/home/tcma/net-snmp-5.1.1/apps/snmptrap: Bourne shell script text executable

Quote:

Originally posted by kev82
what is the output of

file /home/tcma/net-snmp-5.1.1/apps/snmptrap


kev82 08-12-2004 03:57 PM

theres your problem, that file is not a compiled program, its a shell script - a list of commands for bash to run, you can open it in your favourite text editor and maybe find the path of the actual program you want to debug.

Devilhead 07-11-2007 04:50 AM

gdb "not in executable format: File format not recognized "
 
# gdb core
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"..."/opt/nms_mycaller/bin/core": not in executable format: File format not recognized

file core gives
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from 'rplclient'

What can be the reason?

taylor_venable 07-11-2007 08:35 AM

Quote:

Originally Posted by Devilhead
"/opt/nms_mycaller/bin/core": not in executable format: File format not recognized

file core gives
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from 'rplclient'

What can be the reason?

It's a core file (a memory dump, basically, produced when a program died) -- not an executable. To load core files in GDB, first run gdb without any arguments, then use the "core <COREFILE>" command.

Also, as an aside, it probably would have been better to start a new thread on this one, rather than resurrecting a three-years-old one.

ptobra 07-16-2007 05:09 AM

I get this error only when I try to run core file with out specifying the program name which produced the core.
I solved my error this way.
First you do a
"ulimit -c unlimited "
to generate the core
then run the program to generate the core say core.xyz
debug using
"gdb programname core.xyz"

still r u getting the error?

Devilhead 07-17-2007 12:14 AM

Quote:

Originally Posted by taylor_venable
It's a core file (a memory dump, basically, produced when a program died) -- not an executable. To load core files in GDB, first run gdb without any arguments, then use the "core <COREFILE>" command.

Also, as an aside, it probably would have been better to start a new thread on this one, rather than resurrecting a three-years-old one.

Sorry for resurrecting this old thread :).
I tried as mentioned first ran gdb then used core <corefile> it gave an output as
Program terminated with signal 11, Segmentation fault.
#0 0x00a4f9b2 in ?? ()
But how can i pin point in the code where this fault is happening?
Thanks in advance

ptobra 07-18-2007 12:36 AM

did you tried using "where" command

taylor_venable 07-18-2007 07:02 AM

Quote:

Originally Posted by Devilhead
I tried as mentioned first ran gdb then used core <corefile> it gave an output as
Program terminated with signal 11, Segmentation fault.
#0 0x00a4f9b2 in ?? ()
But how can i pin point in the code where this fault is happening?

Try "bt" (backtrace), I think. But if your binary was built without debugging symbols, it's not going to make any difference, because they'll all be memory addresses and question marks.


All times are GMT -5. The time now is 08:48 PM.