Stack smash protection: Automated (de)bugging?
Erik Christiansen
erik at dd.nec.com.au
Tue Jul 11 05:04:24 UTC 2006
On Mon, Jul 10, 2006 at 11:57:09PM -0400, John Richard Moser wrote:
>
> The basic idea is that in the original ProPolice, a fair amount of
> debugging data was spit out at a stack smash. This included the source
> file and function that the buffer that was smashed was created in.
If you're talking about malloc'ed buffers, try "man
__after_morecore_hook". You'll find that you can readily add your own
policeman to your crashing application.
Incidentally, if all your malloc calls take the trouble to check the
return value, then you can report directly, which function ran out of
memory, and exit gracefully. If you're using your own malloc substitute,
then it's also straightforward to handle memory exhaustion as elegantly
as desired.
Just for the record, it's often pointless to focus on the function which
broke the camel's back, when a memory leak a million lines of code away,
or similar, ate most of the memory.
Erik
P.S. Remember, Unix is the IDE. (So there's no need to build it all into
the compiler. But you could try the emacs folk. ;-)
More information about the ubuntu-users
mailing list