This is my C code
C:\Codes>gdb var -q
Reading symbols from C:\Codes\var.exe...done.
(gdb) list
1 #include<stdio.h>
2
3 int main()
4 {
5 int a = 9;
6 int b = 10;
7 int c = 11;
8 return 0;
9 }
(gdb)
Variables a, b, and c
(gdb) info locals
a = 9
b = 10
c = 11
(gdb)
The memory address of variables a, b and c
(gdb) print &a
$1 = (int *) 0x22ff4c
(gdb) print &b
$2 = (int *) 0x22ff48
(gdb) print &c
$3 = (int *) 0x22ff44
(gdb)
Examine the value of the memory address in Hex for variables a, b, and c
(gdb) x 0x22ff4c
0x22ff4c: 0x09
(gdb)
(gdb) x 0x22ff48
0x22ff48: 0x0a
(gdb)
(gdb) x 0x22ff44
0x22ff44: 0x0b
(gdb)
Examine the decimal value of the memory address for variables a, b, and c
(gdb) x/d 0x22ff4c
0x22ff4c: 9
(gdb) x/d 0x22ff48
0x22ff48: 10
(gdb) x/d0x22ff44
0x22ff44: 11
(gdb)
The question arises: is it possible to print the value of the memory address in hexadecimal and decimal values with one command?
It would be very helpful if I could create such a conclusion.
Address Variable Dec Hex
0x22ff4c a 9 0x09
0x22ff48 b 10 0x0a
0x22ff44 c 11 0x0b
source
share