This is a crazy hack, but I'm trying to consciously call segfault at a specific place in the execution, so valgrind will give me a stack trace.
If there is a better way to do this, please tell me, but I would still be interested to know how to deliberaly call segfault, and why my attempt did not work.
This is my unsuccessful attempt:
long* ptr = (long *)0xF0000000;
ptr = 10;
I thought valgrind should at least pick this up as an invalid entry, even if it is not a segmentation violation. Walgrind says nothing about this.
Any ideas why?
EDIT
The answer is accepted, but I still have a few votes for any suggestions for a more reasonable way to get the stack trace ...
source
share