This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: alloca is bad?


> Date: Sun, 12 Nov 2000 08:06:27 +0000
> From: Fernando Nasser <fnasser@cygnus.com>
> 
> The problem is that with a corrupted SP and FP you have no idea of where
> it happened.  Doesn't matter if the crash was immediately after the fact,
> all evidence of when it happened is wiped away.

??? The core file will usually tell you the function in which it
crashed, and sometimes the one which called it (if you are lucky).
GDB doesn't need the stack information to tell you what function
crashed, the value of $pc should be enough.  At least usually.

Or am I missing something?

> On the other hand, if you can get your execution path to repeat in a 
> deterministic way so heap pieces are allocated in the same locations,
> you can use hardware watchpoints (as it is memory, not registers).

This is usually almost impossible without having sources to malloc.
Without the sources, you won't know where to put the watchpoints: all
you have is the garbled pointer in the register which caused the
crash, and the crash is usually not related to what your program did
at the point of the crash, so your own variables don't help.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]