[PATCH] [compiler-rt] Add ASan debugging API to get malloc/free stack traces and shadow memory mapping info

Kuba Brecka kuba.brecka at gmail.com
Thu Jul 10 12:32:18 PDT 2014

Hi kcc,

ASan currently has only __asan_describe_address as a debugging API, which prints out a report in textual form only. 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.

It adds 1) __asan_get_alloc_stack and __asan_get_free_stack, which can return a stack trace and thread ID for the allocation or free of a specified heap memory address and 2) __asan_get_shadow_mapping which just returns the current scale and offset for the shadow memory mapping.

The idea is that this would allow an LLDB script (or even calling the functions manually) to query various memory addresses and get their malloc/free stack traces and relevant shadow memory addresses. We could then use LLDB's backtrace formatting to show more consistently formatted information (and use LLDB's symbolication) and even do things like "frame select". The __asan_get_shadow_mapping API can be used to create macros like MemToShadow/ShadowToMem in LLDB and we could even have something like "x --shadow 0x100000000" in LLDB to show the relevant shadow memory alongside with the memory contents.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4466.11285.patch
Type: text/x-patch
Size: 8942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/c9dceb4d/attachment.bin>

More information about the llvm-commits mailing list