[lldb-dev] Figure our what global and static variables are accessed by what functions (at runtime)

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Thu Jan 10 08:24:55 PST 2019


On 10/01/2019 17:16, Peng Yu via lldb-dev wrote:
> Hi,
> 
> I think that I can use the watchpoint command to set watchpoints on
> all global and static variables. Then run the lldb and parse the
> screen output to see what global and static variables are
> read/write-accessed by what functions. Is this a good strategy? Is
> there any other better ways to figure this kind of information out?
> 

Normally, a CPU only allows a very small (as in, ~4) watchpoints. So I 
think this strategy is bound to fail.

If you really need dynamic information about this sort of thing (and not 
just the static "does the function reference this variable" kind), then 
I'd suggest trying to combine the static information (obtained either 
through analysis of the debug info, by looking at the relocations in the 
object files, or from the source code) with some dynamic instrumentation 
framework (the kinds used for coverage analysis) that can tell you 
whether a particular line of code (instruction) got executed.


More information about the lldb-dev mailing list