Replying to myself, for I found out about it five minutes after I posted

the question (and such a thing happens so often to me that I am beginning

to wonder...)

Here is how this works:

(gdb) show radix

Input and output radices set to decimal 10, hex a, octal 12.

(gdb) set radix 16

Input and output radices now set to decimal 16, hex 10, octal 20.

(gdb) p 017

$1 = 0xf

(gdb) p 0d17

$2 = 0x11

On Tue, Jun 16, 2020 at 1:42 PM Luveh Keraph <

[hidden email]> wrote:

> I run my gdb sessions so that the input and output radix is hex:

>

> (gdb) show radix

> Input and output radices set to decimal 16, hex 10, octal 20.

>

> Occasionally, I would like to input integers using some base other than

> hex. The gdb documentation (Controlling GDB section, Numbers subsection)

> says the following:

>

> "You can always enter numbers in octal, decimal, or hexadecimal in GDB by

> the usual conventions: octal numbers begin with `0', decimal numbers end

> with `.', and hexadecimal numbers begin with `0x'.".

>

> This works fine with the set radix command, but not with the print command

> for numbers to base 10:

>

> (gdb) p 017

> $1 = 0xf

> (gdb) p 17.

> $2 = 17

>

> This seems to be in contradiction with the paragraph that I quoted, for it

> does not say that such conventions are constrained to the commands to set

> the radix. This aside, with the settings that I have (input and output in

> hex) is it possible to input integers so that they are interpreted by gdb

> as integers to base 10, rather than 16? My expectation was that, given the

> way it works for octal, we would be able to do the following:

>

> (gdb) p 17.

> $2 = 11

>

>