From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CCr/I8oVHWLFVAAAWB0awg (envelope-from ) for ; Mon, 28 Feb 2022 13:34:50 -0500 Received: by simark.ca (Postfix, from userid 112) id 91BED1F3C8; Mon, 28 Feb 2022 13:34:50 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1DF811EDF0 for ; Mon, 28 Feb 2022 13:34:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6685E385842D for ; Mon, 28 Feb 2022 18:34:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6685E385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646073289; bh=ygI1HOmBVeCoFzLQyzRqXDoQmX2GEvdiUqmeOlKLn+E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DDlgFuz4AFfYr/9963W4NSNoS8D3aoirB6KPAFJZvwrbAsTqdFQpsR1CBWhDbTZWi CXO2pCPismIa28bSI3ANTmw3ELx6+3Kp91VXNWlER0cBX3W10n527f5N5rCe/EAxo8 Uy+y4277dHs4wrAClPjx1dcNgygcOoDz4NS9HxoU= Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id 949D93858C83 for ; Mon, 28 Feb 2022 18:33:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 949D93858C83 Received: by mail-io1-xd2c.google.com with SMTP id c18so15728696ioc.6 for ; Mon, 28 Feb 2022 10:33:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ygI1HOmBVeCoFzLQyzRqXDoQmX2GEvdiUqmeOlKLn+E=; b=iUxZFfeiM3AtuwFhr1TuaJZ2+1aE++WyK9rDXtDeRRBJIuwR0b+Ar7uJd/K3ZJarqY ZDP3mWcoY5YuLTYe3IJYu5mkMghuhfTxxA3cHdqP+4PeF7g3UBHz2BQbpWcdfso24CYY WD+7g9/zus7xjLtd6tOiJhfqYzvkYQ0j+0rRFbtzE5UlI3q7ac3cYu4Ym1LdopsghEGO UxjTyWWosZMGFbfzuSI2DUP/3dy9DKysHSu1DTWcSbd3Z8I8oRYHK/98hcKjWFlMJtx+ mAHo1rEBD+eQPYyB7xXJyD/330T0RbhmLO30AMR3hrr5aWFcoJeBOGKi7CbYqrg8tP1y wiOw== X-Gm-Message-State: AOAM533s6U+I8SRlDk1MxYClLOHfQ8rGyuUrShH/6TAZY+eX4PQtczmy D9UaKrEEgT3lNYMMZJQI8oTLtiulDpz+8A== X-Google-Smtp-Source: ABdhPJzcGVTSaRBlY3AcY6MMVIVHD1Dmm4Aa3qemYSUcya3JwMYW2OissISoohAw5Mb+cBm9gSLfyA== X-Received: by 2002:a02:a78c:0:b0:308:cae5:991c with SMTP id e12-20020a02a78c000000b00308cae5991cmr17801356jaj.116.1646073189053; Mon, 28 Feb 2022 10:33:09 -0800 (PST) Received: from murgatroyd.Home (75-166-141-253.hlrn.qwest.net. [75.166.141.253]) by smtp.gmail.com with ESMTPSA id h9-20020a92c089000000b002b8b3ce939fsm6558845ile.9.2022.02.28.10.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 10:33:08 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1 Date: Mon, 28 Feb 2022 11:33:02 -0700 Message-Id: <20220228183304.1162089-4-tromey@adacore.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220228183304.1162089-1-tromey@adacore.com> References: <20220228183304.1162089-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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