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)
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.
(In reply to Tom Tromey from comment #1) > 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), ...
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.