Disclaimer: I'm expecting that the answer to this question will be that it can't be done, but I'm asking as a just in case.

I am working on a JIT'd language with the compiler and runtime implemented in C (specifically, using gcc on linux + windows). I am finding the address sanitizers to be very handy in diagnosing memory leaks in the runtime/compiler, BUT if there is a memory leak in the compiled (JIT'd) output, then asan is (understandably) unable to produce a stack-trace for any code that I produced, so I will get a leak like:

Direct leak of 1 byte(s) in 1 object(s) allocated from:
    #0 0x7fa844f20cb5 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:67
    #1 0x55879184e092 in std_malloc src/platform/memory/std_allocator.c:12
    #2 0x558791a50c6a in pi_alloc_adapter src/pico/data/client/allocator.c:81
    #3 0x7ba8417b4035  (<unknown module>)
    #4 0x7fff63c5501f  ([stack]+0x8501f)

Which tells me that some compiled code called into an allocator, but not where specifically.

I would like to know if there is any way to add this information (at runtime) so that ASAN is capable of producing a stack-trace through the JIT'd code. I have already been investigating producing DWARF info for GDB's JIT interface, but am not sure if that's relevant.

0

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.