I am working in a program using the DWARF and ELF info. I am hooked to another program using a tool called Pin. I have the addresses from the global variables declared in "Y" program and I hook it into my Pin module which I will call "X".
I am getting a bunch of addresses for these global variables. Unfortunately I am having troubles when I try to dereference them. For example (right now I am doing things manually to see if it is doing what is supposed to be doing):
char * limit, * address1;
for(address1 = (char *) 0x804A040, limit = address1 + bytesize; address1 < limit; address1++)
cout << *(address1) << "\n";
I should be getting the variable that is stored in that address which is a char *
to a word. Do I have to dereference two pointers in this case? The address and then the char *
stored in that address?
This works perfectly fine when I want to dereference an int
variable, but whenever I try to dereference a char pointer or variable I get non-ASCII
values...