Re: gdb with hex values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

On Thu, 4 Jul 2013 23:49:37 -0500
"John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx> wrote:

> 
> Is it possible to tell gdb to show the values of variables in 
> hexadecimal rather than decimal? I can't find anything on the man page.
> 

Use the /x option:

[SHELL]
shlomif[fcs]:$trunk/fc-solve/source/B$ gdb ./fc-solve
GNU gdb (GDB) 7.6-4.mga4 (Mageia release 4)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-mageia-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols
from /home/shlomif/progs/freecell/git/fc-solve/fc-solve/source/B/fc-solve...done.
(gdb) p 100
$1 = 100
(gdb) p /x 100
$2 = 0x64
(gdb) help p
Print value of expression EXP.
Variables accessible are those of the lexical environment of the selected
stack frame, plus all those whose scope is global or an entire file.

$NUM gets previous value number NUM.  $ and $$ are the last two values.
$$NUM refers to NUM'th value back from the last one.
Names starting with $ refer to registers (with the values they would have
if the program were to return to the stack frame now selected, restoring
all registers saved by frames farther in) or else to debugger
"convenience" variables (any such name not a known register).
Use assignment expressions to give values to convenience variables.

{TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP.
@ is a binary operator for treating consecutive data objects
anywhere in memory as an array.  FOO@NUM gives an array whose first
element is FOO, whose second element is stored in the space following
where FOO is stored, etc.  FOO must be an expression whose value
resides in memory.

EXP may be preceded with /FMT, where FMT is a format letter
but no count or size letter (see "x" command).
(gdb) 
[/SHELL]

You can find more information about using gdb from its online manual:

http://www.gnu.org/software/gdb/documentation/

And from these resources:

* http://tel.foss.org.il/advanced.html (search for the "Advanced GDB" row).

* http://www.haifux.org/lectures/210/ (and
http://www.mail-archive.com/haifux@xxxxxxxxxx/msg03722.html )

Hope it helps.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Understand what Open Source is - http://shlom.in/oss-fs

<rindolf>  If you repeat a scene 50k times, then the movie will have less
entropy and will compress better. ( irc://irc.freenode.org/#perlcafe )

Please reply to list if it's a mailing list post - http://shlom.in/reply .

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list




[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]