Discussion:
[Bug gdb/23390] New: GDB does not honor 'set output-radix 16'; it displays in octal
noloader at gmail dot com
2018-07-09 12:13:46 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23390

Bug ID: 23390
Summary: GDB does not honor 'set output-radix 16'; it displays
in octal
Product: gdb
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: noloader at gmail dot com
Target Milestone: ---

I've tried setting base 16 radix in GDB interactive session and .gdbinit. Both
are no joy. I don't read in octal so it makes a GDB session quite painful.

The session below is from an ARM dev-board but the same happens on desktops,
too.

I've also noticed GDB has problems displaying short's too. It tries to print
them as strings rather that the 2-byte hex as requested.

The problem has existed since at least the GDB 6 days.

Breakpoint 2, CRYPTOGAMS_encrypt (
inBlock=0x4f3020 "}ќ\322\021i\f;\270\001\344\267R\253\t\004",
xorBlock=0x0,
outBlock=0x4fc1f0 "}ќ\322\021i\f;\270\001\344\267R\253\t\004",
rkey=0x4fbce8) at rijndael.cpp:334
334 AES_encrypt(inBlock, outBlock, rkey);

(gdb) set output-radix 16
Output radix now set to decimal 16, hex 10, octal 20.
(gdb) c
Continuing.

Breakpoint 2, CRYPTOGAMS_encrypt (
inBlock=0x4f3020 "%F\233\235;\354*6\236\360\232\f\036\017\023q",
xorBlock=0x0,
outBlock=0x4fc1f0 "%F\233\235;\354*6\236\360\232\f\036\017\023q",
rkey=0x4fbce8) at rijndael.cpp:334
334 AES_encrypt(inBlock, outBlock, rkey);

(gdb) shell gdb --version
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.

Out of morbid curiosity, who (or how many people) read in octal? How did it
become the dominant use case so that it is displayed by default and ignore user
settings? (I know lots of people who fluently scan hex. I don't know anyone who
does the same in octal. I guess the Red Hat offices are different than the most
of the world)
--
You are receiving this mail because:
You are on the CC list for the bug.
noloader at gmail dot com
2018-07-09 17:59:55 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23390

Jeffrey Walton <noloader at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |noloader at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-18 08:23:59 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23390

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-07-18
CC| |tromey at sourceware dot org
Ever confirmed|0 |1

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
It took me a minute to realize that this refers to the escape
sequences in the strings. And indeed it would be nice if there
were a way to avoid octal here; though I'm not certain that
output-radix is the best way.
--
You are receiving this mail because:
You are on the CC list for the bug.
noloader at gmail dot com
2018-07-18 10:19:30 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23390

--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Tom Tromey from comment #1)
Post by tromey at sourceware dot org
It took me a minute to realize that this refers to the escape
sequences in the strings. And indeed it would be nice if there
were a way to avoid octal here; though I'm not certain that
output-radix is the best way.
Lol... I don't even know what output-radix controls. It is the canonical answer
for displaying in hex, but it does not work here, it does not work with short
arrays (x/4h <addr>, which attempts to print as unicode), ...
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-18 16:46:49 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23390

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I think it just controls the printing of scalars from "print"
and "output".

(gdb) print 23
$1 = 0x17

The "x" command has its own flags for the radix.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...