Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jul 2008 20:44:43 +0200
From:      cpghost <cpghost@cordula.ws>
To:        Tobias Rehbein <tobias.rehbein@web.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: [OT] Why behaves my application different when run in gdb
Message-ID:  <20080706204443.5427f0c5@epia-2.farid-hajji.net>
In-Reply-To: <20080706163626.GA1896@sushi.pseudo.local>
References:  <20080706163626.GA1896@sushi.pseudo.local>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 6 Jul 2008 18:36:26 +0200
Tobias Rehbein <tobias.rehbein@web.de> wrote:

> What me struck now is the fact that my code will crash (signal 11)
> while processing a strcpy. When I run the same thing in gdb it won't
> crash and whats even more important to me: It does what I wanted it
> to do...

If you showed the program, we could have a closer look
at this and tell the exact reason. So the following is just
a wild guess, out of the blue:

If it's strcpy(), you're probably corrupting the stack
(or the malloc arena) by writing past the end of a buffer.
When you run under gdb, the debugger dynamically inserts
special instructions into the program so you can single-step
through it. This tends to slightly modify the memory layout
of your program, and you'll be jumping back to some other
address.

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080706204443.5427f0c5>