Examine memory address in 2 different format (decimal & hexadecimal) at the same time?

Viewed 515

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) 

Value of variables a,b & c

(gdb) info locals
a = 9
b = 10
c = 11
(gdb)

Memory address of variables a,b & c

(gdb) print &a
$1 = (int *) 0x22ff4c

(gdb) print &b
$2 = (int *) 0x22ff48

(gdb) print &c
$3 = (int *) 0x22ff44
(gdb)

Examine memory address value in Hex for variables a,b & c

(gdb) x 0x22ff4c
0x22ff4c:       0x09
(gdb)

(gdb) x 0x22ff48
0x22ff48:       0x0a
(gdb)

(gdb) x 0x22ff44
0x22ff44:       0x0b
(gdb)

Examine memory address value in Decimal for variables a,b & c

(gdb) x/d 0x22ff4c
0x22ff4c:       9

(gdb) x/d 0x22ff48
0x22ff48:       10

(gdb) x/d0x22ff44
0x22ff44:       11
(gdb)

The question is; is it possible to print memory address value in Hex & Decimal in single command?

It would be very helpful if I can produce the output like this.

Address   Variable  Dec Hex
0x22ff4c  a         9   0x09
0x22ff48  b         10  0x0a
0x22ff44  c         11  0x0b
2 Answers
Related