mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-23 19:51:46 +00:00
Also print out stack pointer (with optional stack dump)
This commit is contained in:
parent
a1f021db96
commit
c650c8c84a
@ -3,6 +3,7 @@
|
||||
|
||||
__attribute__ (( noreturn, section ( ".text.null_trap" ) ))
|
||||
void null_function_trap ( void ) {
|
||||
void *stack;
|
||||
|
||||
/* 128 bytes of NOPs; the idea of this is that if something
|
||||
* dereferences a NULL pointer and overwrites us, we at least
|
||||
@ -42,7 +43,9 @@ void null_function_trap ( void ) {
|
||||
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
||||
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
||||
|
||||
printf ( "NULL method called from %p\n",
|
||||
__builtin_return_address ( 0 ) );
|
||||
__asm__ __volatile__ ( "movl %%esp, %0" : "=r" ( stack ) );
|
||||
printf ( "NULL method called from %p (stack %p)\n",
|
||||
__builtin_return_address ( 0 ), stack );
|
||||
DBG_HD ( stack, 256 );
|
||||
while ( 1 ) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user