|
|
01917d |
Message-ID: <54BD2C4B.7010102@gmail.com>
|
|
|
01917d |
Date: Tue, 20 Jan 2015 00:09:47 +0800
|
|
|
01917d |
From: Wei-cheng Wang <cole945 at gmail dot com>
|
|
|
01917d |
To: Joel Brobecker <brobecker at adacore dot com>
|
|
|
01917d |
CC: Ulrich Weigand <uweigand at de dot ibm dot com>, gdb-patches at sourceware dot org
|
|
|
01917d |
Subject: Re: [PATCH 2/3 v4] Process record support for PowerPC
|
|
|
01917d |
|
|
|
01917d |
On 2015/1/19 下午 03:48, Joel Brobecker wrote:
|
|
|
01917d |
>> Using %s+paddress instead of %lx+long in this patch.
|
|
|
01917d |
> The change looks fine to me, but there is no ChangeLog.
|
|
|
01917d |
|
|
|
01917d |
Hi Joel,
|
|
|
01917d |
|
|
|
01917d |
ChangeLog is in my last mail. Re-post below for your review.
|
|
|
01917d |
|
|
|
01917d |
2015-01-18 Wei-cheng Wang <cole945@gmail.com>
|
|
|
01917d |
|
|
|
01917d |
* rs6000-tdep.c (ppc_process_record_op4, ppc_process_record_op19,
|
|
|
01917d |
ppc_process_record_op31, ppc_process_record_op59,
|
|
|
01917d |
ppc_process_record_op60, ppc_process_record_op63,
|
|
|
01917d |
ppc_process_record): Fix -Wformat warning.
|
|
|
01917d |
* rs6000-tdep.c (rs6000_epilogue_frame_cache, ppc_process_record_op60):
|
|
|
01917d |
Remove unused variables.
|
|
|
01917d |
|
|
|
01917d |
> Also, I ended glancing at some of the patches you recently pushed,
|
|
|
01917d |
> and noticed that you added a lot of new functions for which there
|
|
|
01917d |
> is no introductory comment describing the function's behavior and
|
|
|
01917d |
> arguments. It is now mandatory that all new functions, no matter
|
|
|
01917d |
> how trivial, have such introductory comment. Would you mind going
|
|
|
01917d |
> back over your patches, and send a patch that adds the missing
|
|
|
01917d |
> comments, please?
|
|
|
01917d |
|
|
|
01917d |
I've added the missing comments. See below.
|
|
|
01917d |
|
|
|
01917d |
Thanks,
|
|
|
01917d |
Wei-cheng
|
|
|
01917d |
|
|
|
01917d |
|
|
|
01917d |
2015-01-18 Wei-cheng Wang <cole945@gmail.com>
|
|
|
01917d |
|
|
|
01917d |
* ppc-linux-tdep.c (ppc_skip_trampoline_code,
|
|
|
01917d |
ppc_canonicalize_syscall, ppc_linux_syscall_record,
|
|
|
01917d |
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
|
|
|
01917d |
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
|
|
|
01917d |
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
|
|
|
01917d |
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
|
|
|
01917d |
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
|
|
|
01917d |
ppc_process_record_op19, ppc_process_record_op31,
|
|
|
01917d |
ppc_process_record_op59, ppc_process_record_op60,
|
|
|
01917d |
ppc_process_record_op63): Likewise.
|
|
|
01917d |
|
|
|
01917d |
commit ddeca1dffbe346eea03b893bf3c5bc46e4439e93
|
|
|
01917d |
Author: Wei-cheng Wang <cole945@gmail.com>
|
|
|
01917d |
Date: Mon Jan 19 23:34:07 2015 +0800
|
|
|
01917d |
|
|
|
01917d |
Add missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.
|
|
|
01917d |
|
|
|
01917d |
gdb/ChangeLog:
|
|
|
01917d |
|
|
|
01917d |
* ppc-linux-tdep.c (ppc_skip_trampoline_code,
|
|
|
01917d |
ppc_canonicalize_syscall, ppc_linux_syscall_record,
|
|
|
01917d |
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
|
|
|
01917d |
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
|
|
|
01917d |
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
|
|
|
01917d |
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
|
|
|
01917d |
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
|
|
|
01917d |
ppc_process_record_op19, ppc_process_record_op31,
|
|
|
01917d |
ppc_process_record_op59, ppc_process_record_op60,
|
|
|
01917d |
ppc_process_record_op63): Likewise.
|
|
|
01917d |
|
|
|
01917d |
Index: gdb-7.6.1/gdb/ppc64-tdep.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/ppc64-tdep.c
|
|
|
01917d |
+++ gdb-7.6.1/gdb/ppc64-tdep.c
|
|
|
01917d |
@@ -449,7 +449,10 @@ ppc64_standard_linkage4_target (struct f
|
|
|
01917d |
|
|
|
01917d |
|
|
|
01917d |
/* Given that we've begun executing a call trampoline at PC, return
|
|
|
01917d |
- the entry point of the function the trampoline will go to. */
|
|
|
01917d |
+ the entry point of the function the trampoline will go to.
|
|
|
01917d |
+
|
|
|
01917d |
+ When the execution direction is EXEC_REVERSE, scan backward to
|
|
|
01917d |
+ check whether we are in the middle of a PLT stub. */
|
|
|
01917d |
|
|
|
01917d |
CORE_ADDR
|
|
|
01917d |
ppc64_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
|
|
|
01917d |
Index: gdb-7.6.1/gdb/ppc-linux-tdep.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/ppc-linux-tdep.c
|
|
|
01917d |
+++ gdb-7.6.1/gdb/ppc-linux-tdep.c
|
|
|
01917d |
@@ -353,7 +353,12 @@ powerpc_linux_in_dynsym_resolve_code (CO
|
|
|
01917d |
return 0;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Follow PLT stub to actual routine. */
|
|
|
01917d |
+/* Follow PLT stub to actual routine.
|
|
|
01917d |
+
|
|
|
01917d |
+ When the execution direction is EXEC_REVERSE, scan backward to
|
|
|
01917d |
+ check whether we are in the middle of a PLT stub. Currently,
|
|
|
01917d |
+ we only look-behind at most 4 instructions (the max length of PLT
|
|
|
01917d |
+ stub sequence. */
|
|
|
01917d |
|
|
|
01917d |
static CORE_ADDR
|
|
|
01917d |
ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
|
|
|
01917d |
@@ -839,11 +844,16 @@ ppc_linux_get_syscall_number (struct gdb
|
|
|
01917d |
static struct linux_record_tdep ppc_linux_record_tdep;
|
|
|
01917d |
static struct linux_record_tdep ppc64_linux_record_tdep;
|
|
|
01917d |
|
|
|
01917d |
+/* ppc_canonicalize_syscall maps from the native PowerPC Linux set of
|
|
|
01917d |
+ syscall ids into a canonical set of syscall ids used by process
|
|
|
01917d |
+ record. (See arch/powerpc/include/uapi/asm/unistd.h in kernel tree.)
|
|
|
01917d |
+ Return -1 if this system call is not supported by process record.
|
|
|
01917d |
+ Otherwise, return the syscall number for preocess reocrd of given
|
|
|
01917d |
+ SYSCALL. */
|
|
|
01917d |
+
|
|
|
01917d |
static enum gdb_syscall
|
|
|
01917d |
ppc_canonicalize_syscall (int syscall)
|
|
|
01917d |
{
|
|
|
01917d |
- /* See arch/powerpc/include/uapi/asm/unistd.h */
|
|
|
01917d |
-
|
|
|
01917d |
if (syscall <= 165)
|
|
|
01917d |
return syscall;
|
|
|
01917d |
else if (syscall >= 167 && syscall <= 190) /* Skip query_module 166 */
|
|
|
01917d |
@@ -869,6 +879,9 @@ ppc_canonicalize_syscall (int syscall)
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Record registers which might be clobbered during system call.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
+
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_linux_syscall_record (struct regcache *regcache)
|
|
|
01917d |
{
|
|
|
01917d |
@@ -949,6 +962,9 @@ ppc_linux_syscall_record (struct regcach
|
|
|
01917d |
return 0;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Record registers which might be clobbered during signal handling.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
+
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
enum gdb_signal signal)
|
|
|
01917d |
@@ -1470,7 +1486,9 @@ static const struct frame_unwind ppu2spu
|
|
|
01917d |
ppu2spu_prev_arch,
|
|
|
01917d |
};
|
|
|
01917d |
|
|
|
01917d |
-/* Initialize linux_record_tdep if not initialized yet. */
|
|
|
01917d |
+/* Initialize linux_record_tdep if not initialized yet.
|
|
|
01917d |
+ WORDSIZE is 4 or 8 for 32- or 64-bit PowerPC Linux respectively.
|
|
|
01917d |
+ Sizes of data structures are initialized accordingly. */
|
|
|
01917d |
|
|
|
01917d |
static void
|
|
|
01917d |
ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
|
|
|
01917d |
Index: gdb-7.6.1/gdb/rs6000-tdep.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/rs6000-tdep.c
|
|
|
01917d |
+++ gdb-7.6.1/gdb/rs6000-tdep.c
|
|
|
01917d |
@@ -3398,6 +3398,9 @@ static const struct frame_unwind rs6000_
|
|
|
01917d |
default_frame_sniffer
|
|
|
01917d |
};
|
|
|
01917d |
|
|
|
01917d |
+/* Allocate and initialize a frame cache for an epilogue frame.
|
|
|
01917d |
+ SP is restored and prev-PC is stored in LR. */
|
|
|
01917d |
+
|
|
|
01917d |
static struct rs6000_frame_cache *
|
|
|
01917d |
rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
|
|
01917d |
{
|
|
|
01917d |
@@ -3434,6 +3437,9 @@ rs6000_epilogue_frame_cache (struct fram
|
|
|
01917d |
return cache;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Implementation of frame_unwind.this_id, as defined in frame_unwind.h.
|
|
|
01917d |
+ Return the frame ID of an epilogue frame. */
|
|
|
01917d |
+
|
|
|
01917d |
static void
|
|
|
01917d |
rs6000_epilogue_frame_this_id (struct frame_info *this_frame,
|
|
|
01917d |
void **this_cache, struct frame_id *this_id)
|
|
|
01917d |
@@ -3449,6 +3455,9 @@ rs6000_epilogue_frame_this_id (struct fr
|
|
|
01917d |
(*this_id) = frame_id_build (info->base, pc);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Implementation of frame_unwind.prev_register, as defined in frame_unwind.h.
|
|
|
01917d |
+ Return the register value of REGNUM in previous frame. */
|
|
|
01917d |
+
|
|
|
01917d |
static struct value *
|
|
|
01917d |
rs6000_epilogue_frame_prev_register (struct frame_info *this_frame,
|
|
|
01917d |
void **this_cache, int regnum)
|
|
|
01917d |
@@ -3458,6 +3467,9 @@ rs6000_epilogue_frame_prev_register (str
|
|
|
01917d |
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Implementation of frame_unwind.sniffer, as defined in frame_unwind.h.
|
|
|
01917d |
+ Check whether this an epilogue frame. */
|
|
|
01917d |
+
|
|
|
01917d |
static int
|
|
|
01917d |
rs6000_epilogue_frame_sniffer (const struct frame_unwind *self,
|
|
|
01917d |
struct frame_info *this_frame,
|
|
|
01917d |
@@ -3471,6 +3483,9 @@ rs6000_epilogue_frame_sniffer (const str
|
|
|
01917d |
return 0;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Frame unwinder for epilogue frame. This is required for reverse step-over
|
|
|
01917d |
+ a function without debug information. */
|
|
|
01917d |
+
|
|
|
01917d |
static const struct frame_unwind rs6000_epilogue_frame_unwind =
|
|
|
01917d |
{
|
|
|
01917d |
NORMAL_FRAME,
|
|
|
01917d |
@@ -3717,7 +3732,9 @@ bfd_uses_spe_extensions (bfd *abfd)
|
|
|
01917d |
#define PPC_XT(insn) ((PPC_TX (insn) << 5) | PPC_T (insn))
|
|
|
01917d |
#define PPC_XER_NB(xer) (xer & 0x7f)
|
|
|
01917d |
|
|
|
01917d |
-/* Record Vector-Scalar Registers. */
|
|
|
01917d |
+/* Record Vector-Scalar Registers.
|
|
|
01917d |
+ For VSR less than 32, it's represented by an FPR and an VSR-upper register.
|
|
|
01917d |
+ Otherwise, it's just a VR register. Record them accordingly. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_record_vsr (struct regcache *regcache, struct gdbarch_tdep *tdep, int vsr)
|
|
|
01917d |
@@ -3742,11 +3759,12 @@ ppc_record_vsr (struct regcache *regcach
|
|
|
01917d |
return 0;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-4. */
|
|
|
01917d |
+/* Parse and record instructions primary opcode-4 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
- CORE_ADDR addr, uint32_t insn)
|
|
|
01917d |
+ CORE_ADDR addr, uint32_t insn)
|
|
|
01917d |
{
|
|
|
01917d |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
01917d |
int ext = PPC_FIELD (insn, 21, 11);
|
|
|
01917d |
@@ -4010,7 +4028,8 @@ ppc_process_record_op4 (struct gdbarch *
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-19. */
|
|
|
01917d |
+/* Parse and record instructions of primary opcode-19 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
@@ -4053,7 +4072,8 @@ ppc_process_record_op19 (struct gdbarch
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-31. */
|
|
|
01917d |
+/* Parse and record instructions of primary opcode-31 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
@@ -4531,7 +4551,8 @@ UNKNOWN_OP:
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-59. */
|
|
|
01917d |
+/* Parse and record instructions of primary opcode-59 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
@@ -4623,7 +4644,8 @@ ppc_process_record_op59 (struct gdbarch
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-60. */
|
|
|
01917d |
+/* Parse and record instructions of primary opcode-60 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
|
|
|
01917d |
@@ -4905,7 +4927,8 @@ ppc_process_record_op60 (struct gdbarch
|
|
|
01917d |
return -1;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
-/* Parse instructions of primary opcode-63. */
|
|
|
01917d |
+/* Parse and record instructions of primary opcode-63 at ADDR.
|
|
|
01917d |
+ Return 0 if successful. */
|
|
|
01917d |
|
|
|
01917d |
static int
|
|
|
01917d |
ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
|