Hello all,

I'm working on a project based on Valgrind and I have a question about
Valgrind's debuginfo interface. Namely, is there any functionality to
obtain the offset of a variable, given its name?

The Valgrind instrumentation tool I'm writing needs to access the
contents of some variables specified by the user of the tool. I've
looked at include/pub_tool_debuginfo.h as well as
coregrind/pub_core_debuginfo.h (in the 3.13 codebase). There are
functions get_datasym_and_offset() and get_data_addr() which return
the name of a variable, given a known memory address, but I can't find
anything which would let me go in the opposite direction (given a
variable name, compute its address).

My current best bet seems to be to patch Valgrind's DWARF parser to
store the offsets of requested variables in a table, and add some
functions for reading the table to pub_tool_debuginfo.h. Am I correct
in my understanding, or is there any functionality I missed which
would let me obtain a variable offset without having to extend
Valgrind's pub_tool_* interfaces?

All the best,
     Serguei Makarov

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to