On 05/06/11 11:03, Bruno Haible wrote:
as this is good enough if you have a debugger
Honestly, I think this would be a misfeature.
I completely agree, but without any conditions.
The problem is that most distros nowadays disable core dumps.
So you don't get a message and you don't get a core dump.
It just falls over. Ick.
I'm sure that with enough effort that I certainly don't have
time for, you could write a "message-and-then-abort" function
that could pull a message out of a hat (er, "ELF section"),
print it and then try to trigger and enable a core:
struct rlimit rlim;
getrlimit(RLIMIT_CORE, &rlim);
rlim.rlim_cur = rlim.rlim_max;
setrlimit(RLIMIT_CORE, &rlim);