public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Wei-cheng Wang <cole945@gmail.com>
To: uweigand@de.ibm.com, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3 v2] Process record support for PowerPC
Date: Sat, 06 Dec 2014 18:00:00 -0000	[thread overview]
Message-ID: <54834450.3020506@gmail.com> (raw)

2014-12-06  Wei-cheng Wang  <cole945@gmail.com>

	* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code):
	Scan PLT stub backward for reverse debugging.
	(ppc_linux_init_abi): set powerpc_linux_in_dynsym_resolve_code
	for both 32-bit and 64-bit.

---
  gdb/ppc-linux-tdep.c | 35 ++++++++++++++++++++++++++---------
  1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 0a2afa7..f8971a3 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -51,6 +51,7 @@
  #include "linux-tdep.h"
  #include "linux-record.h"
  #include "record-full.h"
+#include "infrun.h"

  #include "stap-probe.h"
  #include "ax.h"
@@ -300,6 +301,22 @@ powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
  	  || strcmp (MSYMBOL_LINKAGE_NAME (sym.minsym),
  		     "__glink_PLTresolve") == 0))
      return 1;
+  else if (execution_direction == EXEC_REVERSE)
+    {
+      int i;
+      struct frame_info *frame = get_current_frame ();
+      struct gdbarch *gdbarch = get_frame_arch (frame);
+      const int plt_stub_len = 4;
+
+      /* Scan backward to chech whether we are in the middle
+	 of PLT stub.  */
+      for (i = 0; i < plt_stub_len; i++)
+	{
+	  if (gdbarch_skip_trampoline_code (gdbarch, frame, pc))
+	    return 1;
+	  pc -= 4;
+	}
+    }

    return 0;
  }
@@ -1698,15 +1715,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
        else
  	set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");

-      if (powerpc_so_ops.in_dynsym_resolve_code == NULL)
-	{
-	  powerpc_so_ops = svr4_so_ops;
-	  /* Override dynamic resolve function.  */
-	  powerpc_so_ops.in_dynsym_resolve_code =
-	    powerpc_linux_in_dynsym_resolve_code;
-	}
-      set_solib_ops (gdbarch, &powerpc_so_ops);
-
        set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
      }

@@ -1751,6 +1759,15 @@ ppc_linux_init_abi (struct gdbarch_info info,
  	set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
      }

+  if (powerpc_so_ops.in_dynsym_resolve_code == NULL)
+    {
+      powerpc_so_ops = svr4_so_ops;
+      /* Override dynamic resolve function.  */
+      powerpc_so_ops.in_dynsym_resolve_code =
+	powerpc_linux_in_dynsym_resolve_code;
+    }
+  set_solib_ops (gdbarch, &powerpc_so_ops);
+
    /* PPC32 uses a different prpsinfo32 compared to most other Linux
       archs.  */
    if (tdep->wordsize == 4)
-- 
1.9.1

             reply	other threads:[~2014-12-06 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-06 18:00 Wei-cheng Wang [this message]
2014-12-08 19:13 ` Ulrich Weigand
2014-12-17 17:33   ` Wei-cheng Wang
2014-12-17 18:45     ` 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=54834450.3020506@gmail.com \
    --to=cole945@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.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).