34

By default, GDB always prints/displays all variables / arguments in base 10.

Is there any way to ask GDB to always use base 16 while printing anything (and turn back to default settings when I don't need that)?

I know that it can be printed by supplying the /x argument to print/display, but I don't want to do it every time.

2 Answers 2

60

set output-radix 16 (and set output-radix 10 to switch it back).

Sign up to request clarification or add additional context in comments.

6 Comments

It too bad this does not work in practice... How do I force GDB to print in base 16?
Works for me, with bt full. So maybe it doesn't always work (as described in the linked question), but sometimes it works really well.
Now open in the GDB Bugzilla: Issue 23390, GDB does not honor 'set output-radix 16'; it displays in octal. I could not take it anymore. Man I loathe working with GDB. I cringe when it is the only debugger available.
Works for me. gdb --version: GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7_4.1
Works, for me except inside strings. I'm working with UTF/ISO conversions so would be really helpful to have "unknown" chars displayed in hex instead of octal.
|
0

In my machine, set output-radix 10 doesn't work, but set output-radix 0xA works.

1 Comment

What does show input-radix tell you?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.