diff options
author | Tom Tromey <tromey@adacore.com> | 2022-02-03 13:18:25 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-03-07 07:52:59 -0700 |
commit | c8b76e1ec346de509dbcc2c6dfc4519c572f7322 (patch) | |
tree | 103e21c08c6ecfdbb7471bd1c3b136fb5224b55b /gdbsupport | |
parent | 36f5ca535d0cffb4d9767f4471ac632dddd94c3b (diff) | |
download | gdb-c8b76e1ec346de509dbcc2c6dfc4519c572f7322.zip gdb-c8b76e1ec346de509dbcc2c6dfc4519c572f7322.tar.gz gdb-c8b76e1ec346de509dbcc2c6dfc4519c572f7322.tar.bz2 |
Let phex and phex_nz handle sizeof_l==1
Currently, neither phex nor phex_nz handle sizeof_l==1 -- they let
this case fall through to the default case. However, a subsequent
patch in this series needs this case to work correctly.
I looked at all calls to these functions that pass a 1 for the
sizeof_l parameter. The only such case seems to be correct with this
change.
Diffstat (limited to 'gdbsupport')
-rw-r--r-- | gdbsupport/print-utils.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdbsupport/print-utils.cc b/gdbsupport/print-utils.cc index 0ef8cb8..73ff1af 100644 --- a/gdbsupport/print-utils.cc +++ b/gdbsupport/print-utils.cc @@ -168,6 +168,10 @@ phex (ULONGEST l, int sizeof_l) str = get_print_cell (); xsnprintf (str, PRINT_CELL_SIZE, "%04x", (unsigned short) (l & 0xffff)); break; + case 1: + str = get_print_cell (); + xsnprintf (str, PRINT_CELL_SIZE, "%02x", (unsigned short) (l & 0xff)); + break; default: str = phex (l, sizeof (l)); break; @@ -206,6 +210,10 @@ phex_nz (ULONGEST l, int sizeof_l) str = get_print_cell (); xsnprintf (str, PRINT_CELL_SIZE, "%x", (unsigned short) (l & 0xffff)); break; + case 1: + str = get_print_cell (); + xsnprintf (str, PRINT_CELL_SIZE, "%x", (unsigned short) (l & 0xff)); + break; default: str = phex_nz (l, sizeof (l)); break; |