How to input decimal numbers when radix is set to hexadecimal
Luveh Keraph via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAFy1yb1F0cpXmL=rEJ_j2CyGyZyjA6GGxt6W5DqzRmEO06A1Jg@mail.gmail.com> |
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