diff mbox

[3/3,v2] Process record support for PowerPC

Message ID 54834450.3020506@gmail.com
State New
Headers show

Commit Message

Wei-cheng, Wang Dec. 6, 2014, 6 p.m. UTC
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 mbox

Patch

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)