Suppose I have a core dump from a program compiled with AddressSanitizer (ASan), as well as all relevant libraries and debug info, and suppose further that ASan was configured to record a full stack trace at all calls to malloc() (fast_unwind_on_malloc=0).
Had the program been running, ASAN would have been able to report the full stack trace for every extant allocation. It seems to follow that the core dump should contain all the information necessary for that, so I should be able to load up that core dump in GDB, point at any valid memory address, and get a stack trace from when it was allocated.
How do I get the allocation-time stack trace for a byte of memory in a core dump of an ASan-enabled program loaded into gdb? And how deep would I need to get into the internals of ASan?
__asan_get_alloc_stackwould give you in a live process?__asan_describe_addressmore generally. I think I’ve made my peace with the fact that I’m going to need to just rewrite the relevant parts from C++ to GDB-specific Python, so watch this space I guess.