executable and GDB

K

Krishna Sagiraju

Hai,
I'm trying compile a project. Every thing is perfectly compiled and
linked NO errors what so ever.
but then if i run the executable it crashes with segmentation
fault(i'm using Linux) but here's a twist to the problem when i try to
debug the program using gdb, the program never crashes, it runs to
completion with out any problem at all...
I've never come across any thing like this, and cannot figure out
wht's wrong...
please help..

thanx in advance....
 
?

=?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?=

Krishna said:
Hai,
I'm trying compile a project. Every thing is perfectly compiled and
linked NO errors what so ever.
but then if i run the executable it crashes with segmentation fault(i'm
using Linux) but here's a twist to the problem when i try to debug the
program using gdb, the program never crashes, it runs to completion with
out any problem at all...
I've never come across any thing like this, and cannot figure out wht's
wrong...
please help..
get a core dump(ulimit -c unlimited), and debug the core
gdb --core=/path/to/core /path/to/program
Issue the bt command to get a backtrace, should help you along.

For the future,comp.unix.programmer or comp.os.linux.development.apps is
more suitable for such questions.
 
R

Richard Bos

Krishna Sagiraju said:
I'm trying compile a project. Every thing is perfectly compiled and
linked NO errors what so ever.
but then if i run the executable it crashes with segmentation
fault(i'm using Linux) but here's a twist to the problem when i try to
debug the program using gdb, the program never crashes, it runs to
completion with out any problem at all...
I've never come across any thing like this,

<http://www.catb.org/~esr/jargon/html/H/heisenbug.html>

You've probably failed to initialised a variable (probably a pointer).
My guess is that the debugger automatically initialised it to null, and
ignores null pointer dereferences - not very helpful, as you've
experienced.
The solution, of course, is to assign a proper value to each pointer
before you dereference it.

Richard
 
P

Peter Shaggy Haywood

Groovy hepcat Krishna Sagiraju was jivin' on Tue, 19 Oct 2004 01:00:25
-0400 in comp.lang.c.
executable and GDB's a cool scene! Dig it!
I'm trying compile a project. Every thing is perfectly compiled and
linked NO errors what so ever.
but then if i run the executable it crashes with segmentation
fault(i'm using Linux) but here's a twist to the problem when i try to
debug the program using gdb, the program never crashes, it runs to
completion with out any problem at all...

SHOW US THE CODE!!!

How can anyone help you debug your code when we can't see it? If it
is too long to post, then cut it down to the smallest *complete*
program (meaning something that can be expected to compile and run)
that shows the problem. You may even find the problem while cutting it
down. Also tell us briefly what it is supposed to do and how it is
supposed to do it, as well as exactly what actually happens.
Until you do this, all we can do is guess.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
C

CBFalconer

Peter said:
Groovy hepcat Krishna Sagiraju was jivin'


SHOW US THE CODE!!!

What kind of expert are you if you can't point specifically to the
faulty statement with that clear exposition?

There is a one-off error in line 232. What's the problem?
 
P

Peter Shaggy Haywood

Groovy hepcat CBFalconer was jivin' on Thu, 21 Oct 2004 07:22:23 GMT
in comp.lang.c.
Re: executable and GDB's a cool scene! Dig it!
What kind of expert are you if you can't point specifically to the
faulty statement with that clear exposition?

There is a one-off error in line 232. What's the problem?

Um..., okay.
Seriously, though, am i the only regular here who gets tired of
telling newbies to post their code? Anyone with any sense at all would
show the people they're asking for help the thing they need that help
to fix. That makes sense to me; but apparently not to the multitudes
of new posters who come and go here day after day.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top