|
From: Rex W. <wa...@gm...> - 2005-04-21 13:51:57
|
On 4/21/05, Nicholas Nethercote <nj...@cs...> wrote: > I'm curious why you want to know these statistics -- Is this a profiling > exercise? Yes, I m given projects to understand legacy source code, and parallel process the slow portions if possible. This requires data to be serialized into bytes to be sent across a network. It takes a real long time to understand someone else's code if the code-base is huge. So I decided to automate it and one thing i needed was to understand data flow analysis, which data piece gets modified and used in a particular region of the code. The parsing source first and data flow analysis next is like building a compiler which is a daunting task. hence I thot that since Valgrind uses memory locations, I might be able to do something with that. >=20 > This is trickier than it may first sound... what is the definition of a > "variable"? What about compound structures like arrays and struct -- are > they a single variable or do you consider the individual elements as > variables? What about stack vs. static vs. heap-allocated variables? > Etc. Compound structures like Array and Struct I would consider as one variable itself, although they do span a larger address set. This question you have asked has got me thinking about my strategy. > I see. AIUI the symbol table handles code addresses, eg. function names, > but not variable names. Variable names are in the debugging information. > VG_(describe_addr)() in vg_symtypes.c provides some functionality for > converting code addresses to variable names. It's used by Helgrind. You > need to call VG_(needs_data_syms)() before using it. It might do > something like what you want, but I'm not certain. >=20 I will try this out.=20 > Local variables on the stack are going to be tricky to deal with, since > you'll have to identify when you're entering/exiting functions, which is > harder than it first seems. Yes they will be tricky, but that will be the next step. Let me try mapping an address to a symbol or variable first and see if it works. What does Redux actually do ? I tried using it but it seg-faulted and I did not try debugging it. Thanks. Rex. |