|
|
861f93 |
2005-07-14 Jeff Johnsotn <jjohnstn@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
* linux-nat.c (linux_nat_xfer_memory): Incorporate Fujitsu
|
|
|
861f93 |
work-around to use /proc/mem for storage, but to fall-back
|
|
|
861f93 |
to PTRACE for ia64 rse register areas.
|
|
|
861f93 |
* ia64-linux-nat.c (ia64_rse_slot_num): New static function.
|
|
|
861f93 |
(ia64_rse_skip_regs): Ditto.
|
|
|
861f93 |
(ia64_linux_check_stack_region): New function.
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-6.8.50.20090803/gdb/linux-nat.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-04 06:29:55.000000000 +0200
|
|
|
861f93 |
+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-04 06:30:53.000000000 +0200
|
|
|
861f93 |
@@ -4495,15 +4495,38 @@ linux_xfer_partial (struct target_ops *o
|
|
|
861f93 |
offset &= ((ULONGEST) 1 << addr_bit) - 1;
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
-#ifndef NATIVE_XFER_UNWIND_TABLE
|
|
|
861f93 |
- /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
|
|
|
861f93 |
- for accessing thread storage. Revert when Bugzilla 147436
|
|
|
861f93 |
- is fixed. */
|
|
|
861f93 |
xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
|
|
|
861f93 |
offset, len);
|
|
|
861f93 |
if (xfer != 0)
|
|
|
861f93 |
- return xfer;
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+#ifdef NATIVE_XFER_UNWIND_TABLE
|
|
|
861f93 |
+ struct mem_region range;
|
|
|
861f93 |
+ range.lo = memaddr;
|
|
|
861f93 |
+ range.hi = memaddr + len;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* FIXME: For ia64, we cannot currently use
|
|
|
861f93 |
+ linux_proc_xfer_partial for accessing rse register storage.
|
|
|
861f93 |
+ Revert when Bugzilla 147436 is fixed. */
|
|
|
861f93 |
+#ifdef NATIVE_XFER_UNWIND_TABLE
|
|
|
861f93 |
+ extern int ia64_linux_check_stack_region (struct lwp_info *lwp,
|
|
|
861f93 |
+ void *range);
|
|
|
861f93 |
+#endif
|
|
|
861f93 |
+ if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
|
|
|
861f93 |
+ { /* This region contains ia64 rse registers, we have to re-read. */
|
|
|
861f93 |
+ int xxfer;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* Re-read register stack area. */
|
|
|
861f93 |
+ xxfer = super_xfer_partial (ops, object, annex,
|
|
|
861f93 |
+ readbuf + (range.lo - memaddr),
|
|
|
861f93 |
+ writebuf + (range.lo - memaddr),
|
|
|
861f93 |
+ offset + (range.lo - memaddr),
|
|
|
861f93 |
+ range.hi - range.lo);
|
|
|
861f93 |
+ if (xxfer == 0)
|
|
|
861f93 |
+ xfer = 0;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
#endif
|
|
|
861f93 |
+ return xfer;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
|
|
|
861f93 |
return super_xfer_partial (ops, object, annex, readbuf, writebuf,
|
|
|
861f93 |
offset, len);
|
|
|
861f93 |
Index: gdb-6.8.50.20090803/gdb/ia64-linux-nat.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-6.8.50.20090803.orig/gdb/ia64-linux-nat.c 2009-02-23 01:03:49.000000000 +0100
|
|
|
861f93 |
+++ gdb-6.8.50.20090803/gdb/ia64-linux-nat.c 2009-08-04 06:30:53.000000000 +0200
|
|
|
861f93 |
@@ -809,6 +809,64 @@ ia64_linux_xfer_partial (struct target_o
|
|
|
861f93 |
|
|
|
861f93 |
void _initialize_ia64_linux_nat (void);
|
|
|
861f93 |
|
|
|
861f93 |
+/*
|
|
|
861f93 |
+ * Note: taken from ia64_tdep.c
|
|
|
861f93 |
+ *
|
|
|
861f93 |
+ */
|
|
|
861f93 |
+
|
|
|
861f93 |
+static __inline__ unsigned long
|
|
|
861f93 |
+ia64_rse_slot_num (unsigned long addr)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ return (addr >> 3) & 0x3f;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+/* Skip over a designated number of registers in the backing
|
|
|
861f93 |
+ store, remembering every 64th position is for NAT. */
|
|
|
861f93 |
+static __inline__ unsigned long
|
|
|
861f93 |
+ia64_rse_skip_regs (unsigned long addr, long num_regs)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ long delta = ia64_rse_slot_num(addr) + num_regs;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (num_regs < 0)
|
|
|
861f93 |
+ delta -= 0x3e;
|
|
|
861f93 |
+ return addr + ((num_regs + delta/0x3f) << 3);
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+/*
|
|
|
861f93 |
+ * Check mem_region is stack or not. If stack, /proc/<pid>/mem cannot return
|
|
|
861f93 |
+ * expected value.
|
|
|
861f93 |
+ */
|
|
|
861f93 |
+int ia64_linux_check_stack_region(struct lwp_info *ti, struct mem_region *range)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ CORE_ADDR addr;
|
|
|
861f93 |
+ int error;
|
|
|
861f93 |
+ unsigned long bsp, cfm, bspstore;
|
|
|
861f93 |
+ long sof;
|
|
|
861f93 |
+ pid_t pid = ptid_get_lwp(ti->ptid);
|
|
|
861f93 |
+ bsp = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSP ,NULL);
|
|
|
861f93 |
+ if (bsp == (unsigned long)-1) {
|
|
|
861f93 |
+ return 1;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ /* stack is allocated by one-segment, not separated into several segments.
|
|
|
861f93 |
+ So, we only have to check whether bsp is in *range* or not. */
|
|
|
861f93 |
+ if((range->lo <= bsp) && (bsp <= range->hi)) {
|
|
|
861f93 |
+ bspstore = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSPSTORE, NULL);
|
|
|
861f93 |
+ cfm = ptrace(PTRACE_PEEKUSER, pid, PT_CFM, NULL);
|
|
|
861f93 |
+ sof = cfm & 0x3f;
|
|
|
861f93 |
+ bsp = ia64_rse_skip_regs(bsp, -sof);
|
|
|
861f93 |
+ range->lo = bspstore;
|
|
|
861f93 |
+ range->hi = bsp;
|
|
|
861f93 |
+ /* we have to check the size of dirty register stack area */
|
|
|
861f93 |
+ /*
|
|
|
861f93 |
+ fprintf_unfiltered(gdb_stdlog, "<%d> <%p> <%lx> <%p> <%p>\n",
|
|
|
861f93 |
+ pid, bsp, sof, range->lo, range->hi);
|
|
|
861f93 |
+ */
|
|
|
861f93 |
+ return 1;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
void
|
|
|
861f93 |
_initialize_ia64_linux_nat (void)
|
|
|
861f93 |
{
|