- Notifications
You must be signed in to change notification settings - Fork1.1k
AddressSanitizerAndDebugger
Evgeniy Stepanov edited this pageAug 26, 2016 ·7 revisions
You can usegdb withbinaries built byAddressSanitizer in a usual way.WhenAddressSanitizer finds a bug it calls one of the functions__asan_report_{load,store}{1,2,4,8,16} which in turn calls__asan::ReportGenericError.If you want gdb to stop before asan reports an error, set a breakpoint on__asan::ReportGenericError.If you want gdb to stop after asan has reported an error, set a breakpoint on __sanitizer::Die or useASAN_OPTIONS=abort_on_error=1.
Inside gdb you can ask asan to describe a memory location:
(gdb) set overload-resolution off(gdb) p __asan_describe_address(0x7ffff73c3f80)0x7ffff73c3f80 is located 0 bytes inside of 10-byte region [0x7ffff73c3f80,0x7ffff73c3f8a)freed by thread T0 here: ...