|
|
861f93 |
2004-06-22 Andrew Cagney <cagney@gnu.org>
|
|
|
861f93 |
|
|
|
861f93 |
* rs6000-tdep.c (struct rs6000_framedata): Add field "func_start".
|
|
|
861f93 |
(skip_prologue): Delete local variable "orig_pc", use
|
|
|
861f93 |
"func_start". Add local variable "num_skip_linux_syscall_insn",
|
|
|
861f93 |
use to skip over first half of a GNU/Linux syscall and update
|
|
|
861f93 |
"func_start".
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-7.2.50.20110117/gdb/rs6000-tdep.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.2.50.20110117.orig/gdb/rs6000-tdep.c 2011-01-11 20:23:02.000000000 +0100
|
|
|
861f93 |
+++ gdb-7.2.50.20110117/gdb/rs6000-tdep.c 2011-01-17 15:48:19.000000000 +0100
|
|
|
861f93 |
@@ -126,6 +126,7 @@ static const char *powerpc_vector_abi_st
|
|
|
861f93 |
|
|
|
861f93 |
struct rs6000_framedata
|
|
|
861f93 |
{
|
|
|
861f93 |
+ CORE_ADDR func_start; /* True function start. */
|
|
|
861f93 |
int offset; /* total size of frame --- the distance
|
|
|
861f93 |
by which we decrement sp to allocate
|
|
|
861f93 |
the frame */
|
|
|
861f93 |
@@ -1496,7 +1497,6 @@ static CORE_ADDR
|
|
|
861f93 |
skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
|
|
861f93 |
struct rs6000_framedata *fdata)
|
|
|
861f93 |
{
|
|
|
861f93 |
- CORE_ADDR orig_pc = pc;
|
|
|
861f93 |
CORE_ADDR last_prologue_pc = pc;
|
|
|
861f93 |
CORE_ADDR li_found_pc = 0;
|
|
|
861f93 |
gdb_byte buf[4];
|
|
|
861f93 |
@@ -1514,12 +1514,14 @@ skip_prologue (struct gdbarch *gdbarch,
|
|
|
861f93 |
int minimal_toc_loaded = 0;
|
|
|
861f93 |
int prev_insn_was_prologue_insn = 1;
|
|
|
861f93 |
int num_skip_non_prologue_insns = 0;
|
|
|
861f93 |
+ int num_skip_ppc64_gnu_linux_syscall_insn = 0;
|
|
|
861f93 |
int r0_contains_arg = 0;
|
|
|
861f93 |
const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
|
|
|
861f93 |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
861f93 |
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
|
|
861f93 |
|
|
|
861f93 |
memset (fdata, 0, sizeof (struct rs6000_framedata));
|
|
|
861f93 |
+ fdata->func_start = pc;
|
|
|
861f93 |
fdata->saved_gpr = -1;
|
|
|
861f93 |
fdata->saved_fpr = -1;
|
|
|
861f93 |
fdata->saved_vr = -1;
|
|
|
861f93 |
@@ -1553,6 +1555,55 @@ skip_prologue (struct gdbarch *gdbarch,
|
|
|
861f93 |
break;
|
|
|
861f93 |
op = extract_unsigned_integer (buf, 4, byte_order);
|
|
|
861f93 |
|
|
|
861f93 |
+ /* A PPC64 GNU/Linux system call function is split into two
|
|
|
861f93 |
+ sub-functions: a non-threaded fast-path (__NAME_nocancel)
|
|
|
861f93 |
+ which does not use a frame; and a threaded slow-path
|
|
|
861f93 |
+ (Lpseudo_cancel) that does create a frame. Ref:
|
|
|
861f93 |
+ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
|
|
|
861f93 |
+
|
|
|
861f93 |
+ *INDENT-OFF*
|
|
|
861f93 |
+ NAME:
|
|
|
861f93 |
+ SINGLE_THREAD_P
|
|
|
861f93 |
+ bne- .Lpseudo_cancel
|
|
|
861f93 |
+ __NAME_nocancel:
|
|
|
861f93 |
+ li r0,162
|
|
|
861f93 |
+ sc
|
|
|
861f93 |
+ bnslr+
|
|
|
861f93 |
+ b 0x7fe014ef64 <.__syscall_error>
|
|
|
861f93 |
+ Lpseudo_cancel:
|
|
|
861f93 |
+ stdu r1,-128(r1)
|
|
|
861f93 |
+ ...
|
|
|
861f93 |
+ *INDENT-ON*
|
|
|
861f93 |
+
|
|
|
861f93 |
+ Unfortunatly, because the latter case uses a local label (not
|
|
|
861f93 |
+ in the symbol table) a PC in "Lpseudo_cancel" appears to be
|
|
|
861f93 |
+ in "__NAME_nocancel". The following code recognizes this,
|
|
|
861f93 |
+ adjusting FUNC_START to point to where "Lpseudo_cancel"
|
|
|
861f93 |
+ should be, and parsing the prologue sequence as if
|
|
|
861f93 |
+ "Lpseudo_cancel" was the entry point. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */
|
|
|
861f93 |
+ && pc == fdata->func_start + 0
|
|
|
861f93 |
+ && num_skip_ppc64_gnu_linux_syscall_insn == 0)
|
|
|
861f93 |
+ || (op == 0x44000002 /* sc */
|
|
|
861f93 |
+ && pc == fdata->func_start + 4
|
|
|
861f93 |
+ && num_skip_ppc64_gnu_linux_syscall_insn == 1)
|
|
|
861f93 |
+ || (op == 0x4ca30020 /* bnslr+ */
|
|
|
861f93 |
+ && pc == fdata->func_start + 8
|
|
|
861f93 |
+ && num_skip_ppc64_gnu_linux_syscall_insn == 2))
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ num_skip_ppc64_gnu_linux_syscall_insn++;
|
|
|
861f93 |
+ continue;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */
|
|
|
861f93 |
+ && pc == fdata->func_start + 12
|
|
|
861f93 |
+ && num_skip_ppc64_gnu_linux_syscall_insn == 3)
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ num_skip_ppc64_gnu_linux_syscall_insn = -1;
|
|
|
861f93 |
+ fdata->func_start = pc;
|
|
|
861f93 |
+ continue;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
if ((op & 0xfc1fffff) == 0x7c0802a6)
|
|
|
861f93 |
{ /* mflr Rx */
|
|
|
861f93 |
/* Since shared library / PIC code, which needs to get its
|
|
|
861f93 |
@@ -1734,9 +1785,9 @@ skip_prologue (struct gdbarch *gdbarch,
|
|
|
861f93 |
we have no line table information or the line info tells
|
|
|
861f93 |
us that the subroutine call is not part of the line
|
|
|
861f93 |
associated with the prologue. */
|
|
|
861f93 |
- if ((pc - orig_pc) > 8)
|
|
|
861f93 |
+ if ((pc - fdata->func_start) > 8)
|
|
|
861f93 |
{
|
|
|
861f93 |
- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
|
|
|
861f93 |
+ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0);
|
|
|
861f93 |
struct symtab_and_line this_sal = find_pc_line (pc, 0);
|
|
|
861f93 |
|
|
|
861f93 |
if ((prologue_sal.line == 0)
|