LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-12-2004, 11:23 AM   #1
tcma
Member
 
Registered: Aug 2004
Distribution: gentoo, Fedora Core
Posts: 54

Rep: Reputation: 15
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))
 
Old 08-12-2004, 12:21 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
what is the output of

file /home/tcma/net-snmp-5.1.1/apps/snmptrap
 
Old 08-12-2004, 01:02 PM   #3
tcma
Member
 
Registered: Aug 2004
Distribution: gentoo, Fedora Core
Posts: 54

Original Poster
Rep: Reputation: 15
/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
 
Old 08-12-2004, 02:57 PM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
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.
 
Old 07-11-2007, 03:50 AM   #5
Devilhead
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
Unhappy 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?
 
Old 07-11-2007, 07:35 AM   #6
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 40
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.
 
Old 07-16-2007, 04:09 AM   #7
ptobra
LQ Newbie
 
Registered: Jun 2007
Posts: 11

Rep: Reputation: 0
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?
 
Old 07-16-2007, 11:14 PM   #8
Devilhead
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
Question

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
 
Old 07-17-2007, 11:36 PM   #9
ptobra
LQ Newbie
 
Registered: Jun 2007
Posts: 11

Rep: Reputation: 0
did you tried using "where" command
 
Old 07-18-2007, 06:02 AM   #10
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 40
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Realtek 8180 ,Debian, "Invalid module format" medo Linux - Wireless Networking 0 05-25-2005 07:08 AM
KDE 3.2 Print Problem "File Format is not directly supported" forgox Debian 0 09-22-2004 09:07 PM
"Invalid module format" after FULL kernel recompile RedDwarf Linux - General 6 08-07-2004 07:46 PM
Freaky file Format "KPX" Sakyua General 0 05-31-2004 01:32 PM
feh / Imlib2: "no imlib2 loader for that file format" froedi Linux - Software 2 11-30-2003 07:44 AM


All times are GMT -5. The time now is 02:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration