public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: gdb-patches@sourceware.org, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Cc: Will Schmidt <will_schmidt@vnet.ibm.com>,
	Rogerio Alves <rogealve@br.ibm.com>,
	cel@us.ibm.com
Subject: [PATCH ver2] gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame.exp
Date: Fri, 03 Dec 2021 16:38:26 -0800	[thread overview]
Message-ID: <61a8f3c2be6a60ff211ca02469bf3ce4554a36b1.camel@us.ibm.com> (raw)
In-Reply-To: <c7d8e67ae6f51b87109fd474efb1b6f1146b47f5.camel@us.ibm.com>


GDB maintainers:

The following is an updated version of the patch based on the comments
from Will Schmidt.  Also added Ulrigh to the cc list.

The following patch adds the needed Powerpc support to the
gdb.dwarf2/frame-inlined-in-outer-frame test as described below.

The patch has been tested on PowerPC LE and BE as well as X86_64 with
no failures.

Please let me know if this patch is acceptable for mainline.  Thanks.

                      Carl 

-----------------------------------------------
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 | 34 +++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

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..ad332cfc671 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,8 +100,28 @@
    16 }
 */
 
-.global _start
-_start:
+# if defined __powerpc64__
+	#if _CALL_ELF == 2
+		.abiversion 2   /* Tell gdb what ELF version to use. */
+		.global _start
+		_start:
+	#else
+		.abiversion 1   /* Tell gdb what ELF version to use. */
+		.align 2
+		.global _start
+		.section ".opd", "aw"
+		.align 3
+		_start:
+		.quad ._start,.TOC.@tocbase,0
+		.previous
+		.type ._start,@function
+		._start:
+	#endif
+#else
+	.global _start
+	_start:
+#endif
+
 .cfi_startproc
 
 /* State that the return address for this frame is undefined. */
-- 
2.30.2



  parent reply	other threads:[~2021-12-04  0:39 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 ` Carl Love [this message]
2021-12-04  2:13   ` [PATCH ver2] " 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
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=61a8f3c2be6a60ff211ca02469bf3ce4554a36b1.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=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).