[llvm-dev] How do I get access to the llvm_stackmaps segment of an ELF .so file mmap'd in linux?
Christian Schafmeister via llvm-dev
llvm-dev at lists.llvm.org
Tue Nov 13 06:50:34 PST 2018
I've gotten llvm.experimental.stackmaps working on macOS to locate a
structure that I spill register arguments into so that I can recover them
for backtraces.
I generate a stackmap entry for every function that I compile and then
compile my code to object files and link them into a .so dynamic library.
I load this library into the Clasp executable and the functions become
available. I'm trying to make the stackmap information available as well -
I can see that it is in the ELF file using 'readelf'. I can also find it
mmap'd into memory using a combination of readelf, peeking at the
/proc/<pid>/maps file, gdb and arithmetic.
On linux,however, I can't figure out how to get access to the
llvm_stackmap section of an ELF .so file that is mmap'd into memory. I can
use dl_iterate_phdr to iterate over the ELF segments - but there doesn't
appear to be any way to access the .llvm_stackmap section, which IS loaded
and relocated in memory (I can dump it with gdb and it's all ready to go if
I could figure out its start and end). I could read the ELF file on disk
and figure out where the llvm_stackmap section is in the "section header
table" - but that seems really inelegant to go back to disk to figure out
where something is in memory.
--
Christian Schafmeister
Professor, Chemistry Department
Temple University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181113/5f4e3285/attachment.html>
More information about the llvm-dev
mailing list