PDA

View Full Version : Reterive addresses of variables of C programs in a file



parulkalra14
17th February 2014, 07:38
I have plaintextEdit on which C program will be written ,i am able to reterive the entire program in one input file and also able to find the output of the entire program but i want to extract only variables used in the program with their addresses in another file. Is it possible to reterive all variables with their addresses in one file?? Any help would be appreciable!!!

stampede
17th February 2014, 13:17
Sorry it is very hard to understand what you want. What do you mean by "variable address", memory location ? It is not known until the runtime and definitely you cannot deduce it from the C source code.
Maybe you can give an example of input and expected output.

parulkalra14
18th February 2014, 08:39
Yes Variable address is memory location allocated to variable during runtime. After the program has been successfully build and run then are we able collect all the variables of the program with their memory locations in a file. So that ill be able to reterive all variables with their addresses in another plainTextEdit which helps user to relate which variable is located at which memory location.

stampede
18th February 2014, 15:06
What do you need that information for ? Are you trying to create some kind of debugger ?

wysota
18th February 2014, 15:08
Yes Variable address is memory location allocated to variable during runtime. After the program has been successfully build and run then are we able collect all the variables of the program with their memory locations in a file. So that ill be able to reterive all variables with their addresses in another plainTextEdit which helps user to relate which variable is located at which memory location.

How is your question related to Qt?

anda_skoa
18th February 2014, 18:12
What do you need that information for ? Are you trying to create some kind of debugger ?

Yes, this person and at least another one are trying to create an IDE.

Not a very wise choice for people new to programming and with little to none knowledge about the concepts involved in IDEs.

Cheers,
_

stampede
18th February 2014, 19:34
Aaah yes, now I remember :)
Ok OP, if you really want, start reading about debugging on windows (I assumed windows from your forum settings), here is nice article with code examples : Writing-a-basic-Windows-debugger (http://www.codeproject.com/Articles/43682/Writing-a-basic-Windows-debugger).
But I have to agree with anda_skoa - maybe something easier than an IDE + debugger for a start ? :)