[OT] Why behaves my application different when run in gdb

cpghost cpghost at cordula.ws
Sun Jul 6 18:44:47 UTC 2008


On Sun, 6 Jul 2008 18:36:26 +0200
Tobias Rehbein <tobias.rehbein at 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/


More information about the freebsd-questions mailing list