From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1
Date: Mon, 28 Feb 2022 11:33:02 -0700 [thread overview]
Message-ID: <20220228183304.1162089-4-tromey@adacore.com> (raw)
In-Reply-To: <20220228183304.1162089-1-tromey@adacore.com>
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.
---
gdbsupport/print-utils.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gdbsupport/print-utils.cc b/gdbsupport/print-utils.cc
index 0ef8cb829a1..73ff1afda30 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;
--
2.31.1
next prev parent reply other threads:[~2022-02-28 18:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 18:32 [PATCH 0/5] Handle non-ASCII identifiers in Ada Tom Tromey
2022-02-28 18:33 ` [PATCH 1/5] Simplify a regular expression in ada-lex.l Tom Tromey
2022-02-28 18:33 ` [PATCH 2/5] Don't pre-size result string in ada_decode Tom Tromey
2022-02-28 18:33 ` Tom Tromey [this message]
2022-03-01 14:26 ` [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1 Simon Marchi
2022-03-01 14:32 ` Tom Tromey
2022-02-28 18:33 ` [PATCH 4/5] Define HOST_UTF32 in charset.h Tom Tromey
2022-02-28 18:33 ` [PATCH 5/5] Handle non-ASCII identifiers in Ada Tom Tromey
2022-02-28 18:59 ` Eli Zaretskii
2022-02-28 20:59 ` Tom Tromey
2022-03-01 3:28 ` Eli Zaretskii
2022-03-01 14:49 ` Tom Tromey
2022-03-01 15:17 ` Eli Zaretskii
2022-03-01 15:33 ` Tom Tromey
2022-03-07 14:52 ` [PATCH 0/5] " Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220228183304.1162089-4-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).