[PATCH] D11365: [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV

Kuba Brecka kuba.brecka at gmail.com
Mon Jul 20 12:34:49 PDT 2015


kubabrecka created this revision.
kubabrecka added reviewers: glider, samsonov, kcc.
kubabrecka added subscribers: llvm-commits, kcc, samsonov, glider, zaks.anna.

This patch adds a new ASan flag, `dump_registers` (off by default), which after a SIGSEGV prints out all CPU registers.  These are available in the signal handler context.  The use case is when you're not running under the debugger, and you end up with a SIGSEGV ASan report, which doesn't contain much information – knowing the register values can be helpful here.  Another interesting case is on x86_64, where if you fault on a non-canonical address (e.g. `0xdeaddeaddeaddead`), this address is not propagated into `siginfo->si_addr` and is only located in one of the registers.

I only implemented the Darwin part and left the other functions (Linux, Windows) empty in hopes that some good soul will fill these in :)


http://reviews.llvm.org/D11365

Files:
  lib/asan/asan_flags.inc
  lib/asan/asan_report.cc
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_linux.cc
  lib/sanitizer_common/sanitizer_mac.cc
  lib/sanitizer_common/sanitizer_win.cc
  test/asan/TestCases/Darwin/dump_registers.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11365.30179.patch
Type: text/x-patch
Size: 5940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150720/6d0bebc1/attachment.bin>


More information about the llvm-commits mailing list