public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1
Date: Tue, 1 Mar 2022 09:26:50 -0500	[thread overview]
Message-ID: <e5cc72be-27ec-52d7-8f8a-6b638ea8ff44@polymtl.ca> (raw)
In-Reply-To: <20220228183304.1162089-4-tromey@adacore.com>



On 2022-02-28 13:33, Tom Tromey via Gdb-patches wrote:
> 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));

I'm just wondering why you're casting to unsigned short specifically (and not
unsigned char).  But in practice it works, the patch LGTM.

Simon

  reply	other threads:[~2022-03-01 14:26 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 ` [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1 Tom Tromey
2022-03-01 14:26   ` Simon Marchi [this message]
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=e5cc72be-27ec-52d7-8f8a-6b638ea8ff44@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /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).