Skip to content

release_2.3.18322

Compare
Choose a tag to compare
@derekbruening derekbruening released this 01 Mar 23:56
af3a792

Build for the initial implementation of the memory dumping feature:

#2266: Dump memory layout to json file on annotation

Adds a new annotation DRMEMORY_ANNOTATE_DUMP_MEMORY_LAYOUT() which
triggers dumping the memory layout to a new file "memlayout.nnnn.json"
in the log subdirectory, where "nnnn" is incremented on each
successive dump. The file is in JSON format.

Exports annotation support by building the required .c file with
custom flags as a library, and exports it and the two required header
files drmemory_annotations.h and dr_annotations_asm.h.

A basic block whose tag matches the address of the symbol "main" in
the executable is watched for. Heap allocations prior to that point
are marked with a new flag MALLOC_BEFORE_MAIN. The stack pointer at
that point is recorded.

At dump time, a heap iteration is done, skipping MALLOC_BEFORE_MAIN
objects. Each object is placed into a tree. Each thread stack is
also placed into a trace; fof the primary thread, only the stack
region between the recorded main stack point and the TOS is
considered. Both trees are then walked, with each memory region
walked in pointer-sized chunks, printing out values and whether values
look like pointers to the top or middle of other objects in either
tree.

This feature and its annotation are disabled if asm-goto is not supported
by the compiler (clang<9.0), determined by try-compile.