hello everybody
is it possible, when debugging, to watch a value pointed by a pointer? i mean, to see what is inside that adress?
in this picture, pi shows 0x7fffffffe714. is it possible to see the value 10 trough pi?
(https://i.postimg.cc/VLchGHQs/Captura-de-tela-de-2019-02-21-15-42-04.png) (https://postimg.cc/6TYzTcpF)
i searched about it, and found some people saying to dereference the pointers. but do they mean dereferencing in the actual code? do i have to make it to all pointer variables that i want to see "inside"? :o
i hope i was able to explain the issue... :-\
thanks for the help!
Add pi as a watch and right click dereference or just add *pi as a watch.
thanks, it works! but and in this another situation, using arrays, is it also possible? it doesn't seems to work to me, since no "dereference" option shows up.
int main(){
int i = 10;
int* n[1] = {&i};
return 0;
}
For arrays you have to right click on the watch -> properties -> mark it as array and specify a size.
it did not work in the case... no "dereference" option yet.
but if i add **pi as a watch, it shows the value. i didn't knew i could add the variable names manually in the watch window before your answers :P
thank you!
EDIT: ok, no just one more problem. how to watch multidimensional arrays of pointers?
up to now, i'm like this:
(https://i.postimg.cc/WtZYMLYB/Captura-de-tela-de-2019-02-22-08-57-38.png) (https://postimg.cc/WtZYMLYB)
(https://i.postimg.cc/ygktqDPx/Captura-de-tela-de-2019-02-22-08-53-50.png) (https://postimg.cc/ygktqDPx)
but i'm not able to see the values, just adresses.
thanks again!
EDIT AGAIN:
omg, i feel stupid. i didn't knew i could add things like *p[1][1] and *0x5555555a46b0 to the watch screen. problems solved!
thank you very much!
just for reference:
Nearly every valid c/c++ expression can be entered in the watches window, also function calls (but be aware, they may crash your application if called in the wrong context and with it also gdb!)