Unsolved Debug Qt vs memory edit
-
Hi all,
I have a question about debugging on Qt - Ubuntu 64bits. Currently, I have a code as follows:
int a = 257;
char* p = (char*)&a;
However, my issue is printf pointer's address and address of object is different.
Address of pointer - printf: prinntf("%p", p) - Result: 0x7ffef7ccd694
Address of pointer - open memory edit: 7ffef7ccd698
Who can explain this issue help me? Thanks for advanced. -
Hi, the 1st address is what the pointer points to (the value of the pointer) and the 2nd address is the address to the pointer itself.
-
First of all there's no pointers in your example.
%p
is for printing pointers andp
is not a pointer.
If you want to print the value ofp
, which is the truncated address ofa
, you would useprintf("%d", p)
.
If you want to print the address ofp
you would useprintf("%p", &p)
. -
Thank all,
I also wanna ask more a question. If I wanna watch value at address what the pointer point to - value of pointer - in memory edit
So what to it will be show how on Qt instead of printf address and then pass those address to memory edit ? Because when open memory edit, it is address of pointer - not address pointer points to.