about variables....

Started by
7 comments, last by doxxan 21 years, 4 months ago
is it possible to return the name of the variable at some address? don''t know if it''s necessary, but it would be cool in a debugger... "What is darkness? It doesn''t exist where there''s light, and without light, it''s nothing..."
"What is darkness? It doesn't exist where there's light, and without light, it's nothing..."
Advertisement
quote:Original post by doxxan
is it possible to return the name of the variable at some address?

In which language?
oops, forgot hehe. VC++.

"What is darkness? It doesn''t exist where there''s light, and without light, it''s nothing..."
"What is darkness? It doesn't exist where there's light, and without light, it's nothing..."
VC++''s debugger (6 & 7) already keeps track of variable names for you (providing you have debugging information on).
quote:Original post by doxxan
is it possible to return the name of the variable at some address?


quote:Original post by sark
VC++''s debugger (6 & 7) already keeps track of variable names for you


This is one of those "Can you tell me what time it is?" - "Yes. So?" - kind of situations, right?
Not from the program code. The only way is to find the debug info section in the exe (or it may be an external file). To be honest, its too complicated to bother with.

Member of the Unban Mindwipe Society (UMWS)
ok, would be fun to actually have it work though. tnx anywayz guys.

"What is darkness? It doesn''t exist where there''s light, and without light, it''s nothing..."
"What is darkness? It doesn't exist where there's light, and without light, it's nothing..."
I''m pretty sure that once the program is compiled the variable names are lost. It would have no sense to store them into the executable file.
[size="2"]I like the Walrus best.
quote:Original post by xaxa
I''m pretty sure that once the program is compiled the variable names are lost. It would have no sense to store them into the executable file.


The symbol table may or may not be present in the executable depending on the compiler. *NIX have a strip utility whose explicit purpose is to ... strip executables from their symbol table.

In Visual Studio, see this.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement