public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
	gdb-patches@sourceware.org,
	Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Cc: Rogerio Alves <rogealve@br.ibm.com>,
	Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: RE: [PATCH ver3] gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame.exp
Date: Mon, 06 Dec 2021 11:35:28 -0800	[thread overview]
Message-ID: <f2e0202771a1d8fa5de98418259abacec9f024b1.camel@us.ibm.com> (raw)
In-Reply-To: <6f99e11d-25a7-ceaa-0975-06ac1d9d5d05@polymtl.ca>

Simon:

On Mon, 2021-12-06 at 13:50 -0500, Simon Marchi wrote:
> 
> > > 
> > > My only question is whether these two lines:
> > > 
> > >   .global _start
> > >   _start:
> > > 
> > > could be kept unconditional, and just not put in the powerpc-
> > > specific
> > > sections of the code at all.
> > 

OK, I gave that a try and it does seem to work OK for Power LE and BE. 
It keeps the non-Power code the same so it shouldn't break any other
architectures.

Below is the updated and tested patch.  Please let me know what you
think.

                    Carl 
---------------------------------------------------------------
From a94f427447c8da0480a387cd364555450c785d43 Mon Sep 17 00:00:00 2001
From: Carl Love <cel@us.ibm.com>
Date: Fri, 19 Nov 2021 18:33:51 +0000
Subject: [PATCH] gdb: Add PowerPC support to
 gdb.dwarf2/frame-inlined-in-outer-frame

This patch adds an #elif defined for PowerPC to setup the exit_0 macro.
This patch addes the needed macro definitionald logic to handle both elfV1
and elfV2.

The patch has been successfully tested on both PowerPC BE, Powerpc LE and
X86_64 with no regressions.
---
 .../gdb.dwarf2/frame-inlined-in-outer-frame.S | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
index 9fb6e7b7164..224b50b20a5 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
@@ -65,6 +65,16 @@
 	swi 0x0
 .endm
 
+#elif defined __powerpc64__
+
+# define RETURN_ADDRESS_REGNO 65
+
+.macro exit_0
+	li 0, __NR_exit  /* r0 - contains system call number */
+	li 3, 0          /* r3 - contains first argument for sys call */
+	sc
+.endm
+
 #else
 # error "Unsupported architecture"
 #endif
@@ -90,6 +100,20 @@
    16 }
 */
 
+#if defined __powerpc64__
+#  if _CALL_ELF == 2
+.abiversion 2   /* Tell gdb what ELF version to use. */
+#  else
+.abiversion 1   /* Tell gdb what ELF version to use. */
+.align 2
+.section ".opd", "aw"
+.align 3
+.quad ._start,.TOC.@tocbase,0
+.previous
+.type ._start,@function
+._start:
+#  endif
+#endif
 .global _start
 _start:
 .cfi_startproc
-- 
2.30.2



  reply	other threads:[~2021-12-06 19:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 21:43 [PATCH] " Carl Love
2021-11-29 23:22 ` will schmidt
2021-12-04  0:38 ` [PATCH ver2] " Carl Love
2021-12-04  2:13   ` Simon Marchi
2021-12-06  5:56     ` will schmidt
2021-12-06 16:37     ` [PATCH ver3] " Carl Love
2021-12-06 16:43       ` Simon Marchi
2021-12-06 18:06         ` Carl Love
2021-12-06 18:50           ` Simon Marchi
2021-12-06 19:35             ` Carl Love [this message]
2021-12-06 19:38               ` Simon Marchi
2021-12-07  8:37             ` Ulrich Weigand
     [not found]             ` <OF8B2BBF19.16E7F948-ONC12587A4.002F3132-C12587A4.002F617F@us.ibm.com>
2021-12-08 20:49               ` Carl Love
2021-12-09 17:30                 ` Ulrich Weigand

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=f2e0202771a1d8fa5de98418259abacec9f024b1.camel@us.ibm.com \
    --to=cel@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rogealve@br.ibm.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=will_schmidt@vnet.ibm.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).