|
|
861f93 |
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
|
|
|
861f93 |
|
|
|
861f93 |
FIXME: This workaround should be dropped and
|
|
|
861f93 |
glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child
|
|
|
861f93 |
instead.
|
|
|
861f93 |
|
|
|
861f93 |
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
|
|
|
861f93 |
(LINUX_CLONE_LEN): New definition.
|
|
|
861f93 |
(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
|
|
|
861f93 |
(amd64_linux_init_abi): Initialize `outermost_frame_p'.
|
|
|
861f93 |
* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
|
|
|
861f93 |
* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
|
|
|
861f93 |
* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
|
|
|
861f93 |
|
|
|
861f93 |
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
|
|
|
861f93 |
New file.
|
|
|
861f93 |
|
|
|
861f93 |
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
Port to GDB-6.7.
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120703.orig/gdb/amd64-linux-tdep.c 2012-06-13 22:36:48.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c 2012-07-03 17:32:46.547563363 +0200
|
|
|
861f93 |
@@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct
|
|
|
861f93 |
|
|
|
861f93 |
/* Set the program counter for process PTID to PC. */
|
|
|
861f93 |
|
|
|
861f93 |
+/* Detect the outermost frame; during unwind of
|
|
|
861f93 |
+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
|
|
|
861f93 |
+ avoid the additional bogus frame
|
|
|
861f93 |
+ #6 0x0000000000000000 in ??
|
|
|
861f93 |
+ We compare if the `linux_clone_code' block is _before_ unwound PC. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+static const unsigned char linux_clone_code[] =
|
|
|
861f93 |
+{
|
|
|
861f93 |
+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
|
|
|
861f93 |
+/* #ifdef RESET_PID */
|
|
|
861f93 |
+/* ... */
|
|
|
861f93 |
+/* mov $SYS_ify(getpid), %eax */
|
|
|
861f93 |
+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
|
|
|
861f93 |
+/* OR */
|
|
|
861f93 |
+/* mov $SYS_ify(getpid), %rax */
|
|
|
861f93 |
+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
|
|
|
861f93 |
+/* so just: */
|
|
|
861f93 |
+ 0x27, 0x00, 0x00, 0x00,
|
|
|
861f93 |
+/* syscall */
|
|
|
861f93 |
+ 0x0f, 0x05,
|
|
|
861f93 |
+/* movl %eax, %fs:PID */
|
|
|
861f93 |
+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
|
|
|
861f93 |
+/* movl %eax, %fs:TID */
|
|
|
861f93 |
+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
|
|
|
861f93 |
+/* #endif */
|
|
|
861f93 |
+/* |* Set up arguments for the function call. *| */
|
|
|
861f93 |
+/* popq %rax |* Function to call. *| */
|
|
|
861f93 |
+ 0x58,
|
|
|
861f93 |
+/* popq %rdi |* Argument. *| */
|
|
|
861f93 |
+ 0x5f,
|
|
|
861f93 |
+/* call *%rax$ */
|
|
|
861f93 |
+ 0xff, 0xd0
|
|
|
861f93 |
+};
|
|
|
861f93 |
+
|
|
|
861f93 |
+#define LINUX_CLONE_LEN (sizeof linux_clone_code)
|
|
|
861f93 |
+
|
|
|
861f93 |
+static int
|
|
|
861f93 |
+amd64_linux_clone_running (struct frame_info *this_frame)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
|
|
861f93 |
+ unsigned char buf[LINUX_CLONE_LEN];
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
|
|
|
861f93 |
+ LINUX_CLONE_LEN))
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 1;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static int
|
|
|
861f93 |
+amd64_linux_outermost_frame (struct frame_info *this_frame)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
|
|
861f93 |
+ const char *name;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ find_pc_partial_function (pc, &name, NULL, NULL);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* If we have NAME, we can optimize the search.
|
|
|
861f93 |
+ `clone' NAME still needs to have the code checked as its name may be
|
|
|
861f93 |
+ present in the user code.
|
|
|
861f93 |
+ `__clone' NAME should not be present in the user code but in the initial
|
|
|
861f93 |
+ parts of the `__clone' implementation the unwind still makes sense.
|
|
|
861f93 |
+ More detailed unwinding decision would be too much sensitive to possible
|
|
|
861f93 |
+ subtle changes in specific glibc revisions. */
|
|
|
861f93 |
+ if (name == NULL || strcmp (name, "clone") == 0
|
|
|
861f93 |
+ || strcmp ("__clone", name) == 0)
|
|
|
861f93 |
+ return (amd64_linux_clone_running (this_frame) != 0);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
static void
|
|
|
861f93 |
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
|
|
861f93 |
{
|
|
|
861f93 |
@@ -1547,6 +1621,8 @@ amd64_linux_init_abi (struct gdbarch_inf
|
|
|
861f93 |
|
|
|
861f93 |
amd64_linux_init_abi_common (info, gdbarch);
|
|
|
861f93 |
|
|
|
861f93 |
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
|
|
|
861f93 |
+
|
|
|
861f93 |
/* GNU/Linux uses SVR4-style shared libraries. */
|
|
|
861f93 |
set_solib_svr4_fetch_link_map_offsets
|
|
|
861f93 |
(gdbarch, svr4_lp64_fetch_link_map_offsets);
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/amd64-tdep.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120703.orig/gdb/amd64-tdep.c 2012-06-16 17:20:22.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/amd64-tdep.c 2012-07-03 17:32:12.335604415 +0200
|
|
|
861f93 |
@@ -2324,6 +2324,7 @@ amd64_frame_unwind_stop_reason (struct f
|
|
|
861f93 |
{
|
|
|
861f93 |
struct amd64_frame_cache *cache =
|
|
|
861f93 |
amd64_frame_cache (this_frame, this_cache);
|
|
|
861f93 |
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
|
|
861f93 |
|
|
|
861f93 |
if (!cache->base_p)
|
|
|
861f93 |
return UNWIND_UNAVAILABLE;
|
|
|
861f93 |
@@ -2332,6 +2333,10 @@ amd64_frame_unwind_stop_reason (struct f
|
|
|
861f93 |
if (cache->base == 0)
|
|
|
861f93 |
return UNWIND_OUTERMOST;
|
|
|
861f93 |
|
|
|
861f93 |
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
|
|
861f93 |
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
|
|
861f93 |
+ return UNWIND_OUTERMOST;
|
|
|
861f93 |
+
|
|
|
861f93 |
return UNWIND_NO_REASON;
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
@@ -2341,6 +2346,7 @@ amd64_frame_this_id (struct frame_info *
|
|
|
861f93 |
{
|
|
|
861f93 |
struct amd64_frame_cache *cache =
|
|
|
861f93 |
amd64_frame_cache (this_frame, this_cache);
|
|
|
861f93 |
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
|
|
861f93 |
|
|
|
861f93 |
if (!cache->base_p)
|
|
|
861f93 |
return;
|
|
|
861f93 |
@@ -2349,6 +2355,10 @@ amd64_frame_this_id (struct frame_info *
|
|
|
861f93 |
if (cache->base == 0)
|
|
|
861f93 |
return;
|
|
|
861f93 |
|
|
|
861f93 |
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
|
|
861f93 |
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
|
|
861f93 |
+ return;
|
|
|
861f93 |
+
|
|
|
861f93 |
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/i386-tdep.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.c 2012-06-18 19:31:34.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/i386-tdep.c 2012-07-03 17:32:12.339604409 +0200
|
|
|
861f93 |
@@ -7655,6 +7655,9 @@ i386_gdbarch_init (struct gdbarch_info i
|
|
|
861f93 |
|
|
|
861f93 |
tdep->xsave_xcr0_offset = -1;
|
|
|
861f93 |
|
|
|
861f93 |
+ /* Unwinding stops on i386 automatically. */
|
|
|
861f93 |
+ tdep->outermost_frame_p = NULL;
|
|
|
861f93 |
+
|
|
|
861f93 |
tdep->record_regmap = i386_record_regmap;
|
|
|
861f93 |
|
|
|
861f93 |
set_gdbarch_long_long_align_bit (gdbarch, 32);
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/i386-tdep.h
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.h 2012-06-13 22:29:15.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/i386-tdep.h 2012-07-03 17:32:12.340604408 +0200
|
|
|
861f93 |
@@ -219,6 +219,9 @@ struct gdbarch_tdep
|
|
|
861f93 |
int (*i386_sysenter_record) (struct regcache *regcache);
|
|
|
861f93 |
/* Parse syscall args. */
|
|
|
861f93 |
int (*i386_syscall_record) (struct regcache *regcache);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
|
|
861f93 |
+ int (*outermost_frame_p) (struct frame_info *this_frame);
|
|
|
861f93 |
};
|
|
|
861f93 |
|
|
|
861f93 |
/* Floating-point registers. */
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/ia64-tdep.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120703.orig/gdb/ia64-tdep.c 2012-07-03 17:30:09.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/ia64-tdep.c 2012-07-03 17:32:12.343604405 +0200
|
|
|
861f93 |
@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr
|
|
|
861f93 |
default_frame_sniffer
|
|
|
861f93 |
};
|
|
|
861f93 |
|
|
|
861f93 |
+/* Detect the outermost frame; during unwind of
|
|
|
861f93 |
+ #6 0x2000000000347100 in __clone2 () from /lib/libc.so.6.1
|
|
|
861f93 |
+ avoid the additional bogus frame
|
|
|
861f93 |
+ #7 0x0000000000000000 in ?? () */
|
|
|
861f93 |
+
|
|
|
861f93 |
+static char linux_clone2_code[] =
|
|
|
861f93 |
+{
|
|
|
861f93 |
+/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */
|
|
|
861f93 |
+ 0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40,
|
|
|
861f93 |
+ 0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
|
|
|
861f93 |
+/* st4 [r9]=r8 */
|
|
|
861f93 |
+/* st4 [r10]=r8 */
|
|
|
861f93 |
+/* ;; */
|
|
|
861f93 |
+/* #endif */
|
|
|
861f93 |
+ 0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02,
|
|
|
861f93 |
+ 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
|
|
|
861f93 |
+/* 1: ld8 out1=[in0],8 |* Retrieve code pointer. *| */
|
|
|
861f93 |
+/* mov out0=in4 |* Pass proper argument to fn *| */
|
|
|
861f93 |
+/* ;; */
|
|
|
861f93 |
+ 0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50,
|
|
|
861f93 |
+ 0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12,
|
|
|
861f93 |
+/* ld8 gp=[in0] |* Load function gp. *| */
|
|
|
861f93 |
+/* mov b6=out1 */
|
|
|
861f93 |
+/* br.call.dptk.many rp=b6 |* Call fn(arg) in the child *| */
|
|
|
861f93 |
+/* ;; */
|
|
|
861f93 |
+ 0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00,
|
|
|
861f93 |
+ 0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b,
|
|
|
861f93 |
+/* mov out0=r8 |* Argument to _exit *| */
|
|
|
861f93 |
+/* mov gp=loc0 */
|
|
|
861f93 |
+/* .globl HIDDEN_JUMPTARGET(_exit) */
|
|
|
861f93 |
+/* br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */
|
|
|
861f93 |
+/* |* call _exit with result from fn. *| */
|
|
|
861f93 |
+ 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
|
861f93 |
+ 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00
|
|
|
861f93 |
+/* ret |* Not reached. *| */
|
|
|
861f93 |
+};
|
|
|
861f93 |
+
|
|
|
861f93 |
+#define LINUX_CLONE_PRE_SLOTS 3 /* Number of slots before PC. */
|
|
|
861f93 |
+#define LINUX_CLONE_LEN (sizeof linux_clone2_code)
|
|
|
861f93 |
+
|
|
|
861f93 |
+static int
|
|
|
861f93 |
+ia64_linux_clone2_running (struct frame_info *this_frame)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
|
|
861f93 |
+ char buf[LINUX_CLONE_LEN];
|
|
|
861f93 |
+ struct minimal_symbol *minsym;
|
|
|
861f93 |
+ long long instr;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16,
|
|
|
861f93 |
+ buf, LINUX_CLONE_LEN))
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0)
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* Adjust the expected "_exit" address. */
|
|
|
861f93 |
+ minsym = lookup_minimal_symbol_text ("_exit", NULL);
|
|
|
861f93 |
+ if (minsym == NULL)
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
|
|
|
861f93 |
+ instr &= ~(((1L << 20) - 1) << 13);
|
|
|
861f93 |
+ /* Address is relative to the jump instruction slot, not the next one. */
|
|
|
861f93 |
+ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
|
|
|
861f93 |
+ & ((1L << 20) - 1)) << 13;
|
|
|
861f93 |
+ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
|
|
|
861f93 |
+ 2);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
|
|
|
861f93 |
+ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
|
|
|
861f93 |
+ LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0)
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 1;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static int
|
|
|
861f93 |
+ia64_outermost_frame (struct frame_info *this_frame)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
|
|
861f93 |
+ char *name;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ find_pc_partial_function (pc, &name, NULL, NULL);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* If we have NAME, we can optimize the search.
|
|
|
861f93 |
+ `clone' NAME still needs to have the code checked as its name may be
|
|
|
861f93 |
+ present in the user code.
|
|
|
861f93 |
+ `__clone' NAME should not be present in the user code but in the initial
|
|
|
861f93 |
+ parts of the `__clone' implementation the unwind still makes sense.
|
|
|
861f93 |
+ More detailed unwinding decision would be too much sensitive to possible
|
|
|
861f93 |
+ subtle changes in specific glibc revisions. */
|
|
|
861f93 |
+ if (name == NULL || strcmp (name, "clone2") == 0
|
|
|
861f93 |
+ || strcmp ("__clone2", name) == 0)
|
|
|
861f93 |
+ return (ia64_linux_clone2_running (this_frame) != 0);
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static void
|
|
|
861f93 |
+ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
|
|
861f93 |
+ struct frame_id *this_id)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ /* Leave the default outermost frame at *THIS_ID. */
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static struct value *
|
|
|
861f93 |
+ia64_clone2_frame_prev_register (struct frame_info *this_frame,
|
|
|
861f93 |
+ void **this_cache, int regnum)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ return frame_unwind_got_register (this_frame, regnum, regnum);
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static int
|
|
|
861f93 |
+ia64_clone2_frame_sniffer (const struct frame_unwind *self,
|
|
|
861f93 |
+ struct frame_info *this_frame,
|
|
|
861f93 |
+ void **this_prologue_cache)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ if (ia64_outermost_frame (this_frame))
|
|
|
861f93 |
+ return 1;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+static const struct frame_unwind ia64_clone2_frame_unwind =
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ NORMAL_FRAME,
|
|
|
861f93 |
+ &ia64_clone2_frame_this_id,
|
|
|
861f93 |
+ &ia64_clone2_frame_prev_register,
|
|
|
861f93 |
+ NULL,
|
|
|
861f93 |
+ &ia64_clone2_frame_sniffer
|
|
|
861f93 |
+};
|
|
|
861f93 |
+
|
|
|
861f93 |
/* Signal trampolines. */
|
|
|
861f93 |
|
|
|
861f93 |
static void
|
|
|
861f93 |
@@ -4146,6 +4278,7 @@ ia64_gdbarch_init (struct gdbarch_info i
|
|
|
861f93 |
set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
|
|
|
861f93 |
|
|
|
861f93 |
set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
|
|
|
861f93 |
+ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind);
|
|
|
861f93 |
#ifdef HAVE_LIBUNWIND_IA64_H
|
|
|
861f93 |
frame_unwind_append_unwinder (gdbarch,
|
|
|
861f93 |
&ia64_libunwind_sigtramp_frame_unwind);
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-07-03 17:32:12.344604404 +0200
|
|
|
861f93 |
@@ -0,0 +1,39 @@
|
|
|
861f93 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ Copyright 2006 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+ it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
861f93 |
+ (at your option) any later version.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+ GNU General Public License for more details.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+ along with this program; if not, write to the Free Software
|
|
|
861f93 |
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
861f93 |
+ MA 02110-1301, USA. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+
|
|
|
861f93 |
+#include <pthread.h>
|
|
|
861f93 |
+#include <unistd.h>
|
|
|
861f93 |
+#include <assert.h>
|
|
|
861f93 |
+
|
|
|
861f93 |
+
|
|
|
861f93 |
+void *threader (void *arg)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ assert (0);
|
|
|
861f93 |
+ return NULL;
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+int main (void)
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ pthread_t t1;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ pthread_create (&t1, NULL, threader, (void *) NULL);
|
|
|
861f93 |
+ for (;;)
|
|
|
861f93 |
+ pause();
|
|
|
861f93 |
+}
|
|
|
861f93 |
Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
861f93 |
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-07-03 17:32:12.344604404 +0200
|
|
|
861f93 |
@@ -0,0 +1,61 @@
|
|
|
861f93 |
+# Copyright 2006 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+# it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
861f93 |
+# (at your option) any later version.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+# GNU General Public License for more details.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+# along with this program; if not, write to the Free Software
|
|
|
861f93 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Backtraced `clone' must not have `PC == 0' as its previous frame.
|
|
|
861f93 |
+
|
|
|
861f93 |
+if $tracelevel then {
|
|
|
861f93 |
+ strace $tracelevel
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+set testfile bt-clone-stop
|
|
|
861f93 |
+set srcfile ${testfile}.c
|
|
|
861f93 |
+set binfile ${objdir}/${subdir}/${testfile}
|
|
|
861f93 |
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
|
861f93 |
+ untested "Couldn't compile test program"
|
|
|
861f93 |
+ return -1
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Get things started.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_exit
|
|
|
861f93 |
+gdb_start
|
|
|
861f93 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
861f93 |
+gdb_load ${binfile}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# threader: threader.c:8: threader: Assertion `0' failed.
|
|
|
861f93 |
+# Program received signal SIGABRT, Aborted.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "run" \
|
|
|
861f93 |
+ "Program received signal SIGABRT.*" \
|
|
|
861f93 |
+ "run"
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Former gdb unwind (the first function is `clone'):
|
|
|
861f93 |
+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
|
|
|
861f93 |
+# #6 0x0000000000000000 in ?? ()
|
|
|
861f93 |
+# (gdb)
|
|
|
861f93 |
+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
|
|
|
861f93 |
+# Unhandled case below should not happen and it is fortunately handled by
|
|
|
861f93 |
+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
|
|
|
861f93 |
+gdb_test_multiple "bt" "0x0 entry output invalid" {
|
|
|
861f93 |
+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
|
|
|
861f93 |
+ fail "0x0 entry found"
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ -re "in threader \\(.*$gdb_prompt $" {
|
|
|
861f93 |
+ pass "0x0 entry not found"
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|