Mike
Mike

Reputation: 1857

output of the c format for gdb x command

From the documentation at [1], an example output for the gdb x command in c format is as follows:

(gdb) x/c testArray
0xbfffef7b: 48 '0'
(gdb) x/5c testArray
0xbfffef7b: 48 '0' 49 '1' 50 '2' 51 '3' 52 '4'

What does these numbers, such as 48, 49, 50 in the output mean?

Is it some kind of relative address?

Thank you very much!

[1] http://visualgdb.com/gdbreference/commands/x

Upvotes: 1

Views: 365

Answers (1)

Leandros
Leandros

Reputation: 16825

x is displaying the memory contents at a given address using the given format.

In your specific case, x/5c is displaying the first 5 bytes at the memory location testArray, and printing the bytes as a char.

The first 5 bytes of testArray are the characters 0, 1, 2, 3, 4 (the value in single quotes). The value before is the decimal value of the char.

Upvotes: 2

Related Questions