From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3A5AF3858C62 for ; Fri, 13 Oct 2023 20:34:34 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3A5AF3858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697229275; cv=none; b=P7xXj2dmIriu9z3MkW0Xk9VTaBnVaEl6DO5ohsJL7IPU1OdoLQ9bK8ZiCDqJL8+CZG9IjXvxGBpkgOhdytKZXAbr3Ja/DjHx/Ve/qeu3RM4tl4qA3a6sS4zw/HmAms/ZEMAmkoRY82bDVULIq/OCY/rnTEzdpwnJ84ysy4I1dfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697229275; c=relaxed/simple; bh=CAWvhxbxkwki9VsN/XSJBzFemZ5yudgQd+RPGn7GoBw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=J+u0EEt0O6tlQV4nlKpC4A33uJgZuL7WK2uQJdi3uLKE/IMC/PQiQRNpd2jlAn9B+jIaQ3/8ywh5J9W4GP7jNw9GeWuHv7crue9Fw+iww4F0U9+9V+AeoRW0maPM0iaMSP3Arm3CRjldgmH+AYh5pTKitPU5mAQsF71zfeuwgY8= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A5AF3858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697229273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/J8I55JdvBSY9U4u+mjc7QfX9pC4pq/czp5zwTuahQk=; b=VOn9AorFZNgPDU9mmANzlQMdCq3qXC/VL95f7hZKRR3r8rAt4wnEODHoMaVxexosDTf/3D nLHx9jHOHkmepicNo8Mn3CXDmn7uixdAucHSFwUrI/yKw9v6XQZi6jONbRtM15DIYK4zQ1 Kk0vdHtKjZSjwG8vvf2w6Uatit/OoHs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-284-YvNLH-yWM9O6np_MZMeNEw-1; Fri, 13 Oct 2023 16:34:32 -0400 X-MC-Unique: YvNLH-yWM9O6np_MZMeNEw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18778185A790; Fri, 13 Oct 2023 20:34:32 +0000 (UTC) Received: from guittard.redhat.com (unknown [10.22.18.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9896492BD9; Fri, 13 Oct 2023 20:34:31 +0000 (UTC) From: Keith Seitz To: cel@us.ibm.com Cc: Ulrich.Weigand@de.ibm.com, gdb-patches@sourceware.org Subject: Re: [Patch 1/2] PowerPC, Fix-test-gdb.base-store.exp Date: Fri, 13 Oct 2023 13:34:31 -0700 Message-ID: <20231013203431.1548147-1-keiths@redhat.com> In-Reply-To: <76b8ed7b93608d40ab42b0538319f78eaf7d621c.camel@us.ibm.com> References: <76b8ed7b93608d40ab42b0538319f78eaf7d621c.camel@us.ibm.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Carl Love wrote: > This patch fixes two regression test failures in gdb.base/store.exp. It > also fixes two regression failures in gdb.python/py-thread-exited.exp. I did not notice any failures on HEAD in this test? But I also don't see any new regressions in any test with your patch. Just FAIL -> PASS. > Patch has been tested on Power 8 LE/BE, Power 9 LE/BE, Power 10 with no > new regressions. I've read through this patch (and tested it), and I only have a few very trivial fixes to request. I don't think there's any reason to repost to fix a couple of typos, so just await a proper maintainers approval and commit with that approval. I don't know this code sufficiently well to give a proper approval, but I did not notice anything egregiously wrong. Tested-by: Keith Seitz Thanks for the patch! Keith --- gdb/infrun.c | 13 ++++++++++ gdb/ppc-linux-tdep.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 784dafa59db..7fb90799dff 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -83,6 +83,7 @@ #include "features/rs6000/powerpc-isa207-vsx64l.c" #include "features/rs6000/powerpc-isa207-htm-vsx64l.c" #include "features/rs6000/powerpc-e500l.c" +#include "dwarf2/frame.h" /* Shared library operations for PowerPC-Linux. */ static struct target_so_ops powerpc_so_ops; @@ -2088,6 +2089,52 @@ ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread, return per_inferior->disp_step_buf->prepare (thread, displaced_pc); } +/* Convert a Dwarf 2 register number to a GDB register number for Linux. */ +static int +rs6000_linux_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num) +{ + ppc_gdbarch_tdep *tdep = gdbarch_tdep(gdbarch); + + if (0 <= num && num <= 31) + return tdep->ppc_gp0_regnum + num; + else if (32 <= num && num <= 63) + /* FIXME: jimb/2004-05-05: What should we do when the debug info + specifies registers the architecture doesn't have? Our + callers don't check the value we return. */ + return tdep->ppc_fp0_regnum + (num - 32); + else if (77 <= num && num < 77 + 32) + return tdep->ppc_vr0_regnum + (num - 77); + else + switch (num) + { + case 65: + return tdep->ppc_lr_regnum; + case 66: + return tdep->ppc_ctr_regnum; + case 76: + return tdep->ppc_xer_regnum; + case 109: + return tdep->ppc_vrsave_regnum; + case 110: + return tdep->ppc_vrsave_regnum - 1; /* vscr */ + } + + /* Unknown DWARF register number. */ + return -1; +} + The spacing here is inconsistent. In the function above, there is no newline between the comment and the definition. Here there are two newlines: +/* Translate a .eh_frame register to DWARF register, or adjust a + .debug_frame register. */ + + +static int +rs6000_linux_adjust_frame_regnum (struct gdbarch *gdbarch, int num, + int eh_frame_p) +{ + /* Linux uses the same numbering for .debug_frame numbering as .eh_frame. */ + return num; +} + static void ppc_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -2135,6 +2182,15 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand); set_gdbarch_stap_parse_special_token (gdbarch, ppc_stap_parse_special_token); + /* Linux DWARF register mapping is different from the othe OS's. */ Note the typo, "othe[r]". The correct plural form is "OSes". + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, + rs6000_linux_dwarf2_reg_to_regnum); + /* Note on Linux the mapping for the DWARF registers and the stab registers + use the same numbers. Install rs6000_linux_dwarf2_reg_to_regnum for the + stab register mappings as well. */ + set_gdbarch_stab_reg_to_regnum (gdbarch, + rs6000_linux_dwarf2_reg_to_regnum); + dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_linux_adjust_frame_regnum); if (tdep->wordsize == 4) { -- 2.37.2