Consider this NLM code:
Articles and Tips: qna
01 Jul 2003
Q.
Consider this NLM code:
Int a(int b) { char *p = NULL; #ifdef DIE_HERE *p = '\0'; // die here #else printf("%s\n", p); // die in CLIB #endif } Int b(int c) { a(c); } Main() { b(1); }
If DIE_HERE is defined and I use -sym internal, I get a nice stack dump of the crash with RDebug's DDS command. However if printf is called? says that the problem was in CLIB (of course, since I called printf with a NULL pointer), but DDS does not return so nice a stack. How can I backtrack to the last function in my NLM?
A.
Normally, printf("%s", NULL) will die in CLIB's _idoprint. Disassemble from _idoprint to see how much stack it preallocates (sub esp, f000 or something) and then do DDS esp + f000 and start searching for return addresses into printf or similar.
When you find where you, are do the same with that function and go up until you are into your NLM. The NLM Virtual Debugger provides better tools for determining where your NLM crashed.
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.