how to enumerate data members?
- From: Stephen Kellett <snail@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Jul 2006 12:38:33 +0100
Hello everyone,
If I have a class:
class testClass
{
public
testClass();
private:
DWORD dwMember1;
char *charMember2;
int intMember3;
};
How can I determine the offsets of each of the data members from the
start of memory that represents each object of this class? I need to do
this using only data available in the PDB file. I know the class name
but not the data member names or how many data members there are.
I had thought SymGetTypeInfo() with TI_GET_CHILDRENCOUNT and
TI_FINDCHILDREN would be useful but these appear to be only useful in
the context of a function call that has a testClass object as a
parameter or local. I need to get this information regardless of
context.
What I'd ideally like is the number of data members, name of each data
member, size of each data member, and if possible the type of each data
member.
I also thought SymGetTypeFromName may be useful but never seems to
return anything.
SYMBOL_INFO info;
if (SymGetTypeFromName(hProcess, ModuleLoadAddress, "testClass",
&info))
{
// never gets here, always fails
}
Any ideas about how to get this info?
Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
.
- Prev by Date: RE: "cannot execute error" attaching to an existing process
- Next by Date: Re: VC6 Debugger fails on dual-core platform
- Previous by thread: RE: "cannot execute error" attaching to an existing process
- Next by thread: Re: VC6 Debugger fails on dual-core platform
- Index(es):