Groups > Microsoft > WinDbg > Re: DBGHelp: Grabbing Data Associated with a Symbol




DBGHelp: Grabbing Data Associated with a Symbol

DBGHelp: Grabbing Data Associated with a Symbol
Wed, 19 Mar 2008 12:57:02 -070
Hello, I am trying to find the data-value behind a symbol.  For the sake of 
this discussion I am trying to get the types and values of function 
parameters. e.g  
func(int i)
func(20)

My goal is to find the value of i which is 20.  For example I have an index 
to a symbol representing int i. I use the index to get the typeID.  I use 
that typeID to get a tag.   In this case the symbol has a tag of type btInt.  
Now I want to get the value of that int.  Is there a way to go from the 
symbol index to the value of the i which is 20?

Currently I am working on maintaining an offset from the stackframe (ebp)  
to pull the values. Managing the offset is a little tricky.   I was curious 
if there was a better or more direct way to approach this. 

Thanks,
Post Reply
Re: DBGHelp: Grabbing Data Associated with a Symbol
Wed, 19 Mar 2008 15:17:09 -070
Hello Adam.

Now that you know the type of data, you need to read the memory associated 
with the address of the symbol.  How you do this will depend upon a few 
things.  Is this a live process that you are debugging?  Can you access this 
memory with a call to ReadProcessMemory()?  Are you reading a dump file? 
Also, you need to look that the symbol information and make sure that the 
symbol is in memory and not implemented in a register.  If it is a register, 
you can imagine that your code will have to change a lot as the register 
contents are volatile when the target process is not active and/or if the 
frame is not active.

I think you would be best served using the dbgeng.dll interface.

.pat styles [microsoft]

"neojava" <neojava@discussions.microsoft.com> wrote in message 
news:0EF0BEF8-C305-4C2B-B230-560CF4ABB240@microsoft.com...
Hello, I am trying to find the data-value behind a symbol.  For the sake of
this discussion I am trying to get the types and values of function
parameters. e.g
func(int i)
func(20)

My goal is to find the value of i which is 20.  For example I have an index
to a symbol representing int i. I use the index to get the typeID.  I use
that typeID to get a tag.   In this case the symbol has a tag of type btInt.
Now I want to get the value of that int.  Is there a way to go from the
symbol index to the value of the i which is 20?

Currently I am working on maintaining an offset from the stackframe (ebp)
to pull the values. Managing the offset is a little tricky.   I was curious
if there was a better or more direct way to approach this.

Thanks,
Adam 
Post Reply
about | contact