[PATCH] [compiler-rt] ASan debugging API for report info extraction and locating addresses

Kuba Brecka kuba.brecka at gmail.com
Tue Jul 15 15:00:47 PDT 2014


Hi kcc, glider,

This patch is part of an effort to implement a more generic debugging API, as proposed in http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/074656.html, with first part reviewed at http://reviews.llvm.org/D4466.

Now adding two new APIs:

* __asan_get_report_data which returns a 0 if no asan report happened yet, or 1 if yes and also returns the PC, BP, SP, address, access type (read/write), access size and bug description (e.g. "heap-use-after-free")

* __asan_locate_address which takes a pointer and tries to locate it, i.e. say whether it is a heap pointer, a global or a stack, or whether it's a pointer into the shadow memory. If global or stack, tries to also return the variable name, address and size. If heap, tries to return the chunk address and size.

Generally these should serve as an alternative to "__asan_describe_address", which only returns all the data in text form. Having an API to get these data could allow having debugging scripts/extensions that could show additional information about a variable/expression/pointer. The idea behind having __asan_get_report_data is that we could have a special lldb stop reason that could show much more information than just "EXC_BAD_ACCESS".

http://reviews.llvm.org/D4527

Files:
  include/sanitizer/asan_interface.h
  lib/asan/asan_debugging.cc
  lib/asan/asan_globals.cc
  lib/asan/asan_interface_internal.h
  lib/asan/asan_report.cc
  lib/asan/asan_report.h
  test/asan/TestCases/debug_locate.cc
  test/asan/TestCases/debug_report.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4527.11470.patch
Type: text/x-patch
Size: 17191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140715/05ac4171/attachment.bin>


More information about the llvm-commits mailing list