- Upgrade to the upstream gdb-6.8 prerelease.

- Cleanup the leftover `.orig' files during %prep.
- Add expat-devel check by the configure script (for the other-arch
    builds).
- `--with testsuite' now also BuildRequires: fpc
- Backport fix of a segfault + PIE regression since 6.7.1 on PIE
    executables.
- Update the printed GDB version string to be Fedora specific.
This commit is contained in:
Jan Kratochvil 2008-03-03 16:13:47 +00:00
parent 2da8118ede
commit 25ff8a1663
34 changed files with 4018 additions and 11546 deletions

View File

@ -1 +1 @@
gdb-6.7.1.tar.bz2 gdb-6.7.50.20080227.tar.bz2

View File

@ -6,52 +6,153 @@ from Alexandre Oliva <aoliva@redhat.com>
(i386_linux_set_debug_regs_for_thread): ... this, and (i386_linux_set_debug_regs_for_thread): ... this, and
add new function to catch exceptions in the old one. add new function to catch exceptions in the old one.
Index: gdb-6.5/gdb/i386-linux-nat.c 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
This patch was originally made to workaround a deficiency of ia32el (==ia32
emulator on ia64) which EIOs on ptrace(2) of the debug registers.
Currently I can no longer run gdb.i386 on RHEL-5.1.ia64 as it fails on
$ rpm -qv kernel
kernel-2.6.18-53.el5.ia64
$ file /emul/ia32-linux/usr/bin/gdb ./print-threads
/emul/ia32-linux/usr/bin/gdb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
./print-threads: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
$ /emul/ia32-linux/usr/bin/gdb ./print-threads
(gdb) r
Starting program: /root/jkratoch/redhat/print-threads
Warning:
Cannot insert breakpoint -2.
Error accessing memory address 0x555766fb: Input/output error.
(gdb) maint info breakpoints
Num Type Disp Enb Address What
-1 longjmp resume keep n 0x00000000
-2 shlib events keep y 0x555766fb
ia32-on-ia64 run problem info:
the inconsistency is in function linux_nat_wait - there is a variable called
block_mask, which is assumed to represent the current signal mask. in the
following execution path this assumption does not hold:
1) block-mask is filled with SIGCHLD and the signal is masked in
lin_lwp_attach_lwp, which is called at the beginning of the procedure
that handles a new thread in the debuggee.
2) further down this procedure gdb tries to set the debug regs of the debuggee.
when trying to set debug regs - gdb fails and calls throw_exception. this
function finishes with siglongjmp, which clears the sigmask (seq. 1).
3) further down, linux_nat_wait is called to wait on the new child. in
linux_nat_wait there is a sequence :
if ( ! (block_mask & SIGCHLD) )
mask- SIGCHLD
while () {
wait-no-hang( )
if no child found then
sigsuspend (SIGCHLD)
4) the signal that notifies the debugger about the child is received after the
wait and before the sigsuspend. originally, this was not supposed to happen
because SIGCHLD is supposed to be blocked, but because what happens in step
2, the signal mask is cleared and the signal is received at this point,
which results with a hang
sequence 1:
catch_errors (symbol_add_stubs)
symbol_file_add_with_addrs_or_offsets
deprecated_target_new_objfile_hook
tui_new_objfile_hook
attach_thread
observer_notify_linux_new_thread
generic_observer_notify
observer_linux_new_thread_notification_stub
i386_linux_new_thread
i386_linux_set_debug_regs_for_thread
i386_linux_dr_set_addr
i386_linux_dr_set
perror_with_name
.
.
.
throw_exception
siglongjmp
RHEL Bug 175270
Index: gdb-6.8cvs20080219/gdb/i386-linux-nat.c
=================================================================== ===================================================================
--- gdb-6.5.orig/gdb/i386-linux-nat.c 2006-07-11 05:21:58.000000000 -0300 --- gdb-6.8cvs20080219.orig/gdb/i386-linux-nat.c 2008-01-10 19:19:02.000000000 +0100
+++ gdb-6.5/gdb/i386-linux-nat.c 2006-07-11 05:24:29.000000000 -0300 +++ gdb-6.8cvs20080219/gdb/i386-linux-nat.c 2008-02-24 09:23:09.000000000 +0100
@@ -27,6 +27,7 @@ @@ -24,6 +24,7 @@
#include "observer.h" #include "regcache.h"
#include "target.h" #include "target.h"
#include "linux-nat.h" #include "linux-nat.h"
+#include "exceptions.h" +#include "exceptions.h"
#include "gdb_assert.h" #include "gdb_assert.h"
#include "gdb_string.h" #include "gdb_string.h"
@@ -695,14 +696,33 @@ struct i386_debug_register_state @@ -611,20 +612,40 @@ i386_linux_dr_get (ptid_t ptid, int regn
unsigned long control; return value;
}; }
-static void -static void
-i386_linux_set_debug_regs_for_thread (ptid_t ptid, -i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
- struct i386_debug_register_state *dbs) -{
+struct i386_debug_register_for_thread - int tid;
+{ +struct i386_linux_dr_set
+ ptid_t ptid; + {
+ struct i386_debug_register_state *dbs; + int tid;
+}; + int regnum;
+ + unsigned long value;
+ };
- tid = TIDGET (ptid);
- if (tid == 0)
- tid = PIDGET (ptid);
+static int +static int
+i386_linux_set_dr_for_thread (void *drp) +i386_linux_dr_set_core (void *data_pointer)
{ +{
+ ptid_t ptid = ((struct i386_debug_register_for_thread *)drp)->ptid; + struct i386_linux_dr_set *data = data_pointer;
+ struct i386_debug_register_state *dbs
+ = ((struct i386_debug_register_for_thread *)drp)->dbs; errno = 0;
int i; - ptrace (PTRACE_POKEUSER, tid,
for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i) - offsetof (struct user, u_debugreg[regnum]), value);
i386_linux_dr_set_addr (ptid, i, dbs->addr[i]); + ptrace (PTRACE_POKEUSER, data->tid,
i386_linux_dr_set_control (ptid, dbs->control); + offsetof (struct user, u_debugreg[data->regnum]), data->value);
if (errno != 0)
perror_with_name (_("Couldn't write debug register"));
+ return 1; + return 1;
+} +}
+ +
+static int +static int
+i386_linux_set_debug_regs_for_thread (ptid_t ptid, +i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
+ struct i386_debug_register_state *dbs)
+{ +{
+ struct i386_debug_register_for_thread dr; + struct i386_linux_dr_set data;
+ dr.ptid = ptid; + int tid;
+ dr.dbs = dbs; +
+ return catch_errors (i386_linux_set_dr_for_thread, &dr, "", RETURN_MASK_ALL); + data.tid = TIDGET (ptid);
+ if (data.tid == 0)
+ data.tid = PIDGET (ptid);
+
+ data.regnum = regnum;
+ data.value = value;
+
+ return catch_errors (i386_linux_dr_set_core, &data, "", RETURN_MASK_ALL);
} }
/* Iterator function to support syncing debug registers across all threads. */ void
Index: gdb-6.8cvs20080219/gdb/Makefile.in
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/Makefile.in 2008-02-24 09:13:35.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/Makefile.in 2008-02-24 09:14:26.000000000 +0100
@@ -2252,7 +2252,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gregset_h) $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
- $(gdb_proc_service_h) $(target_h)
+ $(gdb_proc_service_h) $(target_h) $(exceptions_h)
i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(dwarf2_frame_h) $(gdb_string_h) $(i386_tdep_h) \

View File

@ -3,11 +3,17 @@
* dwarf2read.c (die_type): Tolerate a type reference to location * dwarf2read.c (die_type): Tolerate a type reference to location
<0> and treat as unknown type. <0> and treat as unknown type.
--- gdb-6.3/gdb/dwarf2read.c.fix Tue Feb 1 16:48:49 2005 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+++ gdb-6.3/gdb/dwarf2read.c Tue Feb 1 16:50:12 2005
@@ -7120,6 +7120,10 @@ die_type (struct die_info *die, struct d Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/dwarf2read.c
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/dwarf2read.c 2008-02-22 08:10:39.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/dwarf2read.c 2008-02-22 08:17:56.000000000 +0100
@@ -7634,6 +7634,10 @@ die_type (struct die_info *die, struct d
/* A missing DW_AT_type represents a void type. */ /* A missing DW_AT_type represents a void type. */
return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu); return builtin_type (current_gdbarch)->builtin_void;
} }
+ else if (DW_ADDR (type_attr) == 0) + else if (DW_ADDR (type_attr) == 0)
+ /* If we have an invalid reference to 0, ignore it and treat + /* If we have an invalid reference to 0, ignore it and treat

View File

@ -9,6 +9,10 @@ testsuite:
* gdb.arch/ia64-sigtramp.exp: New test. * gdb.arch/ia64-sigtramp.exp: New test.
* gdb.arch/ia64-sigtramp.c: Ditto. * gdb.arch/ia64-sigtramp.c: Ditto.
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre. (Only the testcase has remained.)
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix 2005-07-25 16:42:46.000000000 -0400 --- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix 2005-07-25 16:42:46.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c 2005-07-25 16:42:08.000000000 -0400 +++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c 2005-07-25 16:42:08.000000000 -0400
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
@ -104,17 +108,3 @@ testsuite:
+gdb_test "f 1" ".*signal handler called.*" "frame 1" +gdb_test "f 1" ".*signal handler called.*" "frame 1"
+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame" +gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame"
+ +
--- gdb-6.3/gdb/libunwind-frame.c.fix 2005-07-25 16:41:30.000000000 -0400
+++ gdb-6.3/gdb/libunwind-frame.c 2005-07-25 16:46:23.000000000 -0400
@@ -303,8 +303,9 @@ libunwind_frame_prev_register (struct fr
modification to support unwinding through a sigaltstack. */
if (uw_regnum == INT_MAX)
{
- store_unsigned_integer (valuep, sizeof (CORE_ADDR),
- (CORE_ADDR)&cache->cursor);
+ if (valuep)
+ store_unsigned_integer (valuep, sizeof (CORE_ADDR),
+ (CORE_ADDR)&cache->cursor);
return;
}

View File

@ -1,204 +0,0 @@
2005-07-11 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (pseudo_regs): Add CURSOR_ADDR_REGNUM.
(ia64_register_names): Add empty string for CURSOR_ADDR_REGNUM.
(ia64_frame_prev_register): Default a request for CURSOR_ADDR_REGNUM
to return 0.
(ia64_sigtramp_frame_prev_register): Ditto.
(ia64_gdb2uw_regnum): Map CURSOR_ADDR_REGNUM to INT_MAX so
it won't clash with any legitimate UNW register number.
(ia64_unwind_cursor): New callback.
(ia64_libunwind_descr): Add new ia64_unwind_cursor callback.
* libunwind-frame.h (struct libunwind_descr): Add new slot
for unwind cursor callback.
* libunwind-frame.c (libunwind_frame_cache): Attempt to copy
and step previous cursor if possible, otherwise, create new
cursor.
(libunwind_frame_prev_register): Support request for
getting the cursor address.
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/ia64-tdep.c
===================================================================
--- gdb-6.7.orig/gdb/ia64-tdep.c 2007-10-14 23:57:38.000000000 +0200
+++ gdb-6.7/gdb/ia64-tdep.c 2007-10-15 00:05:20.000000000 +0200
@@ -131,7 +131,7 @@ static int lr_regnum = IA64_VRAP_REGNUM;
they may not be accessible via the ptrace register get/set interfaces. */
enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS, VBOF_REGNUM = IA64_NAT127_REGNUM + 1, V32_REGNUM,
V127_REGNUM = V32_REGNUM + 95,
- VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16, VP63_REGNUM = VP0_REGNUM + 63, LAST_PSEUDO_REGNUM };
+ VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16, VP63_REGNUM = VP0_REGNUM + 63, CURSOR_ADDR_REGNUM, LAST_PSEUDO_REGNUM };
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
@@ -243,6 +243,7 @@ static char *ia64_register_names[] =
"p40", "p41", "p42", "p43", "p44", "p45", "p46", "p47",
"p48", "p49", "p50", "p51", "p52", "p53", "p54", "p55",
"p56", "p57", "p58", "p59", "p60", "p61", "p62", "p63",
+ ""
};
struct ia64_frame_cache
@@ -1856,6 +1857,12 @@ ia64_frame_prev_register (struct frame_i
read_memory (addr, valuep, register_size (current_gdbarch, regnum));
}
}
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ {
+ /* The cursor is the address of the ia64 libunwind cursor.
+ Default to 0. */
+ *lvalp = lval_memory;
+ }
else
{
CORE_ADDR addr = 0;
@@ -2178,6 +2185,12 @@ ia64_sigtramp_frame_prev_register (struc
*addrp = pr_addr;
}
}
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ {
+ /* The cursor is the address of the ia64 libunwind cursor.
+ Default to 0. */
+ *lvalp = lval_memory;
+ }
else
{
/* All other registers not listed above. */
@@ -2299,6 +2312,8 @@ ia64_gdb2uw_regnum (int regnum)
return UNW_IA64_AR + (regnum - IA64_AR0_REGNUM);
else if ((unsigned) (regnum - IA64_NAT0_REGNUM) < 128)
return UNW_IA64_NAT + (regnum - IA64_NAT0_REGNUM);
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ return INT_MAX;
else
return -1;
}
@@ -2334,6 +2349,21 @@ ia64_uw2gdb_regnum (int uw_regnum)
return -1;
}
+/* Special callback function to allow libunwind-frame to get
+ the address of the next frame's cursor so it may be copied and
+ stepped. */
+static unw_cursor_t *
+ia64_unwind_cursor (struct frame_info *next_frame)
+{
+ unw_cursor_t *cursor_addr;
+ char buf[8];
+
+ frame_unwind_register (next_frame, CURSOR_ADDR_REGNUM, buf);
+ cursor_addr = (unw_cursor_t *)extract_unsigned_integer (buf, 8);
+
+ return cursor_addr;
+}
+
/* Gdb libunwind-frame callback function to reveal if register is a float
register or not. */
static int
@@ -3046,6 +3076,7 @@ static struct libunwind_descr ia64_libun
ia64_gdb2uw_regnum,
ia64_uw2gdb_regnum,
ia64_is_fpreg,
+ ia64_unwind_cursor,
&ia64_unw_accessors,
&ia64_unw_rse_accessors,
};
Index: gdb-6.7/gdb/libunwind-frame.c
===================================================================
--- gdb-6.7.orig/gdb/libunwind-frame.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/libunwind-frame.c 2007-10-15 00:07:56.000000000 +0200
@@ -125,6 +125,7 @@ libunwind_frame_set_descr (struct gdbarc
arch_descr->is_fpreg = descr->is_fpreg;
arch_descr->accessors = descr->accessors;
arch_descr->special_accessors = descr->special_accessors;
+ arch_descr->unwind_cursor = descr->unwind_cursor;
}
static struct libunwind_frame_cache *
@@ -132,6 +133,7 @@ libunwind_frame_cache (struct frame_info
{
unw_accessors_t *acc;
unw_addr_space_t as;
+ unw_cursor_t *cursor_addr;
unw_word_t fp;
unw_regnum_t uw_sp_regnum;
struct libunwind_frame_cache *cache;
@@ -153,23 +155,34 @@ libunwind_frame_cache (struct frame_info
&& get_frame_type (next_frame) != SIGTRAMP_FRAME)
return NULL;
- /* Get a libunwind cursor to the previous frame. We do this by initializing
- a cursor. Libunwind treats a new cursor as the top of stack and will get
- the current register set via the libunwind register accessor. Now, we
- provide the platform-specific accessors and we set up the register accessor to use
- the frame register unwinding interfaces so that we properly get the registers for
- the current frame rather than the top. We then use the unw_step function to
- move the libunwind cursor back one frame. We can later use this cursor to find previous
- registers via the unw_get_reg interface which will invoke libunwind's special logic. */
+ /* Get a libunwind cursor to the previous frame. We do this by getting
+ the address of the next frame's cursor (if one exists). If we are at
+ the top of stack, then we will get back a zero cursor address and we
+ should initialize a new cursor.
+
+ Otherwise, we copy the cursor address contents and step back by one.
+ Libunwind will use our register accessors which are set up to
+ unwind registers from the previous frame. We will later use this cursor
+ to find previous registers via the unw_get_reg interface. By passing
+ back a cursor, we allow libunwind to handle sigaltstack which requires
+ one cursor stepped back for all frames. */
descr = libunwind_descr (get_frame_arch (next_frame));
- acc = descr->accessors;
- as = unw_create_addr_space_p (acc,
+ cursor_addr = descr->unwind_cursor (next_frame);
+
+ if (cursor_addr == 0)
+ {
+ acc = descr->accessors;
+ as = unw_create_addr_space_p (acc,
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG
? __BIG_ENDIAN
: __LITTLE_ENDIAN);
- unw_init_remote_p (&cache->cursor, as, next_frame);
+ unw_init_remote_p (&cache->cursor, as, next_frame);
+ }
+ else /* make copy */
+ cache->cursor = *cursor_addr;
+
if (unw_step_p (&cache->cursor) < 0)
{
unw_destroy_addr_space_p (as);
@@ -316,6 +329,16 @@ libunwind_frame_prev_register (struct fr
if (uw_regnum < 0)
return;
+ /* Check if we are unwinding the cursor address which just gives
+ back the address of the next frame's cursor. This is a special
+ modification to support unwinding through a sigaltstack. */
+ if (uw_regnum == INT_MAX)
+ {
+ store_unsigned_integer (valuep, sizeof (CORE_ADDR),
+ (CORE_ADDR)&cache->cursor);
+ return;
+ }
+
/* To get the previous register, we use the libunwind register APIs with
the cursor we have already pushed back to the previous frame. */
Index: gdb-6.7/gdb/libunwind-frame.h
===================================================================
--- gdb-6.7.orig/gdb/libunwind-frame.h 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/libunwind-frame.h 2007-10-15 00:05:20.000000000 +0200
@@ -36,6 +36,7 @@ struct libunwind_descr
int (*gdb2uw) (int);
int (*uw2gdb) (int);
int (*is_fpreg) (int);
+ unw_cursor_t *(*unwind_cursor) (struct frame_info *next_frame);
void *accessors;
void *special_accessors;
};

View File

@ -16,10 +16,14 @@
Port to GDB-6.7. Port to GDB-6.7.
Index: gdb-6.7/gdb/libunwind-frame.c 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/libunwind-frame.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/libunwind-frame.c 2007-10-15 00:08:30.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/libunwind-frame.c 2008-01-02 00:04:03.000000000 +0100
+++ gdb-6.7/gdb/libunwind-frame.c 2007-10-15 00:13:29.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/libunwind-frame.c 2008-02-24 20:25:56.000000000 +0100
@@ -61,6 +61,7 @@ static unw_word_t (*unw_find_dyn_list_p) @@ -61,6 +61,7 @@ static unw_word_t (*unw_find_dyn_list_p)
struct libunwind_frame_cache struct libunwind_frame_cache
{ {
@ -28,19 +32,19 @@ Index: gdb-6.7/gdb/libunwind-frame.c
CORE_ADDR func_addr; CORE_ADDR func_addr;
unw_cursor_t cursor; unw_cursor_t cursor;
unw_addr_space_t as; unw_addr_space_t as;
@@ -134,7 +135,7 @@ libunwind_frame_cache (struct frame_info @@ -133,6 +134,7 @@ libunwind_frame_cache (struct frame_info
unw_accessors_t *acc; unw_accessors_t *acc;
unw_addr_space_t as; unw_addr_space_t as;
unw_cursor_t *cursor_addr; unw_word_t fp;
- unw_word_t fp;
+ unw_word_t fp, sp; + unw_word_t fp, sp;
unw_regnum_t uw_sp_regnum; unw_regnum_t uw_sp_regnum;
struct libunwind_frame_cache *cache; struct libunwind_frame_cache *cache;
struct libunwind_descr *descr; struct libunwind_descr *descr;
@@ -183,14 +184,29 @@ libunwind_frame_cache (struct frame_info @@ -171,14 +173,30 @@ libunwind_frame_cache (struct frame_info
else /* make copy */ : __LITTLE_ENDIAN);
cache->cursor = *cursor_addr;
unw_init_remote_p (&cache->cursor, as, next_frame);
+
+ /* For the base address, we have a small problem. The majority + /* For the base address, we have a small problem. The majority
+ of the time, we can get the stack pointer of the previous + of the time, we can get the stack pointer of the previous
+ frame to use as a frame pointer. In the case where we have + frame to use as a frame pointer. In the case where we have
@ -50,7 +54,7 @@ Index: gdb-6.7/gdb/libunwind-frame.c
+ sigaltstack as we want. To handle this, we record the stack + sigaltstack as we want. To handle this, we record the stack
+ address so the caller may calculate a more correct base address + address so the caller may calculate a more correct base address
+ to use. */ + to use. */
+ uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (current_gdbarch)); + uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (gdbarch));
+ ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &sp); + ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &sp);
+ if (ret < 0) + if (ret < 0)
+ { + {
@ -65,11 +69,11 @@ Index: gdb-6.7/gdb/libunwind-frame.c
} }
- /* To get base address, get sp from previous frame. */ - /* To get base address, get sp from previous frame. */
- uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (current_gdbarch)); - uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (gdbarch));
ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp); ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp);
if (ret < 0) if (ret < 0)
{ {
@@ -198,6 +214,7 @@ libunwind_frame_cache (struct frame_info @@ -186,6 +204,7 @@ libunwind_frame_cache (struct frame_info
error (_("Can't get libunwind sp register.")); error (_("Can't get libunwind sp register."));
} }
@ -77,7 +81,7 @@ Index: gdb-6.7/gdb/libunwind-frame.c
cache->base = (CORE_ADDR)fp; cache->base = (CORE_ADDR)fp;
cache->as = as; cache->as = as;
@@ -402,6 +419,31 @@ libunwind_search_unwind_table (void *as, @@ -381,6 +400,31 @@ libunwind_search_unwind_table (void *as,
di, pi, need_unwind_info, args); di, pi, need_unwind_info, args);
} }
@ -109,7 +113,7 @@ Index: gdb-6.7/gdb/libunwind-frame.c
/* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */ /* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */
const struct frame_unwind * const struct frame_unwind *
libunwind_sigtramp_frame_sniffer (struct frame_info *next_frame) libunwind_sigtramp_frame_sniffer (struct frame_info *next_frame)
@@ -439,7 +481,7 @@ libunwind_sigtramp_frame_sniffer (struct @@ -419,7 +463,7 @@ libunwind_sigtramp_frame_sniffer (struct
ret = unw_is_signal_frame_p (&cursor); ret = unw_is_signal_frame_p (&cursor);
unw_destroy_addr_space_p (as); unw_destroy_addr_space_p (as);
if (ret > 0) if (ret > 0)
@ -118,11 +122,11 @@ Index: gdb-6.7/gdb/libunwind-frame.c
return NULL; return NULL;
} }
Index: gdb-6.7/gdb/libunwind-frame.h Index: gdb-6.8cvs20080219/gdb/libunwind-frame.h
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/libunwind-frame.h 2007-10-15 00:05:20.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/libunwind-frame.h 2008-01-02 00:04:03.000000000 +0100
+++ gdb-6.7/gdb/libunwind-frame.h 2007-10-15 00:08:36.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/libunwind-frame.h 2008-02-24 20:23:47.000000000 +0100
@@ -48,6 +48,9 @@ void libunwind_frame_set_descr (struct g @@ -47,6 +47,9 @@ void libunwind_frame_set_descr (struct g
void libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache, void libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache,
struct frame_id *this_id); struct frame_id *this_id);
@ -132,11 +136,11 @@ Index: gdb-6.7/gdb/libunwind-frame.h
void libunwind_frame_prev_register (struct frame_info *next_frame, void **this_cache, void libunwind_frame_prev_register (struct frame_info *next_frame, void **this_cache,
int regnum, int *optimizedp, int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp, enum lval_type *lvalp, CORE_ADDR *addrp,
Index: gdb-6.7/gdb/ia64-tdep.c Index: gdb-6.8cvs20080219/gdb/ia64-tdep.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/ia64-tdep.c 2007-10-15 00:05:20.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/ia64-tdep.c 2008-02-24 20:23:40.000000000 +0100
+++ gdb-6.7/gdb/ia64-tdep.c 2007-10-15 00:08:36.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/ia64-tdep.c 2008-02-24 20:23:47.000000000 +0100
@@ -2968,7 +2968,7 @@ ia64_libunwind_sigtramp_frame_this_id (s @@ -2942,7 +2942,7 @@ ia64_libunwind_sigtramp_frame_this_id (s
struct frame_id id; struct frame_id id;
CORE_ADDR prev_ip; CORE_ADDR prev_ip;
@ -145,7 +149,7 @@ Index: gdb-6.7/gdb/ia64-tdep.c
if (frame_id_eq (id, null_frame_id)) if (frame_id_eq (id, null_frame_id))
{ {
(*this_id) = null_frame_id; (*this_id) = null_frame_id;
@@ -2980,8 +2980,14 @@ ia64_libunwind_sigtramp_frame_this_id (s @@ -2954,8 +2954,14 @@ ia64_libunwind_sigtramp_frame_this_id (s
frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8);

View File

@ -13,10 +13,14 @@
Port to GDB-6.7. Port to GDB-6.7.
Index: gdb-6.7/gdb/doc/observer.texi 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/doc/observer.texi
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/doc/observer.texi 2007-10-13 05:09:50.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/doc/observer.texi 2007-10-09 13:06:07.000000000 +0200
+++ gdb-6.7/gdb/doc/observer.texi 2007-10-14 23:24:52.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/doc/observer.texi 2008-02-21 17:45:46.000000000 +0100
@@ -119,6 +119,10 @@ when @value{GDBN} calls this observer, t @@ -119,6 +119,10 @@ when @value{GDBN} calls this observer, t
haven't been loaded yet. haven't been loaded yet.
@end deftypefun @end deftypefun
@ -28,11 +32,19 @@ Index: gdb-6.7/gdb/doc/observer.texi
@deftypefun void solib_unloaded (struct so_list *@var{solib}) @deftypefun void solib_unloaded (struct so_list *@var{solib})
The shared library specified by @var{solib} has been unloaded. The shared library specified by @var{solib} has been unloaded.
@end deftypefun @end deftypefun
Index: gdb-6.7/gdb/linux-nat.c Index: gdb-6.8cvs20080219/gdb/linux-nat.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/linux-nat.c 2007-10-13 05:09:50.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-21 17:45:45.000000000 +0100
+++ gdb-6.7/gdb/linux-nat.c 2007-10-14 23:24:52.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-22 08:12:57.000000000 +0100
@@ -742,11 +742,26 @@ iterate_over_lwps (int (*callback) (stru @@ -37,6 +37,7 @@
#include "regset.h"
#include "inf-ptrace.h"
#include "auxv.h"
+#include "observer.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
@@ -751,11 +752,26 @@ iterate_over_lwps (int (*callback) (stru
{ {
struct lwp_info *lp, *lpnext; struct lwp_info *lp, *lpnext;
@ -62,8 +74,8 @@ Index: gdb-6.7/gdb/linux-nat.c
} }
return NULL; return NULL;
@@ -3272,6 +3284,18 @@ linux_nat_add_target (struct target_ops @@ -3319,6 +3335,18 @@ linux_nat_get_siginfo (ptid_t ptid)
thread_db_init (t); return &lp->siginfo;
} }
+/* Observer function for a mourn inferior event. This is needed +/* Observer function for a mourn inferior event. This is needed
@ -81,7 +93,7 @@ Index: gdb-6.7/gdb/linux-nat.c
void void
_initialize_linux_nat (void) _initialize_linux_nat (void)
{ {
@@ -3286,6 +3310,8 @@ Specify any of the following keywords fo @@ -3333,6 +3361,8 @@ Specify any of the following keywords fo
status -- list a different bunch of random process info.\n\ status -- list a different bunch of random process info.\n\
all -- list all available /proc info.")); all -- list all available /proc info."));
@ -90,10 +102,10 @@ Index: gdb-6.7/gdb/linux-nat.c
/* Save the original signal mask. */ /* Save the original signal mask. */
sigprocmask (SIG_SETMASK, NULL, &normal_mask); sigprocmask (SIG_SETMASK, NULL, &normal_mask);
Index: gdb-6.7/gdb/target.c Index: gdb-6.8cvs20080219/gdb/target.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/target.c 2007-08-23 20:08:45.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/target.c 2008-02-14 23:04:00.000000000 +0100
+++ gdb-6.7/gdb/target.c 2007-10-14 23:25:13.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/target.c 2008-02-22 08:10:37.000000000 +0100
@@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
#include "gdbcore.h" #include "gdbcore.h"
#include "exceptions.h" #include "exceptions.h"
@ -116,11 +128,11 @@ Index: gdb-6.7/gdb/target.c
static int static int
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct target_ops *t) struct target_ops *t)
Index: gdb-6.7/gdb/target.h Index: gdb-6.8cvs20080219/gdb/target.h
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/target.h 2007-08-23 20:08:46.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/target.h 2008-01-02 00:04:05.000000000 +0100
+++ gdb-6.7/gdb/target.h 2007-10-14 23:24:52.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/target.h 2008-02-22 08:10:37.000000000 +0100
@@ -864,8 +864,7 @@ int target_follow_fork (int follow_child @@ -861,8 +861,7 @@ int target_follow_fork (int follow_child
/* The inferior process has died. Do what is right. */ /* The inferior process has died. Do what is right. */
@ -130,9 +142,10 @@ Index: gdb-6.7/gdb/target.h
/* Does target have enough data to do a run or attach command? */ /* Does target have enough data to do a run or attach command? */
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c gdb-6.6/gdb/testsuite/gdb.base/follow-child.c Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:24:58.000000000 +0200 ===================================================================
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:11:08.000000000 +0200 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c 2008-02-22 08:14:04.000000000 +0100
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -147,7 +160,7 @@ diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.bas
+ but WITHOUT ANY WARRANTY; without even the implied warranty of + but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details. + GNU General Public License for more details.
+ +
+ You should have received a copy of the GNU General Public License + You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software + along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -163,9 +176,10 @@ diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.bas
+ sleep (60); + sleep (60);
+ return 0; + return 0;
+} +}
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:58.000000000 +0200 ===================================================================
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:21.000000000 +0200 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp 2008-02-22 08:14:17.000000000 +0100
@@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
+# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007 Free Software Foundation, Inc.
+ +
@ -181,7 +195,7 @@ diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.bas
+# +#
+# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if $tracelevel then { +if $tracelevel then {
+ strace $tracelevel + strace $tracelevel
@ -222,3 +236,16 @@ diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.bas
+ fail $test + fail $test
+ } + }
+} +}
Index: gdb-6.8cvs20080219/gdb/Makefile.in
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/Makefile.in 2008-02-22 08:10:38.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/Makefile.in 2008-02-22 08:13:31.000000000 +0100
@@ -2377,7 +2377,7 @@ linux-nat.o: linux-nat.c $(defs_h) $(inf
$(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \
$(gdbcmd_h) $(regcache_h) $(regset_h) $(inf_ptrace_h) $(auxv_h) \
$(elf_bfd_h) $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_h) \
- $(linux_fork_h)
+ $(linux_fork_h) $(observer_h)
linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \

View File

@ -10,11 +10,19 @@
* solib-svr4.c (svr4_current_sos): Fix segfault on NULL EXEC_BFD. * solib-svr4.c (svr4_current_sos): Fix segfault on NULL EXEC_BFD.
Index: gdb-6.7.1/gdb/dwarf2read.c 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to gdb-6.7.50.20080227.
Index: gdb-6.7.50.20080227/gdb/dwarf2read.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/dwarf2read.c 2007-11-02 15:24:10.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/dwarf2read.c 2008-02-27 08:57:20.000000000 +0100
+++ gdb-6.7.1/gdb/dwarf2read.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/dwarf2read.c 2008-02-27 08:57:31.000000000 +0100
@@ -1226,7 +1226,7 @@ dwarf2_build_psymtabs (struct objfile *o @@ -1217,7 +1217,7 @@ dwarf2_build_psymtabs (struct objfile *o
else else
dwarf2_per_objfile->loc_buffer = NULL; dwarf2_per_objfile->loc_buffer = NULL;
@ -23,10 +31,10 @@ Index: gdb-6.7.1/gdb/dwarf2read.c
|| (objfile->global_psymbols.size == 0 || (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0)) && objfile->static_psymbols.size == 0))
{ {
Index: gdb-6.7.1/gdb/auxv.c Index: gdb-6.7.50.20080227/gdb/auxv.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/auxv.c 2007-08-23 20:08:26.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/auxv.c 2008-01-16 17:27:37.000000000 +0100
+++ gdb-6.7.1/gdb/auxv.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/auxv.c 2008-02-27 08:57:31.000000000 +0100
@@ -80,7 +80,7 @@ procfs_xfer_auxv (struct target_ops *ops @@ -80,7 +80,7 @@ procfs_xfer_auxv (struct target_ops *ops
Return 1 if an entry was read into *TYPEP and *VALP. */ Return 1 if an entry was read into *TYPEP and *VALP. */
int int
@ -89,7 +97,7 @@ Index: gdb-6.7.1/gdb/auxv.c
{ {
#define TAG(tag, text, kind) \ #define TAG(tag, text, kind) \
case tag: name = #tag; description = text; flavor = kind; break case tag: name = #tag; description = text; flavor = kind; break
@@ -211,7 +213,7 @@ fprint_target_auxv (struct ui_file *file @@ -213,7 +215,7 @@ fprint_target_auxv (struct ui_file *file
} }
fprintf_filtered (file, "%-4s %-20s %-30s ", fprintf_filtered (file, "%-4s %-20s %-30s ",
@ -98,10 +106,10 @@ Index: gdb-6.7.1/gdb/auxv.c
switch (flavor) switch (flavor)
{ {
case dec: case dec:
Index: gdb-6.7.1/gdb/auxv.h Index: gdb-6.7.50.20080227/gdb/auxv.h
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/auxv.h 2007-08-23 20:08:26.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/auxv.h 2008-01-01 23:53:09.000000000 +0100
+++ gdb-6.7.1/gdb/auxv.h 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/auxv.h 2008-02-27 08:57:31.000000000 +0100
@@ -35,14 +35,14 @@ struct target_ops; /* Forward declarati @@ -35,14 +35,14 @@ struct target_ops; /* Forward declarati
Return 1 if an entry was read into *TYPEP and *VALP. */ Return 1 if an entry was read into *TYPEP and *VALP. */
extern int target_auxv_parse (struct target_ops *ops, extern int target_auxv_parse (struct target_ops *ops,
@ -119,11 +127,11 @@ Index: gdb-6.7.1/gdb/auxv.h
/* Print the contents of the target's AUXV on the specified file. */ /* Print the contents of the target's AUXV on the specified file. */
extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops); extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
Index: gdb-6.7.1/gdb/breakpoint.h Index: gdb-6.7.50.20080227/gdb/breakpoint.h
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/breakpoint.h 2007-11-02 15:22:24.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/breakpoint.h 2008-02-01 17:24:46.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.h 2007-11-02 15:24:59.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/breakpoint.h 2008-02-27 08:57:31.000000000 +0100
@@ -150,6 +150,7 @@ enum enable_state @@ -144,6 +144,7 @@ enum enable_state
automatically enabled and reset when the call automatically enabled and reset when the call
"lands" (either completes, or stops at another "lands" (either completes, or stops at another
eventpoint). */ eventpoint). */
@ -131,7 +139,7 @@ Index: gdb-6.7.1/gdb/breakpoint.h
bp_permanent /* There is a breakpoint instruction hard-wired into bp_permanent /* There is a breakpoint instruction hard-wired into
the target's code. Don't try to write another the target's code. Don't try to write another
breakpoint instruction on top of it, or restore breakpoint instruction on top of it, or restore
@@ -826,6 +827,10 @@ extern void remove_thread_event_breakpoi @@ -823,6 +824,10 @@ extern void remove_thread_event_breakpoi
extern void disable_breakpoints_in_shlibs (void); extern void disable_breakpoints_in_shlibs (void);
@ -139,13 +147,13 @@ Index: gdb-6.7.1/gdb/breakpoint.h
+ +
+extern void re_enable_breakpoints_at_startup (void); +extern void re_enable_breakpoints_at_startup (void);
+ +
extern void create_solib_load_event_breakpoint (char *, int, char *, char *); /* This function returns TRUE if ep is a catchpoint. */
extern int ep_is_catchpoint (struct breakpoint *);
extern void create_solib_unload_event_breakpoint (char *, int, Index: gdb-6.7.50.20080227/gdb/symfile-mem.c
Index: gdb-6.7.1/gdb/symfile-mem.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/symfile-mem.c 2007-08-23 20:08:39.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/symfile-mem.c 2008-01-01 23:53:13.000000000 +0100
+++ gdb-6.7.1/gdb/symfile-mem.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/symfile-mem.c 2008-02-27 08:57:31.000000000 +0100
@@ -108,7 +108,7 @@ symbol_file_add_from_memory (struct bfd @@ -108,7 +108,7 @@ symbol_file_add_from_memory (struct bfd
} }
@ -155,11 +163,11 @@ Index: gdb-6.7.1/gdb/symfile-mem.c
/* This might change our ideas about frames already looked at. */ /* This might change our ideas about frames already looked at. */
reinit_frame_cache (); reinit_frame_cache ();
Index: gdb-6.7.1/gdb/infrun.c Index: gdb-6.7.50.20080227/gdb/infrun.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/infrun.c 2007-11-02 15:21:57.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/infrun.c 2008-02-27 08:57:20.000000000 +0100
+++ gdb-6.7.1/gdb/infrun.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/infrun.c 2008-02-27 08:57:31.000000000 +0100
@@ -2298,6 +2298,11 @@ process_event_stop_test: @@ -2277,6 +2277,11 @@ process_event_stop_test:
#endif #endif
target_terminal_inferior (); target_terminal_inferior ();
@ -171,13 +179,13 @@ Index: gdb-6.7.1/gdb/infrun.c
/* If requested, stop when the dynamic linker notifies /* If requested, stop when the dynamic linker notifies
gdb of events. This allows the user to get control gdb of events. This allows the user to get control
and place breakpoints in initializer routines for and place breakpoints in initializer routines for
Index: gdb-6.7.1/gdb/objfiles.c Index: gdb-6.7.50.20080227/gdb/objfiles.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/objfiles.c 2007-08-23 20:08:36.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/objfiles.c 2008-01-01 23:53:12.000000000 +0100
+++ gdb-6.7.1/gdb/objfiles.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/objfiles.c 2008-02-27 08:57:31.000000000 +0100
@@ -48,6 +48,9 @@ @@ -49,6 +49,9 @@
#include "dictionary.h"
#include "source.h" #include "source.h"
#include "addrmap.h"
+#include "auxv.h" +#include "auxv.h"
+#include "elf/common.h" +#include "elf/common.h"
@ -185,7 +193,7 @@ Index: gdb-6.7.1/gdb/objfiles.c
/* Prototypes for local functions */ /* Prototypes for local functions */
static void objfile_alloc_data (struct objfile *objfile); static void objfile_alloc_data (struct objfile *objfile);
@@ -259,7 +262,19 @@ init_entry_point_info (struct objfile *o @@ -260,7 +263,19 @@ init_entry_point_info (struct objfile *o
CORE_ADDR CORE_ADDR
entry_point_address (void) entry_point_address (void)
{ {
@ -206,10 +214,10 @@ Index: gdb-6.7.1/gdb/objfiles.c
} }
/* Create the terminating entry of OBJFILE's minimal symbol table. /* Create the terminating entry of OBJFILE's minimal symbol table.
Index: gdb-6.7.1/gdb/solib-svr4.c Index: gdb-6.7.50.20080227/gdb/solib-svr4.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/solib-svr4.c 2007-11-02 15:21:46.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-02-27 08:57:19.000000000 +0100
+++ gdb-6.7.1/gdb/solib-svr4.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-02-27 08:59:06.000000000 +0100
@@ -31,6 +31,8 @@ @@ -31,6 +31,8 @@
#include "gdbcore.h" #include "gdbcore.h"
#include "target.h" #include "target.h"
@ -219,7 +227,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
#include "gdb_assert.h" #include "gdb_assert.h"
@@ -249,7 +251,9 @@ static char *debug_loader_name; @@ -246,7 +248,9 @@ static char *debug_loader_name;
/* Local function prototypes */ /* Local function prototypes */
@ -229,7 +237,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
static CORE_ADDR bfd_lookup_symbol (bfd *, char *); static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
@@ -352,10 +356,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE @@ -349,10 +353,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
int arch_size, step, sect_size; int arch_size, step, sect_size;
long dyn_tag; long dyn_tag;
CORE_ADDR dyn_ptr, dyn_addr; CORE_ADDR dyn_ptr, dyn_addr;
@ -242,7 +250,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
if (abfd == NULL) if (abfd == NULL)
return 0; return 0;
@@ -363,19 +369,74 @@ scan_dyntag (int dyntag, bfd *abfd, CORE @@ -360,19 +366,74 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
if (arch_size == -1) if (arch_size == -1)
return 0; return 0;
@ -319,7 +327,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
/* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */ /* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */
step = (arch_size == 32) ? sizeof (Elf32_External_Dyn) step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
@@ -408,9 +469,43 @@ scan_dyntag (int dyntag, bfd *abfd, CORE @@ -405,9 +466,43 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
CORE_ADDR ptr_addr; CORE_ADDR ptr_addr;
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8; ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
@ -365,7 +373,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
*ptr = dyn_ptr; *ptr = dyn_ptr;
} }
return 1; return 1;
@@ -547,6 +642,10 @@ solib_svr4_r_map (void) @@ -544,6 +639,10 @@ solib_svr4_r_map (void)
{ {
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
@ -376,41 +384,40 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
return read_memory_typed_address (debug_base + lmo->r_map_offset, return read_memory_typed_address (debug_base + lmo->r_map_offset,
builtin_type_void_data_ptr); builtin_type_void_data_ptr);
} }
@@ -704,6 +803,11 @@ svr4_current_sos (void) @@ -713,6 +812,11 @@ svr4_current_sos (void)
struct so_list *head = 0;
struct so_list **link_ptr = &head; struct so_list **link_ptr = &head;
CORE_ADDR ldsomap = 0; CORE_ADDR ldsomap = 0;
+ const char *filename = exec_bfd ? exec_bfd->filename : "<none>"; + const char *filename = exec_bfd ? exec_bfd->filename : "<none>";
+
+ if (debug_solib) + if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog,
+ "svr4_current_sos: exec_bfd %s\n", filename); + "svr4_current_sos: exec_bfd %s\n", filename);
+
/* Make sure we've looked up the inferior's dynamic linker's base /* Always locate the debug struct, in case it has moved. */
structure. */ debug_base = 0;
@@ -721,10 +825,19 @@ svr4_current_sos (void)
/* If we can't find the dynamic linker's base structure, this
must not be a dynamically linked executable. Hmm. */
if (! debug_base) if (! debug_base)
@@ -713,11 +817,20 @@ svr4_current_sos (void) - return svr4_default_sos ();
/* If we can't find the dynamic linker's base structure, this + {
must not be a dynamically linked executable. Hmm. */ + if (debug_solib)
if (! debug_base) + fprintf_unfiltered (gdb_stdlog,
- return svr4_default_sos (); + "svr4_current_sos: no DT_DEBUG found in %s -- return now\n",
+ { + filename);
+ if (debug_solib) + return svr4_default_sos ();
+ fprintf_unfiltered (gdb_stdlog, + }
+ "svr4_current_sos: no DT_DEBUG found in %s -- return now\n",
+ filename);
+ return svr4_default_sos ();
+ }
}
/* Walk the inferior's link map list, and build our list of /* Walk the inferior's link map list, and build our list of
`struct so_list' nodes. */ `struct so_list' nodes. */
+ if (debug_solib) + if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog,
+ "svr4_current_sos: walk link map in %s\n", filename); + "svr4_current_sos: walk link map in %s\n", filename);
lm = solib_svr4_r_map (); lm = solib_svr4_r_map ();
while (lm) while (lm)
@@ -733,23 +847,103 @@ svr4_current_sos (void) @@ -740,23 +853,103 @@ svr4_current_sos (void)
new->lm_info->lm = xzalloc (lmo->link_map_size); new->lm_info->lm = xzalloc (lmo->link_map_size);
make_cleanup (xfree, new->lm_info->lm); make_cleanup (xfree, new->lm_info->lm);
@ -516,7 +523,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
target_read_string (LM_NAME (new), &buffer, target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode); SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0) if (errcode != 0)
@@ -757,23 +951,35 @@ svr4_current_sos (void) @@ -764,23 +957,35 @@ svr4_current_sos (void)
safe_strerror (errcode)); safe_strerror (errcode));
else else
{ {
@ -568,7 +575,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
} }
/* On Solaris, the dynamic linker is not in the normal list of /* On Solaris, the dynamic linker is not in the normal list of
@@ -789,6 +995,9 @@ svr4_current_sos (void) @@ -796,6 +1001,9 @@ svr4_current_sos (void)
if (head == NULL) if (head == NULL)
return svr4_default_sos (); return svr4_default_sos ();
@ -578,7 +585,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
return head; return head;
} }
@@ -868,7 +1079,7 @@ svr4_fetch_objfile_link_map (struct objf @@ -875,7 +1083,7 @@ svr4_fetch_objfile_link_map (struct objf
/* On some systems, the only way to recognize the link map entry for /* On some systems, the only way to recognize the link map entry for
the main executable file is by looking at its name. Return the main executable file is by looking at its name. Return
non-zero iff SONAME matches one of the known main executable names. */ non-zero iff SONAME matches one of the known main executable names. */
@ -587,7 +594,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
static int static int
match_main (char *soname) match_main (char *soname)
{ {
@@ -882,6 +1093,7 @@ match_main (char *soname) @@ -889,6 +1097,7 @@ match_main (char *soname)
return (0); return (0);
} }
@ -595,7 +602,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
/* Return 1 if PC lies in the dynamic symbol resolution code of the /* Return 1 if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */ SVR4 run time loader. */
@@ -979,6 +1191,11 @@ enable_break (void) @@ -1040,6 +1249,11 @@ enable_break (void)
/* Find the .interp section; if not found, warn the user and drop /* Find the .interp section; if not found, warn the user and drop
into the old breakpoint at symbol code. */ into the old breakpoint at symbol code. */
interp_sect = bfd_get_section_by_name (exec_bfd, ".interp"); interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
@ -607,7 +614,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
if (interp_sect) if (interp_sect)
{ {
unsigned int interp_sect_size; unsigned int interp_sect_size;
@@ -1018,6 +1235,9 @@ enable_break (void) @@ -1074,6 +1288,9 @@ enable_break (void)
if (tmp_fd >= 0) if (tmp_fd >= 0)
tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd); tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
@ -617,7 +624,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
if (tmp_bfd == NULL) if (tmp_bfd == NULL)
goto bkpt_at_symbol; goto bkpt_at_symbol;
@@ -1115,6 +1335,9 @@ enable_break (void) @@ -1180,6 +1397,9 @@ enable_break (void)
if (sym_addr != 0) if (sym_addr != 0)
{ {
create_solib_event_breakpoint (load_addr + sym_addr); create_solib_event_breakpoint (load_addr + sym_addr);
@ -627,7 +634,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
return 1; return 1;
} }
@@ -1375,6 +1598,8 @@ svr4_solib_create_inferior_hook (void) @@ -1440,6 +1660,8 @@ svr4_solib_create_inferior_hook (void)
while (stop_signal != TARGET_SIGNAL_TRAP); while (stop_signal != TARGET_SIGNAL_TRAP);
stop_soon = NO_STOP_QUIETLY; stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */ #endif /* defined(_SCO_DS) */
@ -636,7 +643,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
} }
static void static void
@@ -1551,6 +1776,75 @@ svr4_lp64_fetch_link_map_offsets (void) @@ -1620,6 +1842,75 @@ svr4_lp64_fetch_link_map_offsets (void)
return lmp; return lmp;
} }
@ -712,20 +719,19 @@ Index: gdb-6.7.1/gdb/solib-svr4.c
struct target_so_ops svr4_so_ops; struct target_so_ops svr4_so_ops;
@@ -1592,4 +1886,8 @@ _initialize_svr4_solib (void) @@ -1678,4 +1969,7 @@ _initialize_svr4_solib (void)
svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code;
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */ svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
current_target_so_ops = &svr4_so_ops; svr4_so_ops.same = svr4_same;
+ +
+ add_info ("linkmap", info_linkmap_command, + add_info ("linkmap", info_linkmap_command,
+ "Display the inferior's linkmap."); + "Display the inferior's linkmap.");
+
} }
Index: gdb-6.7.1/gdb/varobj.c Index: gdb-6.7.50.20080227/gdb/varobj.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/varobj.c 2008-02-04 08:49:04.000000000 +0100
+++ gdb-6.7.1/gdb/varobj.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/varobj.c 2008-02-27 08:57:31.000000000 +0100
@@ -1116,6 +1116,62 @@ install_new_value (struct varobj *var, s @@ -1078,6 +1078,62 @@ install_new_value (struct varobj *var, s
return changed; return changed;
} }
@ -788,10 +794,10 @@ Index: gdb-6.7.1/gdb/varobj.c
/* Update the values for a variable and its children. This is a /* Update the values for a variable and its children. This is a
two-pronged attack. First, re-parse the value for the root's two-pronged attack. First, re-parse the value for the root's
expression to see if it's changed. Then go all the way expression to see if it's changed. Then go all the way
Index: gdb-6.7.1/gdb/solist.h Index: gdb-6.7.50.20080227/gdb/solist.h
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/solist.h 2007-08-23 20:08:38.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/solist.h 2008-01-07 16:19:58.000000000 +0100
+++ gdb-6.7.1/gdb/solist.h 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/solist.h 2008-02-27 08:57:31.000000000 +0100
@@ -61,6 +61,8 @@ struct so_list @@ -61,6 +61,8 @@ struct so_list
bfd *abfd; bfd *abfd;
char symbols_loaded; /* flag: symbols read in yet? */ char symbols_loaded; /* flag: symbols read in yet? */
@ -801,7 +807,7 @@ Index: gdb-6.7.1/gdb/solist.h
struct objfile *objfile; /* objfile for loaded lib */ struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections; struct section_table *sections;
struct section_table *sections_end; struct section_table *sections_end;
@@ -123,9 +125,15 @@ void free_so (struct so_list *so); @@ -127,9 +129,15 @@ void free_so (struct so_list *so);
/* Return address of first so_list entry in master shared object list. */ /* Return address of first so_list entry in master shared object list. */
struct so_list *master_so_list (void); struct so_list *master_so_list (void);
@ -817,28 +823,28 @@ Index: gdb-6.7.1/gdb/solist.h
/* FIXME: gdbarch needs to control this variable */ /* FIXME: gdbarch needs to control this variable */
extern struct target_so_ops *current_target_so_ops; extern struct target_so_ops *current_target_so_ops;
@@ -143,4 +151,6 @@ struct symbol *solib_global_lookup (cons @@ -140,4 +148,6 @@ struct symbol *solib_global_lookup (cons
const domain_enum domain, const domain_enum domain,
struct symtab **symtab); struct symtab **symtab);
+/* Controls the printing of debugging output. */ +/* Controls the printing of debugging output. */
+extern int debug_solib; +extern int debug_solib;
#endif #endif
Index: gdb-6.7.1/gdb/varobj.h Index: gdb-6.7.50.20080227/gdb/varobj.h
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/varobj.h 2007-08-31 20:52:05.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/varobj.h 2008-01-30 08:17:31.000000000 +0100
+++ gdb-6.7.1/gdb/varobj.h 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/varobj.h 2008-02-27 08:57:31.000000000 +0100
@@ -114,4 +114,6 @@ extern int varobj_update (struct varobj @@ -122,4 +122,6 @@ extern void varobj_invalidate (void);
extern void varobj_invalidate (void); extern int varobj_editable_p (struct varobj *var);
+extern void varobj_refresh(void); +extern void varobj_refresh(void);
+ +
#endif /* VAROBJ_H */ #endif /* VAROBJ_H */
Index: gdb-6.7.1/gdb/symfile.c Index: gdb-6.7.50.20080227/gdb/symfile.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/symfile.c 2007-09-24 23:48:05.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/symfile.c 2008-01-29 23:47:20.000000000 +0100
+++ gdb-6.7.1/gdb/symfile.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/symfile.c 2008-02-27 08:57:31.000000000 +0100
@@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
#include "readline/readline.h" #include "readline/readline.h"
#include "gdb_assert.h" #include "gdb_assert.h"
@ -847,7 +853,7 @@ Index: gdb-6.7.1/gdb/symfile.c
#include "observer.h" #include "observer.h"
#include "exec.h" #include "exec.h"
#include "parser-defs.h" #include "parser-defs.h"
@@ -779,7 +780,7 @@ syms_from_objfile (struct objfile *objfi @@ -778,7 +779,7 @@ syms_from_objfile (struct objfile *objfi
/* Now either addrs or offsets is non-zero. */ /* Now either addrs or offsets is non-zero. */
@ -856,7 +862,7 @@ Index: gdb-6.7.1/gdb/symfile.c
{ {
/* We will modify the main symbol table, make sure that all its users /* We will modify the main symbol table, make sure that all its users
will be cleaned up if an error occurs during symbol reading. */ will be cleaned up if an error occurs during symbol reading. */
@@ -807,7 +808,7 @@ syms_from_objfile (struct objfile *objfi @@ -806,7 +807,7 @@ syms_from_objfile (struct objfile *objfi
We no longer warn if the lowest section is not a text segment (as We no longer warn if the lowest section is not a text segment (as
happens for the PA64 port. */ happens for the PA64 port. */
@ -865,7 +871,7 @@ Index: gdb-6.7.1/gdb/symfile.c
{ {
asection *lower_sect; asection *lower_sect;
asection *sect; asection *sect;
@@ -976,17 +977,21 @@ new_symfile_objfile (struct objfile *obj @@ -975,17 +976,21 @@ new_symfile_objfile (struct objfile *obj
/* If this is the main symbol file we have to clean up all users of the /* If this is the main symbol file we have to clean up all users of the
old main symbol file. Otherwise it is sufficient to fixup all the old main symbol file. Otherwise it is sufficient to fixup all the
breakpoints that may have been redefined by this symbol file. */ breakpoints that may have been redefined by this symbol file. */
@ -889,7 +895,7 @@ Index: gdb-6.7.1/gdb/symfile.c
/* We're done reading the symbol file; finish off complaints. */ /* We're done reading the symbol file; finish off complaints. */
clear_complaints (&symfile_complaints, 0, verbo); clear_complaints (&symfile_complaints, 0, verbo);
@@ -1029,7 +1034,7 @@ symbol_file_add_with_addrs_or_offsets (b @@ -1028,7 +1033,7 @@ symbol_file_add_with_addrs_or_offsets (b
interactively wiping out any existing symbols. */ interactively wiping out any existing symbols. */
if ((have_full_symbols () || have_partial_symbols ()) if ((have_full_symbols () || have_partial_symbols ())
@ -898,7 +904,7 @@ Index: gdb-6.7.1/gdb/symfile.c
&& from_tty && from_tty
&& !query ("Load new symbol table from \"%s\"? ", name)) && !query ("Load new symbol table from \"%s\"? ", name))
error (_("Not confirmed.")); error (_("Not confirmed."));
@@ -1213,6 +1218,10 @@ symbol_file_clear (int from_tty) @@ -1212,6 +1217,10 @@ symbol_file_clear (int from_tty)
symfile_objfile->name) symfile_objfile->name)
: !query (_("Discard symbol table? ")))) : !query (_("Discard symbol table? "))))
error (_("Not confirmed.")); error (_("Not confirmed."));
@ -909,7 +915,7 @@ Index: gdb-6.7.1/gdb/symfile.c
free_all_objfiles (); free_all_objfiles ();
/* solib descriptors may have handles to objfiles. Since their /* solib descriptors may have handles to objfiles. Since their
@@ -2470,6 +2479,8 @@ reread_symbols (void) @@ -2466,6 +2475,8 @@ reread_symbols (void)
/* Discard cleanups as symbol reading was successful. */ /* Discard cleanups as symbol reading was successful. */
discard_cleanups (old_cleanups); discard_cleanups (old_cleanups);
@ -918,7 +924,7 @@ Index: gdb-6.7.1/gdb/symfile.c
/* If the mtime has changed between the time we set new_modtime /* If the mtime has changed between the time we set new_modtime
and now, we *want* this to be out of date, so don't call stat and now, we *want* this to be out of date, so don't call stat
again now. */ again now. */
@@ -2837,6 +2848,7 @@ clear_symtab_users (void) @@ -2834,6 +2845,7 @@ clear_symtab_users (void)
breakpoint_re_set (); breakpoint_re_set ();
set_default_breakpoint (0, 0, 0, 0); set_default_breakpoint (0, 0, 0, 0);
clear_pc_function_cache (); clear_pc_function_cache ();
@ -926,101 +932,20 @@ Index: gdb-6.7.1/gdb/symfile.c
observer_notify_new_objfile (NULL); observer_notify_new_objfile (NULL);
/* Clear globals which might have pointed into a removed objfile. /* Clear globals which might have pointed into a removed objfile.
Index: gdb-6.7.1/gdb/breakpoint.c Index: gdb-6.7.50.20080227/gdb/breakpoint.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/breakpoint.c 2007-11-02 15:24:10.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/breakpoint.c 2008-02-27 08:57:20.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.c 2007-11-02 15:26:50.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/breakpoint.c 2008-02-27 08:57:31.000000000 +0100
@@ -847,15 +847,15 @@ insert_watchpoints_for_new_thread (ptid_ @@ -923,7 +923,7 @@ update_watchpoint (struct breakpoint *b,
struct value *v = b->owner->val_chain; value_release_to_mark (mark);
/* Look at each value on the value chain. */ /* Look at each value on the value chain. */
- for (; v; v = v->next) - for (; v; v = next)
+ for (; v; v = value_next (v)) + for (; v; v = value_next (v))
{ {
/* If it's a memory location, and GDB actually needed /* If it's a memory location, and GDB actually needed
its contents to evaluate the expression, then we its contents to evaluate the expression, then we
must watch it. */ @@ -3882,7 +3882,8 @@ describe_other_breakpoints (CORE_ADDR pc
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
@@ -867,8 +867,8 @@ insert_watchpoints_for_new_thread (ptid_
CORE_ADDR addr;
int len, type;
- addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
- len = TYPE_LENGTH (VALUE_TYPE (v));
+ addr = VALUE_ADDRESS (v) + value_offset (v);
+ len = TYPE_LENGTH (value_type (v));
type = hw_write;
if (b->owner->type == bp_read_watchpoint)
type = hw_read;
@@ -2767,12 +2767,12 @@ mark_triggered_watchpoints (CORE_ADDR st
|| b->type == bp_read_watchpoint
|| b->type == bp_access_watchpoint)
{
- for (v = b->val_chain; v; v = v->next)
+ for (v = b->val_chain; v; v = value_next (v))
{
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2780,11 +2780,11 @@ mark_triggered_watchpoints (CORE_ADDR st
{
CORE_ADDR vaddr;
- vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
+ vaddr = VALUE_ADDRESS (v) + value_offset (v);
/* Exact match not required. Within range is
sufficient. */
if (addr >= vaddr &&
- addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
+ addr < vaddr + TYPE_LENGTH (value_type (v)))
b->watchpoint_triggered = 1;
}
}
@@ -2957,12 +2957,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->stop = 0;
continue;
}
- for (v = b->val_chain; v; v = v->next)
+ for (v = b->val_chain; v; v = value_next (v))
{
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2970,11 +2970,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
{
CORE_ADDR vaddr;
- vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
+ vaddr = VALUE_ADDRESS (v) + value_offset (v);
/* Exact match not required. Within range is
sufficient. */
if (addr >= vaddr &&
- addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
+ addr < vaddr + TYPE_LENGTH (value_type (v)))
must_check_value = 1;
}
}
@@ -4118,7 +4118,8 @@ describe_other_breakpoints (CORE_ADDR pc
printf_filtered (" (thread %d)", b->thread); printf_filtered (" (thread %d)", b->thread);
printf_filtered ("%s%s ", printf_filtered ("%s%s ",
((b->enable_state == bp_disabled || ((b->enable_state == bp_disabled ||
@ -1030,7 +955,7 @@ Index: gdb-6.7.1/gdb/breakpoint.c
? " (disabled)" ? " (disabled)"
: b->enable_state == bp_permanent : b->enable_state == bp_permanent
? " (permanent)" ? " (permanent)"
@@ -4773,6 +4774,62 @@ disable_breakpoints_in_unloaded_shlib (s @@ -4534,6 +4535,62 @@ disable_breakpoints_in_unloaded_shlib (s
} }
} }
@ -1091,13 +1016,13 @@ Index: gdb-6.7.1/gdb/breakpoint.c
+ +
+ +
static void static void
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname, create_fork_vfork_event_catchpoint (int tempflag, char *cond_string,
char *cond_string, enum bptype bp_kind) enum bptype bp_kind)
Index: gdb-6.7.1/gdb/solib.c Index: gdb-6.7.50.20080227/gdb/solib.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/solib.c 2007-08-23 20:08:38.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/solib.c 2008-01-07 16:19:58.000000000 +0100
+++ gdb-6.7.1/gdb/solib.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/solib.c 2008-02-27 08:57:31.000000000 +0100
@@ -78,6 +78,8 @@ set_solib_ops (struct gdbarch *gdbarch, @@ -79,6 +79,8 @@ set_solib_ops (struct gdbarch *gdbarch,
/* external data declarations */ /* external data declarations */
@ -1106,7 +1031,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* FIXME: gdbarch needs to control this variable, or else every /* FIXME: gdbarch needs to control this variable, or else every
configuration needs to call set_solib_ops. */ configuration needs to call set_solib_ops. */
struct target_so_ops *current_target_so_ops; struct target_so_ops *current_target_so_ops;
@@ -105,6 +107,8 @@ The search path for loading non-absolute @@ -102,6 +104,8 @@ The search path for loading non-absolute
value); value);
} }
@ -1115,7 +1040,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* /*
GLOBAL FUNCTION GLOBAL FUNCTION
@@ -394,7 +398,6 @@ free_so (struct so_list *so) @@ -391,7 +395,6 @@ free_so (struct so_list *so)
xfree (so); xfree (so);
} }
@ -1123,7 +1048,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* Return address of first so_list entry in master shared object list. */ /* Return address of first so_list entry in master shared object list. */
struct so_list * struct so_list *
master_so_list (void) master_so_list (void)
@@ -402,7 +405,6 @@ master_so_list (void) @@ -399,7 +402,6 @@ master_so_list (void)
return so_list_head; return so_list_head;
} }
@ -1131,7 +1056,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* A small stub to get us past the arg-passing pinhole of catch_errors. */ /* A small stub to get us past the arg-passing pinhole of catch_errors. */
static int static int
@@ -414,15 +416,40 @@ symbol_add_stub (void *arg) @@ -411,15 +413,40 @@ symbol_add_stub (void *arg)
/* Have we already loaded this shared object? */ /* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile) ALL_OBJFILES (so->objfile)
{ {
@ -1175,18 +1100,18 @@ Index: gdb-6.7.1/gdb/solib.c
free_section_addr_info (sap); free_section_addr_info (sap);
return (1); return (1);
@@ -550,6 +577,10 @@ update_solib_list (int from_tty, struct @@ -545,6 +572,10 @@ update_solib_list (int from_tty, struct
the inferior's current list. */ }
while (i) else
{ {
+ if (debug_solib) + if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog,
+ "update_solib_list: compare gdb:%s and inferior:%s\n", + "update_solib_list: compare gdb:%s and inferior:%s\n",
+ gdb->so_original_name, i->so_original_name); + gdb->so_original_name, i->so_original_name);
if (! strcmp (gdb->so_original_name, i->so_original_name)) if (! strcmp (gdb->so_original_name, i->so_original_name))
break; break;
}
@@ -603,28 +634,7 @@ update_solib_list (int from_tty, struct @@ -599,28 +630,7 @@ update_solib_list (int from_tty, struct
/* Fill in the rest of each of the `struct so_list' nodes. */ /* Fill in the rest of each of the `struct so_list' nodes. */
for (i = inferior; i; i = i->next) for (i = inferior; i; i = i->next)
{ {
@ -1216,7 +1141,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* Notify any observer that the shared object has been /* Notify any observer that the shared object has been
loaded now that we've added it to GDB's tables. */ loaded now that we've added it to GDB's tables. */
@@ -720,6 +730,41 @@ solib_add (char *pattern, int from_tty, @@ -716,6 +726,41 @@ solib_add (char *pattern, int from_tty,
} }
} }
@ -1258,7 +1183,7 @@ Index: gdb-6.7.1/gdb/solib.c
/* /*
@@ -1045,4 +1090,12 @@ This takes precedence over the environme @@ -1035,4 +1080,12 @@ This takes precedence over the environme
reload_shared_libraries, reload_shared_libraries,
show_solib_search_path, show_solib_search_path,
&setlist, &showlist); &setlist, &showlist);
@ -1271,11 +1196,11 @@ Index: gdb-6.7.1/gdb/solib.c
+ NULL, NULL, + NULL, NULL,
+ &setdebuglist, &showdebuglist); + &setdebuglist, &showdebuglist);
} }
Index: gdb-6.7.1/gdb/elfread.c Index: gdb-6.7.50.20080227/gdb/elfread.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/elfread.c 2007-08-23 20:08:28.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/elfread.c 2008-01-01 23:53:09.000000000 +0100
+++ gdb-6.7.1/gdb/elfread.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/elfread.c 2008-02-27 08:57:31.000000000 +0100
@@ -611,7 +611,7 @@ elf_symfile_read (struct objfile *objfil @@ -644,7 +644,7 @@ elf_symfile_read (struct objfile *objfil
/* If we are reinitializing, or if we have never loaded syms yet, /* If we are reinitializing, or if we have never loaded syms yet,
set table to empty. MAINLINE is cleared so that *_read_psymtab set table to empty. MAINLINE is cleared so that *_read_psymtab
functions do not all also re-initialize the psymbol table. */ functions do not all also re-initialize the psymbol table. */
@ -1284,11 +1209,11 @@ Index: gdb-6.7.1/gdb/elfread.c
{ {
init_psymbol_list (objfile, 0); init_psymbol_list (objfile, 0);
mainline = 0; mainline = 0;
Index: gdb-6.7.1/gdb/Makefile.in Index: gdb-6.7.50.20080227/gdb/Makefile.in
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/Makefile.in 2007-11-02 15:24:10.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/Makefile.in 2008-02-27 08:57:20.000000000 +0100
+++ gdb-6.7.1/gdb/Makefile.in 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/Makefile.in 2008-02-27 08:57:31.000000000 +0100
@@ -1819,7 +1819,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a @@ -1914,7 +1914,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a
$(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \
$(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \ $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \
$(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \ $(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \
@ -1297,10 +1222,10 @@ Index: gdb-6.7.1/gdb/Makefile.in
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \ annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
$(gdbtypes_h) $(breakpoint_h) $(gdbtypes_h) $(breakpoint_h)
arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \ arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
Index: gdb-6.7.1/gdb/amd64-tdep.c Index: gdb-6.7.50.20080227/gdb/amd64-tdep.c
=================================================================== ===================================================================
--- gdb-6.7.1.orig/gdb/amd64-tdep.c 2007-11-02 15:21:46.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/amd64-tdep.c 2008-02-27 08:57:19.000000000 +0100
+++ gdb-6.7.1/gdb/amd64-tdep.c 2007-11-02 15:24:19.000000000 +0100 +++ gdb-6.7.50.20080227/gdb/amd64-tdep.c 2008-02-27 08:57:31.000000000 +0100
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
#include "symfile.h" #include "symfile.h"
#include "dwarf2-frame.h" #include "dwarf2-frame.h"
@ -1309,7 +1234,7 @@ Index: gdb-6.7.1/gdb/amd64-tdep.c
#include "amd64-tdep.h" #include "amd64-tdep.h"
#include "i387-tdep.h" #include "i387-tdep.h"
@@ -734,16 +735,28 @@ amd64_alloc_frame_cache (void) @@ -731,16 +732,28 @@ amd64_alloc_frame_cache (void)
Any function that doesn't start with this sequence will be assumed Any function that doesn't start with this sequence will be assumed
to have no prologue and thus no valid frame pointer in %rbp. */ to have no prologue and thus no valid frame pointer in %rbp. */
@ -1342,7 +1267,7 @@ Index: gdb-6.7.1/gdb/amd64-tdep.c
op = read_memory_unsigned_integer (pc, 1); op = read_memory_unsigned_integer (pc, 1);
@@ -756,18 +769,57 @@ amd64_analyze_prologue (CORE_ADDR pc, CO @@ -753,18 +766,57 @@ amd64_analyze_prologue (CORE_ADDR pc, CO
/* If that's all, return now. */ /* If that's all, return now. */
if (current_pc <= pc + 1) if (current_pc <= pc + 1)

View File

@ -1,99 +0,0 @@
2004-10-26 Andrew Cagney <cagney@gnu.org>
* blockframe.c (find_pc_function): Use find_pc_section to find the
pc's section.
* block.c, symfile.c: Ditto.
*** ./gdb/blockframe.c.1 2004-10-26 21:21:46.517866240 -0400
--- ./gdb/blockframe.c 2004-10-26 21:24:16.345089040 -0400
***************
*** 288,294 ****
struct symbol *
find_pc_function (CORE_ADDR pc)
{
! return find_pc_sect_function (pc, find_pc_mapped_section (pc));
}
/* These variables are used to cache the most recent result
--- 288,311 ----
struct symbol *
find_pc_function (CORE_ADDR pc)
{
! struct bfd_section *section;
! struct symbol *symbol;
! /* To ensure that the symbol returned belongs to the correct setion
! (and that the last [random] symbol from the previous section
! isn't returned) try to find the section containing PC. First try
! the overlay code (which by default returns NULL); and second try
! the normal section code (which almost always succeeds). */
! section = find_pc_overlay (pc);
! if (section == NULL)
! {
! struct obj_section *obj_section = find_pc_section (pc);
! if (obj_section == NULL)
! section = NULL;
! else
! section = obj_section->the_bfd_section;
! }
! symbol = find_pc_sect_function (pc, section);
! return symbol;
}
/* These variables are used to cache the most recent result
--- ./gdb/symtab.c.1 2004-10-26 22:47:13.650423616 -0400
+++ ./gdb/symtab.c 2004-10-26 22:50:10.239577984 -0400
@@ -2176,7 +2176,20 @@
{
asection *section;
+ /* To ensure that the symbol returned belongs to the correct setion
+ (and that the last [random] symbol from the previous section
+ isn't returned) try to find the section containing PC. First try
+ the overlay code (which by default returns NULL); and second try
+ the normal section code (which almost always succeeds). */
section = find_pc_overlay (pc);
+ if (section == NULL)
+ {
+ struct obj_section *obj_section = find_pc_section (pc);
+ if (obj_section == NULL)
+ section = NULL;
+ else
+ section = obj_section->the_bfd_section;
+ }
if (pc_in_unmapped_range (pc, section))
pc = overlay_mapped_address (pc, section);
return find_pc_sect_line (pc, section, notcurrent);
--- ./gdb/block.c.1 2004-10-27 00:22:56.881319808 -0400
+++ ./gdb/block.c 2004-10-27 00:24:17.364084568 -0400
@@ -25,6 +25,7 @@
#include "symfile.h"
#include "gdb_obstack.h"
#include "cp-support.h"
+#include "objfiles.h"
/* This is used by struct block to store namespace-related info for
C++ files, namely using declarations and the current namespace in
@@ -153,7 +154,22 @@
struct block *
block_for_pc (CORE_ADDR pc)
{
- return block_for_pc_sect (pc, find_pc_mapped_section (pc));
+ struct bfd_section *section;
+ /* To ensure that the symbol returned belongs to the correct setion
+ (and that the last [random] symbol from the previous section
+ isn't returned) try to find the section containing PC. First try
+ the overlay code (which by default returns NULL); and second try
+ the normal section code (which almost always succeeds). */
+ section = find_pc_overlay (pc);
+ if (section == NULL)
+ {
+ struct obj_section *obj_section = find_pc_section (pc);
+ if (obj_section == NULL)
+ section = NULL;
+ else
+ section = obj_section->the_bfd_section;
+ }
+ return block_for_pc_sect (pc, section);
}
/* Now come some functions designed to deal with C++ namespace issues.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,861 +0,0 @@
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>
* config/i386/nm-linux.h: Change dr register routines to
accept a ptid_t first argument. Change all calling macros
to default the inferior_ptid for the first argument.
(i386_linux_insert_watchpoint): New prototype.
(i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto.
(i386_linux_remove_hw_breakpoint): Ditto.
(target_insert_watchpoint, target_remove_watchpoint): Undef and
override.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto.
* config/i386/nm-linux64.h: Ditto except add amd64 versions of
the watchpoint/hw-breakpoint insert/remove routines.
* i386-nat.c: Include "inferior.h" to define inferior_ptid.
* i386-linux-nat.c: Change all dr get/set routines to accept
ptid_t as first argument and to use this argument to determine
the tid for PTRACE.
(i386_linux_set_debug_regs_for_thread): New function.
(i386_linux_sync_debug_registers_callback): Ditto.
(i386_linux_sync_debug_registers_across_threads): Ditto.
(i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto.
(i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto.
(i386_linux_new_thread): Ditto.
(_initialize_i386_linux_nat): Ditto.
* amd64-linux-nat.c: Change all dr get/set routines to accept
ptid_t as first argument and to use this argument to determine
the tid for PTRACE.
(amd64_linux_set_debug_regs_for_thread): New function.
(amd64_linux_sync_debug_registers_callback): Ditto.
(amd64_linux_sync_debug_registers_across_threads): Ditto.
(amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto.
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
(amd64_linux_new_thread): Ditto.
(_initialize_amd64_linux_nat): Register linux new thread observer.
* testsuite/gdb.threads/watchthreads2.c: New test case.
* testsuite/gdb.threads/watchthreads2.exp: Ditto.
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/config/i386/nm-linux64.h
===================================================================
--- gdb-6.7.orig/gdb/config/i386/nm-linux64.h 2007-08-23 20:08:48.000000000 +0200
+++ gdb-6.7/gdb/config/i386/nm-linux64.h 2007-10-14 23:41:50.000000000 +0200
@@ -33,20 +33,58 @@
/* Provide access to the i386 hardware debugging registers. */
-extern void amd64_linux_dr_set_control (unsigned long control);
+extern void amd64_linux_dr_set_control (ptid_t ptid, unsigned long control);
#define I386_DR_LOW_SET_CONTROL(control) \
- amd64_linux_dr_set_control (control)
+ amd64_linux_dr_set_control (inferior_ptid, control)
-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
+extern void amd64_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr);
#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- amd64_linux_dr_set_addr (regnum, addr)
+ amd64_linux_dr_set_addr (inferior_ptid, regnum, addr)
-extern void amd64_linux_dr_reset_addr (int regnum);
+extern void amd64_linux_dr_reset_addr (ptid_t ptid, int regnum);
#define I386_DR_LOW_RESET_ADDR(regnum) \
- amd64_linux_dr_reset_addr (regnum)
+ amd64_linux_dr_reset_addr (inferior_ptid, regnum)
-extern unsigned long amd64_linux_dr_get_status (void);
+extern unsigned long amd64_linux_dr_get_status (ptid_t ptid);
#define I386_DR_LOW_GET_STATUS() \
- amd64_linux_dr_get_status ()
+ amd64_linux_dr_get_status (inferior_ptid)
+
+/* Watchpoints and hardware breakpoints. */
+
+/* Insert a watchpoint to watch a memory region which starts at
+ * * address ADDR and whose length is LEN bytes. Watch memory accesses
+ * * of the type TYPE. Return 0 on success, -1 on failure. */
+extern int amd64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Remove a watchpoint that watched the memory region which starts at
+ * * address ADDR, whose length is LEN bytes, and for accesses of the
+ * * type TYPE. Return 0 on success, -1 on failure. */
+extern int amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * * unused. Return 0 on success, EBUSY on failure. */
+extern int amd64_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * * unused. Return 0 on success, -1 on failure. */
+extern int amd64_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Override basic amd64 macros for watchpoint and hardware breakpoint
+ * insertion/removal to support threads. */
+#undef target_insert_watchpoint
+#define target_insert_watchpoint(addr, len, type) \
+ amd64_linux_insert_watchpoint (addr, len, type)
+
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ amd64_linux_remove_watchpoint (addr, len, type)
+
+#undef target_insert_hw_breakpoint
+#define target_insert_hw_breakpoint(bp_tgt) \
+ amd64_linux_insert_hw_breakpoint (bp_tgt)
+
+#undef target_remove_hw_breakpoint
+#define target_remove_hw_breakpoint(bp_tgt) \
+ amd64_linux_remove_hw_breakpoint (bp_tgt)
#endif /* nm-linux64.h */
Index: gdb-6.7/gdb/config/i386/nm-linux.h
===================================================================
--- gdb-6.7.orig/gdb/config/i386/nm-linux.h 2007-08-23 20:08:48.000000000 +0200
+++ gdb-6.7/gdb/config/i386/nm-linux.h 2007-10-14 23:40:55.000000000 +0200
@@ -29,21 +29,60 @@
/* Provide access to the i386 hardware debugging registers. */
-extern void i386_linux_dr_set_control (unsigned long control);
+extern void i386_linux_dr_set_control (ptid_t ptid, unsigned long control);
#define I386_DR_LOW_SET_CONTROL(control) \
- i386_linux_dr_set_control (control)
+ i386_linux_dr_set_control (inferior_ptid, control)
-extern void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr);
+extern void i386_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr);
#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- i386_linux_dr_set_addr (regnum, addr)
+ i386_linux_dr_set_addr (inferior_ptid, regnum, addr)
-extern void i386_linux_dr_reset_addr (int regnum);
+extern void i386_linux_dr_reset_addr (ptid_t ptid, int regnum);
#define I386_DR_LOW_RESET_ADDR(regnum) \
- i386_linux_dr_reset_addr (regnum)
+ i386_linux_dr_reset_addr (inferior_ptid, regnum)
-extern unsigned long i386_linux_dr_get_status (void);
+extern unsigned long i386_linux_dr_get_status (ptid_t ptid);
#define I386_DR_LOW_GET_STATUS() \
- i386_linux_dr_get_status ()
+ i386_linux_dr_get_status (inferior_ptid)
+
+/* Watchpoints and hardware breakpoints. */
+
+/* Insert a watchpoint to watch a memory region which starts at
+ * address ADDR and whose length is LEN bytes. Watch memory accesses
+ * of the type TYPE. Return 0 on success, -1 on failure. */
+extern int i386_linux_insert_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Remove a watchpoint that watched the memory region which starts at
+ * address ADDR, whose length is LEN bytes, and for accesses of the
+ * type TYPE. Return 0 on success, -1 on failure. */
+extern int i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * unused. Return 0 on success, EBUSY on failure. */
+extern int i386_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * unused. Return 0 on success, -1 on failure. */
+extern int i386_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Override basic i386 macros for watchpoint and hardware breakpoint
+ insertion/removal to support threads. */
+#undef target_insert_watchpoint
+#define target_insert_watchpoint(addr, len, type) \
+ i386_linux_insert_watchpoint (addr, len, type)
+
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ i386_linux_remove_watchpoint (addr, len, type)
+
+#undef target_insert_hw_breakpoint
+#define target_insert_hw_breakpoint(bp_tgt) \
+ i386_linux_insert_hw_breakpoint (bp_tgt)
+
+#undef target_remove_hw_breakpoint
+#define target_remove_hw_breakpoint(bp_tgt) \
+ i386_linux_remove_hw_breakpoint (bp_tgt)
+
#ifdef HAVE_PTRACE_GETFPXREGS
Index: gdb-6.7/gdb/i386-nat.c
===================================================================
--- gdb-6.7.orig/gdb/i386-nat.c 2007-08-23 20:08:34.000000000 +0200
+++ gdb-6.7/gdb/i386-nat.c 2007-10-14 23:39:04.000000000 +0200
@@ -19,6 +19,7 @@
#include "defs.h"
#include "breakpoint.h"
+#include "inferior.h"
#include "command.h"
#include "gdbcmd.h"
Index: gdb-6.7/gdb/testsuite/gdb.threads/watchthreads2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.threads/watchthreads2.c 2007-10-14 23:39:04.000000000 +0200
@@ -0,0 +1,66 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ This file is copied from schedlock.c. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+void *thread_function(void *arg); /* Pointer to function executed by each thread */
+
+#define NUM 5
+
+unsigned int args[NUM+1];
+
+int main() {
+ int res;
+ pthread_t threads[NUM];
+ void *thread_result;
+ long i;
+
+ for (i = 0; i < NUM; i++)
+ {
+ args[i] = 1; /* Init value. */
+ res = pthread_create(&threads[i],
+ NULL,
+ thread_function,
+ (void *) i);
+ }
+
+ args[i] = 1;
+ thread_function ((void *) i);
+
+ exit(EXIT_SUCCESS);
+}
+
+void *thread_function(void *arg) {
+ int my_number = (long) arg;
+ int *myp = (int *) &args[my_number];
+
+ /* Don't run forever. Run just short of it :) */
+ while (*myp > 0)
+ {
+ (*myp) ++; usleep (1); /* Loop increment. */
+ }
+
+ pthread_exit(NULL);
+}
+
Index: gdb-6.7/gdb/testsuite/gdb.threads/watchthreads2.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.threads/watchthreads2.exp 2007-10-14 23:39:04.000000000 +0200
@@ -0,0 +1,133 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can support multiple watchpoints across threads.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test verifies that a watchpoint is detected in the proper thread
+# so the test is only meaningful on a system with hardware watchpoints.
+if [target_info exists gdb,no_hardware_watchpoints] {
+ return 0;
+}
+
+set testfile "watchthreads2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set can-use-hw-watchpoints 1" "" ""
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+set args_2 0
+set args_3 0
+
+gdb_breakpoint "thread_function"
+gdb_continue_to_breakpoint "thread_function"
+gdb_test "disable 2" ""
+
+gdb_test_multiple "p args\[2\]" "get initial args2" {
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
+ set init_args_2 $expect_out(1,string)
+ pass "get initial args2"
+ }
+}
+
+gdb_test_multiple "p args\[3\]" "get initial args3" {
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
+ set init_args_3 $expect_out(1,string)
+ pass "get initial args3"
+ }
+}
+
+set args_2 $init_args_2
+set args_3 $init_args_3
+
+# Watch values that will be modified by distinct threads.
+gdb_test "watch args\[2\]" "Hardware watchpoint 3: args\\\[2\\\]"
+gdb_test "watch args\[3\]" "Hardware watchpoint 4: args\\\[3\\\]"
+
+set init_line [expr [gdb_get_line_number "Init value"]+1]
+set inc_line [gdb_get_line_number "Loop increment"]
+
+# Loop and continue to allow both watchpoints to be triggered.
+for {set i 0} {$i < 30} {incr i} {
+ set test_flag 0
+ gdb_test_multiple "continue" "threaded watch loop" {
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ { set args_2 1; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ { set args_3 1; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ { set args_2 [expr $args_2+1]; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
+ }
+ # If we fail above, don't bother continuing loop
+ if { $test_flag == 0 } {
+ set i 30;
+ }
+}
+
+# Print success message if loop succeeded.
+if { $test_flag == 1 } {
+ pass "threaded watch loop"
+}
+
+# Verify that we hit first watchpoint in child thread.
+set message "watchpoint on args\[2\] hit in thread"
+if { $args_2 > 1 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that we hit second watchpoint in child thread.
+set message "watchpoint on args\[3\] hit in thread"
+if { $args_3 > 1 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that all watchpoint hits are accounted for.
+set message "combination of threaded watchpoints = 30 + initial values"
+if { [expr $args_2+$args_3] == [expr [expr 30+$init_args_2]+$init_args_3] } {
+ pass $message
+} else {
+ fail $message
+}
Index: gdb-6.7/gdb/i386-linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/i386-linux-nat.c 2007-10-13 05:09:50.000000000 +0200
+++ gdb-6.7/gdb/i386-linux-nat.c 2007-10-14 23:39:04.000000000 +0200
@@ -22,6 +22,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "observer.h"
#include "target.h"
#include "linux-nat.h"
@@ -580,14 +581,14 @@ i386_linux_store_inferior_registers (str
/* Support for debug registers. */
static unsigned long
-i386_linux_dr_get (int regnum)
+i386_linux_dr_get (ptid_t ptid, int regnum)
{
int tid;
unsigned long value;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
/* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
ptrace call fails breaks debugging remote targets. The correct
@@ -608,13 +609,13 @@ i386_linux_dr_get (int regnum)
}
static void
-i386_linux_dr_set (int regnum, unsigned long value)
+i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
errno = 0;
ptrace (PTRACE_POKEUSER, tid,
@@ -624,34 +625,158 @@ i386_linux_dr_set (int regnum, unsigned
}
void
-i386_linux_dr_set_control (unsigned long control)
+i386_linux_dr_set_control (ptid_t ptid, unsigned long control)
{
- i386_linux_dr_set (DR_CONTROL, control);
+ i386_linux_dr_set (ptid, DR_CONTROL, control);
}
void
-i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
+i386_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- i386_linux_dr_set (DR_FIRSTADDR + regnum, addr);
+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
void
-i386_linux_dr_reset_addr (int regnum)
+i386_linux_dr_reset_addr (ptid_t ptid, int regnum)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- i386_linux_dr_set (DR_FIRSTADDR + regnum, 0L);
+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, 0L);
}
unsigned long
-i386_linux_dr_get_status (void)
+i386_linux_dr_get_status (ptid_t ptid)
{
- return i386_linux_dr_get (DR_STATUS);
+ return i386_linux_dr_get (ptid, DR_STATUS);
}
+/* Structure used to sync debug registers for all threads. */
+struct i386_debug_register_state
+{
+ int tid;
+ CORE_ADDR addr[DR_LASTADDR - DR_FIRSTADDR + 1];
+ unsigned long control;
+};
+
+static void
+i386_linux_set_debug_regs_for_thread (ptid_t ptid,
+ struct i386_debug_register_state *dbs)
+{
+ int i;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ i386_linux_dr_set_addr (ptid, i, dbs->addr[i]);
+ i386_linux_dr_set_control (ptid, dbs->control);
+}
+
+/* Iterator function to support syncing debug registers across all threads. */
+static int
+i386_linux_sync_debug_registers_callback (struct lwp_info *lwp, void *data)
+{
+ struct i386_debug_register_state *args = data;
+ int i, tid;
+
+ tid = TIDGET (lwp->ptid);
+ if (tid == 0)
+ tid = PIDGET (lwp->ptid);
+
+ if (tid != args->tid)
+ i386_linux_set_debug_regs_for_thread (lwp->ptid, args);
+ return 0;
+}
+
+/* Sync the debug registers for all known threads to the current
+ thread that has just performed an operation. This is required
+ because the debug registers are thread-specific. We want
+ watchpoints and hardware breakpoints to be treated globally
+ across all threads. */
+static int
+i386_linux_sync_debug_registers_across_threads (void)
+{
+ int i, tid;
+ struct i386_debug_register_state args;
+
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid);
+
+ args.tid = tid;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ args.addr[i] = i386_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ args.control = i386_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ iterate_over_lwps (&i386_linux_sync_debug_registers_callback, &args);
+
+ return 0;
+}
+
+/* Insert a watchpoint to watch a memory region which starts at
+ address ADDR and whose length is LEN bytes. Watch memory accesses
+ of the type TYPE. Return 0 on success, -1 on failure. */
+int
+i386_linux_insert_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_insert_watchpoint (addr, len, type);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a watchpoint that watched the memory region which starts at
+ address ADDR, whose length is LEN bytes, and for accesses of the
+ type TYPE. Return 0 on success, -1 on failure. */
+int
+i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_remove_watchpoint (addr, len, type);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, EBUSY on failure. */
+int
+i386_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_insert_hw_breakpoint (bp_tgt);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, -1 on failure. */
+int
+i386_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_remove_hw_breakpoint (bp_tgt);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Observer function for a new thread attach. We need to insert
+ existing watchpoints and hardware breakpoints on the new thread. */
+static void
+i386_linux_new_thread (ptid_t ptid)
+{
+ int i;
+ struct i386_debug_register_state dbs;
+
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ dbs.addr[i] = i386_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ dbs.control = i386_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ i386_linux_set_debug_regs_for_thread (ptid, &dbs);
+}
+
/* Called by libthread_db. Returns a pointer to the thread local
storage (or its descriptor). */
@@ -816,4 +941,6 @@ _initialize_i386_linux_nat (void)
/* Register the target. */
linux_nat_add_target (t);
+
+ observer_attach_linux_new_thread (i386_linux_new_thread);
}
Index: gdb-6.7/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/amd64-linux-nat.c 2007-10-13 05:09:50.000000000 +0200
+++ gdb-6.7/gdb/amd64-linux-nat.c 2007-10-14 23:39:04.000000000 +0200
@@ -23,6 +23,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "observer.h"
#include "linux-nat.h"
#include "amd64-linux-tdep.h"
@@ -235,14 +236,14 @@ amd64_linux_store_inferior_registers (st
static unsigned long
-amd64_linux_dr_get (int regnum)
+amd64_linux_dr_get (ptid_t ptid, int regnum)
{
int tid;
unsigned long value;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
/* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
ptrace call fails breaks debugging remote targets. The correct
@@ -263,13 +264,13 @@ amd64_linux_dr_get (int regnum)
}
static void
-amd64_linux_dr_set (int regnum, unsigned long value)
+amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
errno = 0;
ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value);
@@ -278,34 +279,158 @@ amd64_linux_dr_set (int regnum, unsigned
}
void
-amd64_linux_dr_set_control (unsigned long control)
+amd64_linux_dr_set_control (ptid_t ptid, unsigned long control)
{
- amd64_linux_dr_set (DR_CONTROL, control);
+ amd64_linux_dr_set (ptid, DR_CONTROL, control);
}
void
-amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
+amd64_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- amd64_linux_dr_set (DR_FIRSTADDR + regnum, addr);
+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
void
-amd64_linux_dr_reset_addr (int regnum)
+amd64_linux_dr_reset_addr (ptid_t ptid, int regnum)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- amd64_linux_dr_set (DR_FIRSTADDR + regnum, 0L);
+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, 0L);
}
unsigned long
-amd64_linux_dr_get_status (void)
+amd64_linux_dr_get_status (ptid_t ptid)
{
- return amd64_linux_dr_get (DR_STATUS);
+ return amd64_linux_dr_get (ptid, DR_STATUS);
}
+/* Structure used to sync debug registers for all threads. */
+struct amd64_debug_register_state
+{
+ int tid;
+ CORE_ADDR addr[DR_LASTADDR - DR_FIRSTADDR + 1];
+ unsigned long control;
+};
+
+static void
+amd64_linux_set_debug_regs_for_thread (ptid_t ptid,
+ struct amd64_debug_register_state *dbs)
+{
+ int i;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ amd64_linux_dr_set_addr (ptid, i, dbs->addr[i]);
+ amd64_linux_dr_set_control (ptid, dbs->control);
+}
+
+/* Iterator function to support syncing debug registers across all threads. */
+static int
+amd64_linux_sync_debug_registers_callback (struct lwp_info *lwp, void *data)
+{
+ struct amd64_debug_register_state *args = data;
+ int i, tid;
+
+ tid = TIDGET (lwp->ptid);
+ if (tid == 0)
+ tid = PIDGET (lwp->ptid);
+
+ if (tid != args->tid)
+ amd64_linux_set_debug_regs_for_thread (lwp->ptid, args);
+ return 0;
+}
+
+/* Sync the debug registers for all known threads to the current
+ thread that has just performed an operation. This is required
+ because the debug registers are thread-specific. We want
+ watchpoints and hardware breakpoints to be treated globally
+ across all threads. */
+static int
+amd64_linux_sync_debug_registers_across_threads (void)
+{
+ int i, tid;
+ struct amd64_debug_register_state args;
+
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid);
+
+ args.tid = tid;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ args.addr[i] = amd64_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ args.control = amd64_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ iterate_over_lwps (&amd64_linux_sync_debug_registers_callback, &args);
+
+ return 0;
+}
+
+/* Insert a watchpoint to watch a memory region which starts at
+ address ADDR and whose length is LEN bytes. Watch memory accesses
+ of the type TYPE. Return 0 on success, -1 on failure. */
+int
+amd64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_insert_watchpoint (addr, len, type);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a watchpoint that watched the memory region which starts at
+ address ADDR, whose length is LEN bytes, and for accesses of the
+ type TYPE. Return 0 on success, -1 on failure. */
+int
+amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_remove_watchpoint (addr, len, type);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, EBUSY on failure. */
+int
+amd64_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_insert_hw_breakpoint (bp_tgt);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, -1 on failure. */
+int
+amd64_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_remove_hw_breakpoint (bp_tgt);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Observer function for a new thread attach. We need to insert
+ existing watchpoints and hardware breakpoints on the new thread. */
+static void
+amd64_linux_new_thread (ptid_t ptid)
+{
+ int i;
+ struct amd64_debug_register_state dbs;
+
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ dbs.addr[i] = amd64_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ dbs.control = amd64_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ amd64_linux_set_debug_regs_for_thread (ptid, &dbs);
+}
+
/* This function is called by libthread_db as part of its handling of
a request for a thread's local storage address. */
@@ -406,4 +531,6 @@ _initialize_amd64_linux_nat (void)
/* Register the target. */
linux_nat_add_target (t);
+
+ observer_attach_linux_new_thread (amd64_linux_new_thread);
}
Index: gdb-6.7/gdb/testsuite/gdb.threads/watchthreads.c
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.threads/watchthreads.c 2007-08-23 20:08:50.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.threads/watchthreads.c 2007-10-14 23:39:04.000000000 +0200
@@ -56,7 +56,7 @@ void *thread_function(void *arg) {
/* Don't run forever. Run just short of it :) */
while (*myp > 0)
{
- (*myp) ++; /* Loop increment. */
+ (*myp) ++; usleep (1); /* Loop increment. */
}
pthread_exit(NULL);

View File

@ -1,6 +1,5 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390
2006-09-28 Jan Kratochvil <jan.kratochvil@redhat.com> 2006-09-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb/utils.c (paddress): Disable cutting of the printed addresses * gdb/utils.c (paddress): Disable cutting of the printed addresses
@ -9,15 +8,16 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390
(value_as_address): New `value_as_address' wrapper - cut memory address (value_as_address): New `value_as_address' wrapper - cut memory address
to the target's address bit size, bugreport by John Reiser. to the target's address bit size, bugreport by John Reiser.
2008-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Index: gdb-6.5/gdb/utils.c Port to GDB-6.8pre.
New testcase `gdb.arch/amd64-i386-address.exp'.
Index: gdb-6.7.50.20080227/gdb/utils.c
=================================================================== ===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v --- gdb-6.7.50.20080227.orig/gdb/utils.c 2008-03-02 14:28:44.000000000 +0100
retrieving revision 1.169 +++ gdb-6.7.50.20080227/gdb/utils.c 2008-03-02 14:35:09.000000000 +0100
diff -u -p -r1.169 utils.c @@ -2540,6 +2540,14 @@ paddr_nz (CORE_ADDR addr)
--- gdb-6.5.orig/gdb/utils.c 21 Sep 2006 13:50:51 -0000 1.169
+++ gdb-6.5/gdb/utils.c 28 Sep 2006 17:06:03 -0000
@@ -2596,6 +2596,14 @@ paddr_nz (CORE_ADDR addr)
const char * const char *
paddress (CORE_ADDR addr) paddress (CORE_ADDR addr)
{ {
@ -32,7 +32,7 @@ diff -u -p -r1.169 utils.c
/* Truncate address to the size of a target address, avoiding shifts /* Truncate address to the size of a target address, avoiding shifts
larger or equal than the width of a CORE_ADDR. The local larger or equal than the width of a CORE_ADDR. The local
variable ADDR_BIT stops the compiler reporting a shift overflow variable ADDR_BIT stops the compiler reporting a shift overflow
@@ -2609,6 +2617,8 @@ paddress (CORE_ADDR addr) @@ -2553,6 +2561,8 @@ paddress (CORE_ADDR addr)
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1; addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
@ -41,30 +41,26 @@ diff -u -p -r1.169 utils.c
return hex_string (addr); return hex_string (addr);
} }
Index: gdb-6.5/gdb/value.c Index: gdb-6.7.50.20080227/gdb/value.c
=================================================================== ===================================================================
RCS file: /cvs/src/src/gdb/value.c,v --- gdb-6.7.50.20080227.orig/gdb/value.c 2008-01-18 18:07:40.000000000 +0100
retrieving revision 1.36 +++ gdb-6.7.50.20080227/gdb/value.c 2008-03-02 14:36:38.000000000 +0100
diff -u -p -r1.36 value.c @@ -983,11 +983,9 @@ value_as_double (struct value *val)
--- gdb-6.5.orig/gdb/value.c 31 Mar 2006 10:36:18 -0000 1.36
+++ gdb-6.5/gdb/value.c 28 Sep 2006 17:06:03 -0000
@@ -950,11 +950,10 @@ value_as_double (struct value *val)
error (_("Invalid floating value found in program."));
return foo; return foo;
} }
-/* Extract a value as a C pointer. Does not deallocate the value. -/* Extract a value as a C pointer. Does not deallocate the value.
- Note that val's type may not actually be a pointer; value_as_long - Note that val's type may not actually be a pointer; value_as_long
- handles all the cases. */ - handles all the cases. */
-CORE_ADDR -CORE_ADDR
-value_as_address (struct value *val) -value_as_address (struct value *val)
+
+/* See `value_as_address' below - core of value to C pointer extraction. */ +/* See `value_as_address' below - core of value to C pointer extraction. */
+static CORE_ADDR +static CORE_ADDR
+value_as_address_core (struct value *val) +value_as_address_core (struct value *val)
{ {
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */ whether we want this to be true eventually. */
@@ -1054,6 +1053,34 @@ value_as_address (struct value *val) @@ -1087,6 +1085,34 @@ value_as_address (struct value *val)
return unpack_long (value_type (val), value_contents (val)); return unpack_long (value_type (val), value_contents (val));
#endif #endif
} }
@ -99,3 +95,103 @@ diff -u -p -r1.36 value.c
/* Unpack raw data (copied from debugee, target byte order) at VALADDR /* Unpack raw data (copied from debugee, target byte order) at VALADDR
as a long, or as a double, assuming the raw data is described as a long, or as a double, assuming the raw data is described
--- /dev/null 2008-03-01 10:30:54.797374318 +0100
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.arch/amd64-i386-address.S 2008-03-02 12:47:06.000000000 +0100
@@ -0,0 +1,32 @@
+/* Copyright 2008 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@gnu.org
+
+ This file is part of the gdb testsuite.
+
+ Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
+ This file is based on the work by John Reiser.
+ This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
+ https://bugzilla.redhat.com/show_bug.cgi?id=181390 */
+
+_start: .globl _start
+ nop
+ int3
+ movl %esp,%ebx
+ int3 # examining memory from $ebx fails, from $esp succeeds
+ nop
+ nop
--- /dev/null 2008-03-01 10:30:54.797374318 +0100
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.arch/amd64-i386-address.exp 2008-03-02 12:57:11.000000000 +0100
@@ -0,0 +1,62 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@gnu.org
+
+# This file is part of the gdb testsuite.
+
+# Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
+# This file is based on the work by John Reiser.
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
+# https://bugzilla.redhat.com/show_bug.cgi?id=181390
+
+if {![istarget "x86_64-*-*"]} then {
+ verbose "Skipping amd64->i386 adress test."
+ return
+}
+
+set testfile "amd64-i386-address"
+set srcfile ${testfile}.S
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32 -nostdlib"]] != "" } {
+ untested amd64-i386-address.exp
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_run_cmd
+
+set test "trap stop"
+gdb_test_multiple "" $test {
+ -re "Program received signal SIGTRAP,.*_start .*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "stepi" ".*_start .*int3.*"
+
+gdb_test "x/x \$esp" "0x\[0-9a-f\]*:\t0x0*1"
+
+# Failure case would be:
+# 0xff8d7f00: Cannot access memory at address 0xff8d7f00
+gdb_test "x/x \$ebx" "0x\[0-9a-f\]*:\t0x0*1"

View File

@ -1,5 +1,8 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
will get: will get:
@ -27,9 +30,11 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
--- ./gdb/dwarf2read.c 25 Oct 2007 20:54:27 -0000 1.236 Index: gdb-6.8cvs20080219/gdb/dwarf2read.c
+++ ./gdb/dwarf2read.c 3 Nov 2007 21:03:43 -0000 ===================================================================
@@ -5550,8 +5550,8 @@ read_partial_die (struct partial_die_inf --- gdb-6.8cvs20080219.orig/gdb/dwarf2read.c 2008-02-19 17:27:21.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/dwarf2read.c 2008-02-20 13:35:19.000000000 +0100
@@ -5679,8 +5679,8 @@ read_partial_die (struct partial_die_inf
{ {
case DW_AT_name: case DW_AT_name:
@ -40,7 +45,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
part_die->name = DW_STRING (&attr); part_die->name = DW_STRING (&attr);
break; break;
case DW_AT_comp_dir: case DW_AT_comp_dir:
@@ -5559,7 +5559,9 @@ read_partial_die (struct partial_die_inf @@ -5688,7 +5688,9 @@ read_partial_die (struct partial_die_inf
part_die->dirname = DW_STRING (&attr); part_die->dirname = DW_STRING (&attr);
break; break;
case DW_AT_MIPS_linkage_name: case DW_AT_MIPS_linkage_name:
@ -51,7 +56,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
break; break;
case DW_AT_low_pc: case DW_AT_low_pc:
has_low_pc_attr = 1; has_low_pc_attr = 1;
@@ -7871,9 +7873,13 @@ dwarf2_linkage_name (struct die_info *di @@ -7936,9 +7938,13 @@ dwarf2_linkage_name (struct die_info *di
{ {
struct attribute *attr; struct attribute *attr;
@ -68,22 +73,20 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
attr = dwarf2_attr (die, DW_AT_name, cu); attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr && DW_STRING (attr)) if (attr && DW_STRING (attr))
return DW_STRING (attr); return DW_STRING (attr);
Index: gdb-6.8cvs20080219/gdb/gdbtypes.c
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/gdbtypes.c 2008-02-14 23:03:57.000000000 +0100
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/gdbtypes.c gdb-6.7.1-patched/gdb/gdbtypes.c +++ gdb-6.8cvs20080219/gdb/gdbtypes.c 2008-02-20 13:35:19.000000000 +0100
--- gdb-6.7.1/gdb/gdbtypes.c 2007-11-04 01:43:03.000000000 +0100 @@ -3106,6 +3106,8 @@ gdbtypes_post_init (struct gdbarch *gdba
+++ gdb-6.7.1-patched/gdb/gdbtypes.c 2007-11-04 01:09:31.000000000 +0100
@@ -3465,6 +3465,8 @@ gdbtypes_post_init (struct gdbarch *gdba
init_type (TYPE_CODE_INT, init_type (TYPE_CODE_INT,
gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
0, "int", (struct objfile *) NULL); 0, "int", (struct objfile *) NULL);
+ builtin_type->builtin_int_ptr = + builtin_type->builtin_int_ptr =
+ make_pointer_type (builtin_type->builtin_int, NULL); + make_pointer_type (builtin_type->builtin_int, NULL);
builtin_type->builtin_unsigned_int = builtin_type->builtin_unsigned_int =
init_type (TYPE_CODE_INT, init_type (TYPE_CODE_INT,
gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
@@ -3559,6 +3561,11 @@ gdbtypes_post_init (struct gdbarch *gdba @@ -3215,6 +3217,11 @@ gdbtypes_post_init (struct gdbarch *gdba
"<text variable, no debug info>", NULL); "<text variable, no debug info>", NULL);
TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol) = TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol) =
builtin_type->builtin_int; builtin_type->builtin_int;
@ -95,10 +98,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/gdbtypes.c gdb-6.7.1-pa
builtin_type->nodebug_data_symbol = builtin_type->nodebug_data_symbol =
init_type (TYPE_CODE_INT, init_type (TYPE_CODE_INT,
gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/gdbtypes.h gdb-6.7.1-patched/gdb/gdbtypes.h Index: gdb-6.8cvs20080219/gdb/gdbtypes.h
--- gdb-6.7.1/gdb/gdbtypes.h 2007-11-04 01:43:03.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/gdbtypes.h 2007-11-04 01:07:50.000000000 +0100 --- gdb-6.8cvs20080219.orig/gdb/gdbtypes.h 2008-02-14 23:03:57.000000000 +0100
@@ -1008,6 +1008,7 @@ struct builtin_type +++ gdb-6.8cvs20080219/gdb/gdbtypes.h 2008-02-20 13:35:19.000000000 +0100
@@ -942,6 +942,7 @@ struct builtin_type
/* Types used for symbols with no debug information. */ /* Types used for symbols with no debug information. */
struct type *nodebug_text_symbol; struct type *nodebug_text_symbol;
@ -106,7 +110,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/gdbtypes.h gdb-6.7.1-pa
struct type *nodebug_data_symbol; struct type *nodebug_data_symbol;
struct type *nodebug_unknown_symbol; struct type *nodebug_unknown_symbol;
struct type *nodebug_tls_symbol; struct type *nodebug_tls_symbol;
@@ -1026,6 +1027,7 @@ struct builtin_type @@ -960,6 +961,7 @@ struct builtin_type
struct type *builtin_char; struct type *builtin_char;
struct type *builtin_short; struct type *builtin_short;
struct type *builtin_int; struct type *builtin_int;
@ -114,10 +118,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/gdbtypes.h gdb-6.7.1-pa
struct type *builtin_long; struct type *builtin_long;
struct type *builtin_signed_char; struct type *builtin_signed_char;
struct type *builtin_unsigned_char; struct type *builtin_unsigned_char;
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/parse.c gdb-6.7.1-patched/gdb/parse.c Index: gdb-6.8cvs20080219/gdb/parse.c
--- gdb-6.7.1/gdb/parse.c 2007-08-23 20:08:36.000000000 +0200 ===================================================================
+++ gdb-6.7.1-patched/gdb/parse.c 2007-11-04 01:06:59.000000000 +0100 --- gdb-6.8cvs20080219.orig/gdb/parse.c 2008-01-02 00:04:03.000000000 +0100
@@ -424,7 +424,12 @@ write_exp_msymbol (struct minimal_symbol +++ gdb-6.8cvs20080219/gdb/parse.c 2008-02-20 13:35:19.000000000 +0100
@@ -437,7 +437,12 @@ write_exp_msymbol (struct minimal_symbol
case mst_text: case mst_text:
case mst_file_text: case mst_file_text:
case mst_solib_trampoline: case mst_solib_trampoline:
@ -131,10 +136,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/parse.c gdb-6.7.1-patch
break; break;
case mst_data: case mst_data:
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/target.c gdb-6.7.1-patched/gdb/target.c Index: gdb-6.8cvs20080219/gdb/target.c
--- gdb-6.7.1/gdb/target.c 2007-11-04 01:43:03.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/target.c 2007-11-04 01:37:45.000000000 +0100 --- gdb-6.8cvs20080219.orig/gdb/target.c 2008-02-19 17:22:33.000000000 +0100
@@ -819,6 +819,25 @@ pop_target (void) +++ gdb-6.8cvs20080219/gdb/target.c 2008-02-20 13:36:17.000000000 +0100
@@ -812,6 +812,25 @@ pop_target (void)
internal_error (__FILE__, __LINE__, _("failed internal consistency check")); internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
} }
@ -157,10 +163,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/target.c gdb-6.7.1-patc
+ return 1; + return 1;
+} +}
+ +
/* Using the objfile specified in BATON, find the address for the /* Using the objfile specified in OBJFILE, find the address for the
current thread's thread-local storage with offset OFFSET. */ current thread's thread-local storage with offset OFFSET. */
CORE_ADDR CORE_ADDR
@@ -904,7 +923,28 @@ target_translate_tls_address (struct obj @@ -893,7 +912,28 @@ target_translate_tls_address (struct obj
/* It wouldn't be wrong here to try a gdbarch method, too; finding /* It wouldn't be wrong here to try a gdbarch method, too; finding
TLS is an ABI-specific thing. But we don't do that yet. */ TLS is an ABI-specific thing. But we don't do that yet. */
else else
@ -190,9 +196,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/target.c gdb-6.7.1-patc
return addr; return addr;
} }
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.c
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-04 01:43:41.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-03 23:29:02.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2008-02-20 13:35:19.000000000 +0100
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -222,9 +229,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw
+ +
+ return 0; /* breakpoint */ + return 0; /* breakpoint */
+} +}
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:43:39.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:41:46.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2008-02-20 13:35:19.000000000 +0100
@@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
+# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007 Free Software Foundation, Inc.
+ +

View File

@ -1,177 +0,0 @@
2007-04-20 Luis Machado <luisgpm@br.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Set the long double format for
powerpc64.
* configure.host : Set the host long double format for powerpc64 to be
a 128-bit type defined in libiberty/floatformat.c.
* ppc-linux-tdep.c (ppc_linux_init_abi): Remove code that sets long double
size to 8 bytes. This breaks expression evaluation by overriding the
default.
* floatformat.c : Introduce default floatformat structs to describe the
128-bit long double found on the powerpc64. Description does not fully
describe this format which is actually a pair of 64-bit doubles. However
we are relying on floatformat_to_doublest() recognizing that this is
also the default host floatformat.
* floatformat.h : Default floatformat structs for powerpc64 128-bit
long doubles.
Index: ./gdb/configure.host
===================================================================
--- ./gdb/configure.host.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/configure.host 2007-04-21 23:51:09.000000000 -0300
@@ -179,6 +179,11 @@
gdb_host_double_format="&floatformat_ieee_double_big"
gdb_host_long_double_format="&floatformat_m68881_ext"
;;
+powerpc64-*-*)
+ gdb_host_float_format=0
+ gdb_host_double_format=0
+ gdb_host_long_double_format="&floatformat_ppc64_long_double_big"
+ ;;
*)
gdb_host_float_format=0
gdb_host_double_format=0
Index: ./gdb/rs6000-tdep.c
===================================================================
--- ./gdb/rs6000-tdep.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/rs6000-tdep.c 2007-04-21 23:51:09.000000000 -0300
@@ -3442,7 +3442,19 @@
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
if (sysv_abi)
- set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ {
+ int byte_order = gdbarch_byte_order (gdbarch);
+
+ if (byte_order == BFD_ENDIAN_BIG)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
+ else if (byte_order == BFD_ENDIAN_LITTLE)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
+ else
+ internal_error (__FILE__, __LINE__,
+ _("rs6000_gdbarch_init: "
+ "bad byte order"));
+ set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ }
else
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
Index: ./include/floatformat.h
===================================================================
--- ./include/floatformat.h.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./include/floatformat.h 2007-04-21 23:51:09.000000000 -0300
@@ -118,6 +118,9 @@
extern const struct floatformat floatformat_ia64_spill_little;
extern const struct floatformat floatformat_ia64_quad_big;
extern const struct floatformat floatformat_ia64_quad_little;
+/* ppc64 long double implemented as 2 doubles */
+extern const struct floatformat floatformat_ppc64_long_double_big;
+extern const struct floatformat floatformat_ppc64_long_double_little;
/* Convert from FMT to a double.
FROM is the address of the extended float.
Index: ./libiberty/floatformat.c
===================================================================
--- ./libiberty/floatformat.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./libiberty/floatformat.c 2007-04-21 23:51:09.000000000 -0300
@@ -106,6 +106,25 @@
floatformat_always_valid
};
+/* floatformats for ppc64 long double, big and little endian. */
+/* The layout is a pair of doubles. Don't use this description to pass */
+/* information to get_field(). The bit size is the important thing. */
+const struct floatformat floatformat_ppc64_long_double_big =
+{
+ floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_big",
+ floatformat_always_valid
+};
+
+const struct floatformat floatformat_ppc64_long_double_little =
+{
+ floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_little",
+ floatformat_always_valid
+};
+
/* floatformat for IEEE double, little endian byte order, with big endian word
ordering, as on the ARM. */
Index: ./gdb/ppc-linux-tdep.c
===================================================================
--- ./gdb/ppc-linux-tdep.c.orig 2007-04-21 19:48:50.000000000 -0300
+++ ./gdb/ppc-linux-tdep.c 2007-04-22 00:29:50.000000000 -0300
@@ -1059,7 +1059,8 @@
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
+#if 0
+ /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
Supplement says that long doubles are sixteen bytes long.
However, as one of the known warts of its ABI, PPC GNU/Linux uses
eight-byte long doubles. GCC only recently got 128-bit long
@@ -1068,6 +1069,7 @@
double' on PPC GNU/Linux are non-conformant. */
/* NOTE: cagney/2005-01-25: True for both 32- and 64-bit. */
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+#endif
if (tdep->wordsize == 4)
{
2007-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/gdbtypes.c gdb-6.7/gdb/gdbtypes.c
--- gdb-6.7-patched/gdb/gdbtypes.c 2007-09-05 02:51:48.000000000 +0200
+++ gdb-6.7/gdb/gdbtypes.c 2007-10-17 12:09:00.000000000 +0200
@@ -95,6 +95,10 @@ const struct floatformat *floatformats_v
&floatformat_vax_d,
&floatformat_vax_d
};
+const struct floatformat *floatformat_ppc64_long_double[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ppc64_long_double_big,
+ &floatformat_ppc64_long_double_little
+};
struct type *builtin_type_ieee_single;
struct type *builtin_type_ieee_double;
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/gdbtypes.h gdb-6.7/gdb/gdbtypes.h
--- gdb-6.7-patched/gdb/gdbtypes.h 2007-09-05 02:51:48.000000000 +0200
+++ gdb-6.7/gdb/gdbtypes.h 2007-10-17 12:08:30.000000000 +0200
@@ -1121,6 +1121,7 @@ extern const struct floatformat *floatfo
extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformat_ppc64_long_double[BFD_ENDIAN_UNKNOWN];
extern struct type *builtin_type_ieee_single;
extern struct type *builtin_type_ieee_double;
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/rs6000-tdep.c gdb-6.7/gdb/rs6000-tdep.c
--- gdb-6.7-patched/gdb/rs6000-tdep.c 2007-10-16 20:52:45.000000000 +0200
+++ gdb-6.7/gdb/rs6000-tdep.c 2007-10-17 12:07:54.000000000 +0200
@@ -3755,16 +3755,7 @@ rs6000_gdbarch_init (struct gdbarch_info
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
if (sysv_abi)
{
- int byte_order = gdbarch_byte_order (gdbarch);
-
- if (byte_order == BFD_ENDIAN_BIG)
- set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
- else if (byte_order == BFD_ENDIAN_LITTLE)
- set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
- else
- internal_error (__FILE__, __LINE__,
- _("rs6000_gdbarch_init: "
- "bad byte order"));
+ set_gdbarch_long_double_format (gdbarch, floatformat_ppc64_long_double);
set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
}
else

View File

@ -19,11 +19,15 @@
Port to GDB-6.7. Port to GDB-6.7.
Index: gdb-6.7/gdb/Makefile.in 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/Makefile.in
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/Makefile.in 2007-10-14 23:57:38.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/Makefile.in 2008-02-19 16:52:21.000000000 +0100
+++ gdb-6.7/gdb/Makefile.in 2007-10-16 15:46:48.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/Makefile.in 2008-02-20 13:39:08.000000000 +0100
@@ -717,6 +717,7 @@ gdb_expat_h = gdb_expat.h @@ -785,6 +785,7 @@ gdb_expat_h = gdb_expat.h
gdb_locale_h = gdb_locale.h gdb_locale_h = gdb_locale.h
gdb_obstack_h = gdb_obstack.h $(obstack_h) gdb_obstack_h = gdb_obstack.h $(obstack_h)
gdb_proc_service_h = gdb_proc_service.h $(gregset_h) gdb_proc_service_h = gdb_proc_service.h $(gregset_h)
@ -31,7 +35,7 @@ Index: gdb-6.7/gdb/Makefile.in
gdb_ptrace_h = gdb_ptrace.h gdb_ptrace_h = gdb_ptrace.h
gdb_regex_h = gdb_regex.h $(xregex_h) gdb_regex_h = gdb_regex.h $(xregex_h)
gdb_select_h = gdb_select.h gdb_select_h = gdb_select.h
@@ -726,6 +727,7 @@ gdb_string_h = gdb_string.h @@ -794,6 +795,7 @@ gdb_string_h = gdb_string.h
gdb_thread_db_h = gdb_thread_db.h gdb_thread_db_h = gdb_thread_db.h
gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h) gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h)
gdbtypes_h = gdbtypes.h $(hashtab_h) gdbtypes_h = gdbtypes.h $(hashtab_h)
@ -39,7 +43,7 @@ Index: gdb-6.7/gdb/Makefile.in
gdb_vfork_h = gdb_vfork.h gdb_vfork_h = gdb_vfork.h
gdb_wait_h = gdb_wait.h gdb_wait_h = gdb_wait.h
glibc_tdep_h = glibc-tdep.h glibc_tdep_h = glibc-tdep.h
@@ -1793,7 +1795,8 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def @@ -1888,7 +1890,8 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def
amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \ $(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \ $(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
@ -49,11 +53,11 @@ Index: gdb-6.7/gdb/Makefile.in
amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \ amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \ $(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \
$(solib_svr4_h) $(gdbtypes_h) $(reggroups_h) $(amd64_linux_tdep_h) $(solib_svr4_h) $(gdbtypes_h) $(reggroups_h) $(amd64_linux_tdep_h)
Index: gdb-6.7/gdb/amd64-linux-nat.c Index: gdb-6.8cvs20080219/gdb/amd64-linux-nat.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/amd64-linux-nat.c 2007-10-14 23:39:04.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/amd64-linux-nat.c 2008-02-16 19:10:27.000000000 +0100
+++ gdb-6.7/gdb/amd64-linux-nat.c 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/amd64-linux-nat.c 2008-02-20 13:39:08.000000000 +0100
@@ -51,6 +51,9 @@ @@ -50,6 +50,9 @@
#include "amd64-tdep.h" #include "amd64-tdep.h"
#include "i386-linux-tdep.h" #include "i386-linux-tdep.h"
#include "amd64-nat.h" #include "amd64-nat.h"
@ -63,7 +67,7 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c
/* Mapping between the general-purpose registers in GNU/Linux x86-64 /* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */ `struct user' format and GDB's register cache layout. */
@@ -85,6 +88,35 @@ static int amd64_linux_gregset64_reg_off @@ -84,6 +87,35 @@ static int amd64_linux_gregset64_reg_off
GNU/Linux i386 registers are all 32-bit, but since we're GNU/Linux i386 registers are all 32-bit, but since we're
little-endian we get away with that. */ little-endian we get away with that. */
@ -99,7 +103,7 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c
/* From <sys/reg.h> on GNU/Linux i386. */ /* From <sys/reg.h> on GNU/Linux i386. */
static int amd64_linux_gregset32_reg_offset[] = static int amd64_linux_gregset32_reg_offset[] =
{ {
@@ -103,6 +135,96 @@ static int amd64_linux_gregset32_reg_off @@ -102,6 +134,96 @@ static int amd64_linux_gregset32_reg_off
}; };
@ -196,7 +200,7 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c
/* Transfering the general-purpose registers between GDB, inferiors /* Transfering the general-purpose registers between GDB, inferiors
and core files. */ and core files. */
@@ -529,6 +649,11 @@ _initialize_amd64_linux_nat (void) @@ -429,6 +551,11 @@ _initialize_amd64_linux_nat (void)
t->to_fetch_registers = amd64_linux_fetch_inferior_registers; t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
t->to_store_registers = amd64_linux_store_inferior_registers; t->to_store_registers = amd64_linux_store_inferior_registers;
@ -207,11 +211,11 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, amd64_linux_new_thread);
Index: gdb-6.7/gdb/config.in Index: gdb-6.8cvs20080219/gdb/config.in
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/config.in 2007-06-18 17:46:37.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/config.in 2008-01-10 19:17:06.000000000 +0100
+++ gdb-6.7/gdb/config.in 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/config.in 2008-02-20 13:39:08.000000000 +0100
@@ -385,6 +385,9 @@ @@ -385,6 +385,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */ /* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H #undef HAVE_SYS_POLL_H
@ -232,11 +236,11 @@ Index: gdb-6.7/gdb/config.in
/* Define to 1 if you have the <sys/user.h> header file. */ /* Define to 1 if you have the <sys/user.h> header file. */
#undef HAVE_SYS_USER_H #undef HAVE_SYS_USER_H
Index: gdb-6.7/gdb/configure Index: gdb-6.8cvs20080219/gdb/configure
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/configure 2007-09-29 22:54:13.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/configure 2008-02-14 23:03:56.000000000 +0100
+++ gdb-6.7/gdb/configure 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/configure 2008-02-20 13:39:08.000000000 +0100
@@ -10439,6 +10439,157 @@ done @@ -11140,6 +11140,157 @@ done
@ -394,11 +398,11 @@ Index: gdb-6.7/gdb/configure
for ac_header in sys/wait.h wait.h for ac_header in sys/wait.h wait.h
do do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
Index: gdb-6.7/gdb/configure.ac Index: gdb-6.8cvs20080219/gdb/configure.ac
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/configure.ac 2007-09-29 22:54:13.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/configure.ac 2008-02-14 23:03:56.000000000 +0100
+++ gdb-6.7/gdb/configure.ac 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/configure.ac 2008-02-20 13:39:08.000000000 +0100
@@ -424,6 +424,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [], @@ -523,6 +523,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [],
# include <sys/param.h> # include <sys/param.h>
#endif #endif
]) ])
@ -406,10 +410,10 @@ Index: gdb-6.7/gdb/configure.ac
AC_CHECK_HEADERS(sys/wait.h wait.h) AC_CHECK_HEADERS(sys/wait.h wait.h)
AC_CHECK_HEADERS(termios.h termio.h sgtty.h) AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(unistd.h)
Index: gdb-6.7/gdb/gcore.c Index: gdb-6.8cvs20080219/gdb/gcore.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/gcore.c 2007-10-14 23:57:38.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/gcore.c 2008-02-19 16:52:21.000000000 +0100
+++ gdb-6.7/gdb/gcore.c 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/gcore.c 2008-02-20 13:39:08.000000000 +0100
@@ -317,6 +317,11 @@ gcore_create_callback (CORE_ADDR vaddr, @@ -317,6 +317,11 @@ gcore_create_callback (CORE_ADDR vaddr,
asection *osec; asection *osec;
flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD; flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD;
@ -422,10 +426,10 @@ Index: gdb-6.7/gdb/gcore.c
/* If the memory segment has no permissions set, ignore it, otherwise /* If the memory segment has no permissions set, ignore it, otherwise
when we later try to access it for read/write, we'll get an error when we later try to access it for read/write, we'll get an error
or jam the kernel. */ or jam the kernel. */
Index: gdb-6.7/gdb/gdb_procfs32.h Index: gdb-6.8cvs20080219/gdb/gdb_procfs32.h
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/gdb_procfs32.h 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/gdb_procfs32.h 2008-02-20 13:39:08.000000000 +0100
@@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
+#ifdef HAVE_SYS_PROCFS32_H +#ifdef HAVE_SYS_PROCFS32_H
+#include <sys/procfs32.h> +#include <sys/procfs32.h>
@ -555,10 +559,10 @@ Index: gdb-6.7/gdb/gdb_procfs32.h
+#endif /* _SYS_PROCFS32_H */ +#endif /* _SYS_PROCFS32_H */
+ +
+#endif /* HAVE_SYS_PROCFS32_H */ +#endif /* HAVE_SYS_PROCFS32_H */
Index: gdb-6.7/gdb/gdb_user32.h Index: gdb-6.8cvs20080219/gdb/gdb_user32.h
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/gdb_user32.h 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/gdb_user32.h 2008-02-20 13:39:08.000000000 +0100
@@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
+#ifdef HAVE_SYS_USER32_H +#ifdef HAVE_SYS_USER32_H
+#include <sys/user32.h> +#include <sys/user32.h>
@ -668,11 +672,11 @@ Index: gdb-6.7/gdb/gdb_user32.h
+#endif /* _SYS_USER32_H */ +#endif /* _SYS_USER32_H */
+ +
+#endif /* HAVE_SYS_USER32_H */ +#endif /* HAVE_SYS_USER32_H */
Index: gdb-6.7/gdb/linux-nat.c Index: gdb-6.8cvs20080219/gdb/linux-nat.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/linux-nat.c 2007-10-15 21:42:26.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-19 17:27:21.000000000 +0100
+++ gdb-6.7/gdb/linux-nat.c 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-20 13:39:08.000000000 +0100
@@ -98,6 +98,21 @@ static LONGEST (*super_xfer_partial) (st @@ -104,6 +104,21 @@ static LONGEST (*super_xfer_partial) (st
const gdb_byte *, const gdb_byte *,
ULONGEST, LONGEST); ULONGEST, LONGEST);
@ -694,7 +698,7 @@ Index: gdb-6.7/gdb/linux-nat.c
static int debug_linux_nat; static int debug_linux_nat;
static void static void
show_debug_linux_nat (struct ui_file *file, int from_tty, show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -2687,11 +2696,11 @@ linux_nat_do_thread_registers (bfd *obfd @@ -2716,11 +2731,11 @@ linux_nat_do_thread_registers (bfd *obfd
else else
fill_gregset (regcache, &gregs, -1); fill_gregset (regcache, &gregs, -1);
@ -711,7 +715,7 @@ Index: gdb-6.7/gdb/linux-nat.c
if (core_regset_p if (core_regset_p
&& (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2", && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
@@ -2702,10 +2711,11 @@ linux_nat_do_thread_registers (bfd *obfd @@ -2731,10 +2746,11 @@ linux_nat_do_thread_registers (bfd *obfd
else else
fill_fpregset (regcache, &fpregs, -1); fill_fpregset (regcache, &fpregs, -1);
@ -727,7 +731,7 @@ Index: gdb-6.7/gdb/linux-nat.c
#ifdef FILL_FPXREGSET #ifdef FILL_FPXREGSET
if (core_regset_p if (core_regset_p
@@ -2799,9 +2808,9 @@ linux_nat_make_corefile_notes (bfd *obfd @@ -2828,9 +2844,9 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end); psargs_end - string_end);
} }
} }
@ -740,16 +744,16 @@ Index: gdb-6.7/gdb/linux-nat.c
} }
/* Dump information for threads. */ /* Dump information for threads. */
Index: gdb-6.7/gdb/linux-nat.h Index: gdb-6.8cvs20080219/gdb/linux-nat.h
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/linux-nat.h 2007-10-13 05:09:50.000000000 +0200 --- gdb-6.8cvs20080219.orig/gdb/linux-nat.h 2008-02-19 14:26:32.000000000 +0100
+++ gdb-6.7/gdb/linux-nat.h 2007-10-16 15:46:18.000000000 +0200 +++ gdb-6.8cvs20080219/gdb/linux-nat.h 2008-02-20 13:39:37.000000000 +0100
@@ -110,3 +110,12 @@ void linux_nat_add_target (struct target @@ -124,3 +124,12 @@ void linux_nat_switch_fork (ptid_t new_p
/* Update linux-nat internal state when changing from one fork
to another. */ /* Return the saved siginfo associated with PTID. */
void linux_nat_switch_fork (ptid_t new_ptid); struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
+ +
+/* This functions make elfcore note sections. +/* These functions make elfcore note sections.
+ They may get overriden by code adjusting data for multi-target builds. */ + They may get overriden by code adjusting data for multi-target builds. */
+extern char *(*linux_elfcore_write_prpsinfo) +extern char *(*linux_elfcore_write_prpsinfo)
+ (bfd *, char *, int *, const char *, const char *); + (bfd *, char *, int *, const char *, const char *);

View File

@ -16,17 +16,21 @@ The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
Port to GDB-6.7. Port to GDB-6.7.
Index: gdb-6.7/gdb/solib-svr4.c 2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to gdb-6.7.50.20080227.
Index: gdb-6.7.50.20080227/gdb/solib-svr4.c
=================================================================== ===================================================================
--- gdb-6.7.orig/gdb/solib-svr4.c 2007-10-14 23:04:45.000000000 +0200 --- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-02-27 08:59:06.000000000 +0100
+++ gdb-6.7/gdb/solib-svr4.c 2007-10-16 15:43:56.000000000 +0200 +++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-02-27 09:00:44.000000000 +0100
@@ -1009,10 +1009,14 @@ CORE_ADDR @@ -1017,10 +1017,14 @@ CORE_ADDR
svr4_fetch_objfile_link_map (struct objfile *objfile) svr4_fetch_objfile_link_map (struct objfile *objfile)
{ {
CORE_ADDR lm; CORE_ADDR lm;
+ int resolve; + int resolve;
if ((debug_base = locate_base ()) == 0) if (locate_base () == 0)
return 0; /* failed somehow... */ return 0; /* failed somehow... */
+for (resolve = 0; resolve <= 1; resolve++) +for (resolve = 0; resolve <= 1; resolve++)
@ -35,7 +39,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
/* Position ourselves on the first link map. */ /* Position ourselves on the first link map. */
lm = solib_svr4_r_map (); lm = solib_svr4_r_map ();
while (lm) while (lm)
@@ -1051,6 +1055,21 @@ svr4_fetch_objfile_link_map (struct objf @@ -1059,6 +1063,21 @@ svr4_fetch_objfile_link_map (struct objf
safe_strerror (errcode)); safe_strerror (errcode));
else else
{ {
@ -57,7 +61,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
/* Is this the linkmap for the file we want? */ /* Is this the linkmap for the file we want? */
/* If the file is not a shared library and has no name, /* If the file is not a shared library and has no name,
we are sure it is the main executable, so we return that. */ we are sure it is the main executable, so we return that. */
@@ -1069,6 +1088,9 @@ svr4_fetch_objfile_link_map (struct objf @@ -1077,6 +1096,9 @@ svr4_fetch_objfile_link_map (struct objf
builtin_type_void_data_ptr); builtin_type_void_data_ptr);
do_cleanups (old_chain); do_cleanups (old_chain);
} }
@ -67,10 +71,10 @@ Index: gdb-6.7/gdb/solib-svr4.c
return 0; return 0;
} }
Index: gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-main.c Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-main.c 2007-10-16 15:40:01.000000000 +0200 +++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-main.c 2008-02-27 09:00:15.000000000 +0100
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -97,10 +101,10 @@ Index: gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
+{ +{
+ return 0; + return 0;
+} +}
Index: gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c 2007-10-16 15:40:01.000000000 +0200 +++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c 2008-02-27 09:00:15.000000000 +0100
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -124,10 +128,10 @@ Index: gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
+ bug-gdb@prep.ai.mit.edu */ + bug-gdb@prep.ai.mit.edu */
+ +
+__thread int var = 42; +__thread int var = 42;
Index: gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug.exp Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug.exp
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2007-10-16 15:40:01.000000000 +0200 +++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2008-02-27 09:00:15.000000000 +0100
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
+# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006 Free Software Foundation, Inc.
+ +

View File

@ -18,11 +18,16 @@
Provide its level 0 to disable the build-id messages. Provide its level 0 to disable the build-id messages.
Resolve the RH Bug 432164. Resolve the RH Bug 432164.
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/Makefile.in gdb-6.7.1-patched/gdb/Makefile.in 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
--- gdb-6.7.1-unpatched/gdb/Makefile.in 2008-02-21 05:01:55.000000000 +0100
+++ gdb-6.7.1-patched/gdb/Makefile.in 2008-02-21 04:58:13.000000000 +0100 Port to GDB-6.8pre.
@@ -387,7 +387,7 @@ INSTALLED_LIBS=-lbfd -lreadline -lopcode
CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) \ Index: gdb-6.7.50.20080227/gdb/Makefile.in
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/Makefile.in 2008-03-01 10:30:49.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/Makefile.in 2008-03-01 10:38:01.000000000 +0100
@@ -392,7 +392,7 @@ INSTALLED_LIBS=-lbfd -lreadline -lopcode
CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
$(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \ $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
$(LIBICONV) $(LIBEXPAT) \ $(LIBICONV) $(LIBEXPAT) \
- $(LIBIBERTY) $(WIN32LIBS) - $(LIBIBERTY) $(WIN32LIBS)
@ -30,33 +35,34 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/Makefile.in g
CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS)
@@ -1932,7 +1932,8 @@ corelow.o: corelow.c $(defs_h) $(arch_ut @@ -2029,7 +2029,8 @@ corelow.o: corelow.c $(defs_h) $(arch_ut
$(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \ $(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \
$(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \ $(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \
$(exec_h) $(readline_h) $(gdb_assert_h) \ $(exec_h) $(readline_h) $(gdb_assert_h) \
- $(exceptions_h) $(solib_h) - $(exceptions_h) $(solib_h) $(filenames_h)
+ $(exceptions_h) $(solib_h) $(auxv_h) $(elf_common_h) $(objfiles_h) \ + $(exceptions_h) $(solib_h) $(filenames_h) $(auxv_h) $(elf_common_h) \
+ $(gdbcmd_h) + $(objfiles_h) $(gdbcmd_h)
core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \ core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \
$(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h) $(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h)
cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \ cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
@@ -2768,7 +2769,8 @@ symfile.o: symfile.c $(defs_h) $(bfdlink @@ -2884,7 +2885,8 @@ symfile.o: symfile.c $(defs_h) $(bfdlink
$(gdb_stabs_h) $(gdb_obstack_h) $(completer_h) $(bcache_h) \ $(gdb_stabs_h) $(gdb_obstack_h) $(completer_h) $(bcache_h) \
$(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_h) \ $(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_h) \
$(gdb_string_h) $(gdb_stat_h) $(observer_h) $(exec_h) \ $(gdb_string_h) $(gdb_stat_h) $(observer_h) $(exec_h) \
- $(parser_defs_h) $(varobj_h) $(elf_bfd_h) - $(parser_defs_h) $(varobj_h) $(elf_bfd_h) $(solib_h)
+ $(parser_defs_h) $(varobj_h) $(elf_bfd_h) $(gdb_stdint_h) $(libbfd_h) \ + $(parser_defs_h) $(varobj_h) $(elf_bfd_h) $(solib_h) $(gdb_stdint_h) \
+ $(elf_bfd_h) $(elf_external_h) + $(libbfd_h) $(elf_bfd_h) $(elf_external_h)
symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \ symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \
$(objfiles_h) $(exceptions_h) $(gdbcmd_h) $(target_h) $(value_h) \ $(objfiles_h) $(exceptions_h) $(gdbcmd_h) $(target_h) $(value_h) \
$(symfile_h) $(observer_h) $(auxv_h) $(elf_common_h) $(symfile_h) $(observer_h) $(auxv_h) $(elf_common_h)
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/corelow.c gdb-6.7.1-patched/gdb/corelow.c Index: gdb-6.7.50.20080227/gdb/corelow.c
--- gdb-6.7.1-unpatched/gdb/corelow.c 2008-02-21 05:01:55.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/corelow.c 2008-02-21 04:58:13.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/corelow.c 2008-02-09 14:45:33.000000000 +0100
@@ -44,6 +44,10 @@ +++ gdb-6.7.50.20080227/gdb/corelow.c 2008-03-01 10:30:50.000000000 +0100
#include "gdb_assert.h" @@ -45,6 +45,10 @@
#include "exceptions.h" #include "exceptions.h"
#include "solib.h" #include "solib.h"
#include "filenames.h"
+#include "auxv.h" +#include "auxv.h"
+#include "elf/common.h" +#include "elf/common.h"
+#include "objfiles.h" +#include "objfiles.h"
@ -64,7 +70,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/corelow.c gdb
#ifndef O_LARGEFILE #ifndef O_LARGEFILE
@@ -251,6 +255,56 @@ add_to_thread_list (bfd *abfd, asection @@ -248,6 +252,56 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = pid_to_ptid (thread_id); /* Yes, make it current */ inferior_ptid = pid_to_ptid (thread_id); /* Yes, make it current */
} }
@ -121,7 +127,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/corelow.c gdb
/* This routine opens and sets up the core file bfd. */ /* This routine opens and sets up the core file bfd. */
static void static void
@@ -347,6 +401,15 @@ core_open (char *filename, int from_tty) @@ -344,6 +398,15 @@ core_open (char *filename, int from_tty)
ontop = !push_target (&core_ops); ontop = !push_target (&core_ops);
discard_cleanups (old_chain); discard_cleanups (old_chain);
@ -137,7 +143,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/corelow.c gdb
/* This is done first, before anything has a chance to query the /* This is done first, before anything has a chance to query the
inferior for information such as symbols. */ inferior for information such as symbols. */
post_create_inferior (&core_ops, from_tty); post_create_inferior (&core_ops, from_tty);
@@ -678,4 +741,11 @@ _initialize_corelow (void) @@ -692,4 +755,11 @@ _initialize_corelow (void)
if (!coreops_suppress_target) if (!coreops_suppress_target)
add_target (&core_ops); add_target (&core_ops);
@ -149,10 +155,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/corelow.c gdb
+ NULL, NULL, NULL, + NULL, NULL, NULL,
+ &setlist, &showlist); + &setlist, &showlist);
} }
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/doc/gdb.texinfo gdb-6.7.1-patched/gdb/doc/gdb.texinfo Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo
--- gdb-6.7.1-unpatched/gdb/doc/gdb.texinfo 2008-02-21 05:00:36.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/doc/gdb.texinfo 2008-02-21 04:59:10.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/doc/gdb.texinfo 2008-03-01 10:30:50.000000000 +0100
@@ -12074,6 +12074,27 @@ information files. +++ gdb-6.7.50.20080227/gdb/doc/gdb.texinfo 2008-03-01 10:38:02.000000000 +0100
@@ -12208,6 +12208,27 @@ information files.
@end table @end table
@ -180,10 +187,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/doc/gdb.texin
@cindex @code{.gnu_debuglink} sections @cindex @code{.gnu_debuglink} sections
@cindex debug link sections @cindex debug link sections
A debug link is a special section of the executable file named A debug link is a special section of the executable file named
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/solib-svr4.c gdb-6.7.1-patched/gdb/solib-svr4.c Index: gdb-6.7.50.20080227/gdb/solib-svr4.c
--- gdb-6.7.1-unpatched/gdb/solib-svr4.c 2008-02-21 05:01:55.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/solib-svr4.c 2008-02-21 04:58:13.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-03-01 10:30:48.000000000 +0100
@@ -960,9 +960,34 @@ svr4_current_sos (void) +++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-03-01 10:30:50.000000000 +0100
@@ -967,9 +967,34 @@ svr4_current_sos (void)
free_so (new); free_so (new);
else else
{ {
@ -221,20 +229,21 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/solib-svr4.c
if (debug_solib) if (debug_solib)
{ {
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb-6.7.1-patched/gdb/symfile.c Index: gdb-6.7.50.20080227/gdb/symfile.c
--- gdb-6.7.1-unpatched/gdb/symfile.c 2008-02-21 05:02:16.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/symfile.c 2008-02-21 04:59:10.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/symfile.c 2008-03-01 10:30:48.000000000 +0100
@@ -53,6 +53,9 @@ +++ gdb-6.7.50.20080227/gdb/symfile.c 2008-03-01 10:47:02.000000000 +0100
#include "parser-defs.h" @@ -54,6 +54,9 @@
#include "varobj.h" #include "varobj.h"
#include "elf-bfd.h" #include "elf-bfd.h"
#include "solib.h"
+#include "gdb_stdint.h" +#include "gdb_stdint.h"
+#include "libbfd.h" +#include "libbfd.h"
+#include "elf/external.h" +#include "elf/external.h"
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
@@ -61,6 +64,7 @@ @@ -62,6 +65,7 @@
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
@ -242,7 +251,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num); int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
@@ -1262,16 +1266,65 @@ symbol_file_clear (int from_tty) @@ -1235,16 +1239,65 @@ symbol_file_clear (int from_tty)
printf_unfiltered (_("No symbol file now.\n")); printf_unfiltered (_("No symbol file now.\n"));
} }
@ -310,7 +319,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
{ {
struct build_id *retval; struct build_id *retval;
@@ -1287,6 +1340,348 @@ build_id_bfd_get (bfd *abfd) @@ -1260,6 +1313,348 @@ build_id_bfd_get (bfd *abfd)
return retval; return retval;
} }
@ -659,7 +668,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int static int
@@ -1301,7 +1696,7 @@ build_id_verify (const char *filename, s @@ -1274,7 +1669,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL) if (abfd == NULL)
return 0; return 0;
@ -668,7 +677,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
if (found == NULL) if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename); warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1317,8 +1712,9 @@ build_id_verify (const char *filename, s @@ -1290,8 +1685,9 @@ build_id_verify (const char *filename, s
return retval; return retval;
} }
@ -680,7 +689,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
{ {
char *link, *s, *retval = NULL; char *link, *s, *retval = NULL;
gdb_byte *data = build_id->data; gdb_byte *data = build_id->data;
@@ -1326,7 +1722,9 @@ build_id_to_debug_filename (struct build @@ -1299,7 +1695,9 @@ build_id_to_debug_filename (struct build
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
@ -691,7 +700,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
s = link + sprintf (link, "%s/.build-id/", debug_file_directory); s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
if (size > 0) if (size > 0)
{ {
@@ -1337,12 +1735,14 @@ build_id_to_debug_filename (struct build @@ -1310,12 +1708,14 @@ build_id_to_debug_filename (struct build
*s++ = '/'; *s++ = '/';
while (size-- > 0) while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++); s += sprintf (s, "%02x", (unsigned) *data++);
@ -708,7 +717,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
if (retval != NULL && !build_id_verify (retval, build_id)) if (retval != NULL && !build_id_verify (retval, build_id))
{ {
@@ -1350,9 +1750,202 @@ build_id_to_debug_filename (struct build @@ -1323,9 +1723,202 @@ build_id_to_debug_filename (struct build
retval = NULL; retval = NULL;
} }
@ -911,7 +920,20 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
static char * static char *
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
{ {
@@ -1447,23 +2040,27 @@ find_separate_debug_file (struct objfile @@ -1411,32 +2004,36 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
+ char *basename = NULL;
+ char *dir = NULL;
+ char *debugfile = NULL;
char *name_copy;
- char *canon_name;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
unsigned long crc32; unsigned long crc32;
int i; int i;
struct build_id *build_id; struct build_id *build_id;
@ -944,64 +966,103 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
} }
basename = get_debug_link_info (objfile, &crc32); basename = get_debug_link_info (objfile, &crc32);
@@ -1471,7 +2068,10 @@ find_separate_debug_file (struct objfile @@ -1444,7 +2041,7 @@ find_separate_debug_file (struct objfile
if (basename == NULL) if (basename == NULL)
/* There's no separate debug info, hence there's no way we could /* There's no separate debug info, hence there's no way we could
load it => no warning. */ load it => no warning. */
- return NULL; - return NULL;
+ { + goto cleanup_return_debugfile;
+ xfree (build_id_filename);
+ return NULL;
+ }
dir = xstrdup (objfile->name); dir = xstrdup (objfile->name);
@@ -1500,6 +2100,7 @@ find_separate_debug_file (struct objfile @@ -1460,23 +2057,19 @@ find_separate_debug_file (struct objfile
gdb_assert (i >= 0 && IS_DIR_SEPARATOR (dir[i]));
dir[i+1] = '\0';
- debugfile = alloca (strlen (debug_file_directory) + 1
- + strlen (dir)
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + strlen (dir)
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name)) if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{ - {
+ xfree (build_id_filename); - xfree (basename);
xfree (basename); - xfree (dir);
xfree (dir); - return xstrdup (debugfile);
return xstrdup (debugfile); - }
@@ -1513,6 +2114,7 @@ find_separate_debug_file (struct objfile + goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1485,11 +2078,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name)) if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{ - {
+ xfree (build_id_filename); - xfree (basename);
xfree (basename); - xfree (dir);
xfree (dir); - return xstrdup (debugfile);
return xstrdup (debugfile); - }
@@ -1526,6 +2128,7 @@ find_separate_debug_file (struct objfile + goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1498,11 +2087,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name)) if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{ - {
+ xfree (build_id_filename); - xfree (basename);
xfree (basename); - xfree (dir);
xfree (dir); - return xstrdup (debugfile);
return xstrdup (debugfile); - }
@@ -1545,6 +2148,7 @@ find_separate_debug_file (struct objfile + goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1517,20 +2102,19 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name)) if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{ - {
+ xfree (build_id_filename); - xfree (canon_name);
xfree (canon_name); - xfree (basename);
xfree (basename); - xfree (dir);
xfree (dir); - return xstrdup (debugfile);
@@ -1552,6 +2156,12 @@ find_separate_debug_file (struct objfile - }
} + goto cleanup_return_debugfile;
} }
-
+ if (build_id_filename != NULL) - if (canon_name)
+ { - xfree (canon_name);
+ build_id_print_missing (objfile->name, build_id_filename);
+ xfree (build_id_filename);
+ }
+
if (canon_name)
xfree (canon_name);
@@ -4275,4 +4885,16 @@ the global debug-file directory prepende + debugfile = NULL;
+ if (build_id_filename != NULL)
+ build_id_print_missing (objfile->name, build_id_filename);
+
+cleanup_return_debugfile:
+ xfree (build_id_filename);
+ xfree (canon_name);
xfree (basename);
xfree (dir);
- return NULL;
+ return debugfile;
}
@@ -4220,4 +4804,16 @@ the global debug-file directory prepende
NULL, NULL,
show_debug_file_directory, show_debug_file_directory,
&setlist, &showlist); &setlist, &showlist);
@ -1018,10 +1079,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.c gdb
+ +
+ observer_attach_inferior_created (missing_debuginfos_change_inferior_created); + observer_attach_inferior_created (missing_debuginfos_change_inferior_created);
} }
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.h gdb-6.7.1-patched/gdb/symfile.h Index: gdb-6.7.50.20080227/gdb/symfile.h
--- gdb-6.7.1-unpatched/gdb/symfile.h 2008-02-21 05:01:55.000000000 +0100 ===================================================================
+++ gdb-6.7.1-patched/gdb/symfile.h 2008-02-21 04:58:13.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/symfile.h 2008-02-03 23:13:29.000000000 +0100
@@ -353,6 +353,13 @@ extern int symfile_map_offsets_to_segmen +++ gdb-6.7.50.20080227/gdb/symfile.h 2008-03-01 10:30:50.000000000 +0100
@@ -358,6 +358,13 @@ extern int symfile_map_offsets_to_segmen
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
void free_symfile_segment_data (struct symfile_segment_data *data); void free_symfile_segment_data (struct symfile_segment_data *data);

View File

@ -1,17 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=232371
diff -u -rup gdb-6.6-orig/gdb/linux-nat.c gdb-6.6/gdb/linux-nat.c
--- gdb-6.6-orig/gdb/linux-nat.c 2007-03-15 19:55:40.000000000 -0400
+++ gdb-6.6/gdb/linux-nat.c 2007-03-15 20:02:09.000000000 -0400
@@ -1014,6 +1014,10 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver
{
/* Try again with __WCLONE to check cloned processes. */
pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
+ if (pid == -1 && errno == ECHILD)
+ error (_("Can't attach %s (%s) - possible SELinux denial,"
+ " check your /var/log/messages for `avc: denied'"),
+ target_pid_to_str (ptid), safe_strerror (errno));
lp->cloned = 1;
}

View File

@ -1,26 +1,25 @@
--- ./gdb/linux-nat.c 9 Feb 2007 20:52:16 -0000 1.56 2008-03-01 Jan Kratochvil <jan.kratochvil@redhat.com>
+++ ./gdb/linux-nat.c 22 Apr 2007 17:20:25 -0000
@@ -378,9 +378,17 @@ child_follow_fork (struct target_ops *op Port to GDB-6.8pre.
Remove the `[' character from the GDB-6.8 default message.
Index: gdb-6.7.50.20080227/gdb/linux-nat.c
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/linux-nat.c 2008-03-01 10:30:48.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/linux-nat.c 2008-03-01 10:48:25.000000000 +0100
@@ -415,7 +415,7 @@ linux_child_follow_fork (struct target_o
/* Detach new forked process? */ /* Detach new forked process? */
if (detach_fork) if (detach_fork)
{ {
+ static int advice_printed = 0; - if (info_verbose || debug_linux_nat)
+ + if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat)
+ target_terminal_ours ();
+ fprintf_filtered (gdb_stdlog,
+ _("[Detaching after fork from child process %d.%s]\n"),
+ child_pid, (advice_printed ? "" :
+ _(" (Try `set detach-on-fork off'.)")));
+ advice_printed = 1;
+
if (debug_linux_nat)
{ {
- target_terminal_ours (); target_terminal_ours ();
fprintf_filtered (gdb_stdlog, fprintf_filtered (gdb_stdlog,
"Detaching after fork from child process %d.\n", Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c
child_pid); ===================================================================
--- /dev/null 1 Jan 1970 00:00:00 -0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ./gdb/testsuite/gdb.base/fork-detach.c 22 Apr 2007 17:20:25 -0000 +++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c 2008-03-01 10:30:49.000000000 +0100
@@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -79,8 +78,10 @@
+ } + }
+ return 0; + return 0;
+} +}
--- /dev/null 1 Jan 1970 00:00:00 -0000 Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp
+++ ./gdb/testsuite/gdb.base/fork-detach.exp 22 Apr 2007 17:20:25 -0000 ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp 2008-03-01 10:49:36.000000000 +0100
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
+# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007 Free Software Foundation, Inc.
+ +
@ -96,7 +97,7 @@
+# +#
+# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if $tracelevel then { +if $tracelevel then {
+ strace $tracelevel + strace $tracelevel
@ -123,5 +124,5 @@
+gdb_run_cmd +gdb_run_cmd
+# `Starting program: .*' prefix is available since gdb-6.7. +# `Starting program: .*' prefix is available since gdb-6.7.
+gdb_test "" \ +gdb_test "" \
+ "\\\[Detaching after fork from child process.*Program exited normally\\..*" \ + "Detaching after fork from child process.*Program exited normally\\..*" \
+ "Info message caught" + "Info message caught"

View File

@ -1,62 +0,0 @@
TODO: ./gdb/testsuite/gdb.threads/watchthreads2.exp
It applies only to recent (~2.6.20) Linux kernels, on RHEL4 the behavior is not
changed (and this patch has no effect there).
--- ./gdb/testsuite/gdb.threads/watchthreads.exp 9 Jan 2007 17:59:14 -0000 1.3
+++ ./gdb/testsuite/gdb.threads/watchthreads.exp 20 Apr 2007 19:11:01 -0000
@@ -65,25 +65,42 @@ set inc_line [gdb_get_line_number "Loop
# Loop and continue to allow both watchpoints to be triggered.
for {set i 0} {$i < 30} {incr i} {
- set test_flag 0
+ set test_flag_0 0
+ set test_flag_1 0
gdb_test_multiple "continue" "threaded watch loop" {
- -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
- { set args_0 1; set test_flag 1 }
- -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
- { set args_1 1; set test_flag 1 }
- -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
- { set args_0 [expr $args_0+1]; set test_flag 1 }
- -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
- { set args_1 [expr $args_1+1]; set test_flag 1 }
+ -re "(.*)$gdb_prompt $" {
+ set test_flag_1 1
+ set string $expect_out(1,string)
+ foreach match [regexp -nocase -all -inline "Hardware watchpoint .*? at .*?watchthreads.c:\[0-9\]*\r" $string] {
+ # FIXME: Test also for the trailing: \[^\r\]*main \\\(\\\) at .*?watchthreads.c:$init_line\r
+ # We cannot test the line position as we do not get it for the
+ # non-active threads (not being last in the list).
+ if [regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = 0\[^\r\]*\r\[^\r\]*New value = 1\r" $match] {
+ set args_0 1; set test_flag_0 1
+ }
+ # FIXME: Test also for the trailing: \[^\r\]*main \\\(\\\) at .*?watchthreads.c:$init_line\r
+ if [regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = 0\[^\r\]*\r\[^\r\]*New value = 1\r" $match] {
+ set args_1 1; set test_flag_0 1
+ }
+ # FIXME: Test also for the trailing: \[^\r\]*thread_function \\\(arg=0x0\\\) at .*?watchthreads.c:$inc_line\r
+ if [regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_0\[^\r\]*\r\[^\r\]*New value = [expr $args_0+1]\r" $match] {
+ set args_0 [expr $args_0+1]; set test_flag_0 1
+ }
+ # FIXME: Test also for the trailing: \[^\r\]*thread_function \\\(arg=0x0\\\) at .*?watchthreads.c:$inc_line\r
+ if [regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_1\[^\r\]*\r\[^\r\]*New value = [expr $args_1+1]\r" $match] {
+ set args_1 [expr $args_1+1]; set test_flag_0 1
+ }
+ }
+ }
}
# If we fail above, don't bother continuing loop
- if { $test_flag == 0 } {
+ if { $test_flag_0 == 0 || $test_flag_1 == 0 } {
set i 30;
}
}
# Print success message if loop succeeded.
-if { $test_flag == 1 } {
+if { $test_flag_0 == 1 && $test_flag_1 == 1 } {
pass "threaded watch loop"
}

View File

@ -6,9 +6,15 @@
(linux_xfer_partial_lwp): ... here. (linux_xfer_partial_lwp): ... here.
(linux_xfer_partial): New function wrapping LINUX_XFER_PARTIAL_LWP. (linux_xfer_partial): New function wrapping LINUX_XFER_PARTIAL_LWP.
--- ./gdb/linux-nat.c 3 Jul 2007 17:01:55 -0000 1.65 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+++ ./gdb/linux-nat.c 7 Jul 2007 15:21:57 -0000
@@ -1343,6 +1343,31 @@ linux_handle_extended_wait (struct lwp_i Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/linux-nat.c
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-21 12:03:38.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-21 12:05:01.000000000 +0100
@@ -1570,6 +1570,31 @@ linux_handle_extended_wait (struct lwp_i
_("unknown ptrace event %d"), event); _("unknown ptrace event %d"), event);
} }
@ -40,7 +46,7 @@
/* Wait for LP to stop. Returns the wait status, or 0 if the LWP has /* Wait for LP to stop. Returns the wait status, or 0 if the LWP has
exited. */ exited. */
@@ -1350,16 +1375,31 @@ static int @@ -1577,16 +1602,31 @@ static int
wait_lwp (struct lwp_info *lp) wait_lwp (struct lwp_info *lp)
{ {
pid_t pid; pid_t pid;
@ -76,7 +82,7 @@
if (pid == -1 && errno == ECHILD) if (pid == -1 && errno == ECHILD)
{ {
/* The thread has previously exited. We need to delete it /* The thread has previously exited. We need to delete it
@@ -3144,10 +3159,12 @@ linux_proc_pending_signals (int pid, sig @@ -3451,10 +3491,12 @@ linux_proc_pending_signals (int pid, sig
fclose (procfile); fclose (procfile);
} }
@ -92,7 +98,7 @@
{ {
LONGEST xfer; LONGEST xfer;
@@ -3164,6 +3181,45 @@ linux_xfer_partial (struct target_ops *o @@ -3495,6 +3537,45 @@ linux_xfer_partial (struct target_ops *o
offset, len); offset, len);
} }
@ -135,6 +141,6 @@
+ return xfer; + return xfer;
+} +}
+ +
/* Create a prototype generic Linux target. The client can override /* Create a prototype generic GNU/Linux target. The client can override
it with local methods. */ it with local methods. */

View File

@ -1,422 +0,0 @@
2007-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (dwarf2_get_pc_bounds): Moved the `DW_AT_ranges' parsing
code with its variables OBJFILE, CU_HEADER and OBFD into ...
(dwarf2_ranges_read): ... a new function.
(read_partial_die): Implemented the parsing of `DW_AT_ranges'.
2007-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-ranges.S, gdb.dwarf2/dw2-ranges.exp,
gdb.dwarf2/dw2-ranges.lds: New files.
--- ./gdb/dwarf2read.c 26 Sep 2007 13:59:54 -0000 1.232
+++ ./gdb/dwarf2read.c 9 Oct 2007 15:03:09 -0000
@@ -3075,6 +3075,124 @@ read_lexical_block_scope (struct die_inf
local_symbols = new->locals;
}
+/* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET.
+ Return 1 if the attributes are present and valid, otherwise, return 0. */
+
+static int
+dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
+ CORE_ADDR *high_return, struct dwarf2_cu *cu)
+{
+ struct objfile *objfile = cu->objfile;
+ struct comp_unit_head *cu_header = &cu->header;
+ bfd *obfd = objfile->obfd;
+ unsigned int addr_size = cu_header->addr_size;
+ CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+ /* Base address selection entry. */
+ CORE_ADDR base;
+ int found_base;
+ unsigned int dummy;
+ gdb_byte *buffer;
+ CORE_ADDR marker;
+ int low_set;
+ CORE_ADDR low = 0;
+ CORE_ADDR high = 0;
+
+ found_base = cu_header->base_known;
+ base = cu_header->base_address;
+
+ if (offset >= dwarf2_per_objfile->ranges_size)
+ {
+ complaint (&symfile_complaints,
+ _("Offset %d out of bounds for DW_AT_ranges attribute"),
+ offset);
+ return 0;
+ }
+ buffer = dwarf2_per_objfile->ranges_buffer + offset;
+
+ /* Read in the largest possible address. */
+ marker = read_address (obfd, buffer, cu, &dummy);
+ if ((marker & mask) == mask)
+ {
+ /* If we found the largest possible address, then
+ read the base address. */
+ base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ buffer += 2 * addr_size;
+ offset += 2 * addr_size;
+ found_base = 1;
+ }
+
+ low_set = 0;
+
+ while (1)
+ {
+ CORE_ADDR range_beginning, range_end;
+
+ range_beginning = read_address (obfd, buffer, cu, &dummy);
+ buffer += addr_size;
+ range_end = read_address (obfd, buffer, cu, &dummy);
+ buffer += addr_size;
+ offset += 2 * addr_size;
+
+ /* An end of list marker is a pair of zero addresses. */
+ if (range_beginning == 0 && range_end == 0)
+ /* Found the end of list entry. */
+ break;
+
+ /* Each base address selection entry is a pair of 2 values.
+ The first is the largest possible address, the second is
+ the base address. Check for a base address here. */
+ if ((range_beginning & mask) == mask)
+ {
+ /* If we found the largest possible address, then
+ read the base address. */
+ base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ found_base = 1;
+ continue;
+ }
+
+ if (!found_base)
+ {
+ /* We have no valid base address for the ranges
+ data. */
+ complaint (&symfile_complaints,
+ _("Invalid .debug_ranges data (no base address)"));
+ return 0;
+ }
+
+ range_beginning += base;
+ range_end += base;
+
+ /* FIXME: This is recording everything as a low-high
+ segment of consecutive addresses. We should have a
+ data structure for discontiguous block ranges
+ instead. */
+ if (! low_set)
+ {
+ low = range_beginning;
+ high = range_end;
+ low_set = 1;
+ }
+ else
+ {
+ if (range_beginning < low)
+ low = range_beginning;
+ if (range_end > high)
+ high = range_end;
+ }
+ }
+
+ if (! low_set)
+ /* If the first entry is an end-of-list marker, the range
+ describes an empty scope, i.e. no instructions. */
+ return 0;
+
+ if (low_return)
+ *low_return = low;
+ if (high_return)
+ *high_return = high;
+ return 1;
+}
+
/* Get low and high pc attributes from a die. Return 1 if the attributes
are present and valid, otherwise, return 0. Return -1 if the range is
discontinuous, i.e. derived from DW_AT_ranges information. */
@@ -3082,10 +3200,7 @@ static int
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR *highpc, struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->objfile;
- struct comp_unit_head *cu_header = &cu->header;
struct attribute *attr;
- bfd *obfd = objfile->obfd;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
int ret = 0;
@@ -3109,108 +3224,11 @@ dwarf2_get_pc_bounds (struct die_info *d
attr = dwarf2_attr (die, DW_AT_ranges, cu);
if (attr != NULL)
{
- unsigned int addr_size = cu_header->addr_size;
- CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
- unsigned int offset = DW_UNSND (attr);
- /* Base address selection entry. */
- CORE_ADDR base;
- int found_base;
- unsigned int dummy;
- gdb_byte *buffer;
- CORE_ADDR marker;
- int low_set;
-
- found_base = cu_header->base_known;
- base = cu_header->base_address;
-
- if (offset >= dwarf2_per_objfile->ranges_size)
- {
- complaint (&symfile_complaints,
- _("Offset %d out of bounds for DW_AT_ranges attribute"),
- offset);
- return 0;
- }
- buffer = dwarf2_per_objfile->ranges_buffer + offset;
-
- /* Read in the largest possible address. */
- marker = read_address (obfd, buffer, cu, &dummy);
- if ((marker & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- buffer += 2 * addr_size;
- offset += 2 * addr_size;
- found_base = 1;
- }
-
- low_set = 0;
-
- while (1)
- {
- CORE_ADDR range_beginning, range_end;
-
- range_beginning = read_address (obfd, buffer, cu, &dummy);
- buffer += addr_size;
- range_end = read_address (obfd, buffer, cu, &dummy);
- buffer += addr_size;
- offset += 2 * addr_size;
-
- /* An end of list marker is a pair of zero addresses. */
- if (range_beginning == 0 && range_end == 0)
- /* Found the end of list entry. */
- break;
-
- /* Each base address selection entry is a pair of 2 values.
- The first is the largest possible address, the second is
- the base address. Check for a base address here. */
- if ((range_beginning & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- found_base = 1;
- continue;
- }
-
- if (!found_base)
- {
- /* We have no valid base address for the ranges
- data. */
- complaint (&symfile_complaints,
- _("Invalid .debug_ranges data (no base address)"));
- return 0;
- }
-
- range_beginning += base;
- range_end += base;
-
- /* FIXME: This is recording everything as a low-high
- segment of consecutive addresses. We should have a
- data structure for discontiguous block ranges
- instead. */
- if (! low_set)
- {
- low = range_beginning;
- high = range_end;
- low_set = 1;
- }
- else
- {
- if (range_beginning < low)
- low = range_beginning;
- if (range_end > high)
- high = range_end;
- }
- }
-
- if (! low_set)
- /* If the first entry is an end-of-list marker, the range
- describes an empty scope, i.e. no instructions. */
+ if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu))
return 0;
-
+ /* Found discontinuous range of addresses. */
ret = -1;
}
}
@@ -5571,6 +5589,11 @@ read_partial_die (struct partial_die_inf
has_high_pc_attr = 1;
part_die->highpc = DW_ADDR (&attr);
break;
+ case DW_AT_ranges:
+ if (dwarf2_ranges_read (DW_UNSND (&attr), &part_die->lowpc,
+ &part_die->highpc, cu))
+ has_low_pc_attr = has_high_pc_attr = 1;
+ break;
case DW_AT_location:
/* Support the .debug_loc offsets */
if (attr_form_is_block (&attr))
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.S 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,33 @@
+/*
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ .text
+
+ .section .text._start, "ax", @progbits
+ .globl _start
+ .func _start
+_start: call func
+ .endfunc
+ .size _start, . - _start
+
+ .section .text.func, "ax", @progbits
+ .globl func
+ .func func
+func: int3
+ nop
+ .endfunc
+ .size func, . - func
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.exp 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,82 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test DW_TAG_compile_unit with no children and with neither DW_AT_low_pc nor
+# DW_AT_high_pc but with DW_AT_ranges instead. We created the hole there for
+# DW_AT_ranges by the linker script.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ verbose "Skipping i386/amd64 DW_AT_ranges test."
+ return 0
+}
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
+ verbose "Skipping i386/amd64 DW_AT_ranges test."
+ return 0
+}
+
+set testfile "dw2-ranges"
+set srcfile ${testfile}.S
+set ldsfile ${testfile}.lds
+set binfile ${objdir}/${subdir}/${testfile}
+
+# Avoid `-lm' from `lib/ada.exp' as it would fail with out `-nostdlib'.
+# Provide BOARD for SET_BOARD_INFO.
+set board [target_info name]
+set_board_info mathlib ""
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-Wl,--script=${srcdir}/${subdir}/${ldsfile} -nostdlib"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Former wrong output:
+# Program received signal SIGTRAP, Trace/breakpoint trap.
+# 0x000000000000002b in func ()
+# (gdb) bt
+# #0 0x000000000000002b in func ()
+# #1 0x0000000000000029 in _start ()
+# (gdb) _
+# Correct output:
+# Program received signal SIGTRAP, Trace/breakpoint trap.
+# func () at dw2-ranges.S:14
+# 14 nop
+# Current language: auto; currently asm
+# (gdb) bt
+# #0 func () at dw2-ranges.S:14
+# #1 0x0000000000000029 in _start () at dw2-ranges.S:6
+# (gdb) _
+# The entry #1 is missing on i386.
+# "#0 +func \\(\\) at .*dw2-ranges.S:\[0-9\]+\r\n#1 .*in _start \\(\\) at .*dw2-ranges.S:\[0-9\]+"
+
+gdb_run_cmd
+set test "run"
+gdb_test_multiple "" "$test" {
+ -re "Program received signal SIGTRAP,.*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "backtrace" "#0 +func \\(\\) at .*dw2-ranges.S:\[0-9\]+"
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.lds 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,25 @@
+/*
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+SECTIONS
+{
+ .text._start : { *(.text._start) }
+ /* Create the hole. */
+ . = . + 1;
+ .text.func : { *(.text.func) }
+}
+ENTRY(_start)

View File

@ -14,38 +14,93 @@ http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html
* gdb.texinfo (Setting Watchpoints): New paragraph on the software * gdb.texinfo (Setting Watchpoints): New paragraph on the software
watchpoints safety wrt `set scheduler-locking'. watchpoints safety wrt `set scheduler-locking'.
diff -u -ruNp gdb-6.7.1-orig/gdb/amd64-linux-nat.c gdb-6.7.1/gdb/amd64-linux-nat.c 2008-03-01 Jan Kratochvil <jan.kratochvil@redhat.com>
--- gdb-6.7.1-orig/gdb/amd64-linux-nat.c 2008-01-11 20:59:17.000000000 +0100
+++ gdb-6.7.1/gdb/amd64-linux-nat.c 2008-01-11 20:49:42.000000000 +0100 Port to GDB-6.8pre.
@@ -501,6 +501,12 @@ amd64_linux_insert_watchpoint (CORE_ADDR
return rc; Index: gdb-6.7.50.20080227/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/amd64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/amd64-linux-nat.c 2008-03-01 16:33:40.000000000 +0100
@@ -408,25 +408,43 @@ amd64_linux_dr_set (ptid_t ptid, int reg
void
amd64_linux_dr_set_control (unsigned long control)
{
- struct lwp_info *lp;
- ptid_t ptid;
-
amd64_linux_dr[DR_CONTROL] = control;
- ALL_LWPS (lp, ptid)
- amd64_linux_dr_set (ptid, DR_CONTROL, control);
+
+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process
+ not listed for ALL_LWPS. */
+
+ if (ptid_get_lwp (inferior_ptid) == 0)
+ amd64_linux_dr_set (inferior_ptid, DR_CONTROL, control);
+ else
+ {
+ struct lwp_info *lp;
+ ptid_t ptid;
+
+ ALL_LWPS (lp, ptid)
+ amd64_linux_dr_set (ptid, DR_CONTROL, control);
+ }
} }
void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
- struct lwp_info *lp;
- ptid_t ptid;
-
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
amd64_linux_dr[DR_FIRSTADDR + regnum] = addr;
- ALL_LWPS (lp, ptid)
- amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+
+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process
+ not listed for ALL_LWPS. */
+
+ if (ptid_get_lwp (inferior_ptid) == 0)
+ amd64_linux_dr_set (inferior_ptid, DR_FIRSTADDR + regnum, addr);
+ else
+ {
+ struct lwp_info *lp;
+ ptid_t ptid;
+
+ ALL_LWPS (lp, ptid)
+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+ }
}
void
@@ -451,6 +469,41 @@ amd64_linux_new_thread (ptid_t ptid)
amd64_linux_dr_set (ptid, DR_CONTROL, amd64_linux_dr[DR_CONTROL]);
}
+
+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child +/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child
+ process of traced FORK. We must clear such watchpoints only once during + process of traced FORK. We must clear such watchpoints only once during
+ DETACH_BREAKPOINTS. */ + DETACH_BREAKPOINTS. */
+ +
+static int amd64_linux_detach_breakpoints_pid; +static int amd64_linux_detach_breakpoints_pid;
+ +
/* Remove a watchpoint that watched the memory region which starts at +/* Remove a watchpoint that watched the memory region which starts at
address ADDR, whose length is LEN bytes, and for accesses of the + address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */ + type TYPE. Return 0 on success, -1 on failure. */
@@ -508,12 +514,33 @@ int +int
amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) +amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
{ +{
int rc;
+
+ if (ptid_get_pid (inferior_ptid) == amd64_linux_detach_breakpoints_pid) + if (ptid_get_pid (inferior_ptid) == amd64_linux_detach_breakpoints_pid)
+ return 0; + return 0;
+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */
+ amd64_linux_detach_breakpoints_pid = 0; + amd64_linux_detach_breakpoints_pid = 0;
+ +
rc = i386_remove_watchpoint (addr, len, type); + return i386_remove_watchpoint (addr, len, type);
if (!rc) +}
amd64_linux_sync_debug_registers_across_threads (); +
return rc;
}
+static void +static void
+amd64_linux_detach_breakpoints (int detached_pid) +amd64_linux_detach_breakpoints (int detached_pid)
+{ +{
@ -60,24 +115,10 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/amd64-linux-nat.c gdb-6.7.1/gdb/amd64-linux-nat
+ +
+ do_cleanups (old_chain); + do_cleanups (old_chain);
+} +}
+
/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
unused. Return 0 on success, EBUSY on failure. */ /* This function is called by libthread_db as part of its handling of
int @@ -520,6 +573,41 @@ amd64_linux_child_post_startup_inferior
@@ -532,6 +559,12 @@ int
amd64_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
{
int rc;
+
+ if (ptid_get_pid (inferior_ptid) == amd64_linux_detach_breakpoints_pid)
+ return 0;
+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */
+ amd64_linux_detach_breakpoints_pid = 0;
+
rc = i386_remove_hw_breakpoint (bp_tgt);
if (!rc)
amd64_linux_sync_debug_registers_across_threads ();
@@ -620,6 +653,41 @@ amd64_linux_child_post_startup_inferior
i386_cleanup_dregs (); i386_cleanup_dregs ();
super_post_startup_inferior (ptid); super_post_startup_inferior (ptid);
} }
@ -119,7 +160,7 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/amd64-linux-nat.c gdb-6.7.1/gdb/amd64-linux-nat
/* Provide a prototype to silence -Wmissing-prototypes. */ /* Provide a prototype to silence -Wmissing-prototypes. */
@@ -656,6 +724,9 @@ _initialize_amd64_linux_nat (void) @@ -556,6 +644,9 @@ _initialize_amd64_linux_nat (void)
linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus; linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus;
linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg; linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg;
@ -128,51 +169,99 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/amd64-linux-nat.c gdb-6.7.1/gdb/amd64-linux-nat
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, amd64_linux_new_thread);
diff -u -ruNp gdb-6.7.1-orig/gdb/config/i386/nm-i386.h gdb-6.7.1/gdb/config/i386/nm-i386.h Index: gdb-6.7.50.20080227/gdb/config/i386/nm-i386.h
--- gdb-6.7.1-orig/gdb/config/i386/nm-i386.h 2007-08-23 20:08:48.000000000 +0200 ===================================================================
+++ gdb-6.7.1/gdb/config/i386/nm-i386.h 2008-01-11 20:47:42.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/config/i386/nm-i386.h 2008-03-01 10:38:02.000000000 +0100
@@ -114,6 +114,8 @@ extern int i386_stopped_by_watchpoint (v +++ gdb-6.7.50.20080227/gdb/config/i386/nm-i386.h 2008-03-01 10:50:39.000000000 +0100
reset all debug registers by calling i386_cleanup_dregs (). */ @@ -110,6 +110,8 @@ extern int i386_stopped_by_watchpoint (v
#define CHILD_POST_STARTUP_INFERIOR #define target_remove_hw_breakpoint(bp_tgt) \
i386_remove_hw_breakpoint (bp_tgt)
+extern void i386_detach_breakpoints (int detached_pid); +extern void i386_detach_breakpoints (int detached_pid);
+ +
#endif /* I386_USE_GENERIC_WATCHPOINTS */ #endif /* I386_USE_GENERIC_WATCHPOINTS */
#endif /* NM_I386_H */ #endif /* NM_I386_H */
diff -u -ruNp gdb-6.7.1-orig/gdb/i386-linux-nat.c gdb-6.7.1/gdb/i386-linux-nat.c Index: gdb-6.7.50.20080227/gdb/i386-linux-nat.c
--- gdb-6.7.1-orig/gdb/i386-linux-nat.c 2008-01-11 20:59:17.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/i386-linux-nat.c 2008-01-11 20:49:52.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/i386-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
@@ -745,6 +745,12 @@ i386_linux_insert_watchpoint (CORE_ADDR +++ gdb-6.7.50.20080227/gdb/i386-linux-nat.c 2008-03-01 16:33:40.000000000 +0100
return rc; @@ -655,21 +655,42 @@ i386_linux_dr_set_control (unsigned long
ptid_t ptid;
i386_linux_dr[DR_CONTROL] = control;
- ALL_LWPS (lp, ptid)
- i386_linux_dr_set (ptid, DR_CONTROL, control);
+
+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process
+ not listed for ALL_LWPS. */
+
+ if (ptid_get_lwp (inferior_ptid) == 0)
+ i386_linux_dr_set (inferior_ptid, DR_CONTROL, control);
+ else
+ {
+ struct lwp_info *lp;
+ ptid_t ptid;
+
+ ALL_LWPS (lp, ptid)
+ i386_linux_dr_set (ptid, DR_CONTROL, control);
+ }
} }
void
i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
- struct lwp_info *lp;
- ptid_t ptid;
-
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
i386_linux_dr[DR_FIRSTADDR + regnum] = addr;
- ALL_LWPS (lp, ptid)
- i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+
+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process
+ not listed for ALL_LWPS. */
+
+ if (ptid_get_lwp (inferior_ptid) == 0)
+ i386_linux_dr_set (inferior_ptid, DR_FIRSTADDR + regnum, addr);
+ else
+ {
+ struct lwp_info *lp;
+ ptid_t ptid;
+
+ ALL_LWPS (lp, ptid)
+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+ }
}
void
@@ -694,6 +715,41 @@ i386_linux_new_thread (ptid_t ptid)
i386_linux_dr_set (ptid, DR_CONTROL, i386_linux_dr[DR_CONTROL]);
}
+
+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child +/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child
+ process of traced FORK. We must clear such watchpoints only once during + process of traced FORK. We must clear such watchpoints only once during
+ DETACH_BREAKPOINTS. */ + DETACH_BREAKPOINTS. */
+ +
+static int i386_linux_detach_breakpoints_pid; +static int i386_linux_detach_breakpoints_pid;
+ +
/* Remove a watchpoint that watched the memory region which starts at +/* Remove a watchpoint that watched the memory region which starts at
address ADDR, whose length is LEN bytes, and for accesses of the + address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */ + type TYPE. Return 0 on success, -1 on failure. */
@@ -752,12 +758,33 @@ int +int
i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) +i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
{ +{
int rc;
+
+ if (ptid_get_pid (inferior_ptid) == i386_linux_detach_breakpoints_pid) + if (ptid_get_pid (inferior_ptid) == i386_linux_detach_breakpoints_pid)
+ return 0; + return 0;
+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */
+ i386_linux_detach_breakpoints_pid = 0; + i386_linux_detach_breakpoints_pid = 0;
+ +
rc = i386_remove_watchpoint (addr, len, type); + return i386_remove_watchpoint (addr, len, type);
if (!rc) +}
i386_linux_sync_debug_registers_across_threads (); +
return rc;
}
+static void +static void
+i386_linux_detach_breakpoints (int detached_pid) +i386_linux_detach_breakpoints (int detached_pid)
+{ +{
@ -187,11 +276,10 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-linux-nat.c gdb-6.7.1/gdb/i386-linux-nat.c
+ +
+ do_cleanups (old_chain); + do_cleanups (old_chain);
+} +}
+
/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
unused. Return 0 on success, EBUSY on failure. */ /* Called by libthread_db. Returns a pointer to the thread local
int @@ -833,6 +889,40 @@ i386_linux_child_post_startup_inferior (
@@ -940,6 +967,40 @@ i386_linux_child_post_startup_inferior (
super_post_startup_inferior (ptid); super_post_startup_inferior (ptid);
} }
@ -232,7 +320,7 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-linux-nat.c gdb-6.7.1/gdb/i386-linux-nat.c
void void
_initialize_i386_linux_nat (void) _initialize_i386_linux_nat (void)
{ {
@@ -959,6 +1020,9 @@ _initialize_i386_linux_nat (void) @@ -852,6 +942,9 @@ _initialize_i386_linux_nat (void)
t->to_fetch_registers = i386_linux_fetch_inferior_registers; t->to_fetch_registers = i386_linux_fetch_inferior_registers;
t->to_store_registers = i386_linux_store_inferior_registers; t->to_store_registers = i386_linux_store_inferior_registers;
@ -241,11 +329,12 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-linux-nat.c gdb-6.7.1/gdb/i386-linux-nat.c
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, i386_linux_new_thread);
diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/gdb/i386-nat.c Index: gdb-6.7.50.20080227/gdb/i386-nat.c
--- gdb-6.7.1-orig/gdb/i386-nat.c 2008-01-11 20:59:17.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/i386-nat.c 2008-01-11 20:47:57.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/i386-nat.c 2008-03-01 10:38:02.000000000 +0100
@@ -545,6 +546,17 @@ i386_remove_watchpoint (CORE_ADDR addr, +++ gdb-6.7.50.20080227/gdb/i386-nat.c 2008-03-01 10:50:39.000000000 +0100
@@ -544,6 +544,17 @@ i386_remove_watchpoint (CORE_ADDR addr,
return retval; return retval;
} }
@ -263,10 +352,12 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/gdb/i386-nat.c
/* Return non-zero if we can watch a memory region that starts at /* Return non-zero if we can watch a memory region that starts at
address ADDR and whose length is LEN bytes. */ address ADDR and whose length is LEN bytes. */
--- gdb-6.5/gdb/ia64-linux-nat.c.orig 2008-01-12 15:47:40.000000000 +0100 Index: gdb-6.7.50.20080227/gdb/ia64-linux-nat.c
+++ gdb-6.5/gdb/ia64-linux-nat.c 2008-01-12 15:57:58.000000000 +0100 ===================================================================
@@ -664,12 +664,23 @@ ia64_linux_remove_watchpoint_callback (s --- gdb-6.7.50.20080227.orig/gdb/ia64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
args->len); +++ gdb-6.7.50.20080227/gdb/ia64-linux-nat.c 2008-03-01 10:50:39.000000000 +0100
@@ -583,6 +583,12 @@ ia64_linux_insert_watchpoint (CORE_ADDR
return 0;
} }
+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child +/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child
@ -275,23 +366,24 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/gdb/i386-nat.c
+ +
+static int ia64_linux_detach_breakpoints_pid; +static int ia64_linux_detach_breakpoints_pid;
+ +
/* Remove a watchpoint for all threads. */
static int static int
ia64_linux_remove_watchpoint (CORE_ADDR addr, int len) ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
{ {
struct linux_watchpoint args; @@ -590,6 +596,11 @@ ia64_linux_remove_watchpoint (CORE_ADDR
long dbr_addr, dbr_mask;
int max_watchpoints = 4;
+ if (ptid_get_pid (inferior_ptid) == ia64_linux_detach_breakpoints_pid) + if (ptid_get_pid (inferior_ptid) == ia64_linux_detach_breakpoints_pid)
+ return 0; + return 0;
+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */
+ ia64_linux_detach_breakpoints_pid = 0; + ia64_linux_detach_breakpoints_pid = 0;
+ +
args.addr = addr; if (len <= 0 || !is_power_of_2 (len))
args.len = len; return -1;
@@ -617,6 +628,22 @@ ia64_linux_remove_watchpoint (CORE_ADDR
}
@@ -771,6 +782,22 @@ ia64_linux_xfer_partial (struct target_o
/* Observer function for a new thread attach. We need to insert
existing watchpoints on the new thread. */
static void static void
+ia64_linux_detach_breakpoints (int detached_pid) +ia64_linux_detach_breakpoints (int detached_pid)
+{ +{
@ -311,9 +403,9 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/gdb/i386-nat.c
+static void +static void
ia64_linux_new_thread (ptid_t ptid) ia64_linux_new_thread (ptid_t ptid)
{ {
insert_watchpoints_for_new_thread (ptid, int i, any;
@@ -793,6 +820,40 @@ ia64_linux_save_sigtrap_info (void *queu @@ -805,6 +832,40 @@ ia64_linux_xfer_partial (struct target_o
lp->saved_trap_data); offset, len);
} }
+static int (*ia64_linux_super_follow_fork) (struct target_ops *ops, +static int (*ia64_linux_super_follow_fork) (struct target_ops *ops,
@ -353,21 +445,22 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/gdb/i386-nat.c
void _initialize_ia64_linux_nat (void); void _initialize_ia64_linux_nat (void);
/* /*
@@ -865,6 +926,9 @@ _initialize_ia64_linux_nat (void) @@ -899,6 +960,9 @@ _initialize_ia64_linux_nat (void)
super_xfer_partial = t->to_xfer_partial; t->to_insert_watchpoint = ia64_linux_insert_watchpoint;
t->to_xfer_partial = ia64_linux_xfer_partial; t->to_remove_watchpoint = ia64_linux_remove_watchpoint;
+ ia64_linux_super_follow_fork = t->to_follow_fork; + ia64_linux_super_follow_fork = t->to_follow_fork;
+ t->to_follow_fork = ia64_linux_follow_fork; + t->to_follow_fork = ia64_linux_follow_fork;
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, ia64_linux_new_thread);
diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c Index: gdb-6.7.50.20080227/gdb/ppc-linux-nat.c
--- gdb-6.7.1-orig/gdb/ppc-linux-nat.c 2007-08-30 15:13:59.000000000 +0200 ===================================================================
+++ gdb-6.7.1/gdb/ppc-linux-nat.c 2008-01-11 20:43:12.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/ppc-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
@@ -837,12 +837,23 @@ ppc_linux_insert_watchpoint (CORE_ADDR a +++ gdb-6.7.50.20080227/gdb/ppc-linux-nat.c 2008-03-01 10:50:39.000000000 +0100
return ptrace (PTRACE_SET_DEBUGREG, tid, 0, dabr_value); @@ -847,6 +847,12 @@ ppc_linux_insert_watchpoint (CORE_ADDR a
return 0;
} }
+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child +/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child
@ -379,19 +472,20 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
static int static int
ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw)
{ {
int tid; @@ -854,6 +860,11 @@ ppc_linux_remove_watchpoint (CORE_ADDR a
ptid_t ptid = inferior_ptid; ptid_t ptid;
long dabr_value = 0;
+ if (ptid_get_pid (inferior_ptid) == ppc_linux_detach_breakpoints_pid) + if (ptid_get_pid (inferior_ptid) == ppc_linux_detach_breakpoints_pid)
+ return 0; + return 0;
+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */
+ ppc_linux_detach_breakpoints_pid = 0; + ppc_linux_detach_breakpoints_pid = 0;
+ +
tid = TIDGET (ptid); saved_dabr_value = 0;
if (tid == 0) ALL_LWPS (lp, ptid)
tid = PIDGET (ptid); if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0)
@@ -850,6 +861,15 @@ ppc_linux_remove_watchpoint (CORE_ADDR a @@ -867,6 +878,15 @@ ppc_linux_new_thread (ptid_t ptid)
return ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0); ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value);
} }
+static void +static void
@ -406,8 +500,8 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
static int static int
ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{ {
@@ -945,6 +965,40 @@ fill_fpregset (const struct regcache *re @@ -976,6 +996,40 @@ ppc_linux_read_description (struct targe
fpregsetp, sizeof (*fpregsetp)); return NULL;
} }
+static int (*ppc_linux_super_follow_fork) (struct target_ops *ops, +static int (*ppc_linux_super_follow_fork) (struct target_ops *ops,
@ -447,26 +541,28 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
void _initialize_ppc_linux_nat (void); void _initialize_ppc_linux_nat (void);
void void
@@ -967,6 +1021,9 @@ _initialize_ppc_linux_nat (void) @@ -1000,6 +1054,9 @@ _initialize_ppc_linux_nat (void)
t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint;
t->to_stopped_data_address = ppc_linux_stopped_data_address; t->to_read_description = ppc_linux_read_description;
+ ppc_linux_super_follow_fork = t->to_follow_fork; + ppc_linux_super_follow_fork = t->to_follow_fork;
+ t->to_follow_fork = ppc_linux_follow_fork; + t->to_follow_fork = ppc_linux_follow_fork;
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
} linux_nat_set_new_thread (t, ppc_linux_new_thread);
--- gdb-6.7.1-unpatched/gdb/s390-nat.c 2008-01-11 15:33:48.000000000 -0500 Index: gdb-6.7.50.20080227/gdb/s390-nat.c
+++ gdb-6.7.1/gdb/s390-nat.c 2008-01-11 15:35:50.000000000 -0500 ===================================================================
@@ -269,17 +269,15 @@ s390_stopped_by_watchpoint (void) --- gdb-6.7.50.20080227.orig/gdb/s390-nat.c 2008-03-01 10:38:02.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/s390-nat.c 2008-03-01 10:50:39.000000000 +0100
@@ -283,21 +283,15 @@ s390_stopped_by_watchpoint (void)
} }
static void static void
-s390_fix_watch_points (ptid_t ptid) -s390_fix_watch_points (ptid_t ptid)
+s390_fix_watch_points_list (int tid, struct watch_area *area_list) +s390_fix_watch_points (int tid, struct watch_area *area_list)
{ {
- int tid = s390_tid (ptid); - int tid;
- -
per_struct per_info; per_struct per_info;
ptrace_area parea; ptrace_area parea;
@ -474,12 +570,16 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0; CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0;
struct watch_area *area; struct watch_area *area;
- tid = TIDGET (ptid);
- if (tid == 0)
- tid = PIDGET (ptid);
-
- for (area = watch_base; area; area = area->next) - for (area = watch_base; area; area = area->next)
+ for (area = area_list; area; area = area->next) + for (area = area_list; area; area = area->next)
{ {
watch_lo_addr = min (watch_lo_addr, area->lo_addr); watch_lo_addr = min (watch_lo_addr, area->lo_addr);
watch_hi_addr = max (watch_hi_addr, area->hi_addr); watch_hi_addr = max (watch_hi_addr, area->hi_addr);
@@ -291,7 +289,7 @@ s390_fix_watch_points (ptid_t ptid) @@ -309,7 +303,7 @@ s390_fix_watch_points (ptid_t ptid)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0) if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0)
perror_with_name (_("Couldn't retrieve watchpoint status")); perror_with_name (_("Couldn't retrieve watchpoint status"));
@ -488,20 +588,26 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
{ {
per_info.control_regs.bits.em_storage_alteration = 1; per_info.control_regs.bits.em_storage_alteration = 1;
per_info.control_regs.bits.storage_alt_space_ctl = 1; per_info.control_regs.bits.storage_alt_space_ctl = 1;
@@ -308,6 +306,12 @@ s390_fix_watch_points (ptid_t ptid) @@ -326,6 +320,18 @@ s390_fix_watch_points (ptid_t ptid)
perror_with_name (_("Couldn't modify watchpoint status")); perror_with_name (_("Couldn't modify watchpoint status"));
} }
+static void +static void
+s390_fix_watch_points (ptid_t ptid) +s390_fix_watch_points (ptid_t ptid)
+{ +{
+ s390_fix_watch_points_list (s390_tid (ptid), watch_base); + int tid;
+
+ tid = TIDGET (ptid);
+ if (tid == 0)
+ tid = PIDGET (ptid);
+
+ s390_fix_watch_points_list (tid, watch_base);
+} +}
+ +
/* Callback routine to use with iterate_over_lwps to insert a specified
watchpoint on all threads. */
static int static int
@@ -348,12 +352,23 @@ s390_remove_watchpoint_callback (struct s390_insert_watchpoint (CORE_ADDR addr, int len, int type)
{
@@ -347,6 +353,12 @@ s390_insert_watchpoint (CORE_ADDR addr,
return 0; return 0;
} }
@ -511,10 +617,11 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
+ +
+static int s390_detach_breakpoints_pid; +static int s390_detach_breakpoints_pid;
+ +
/* Remove a specified watchpoint from all threads. */
static int static int
s390_remove_watchpoint (CORE_ADDR addr, int len, int type) s390_remove_watchpoint (CORE_ADDR addr, int len, int type)
{ {
@@ -354,6 +366,11 @@ s390_remove_watchpoint (CORE_ADDR addr,
ptid_t ptid;
struct watch_area *area, **parea; struct watch_area *area, **parea;
+ if (ptid_get_pid (inferior_ptid) == s390_detach_breakpoints_pid) + if (ptid_get_pid (inferior_ptid) == s390_detach_breakpoints_pid)
@ -525,7 +632,7 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
for (parea = &watch_base; *parea; parea = &(*parea)->next) for (parea = &watch_base; *parea; parea = &(*parea)->next)
if ((*parea)->lo_addr == addr if ((*parea)->lo_addr == addr
&& (*parea)->hi_addr == addr + len - 1) && (*parea)->hi_addr == addr + len - 1)
@@ -378,6 +393,15 @@ s390_remove_watchpoint (CORE_ADDR addr, @@ -375,6 +392,15 @@ s390_remove_watchpoint (CORE_ADDR addr,
return 0; return 0;
} }
@ -541,8 +648,8 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
static int static int
s390_can_use_hw_breakpoint (int type, int cnt, int othertype) s390_can_use_hw_breakpoint (int type, int cnt, int othertype)
{ {
@@ -399,6 +423,39 @@ s390_linux_new_thread (ptid_t ptid) @@ -387,6 +413,39 @@ s390_region_ok_for_hw_watchpoint (CORE_A
s390_fix_watch_points (ptid); return 1;
} }
+static int (*s390_super_follow_fork) (struct target_ops *ops, int follow_child); +static int (*s390_super_follow_fork) (struct target_ops *ops, int follow_child);
@ -581,7 +688,7 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
void _initialize_s390_nat (void); void _initialize_s390_nat (void);
@@ -422,6 +479,9 @@ _initialize_s390_nat (void) @@ -410,6 +469,9 @@ _initialize_s390_nat (void)
t->to_insert_watchpoint = s390_insert_watchpoint; t->to_insert_watchpoint = s390_insert_watchpoint;
t->to_remove_watchpoint = s390_remove_watchpoint; t->to_remove_watchpoint = s390_remove_watchpoint;
@ -590,10 +697,11 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/gdb/ppc-linux-nat.c
+ +
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, s390_fix_watch_points);
diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
--- gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 1970-01-01 01:00:00.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 2008-01-11 20:28:48.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 2008-03-01 15:18:13.000000000 +0100
@@ -0,0 +1,160 @@ @@ -0,0 +1,160 @@
+/* Test case for forgotten hw-watchpoints after fork()-off of a process. +/* Test case for forgotten hw-watchpoints after fork()-off of a process.
+ +
@ -755,9 +863,10 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
+#else +#else
+# error "!FOLLOW_PARENT && !FOLLOW_CHILD" +# error "!FOLLOW_PARENT && !FOLLOW_CHILD"
+#endif +#endif
diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
--- gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c 1970-01-01 01:00:00.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c 2008-01-11 20:28:48.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c 2008-03-01 10:50:39.000000000 +0100
@@ -0,0 +1,154 @@ @@ -0,0 +1,154 @@
+/* Test case for forgotten hw-watchpoints after fork()-off of a process. +/* Test case for forgotten hw-watchpoints after fork()-off of a process.
+ +
@ -861,7 +970,7 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c gdb-
+} +}
+ +
+int main (void) +int main (void)
+{ +{
+ int i; + int i;
+ void *thread_result; + void *thread_result;
+ +
@ -913,9 +1022,10 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c gdb-
+ +
+ return 0; + return 0;
+} +}
diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.c gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork.c Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.c
--- gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.c 1970-01-01 01:00:00.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork.c 2008-01-11 20:28:48.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.c 2008-03-01 10:50:39.000000000 +0100
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
+/* Test case for forgotten hw-watchpoints after fork()-off of a process. +/* Test case for forgotten hw-watchpoints after fork()-off of a process.
+ +
@ -973,9 +1083,10 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.c gdb-6.7
+ +
+ return 0; + return 0;
+} +}
diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.exp gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork.exp Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.exp
--- gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.exp 1970-01-01 01:00:00.000000000 +0100 ===================================================================
+++ gdb-6.7.1/gdb/testsuite/gdb.threads/watchpoint-fork.exp 2008-01-11 20:28:48.000000000 +0100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.exp 2008-03-01 10:50:39.000000000 +0100
@@ -0,0 +1,140 @@ @@ -0,0 +1,140 @@
+# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008 Free Software Foundation, Inc.
+ +
@ -1117,47 +1228,16 @@ diff -u -ruNp gdb-6.7.1-orig/gdb/testsuite/gdb.threads/watchpoint-fork.exp gdb-6
+if {[istarget "*-*-linux*"]} { +if {[istarget "*-*-linux*"]} {
+ test child FOLLOW_CHILD + test child FOLLOW_CHILD
+} +}
Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo
=================================================================== ===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v --- gdb-6.7.50.20080227.orig/gdb/doc/gdb.texinfo 2008-03-01 10:50:39.000000000 +0100
retrieving revision 1.434 +++ gdb-6.7.50.20080227/gdb/doc/gdb.texinfo 2008-03-01 10:50:39.000000000 +0100
retrieving revision 1.435 @@ -3386,6 +3386,14 @@ confident that no other thread can becom
diff -u -r1.434 -r1.435
--- src/gdb/doc/gdb.texinfo 2007/09/28 11:09:55 1.434
+++ src/gdb/doc/gdb.texinfo 2007/10/01 00:17:58 1.435
@@ -3346,20 +3346,13 @@
way of doing that would be to set a code breakpoint at the entry to the
@code{main} function and when it breaks, set all the watchpoints.
-@quotation
@cindex watchpoints and threads
@cindex threads and watchpoints
-@emph{Warning:} In multi-thread programs, watchpoints have only limited
-usefulness. With the current watchpoint implementation, @value{GDBN}
-can only watch the value of an expression @emph{in a single thread}. If
-you are confident that the expression can only change due to the current
-thread's activity (and if you are also confident that no other thread
-can become current), then you can use watchpoints as usual. However,
-@value{GDBN} may not notice when a non-current thread's activity changes
-the expression.
+In multi-threaded programs, watchpoints will detect changes to the
+watched expression from every thread.
-@c FIXME: this is almost identical to the previous paragraph.
-@emph{HP-UX Warning:} In multi-thread programs, software watchpoints
+@quotation
+@emph{Warning:} In multi-threaded programs, software watchpoints
have only limited usefulness. If @value{GDBN} creates a software
watchpoint, it can only watch the value of an expression @emph{in a
single thread}. If you are confident that the expression can only
--- gdb-6.5/gdb/doc/gdb.texinfo-orig 2007-12-15 13:25:14.000000000 +0100
+++ gdb-6.5/gdb/doc/gdb.texinfo 2007-12-15 13:45:25.000000000 +0100
@@ -3261,6 +3261,14 @@
software watchpoints as usual. However, @value{GDBN} may not notice software watchpoints as usual. However, @value{GDBN} may not notice
when a non-current thread's activity changes the expression. (Hardware when a non-current thread's activity changes the expression. (Hardware
watchpoints, in contrast, watch an expression in all threads.) watchpoints, in contrast, watch an expression in all threads.)
+ +
+Software watchpoints single-step the current thread to track the changes. +Software watchpoints single-step the current thread to track the changes.
+Other threads are left freely running on @code{continue}; therefore, their +Other threads are left freely running on @code{continue}; therefore, their
+changes cannot be caught. To get more reliable software watchpoints, please +changes cannot be caught. To get more reliable software watchpoints, please
+use @code{set scheduler-locking on}. The default for Red Hat/Fedora +use @code{set scheduler-locking on}. The default for Red Hat/Fedora
@ -1167,3 +1247,45 @@ diff -u -r1.434 -r1.435
@end quotation @end quotation
@xref{set remote hardware-watchpoint-limit}. @xref{set remote hardware-watchpoint-limit}.
Index: gdb-6.7.50.20080227/gdb/config/i386/nm-linux.h
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/config/i386/nm-linux.h 2008-03-01 10:38:02.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/config/i386/nm-linux.h 2008-03-01 10:50:39.000000000 +0100
@@ -44,6 +44,17 @@ extern void i386_linux_dr_reset_addr (in
extern unsigned long i386_linux_dr_get_status (void);
#define I386_DR_LOW_GET_STATUS() \
i386_linux_dr_get_status ()
+
+/* Remove a watchpoint that watched the memory region which starts at
+ * address ADDR, whose length is LEN bytes, and for accesses of the
+ * type TYPE. Return 0 on success, -1 on failure. */
+extern int i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Override basic i386 macros for watchpoint and hardware breakpoint
+ insertion/removal to support threads. */
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ i386_linux_remove_watchpoint (addr, len, type)
#ifdef HAVE_PTRACE_GETFPXREGS
Index: gdb-6.7.50.20080227/gdb/config/i386/nm-linux64.h
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/config/i386/nm-linux64.h 2008-03-01 10:38:02.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/config/i386/nm-linux64.h 2008-03-01 10:50:39.000000000 +0100
@@ -50,4 +50,15 @@ extern unsigned long amd64_linux_dr_get_
#define I386_DR_LOW_GET_STATUS() \
amd64_linux_dr_get_status ()
+/* Remove a watchpoint that watched the memory region which starts at
+ * address ADDR, whose length is LEN bytes, and for accesses of the
+ * type TYPE. Return 0 on success, -1 on failure. */
+extern int amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Override basic amd64 macros for watchpoint and hardware breakpoint
+ insertion/removal to support threads. */
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ amd64_linux_remove_watchpoint (addr, len, type)
+
#endif /* nm-linux64.h */

View File

@ -17,9 +17,15 @@
* infrun.c (proceed): RESUME_STEP initialized for non-stepping. * infrun.c (proceed): RESUME_STEP initialized for non-stepping.
RESUME_STEP set according to STEP only at the end of the function. RESUME_STEP set according to STEP only at the end of the function.
--- ./gdb/inferior.h 15 Jun 2007 22:44:55 -0000 1.83 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+++ ./gdb/inferior.h 25 Jun 2007 20:33:02 -0000
@@ -194,7 +194,15 @@ extern void reopen_exec_file (void); Port to GDB-6.8pre.
Index: gdb-6.8cvs20080219/gdb/inferior.h
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/inferior.h 2008-02-14 23:03:57.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/inferior.h 2008-02-19 14:15:01.000000000 +0100
@@ -179,7 +179,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances. /* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */ Normally, use `proceed', which handles a lot of bookkeeping. */
@ -36,9 +42,11 @@
/* From misc files */ /* From misc files */
--- ./gdb/infrun.c 22 Jun 2007 12:47:48 -0000 1.243 Index: gdb-6.8cvs20080219/gdb/infrun.c
+++ ./gdb/infrun.c 25 Jun 2007 20:33:02 -0000 ===================================================================
@@ -76,7 +76,8 @@ static void set_schedlock_func (char *ar --- gdb-6.8cvs20080219.orig/gdb/infrun.c 2008-02-14 23:03:57.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/infrun.c 2008-02-19 14:24:37.000000000 +0100
@@ -74,7 +74,8 @@ static void set_schedlock_func (char *ar
struct execution_control_state; struct execution_control_state;
@ -48,7 +56,7 @@
static void xdb_handle_command (char *args, int from_tty); static void xdb_handle_command (char *args, int from_tty);
@@ -496,15 +497,18 @@ set_schedlock_func (char *args, int from @@ -508,15 +509,18 @@ set_schedlock_func (char *args, int from
STEP nonzero if we should step (zero to continue instead). STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */ SIG is the signal to give the inferior (zero for none). */
void void
@ -70,7 +78,7 @@
/* FIXME: calling breakpoint_here_p (read_pc ()) three times! */ /* FIXME: calling breakpoint_here_p (read_pc ()) three times! */
@@ -593,9 +597,10 @@ a command like `return' or `jump' to con @@ -632,9 +636,10 @@ a command like `return' or `jump' to con
resume_ptid = inferior_ptid; resume_ptid = inferior_ptid;
} }
@ -83,7 +91,7 @@
{ {
/* User-settable 'scheduler' mode requires solo thread resume. */ /* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid; resume_ptid = inferior_ptid;
@@ -711,7 +716,7 @@ static CORE_ADDR prev_pc; @@ -742,7 +747,7 @@ static CORE_ADDR prev_pc;
void void
proceed (CORE_ADDR addr, enum target_signal siggnal, int step) proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
{ {
@ -92,7 +100,7 @@
if (step > 0) if (step > 0)
step_start_function = find_pc_function (read_pc ()); step_start_function = find_pc_function (read_pc ());
@@ -725,13 +731,13 @@ proceed (CORE_ADDR addr, enum target_sig @@ -756,13 +761,13 @@ proceed (CORE_ADDR addr, enum target_sig
step one instruction before inserting breakpoints so that step one instruction before inserting breakpoints so that
we do not stop right away (and report a second hit at this we do not stop right away (and report a second hit at this
breakpoint). */ breakpoint). */
@ -108,10 +116,10 @@
} }
else else
{ {
@@ -755,9 +761,9 @@ proceed (CORE_ADDR addr, enum target_sig @@ -786,9 +791,9 @@ proceed (CORE_ADDR addr, enum target_sig
that reported the most recent event. If a step-over is required that reported the most recent event. If a step-over is required
it returns TRUE and sets the current thread to the old thread. */ it returns TRUE and sets the current thread to the old thread. */
if (prepare_to_proceed () && breakpoint_here_p (read_pc ())) if (prepare_to_proceed (step))
- oneproc = 1; - oneproc = 1;
+ resume_step = RESUME_STEP_USER; + resume_step = RESUME_STEP_USER;
@ -119,8 +127,8 @@
+ if (resume_step == RESUME_STEP_USER) + if (resume_step == RESUME_STEP_USER)
/* We will get a trace trap after one instruction. /* We will get a trace trap after one instruction.
Continue it automatically and insert breakpoints then. */ Continue it automatically and insert breakpoints then. */
trap_expected = 1; stepping_over_breakpoint = 1;
@@ -806,8 +812,13 @@ proceed (CORE_ADDR addr, enum target_sig @@ -832,8 +837,13 @@ proceed (CORE_ADDR addr, enum target_sig
updated correctly when the inferior is stopped. */ updated correctly when the inferior is stopped. */
prev_pc = read_pc (); prev_pc = read_pc ();
@ -135,7 +143,7 @@
/* Wait for it to stop (if not standalone) /* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */ and in any case decode why it stopped, and act accordingly. */
@@ -2681,14 +2690,20 @@ process_event_stop_test: @@ -2723,14 +2733,21 @@ process_event_stop_test:
/* Are we in the middle of stepping? */ /* Are we in the middle of stepping? */
@ -145,11 +153,12 @@
{ {
- return ((!ecs->handling_longjmp - return ((!ecs->handling_longjmp
- && ((step_range_end && step_resume_breakpoint == NULL) - && ((step_range_end && step_resume_breakpoint == NULL)
- || trap_expected)) - || stepping_over_breakpoint))
- || ecs->stepping_through_solib_after_catch - || ecs->stepping_through_solib_after_catch
- || bpstat_should_step ()); - || bpstat_should_step ());
+ if (!ecs->handling_longjmp + if (!ecs->handling_longjmp
+ && ((step_range_end && step_resume_breakpoint == NULL) || trap_expected)) + && ((step_range_end && step_resume_breakpoint == NULL)
+ || stepping_over_breakpoint))
+ return RESUME_STEP_USER; + return RESUME_STEP_USER;
+ +
+ if (ecs->stepping_through_solib_after_catch) + if (ecs->stepping_through_solib_after_catch)
@ -162,9 +171,11 @@
} }
/* Subroutine call with source code we should not step over. Do step /* Subroutine call with source code we should not step over. Do step
--- ./gdb/linux-nat.c 16 Jun 2007 17:16:25 -0000 1.64 Index: gdb-6.8cvs20080219/gdb/linux-nat.c
+++ ./gdb/linux-nat.c 25 Jun 2007 20:33:02 -0000 ===================================================================
@@ -1720,7 +1720,10 @@ count_events_callback (struct lwp_info * --- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-14 23:03:57.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-19 14:15:01.000000000 +0100
@@ -1751,7 +1751,10 @@ count_events_callback (struct lwp_info *
static int static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data) select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{ {
@ -176,9 +187,11 @@
return 1; return 1;
else else
return 0; return 0;
--- ./gdb/linux-nat.h 10 May 2007 21:36:00 -0000 1.18 Index: gdb-6.8cvs20080219/gdb/linux-nat.h
+++ ./gdb/linux-nat.h 25 Jun 2007 20:33:02 -0000 ===================================================================
@@ -53,8 +53,8 @@ struct lwp_info --- gdb-6.8cvs20080219.orig/gdb/linux-nat.h 2008-02-14 23:03:58.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/linux-nat.h 2008-02-19 14:15:01.000000000 +0100
@@ -55,8 +55,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */ /* If non-zero, a pending wait status. */
int status; int status;
@ -187,5 +200,5 @@
+ /* The kind of stepping of this LWP. */ + /* The kind of stepping of this LWP. */
+ enum resume_step step; + enum resume_step step;
/* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
for this LWP's last event. This may correspond to STATUS above, be the address of a hardware watchpoint. */

View File

@ -18,10 +18,15 @@
* gdb.texinfo (Attach): Document the ATTACH and DETACH commands for * gdb.texinfo (Attach): Document the ATTACH and DETACH commands for
stopped processes. Document the messages on the seen pending signals. stopped processes. Document the messages on the seen pending signals.
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/NEWS 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
--- gdb-6.5-unpatched/gdb/NEWS 2008-01-09 18:26:07.000000000 +0100
+++ gdb-6.5/gdb/NEWS 2008-01-09 15:26:30.000000000 +0100 Port to GDB-6.8pre.
@@ -9,6 +9,9 @@ Renesas M32C/M16C m32c-elf
Index: gdb-6.8cvs20080219/gdb/NEWS
===================================================================
--- gdb-6.8cvs20080219.orig/gdb/NEWS 2008-02-24 19:35:37.000000000 +0100
+++ gdb-6.8cvs20080219/gdb/NEWS 2008-02-24 19:36:26.000000000 +0100
@@ -412,6 +412,9 @@ Renesas M32C/M16C m32c-elf
Morpho Technologies ms1 ms1-elf Morpho Technologies ms1 ms1-elf
@ -31,30 +36,27 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
* New commands * New commands
init-if-undefined Initialize a convenience variable, but init-if-undefined Initialize a convenience variable, but
--- gdb-6.7.1/gdb/linux-nat.c.orig 2008-01-09 23:54:42.000000000 +0100 Index: gdb-6.8cvs20080219/gdb/linux-nat.c
+++ gdb-6.7.1/gdb/linux-nat.c 2008-01-10 00:08:07.000000000 +0100 ===================================================================
@@ -85,11 +85,20 @@ --- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-24 19:36:26.000000000 +0100
#define __WALL 0x40000000 /* Wait for any child. */ +++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-24 19:45:01.000000000 +0100
@@ -89,6 +89,15 @@
#define PTRACE_GETSIGINFO 0x4202
#endif #endif
+#define STRINGIFY_ARG(x) #x +#define STRINGIFY_ARG(x) #x
+#define STRINGIFY(x) STRINGIFY_ARG (x) +#define STRINGIFY(x) STRINGIFY_ARG (x)
+ +
+static int linux_ptrace_post_attach (struct lwp_info *lp); +static int linux_ptrace_post_attach (ptid_t ptid, int *cloned_return);
+static int kill_lwp (int lwpid, int signo); +static int kill_lwp (int lwpid, int signo);
+
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped;
+ +
/* The single-threaded native GNU/Linux target_ops. We save a pointer for /* The single-threaded native GNU/Linux target_ops. We save a pointer for
the use of the multi-threaded target. */ the use of the multi-threaded target. */
static struct target_ops *linux_ops; static struct target_ops *linux_ops;
static struct target_ops linux_ops_saved; @@ -539,6 +548,11 @@ linux_child_follow_fork (struct target_o
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped;
+
/* The saved to_xfer_partial method, inherited from inf-ptrace.c.
Called by our to_xfer_partial. */
static LONGEST (*super_xfer_partial) (struct target_ops *,
@@ -540,6 +549,11 @@ linux_child_follow_fork (struct target_o
} }
else else
{ {
@ -66,52 +68,75 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
target_detach (NULL, 0); target_detach (NULL, 0);
} }
@@ -940,7 +954,6 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver @@ -942,9 +956,8 @@ lin_lwp_attach_lwp (ptid_t ptid)
to happen. */ to happen. */
if (GET_LWP (ptid) != GET_PID (ptid) && lp == NULL) if (GET_LWP (ptid) != GET_PID (ptid) && lp == NULL)
{ {
- pid_t pid; - pid_t pid;
int status; int status;
- int cloned = 0;
+ int cloned;
if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0) if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
@@ -958,10 +971,156 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver {
if (lp == NULL) @@ -958,37 +971,20 @@ lin_lwp_attach_lwp (ptid_t ptid)
lp = add_lwp (ptid); return -1;
}
- if (debug_linux_nat) - if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog, - fprintf_unfiltered (gdb_stdlog,
- "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n", - "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
- target_pid_to_str (ptid)); - target_pid_to_str (ptid));
+ status = linux_ptrace_post_attach (lp); -
- pid = my_waitpid (GET_LWP (ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
- {
- /* Try again with __WCLONE to check cloned processes. */
- pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
- cloned = 1;
+ status = linux_ptrace_post_attach (ptid, &cloned);
+ if (status != 0) + if (status != 0)
+ { + {
+ error (_("Thread %s exited: %s"), target_pid_to_str (ptid), + error (_("Thread %s exited: %s"), target_pid_to_str (ptid),
+ status_to_str (status)); + status_to_str (status));
+ } }
+
- gdb_assert (pid == GET_LWP (ptid)
- && WIFSTOPPED (status) && WSTOPSIG (status));
-
- if (lp == NULL)
- lp = add_lwp (ptid);
+ /* ADD_LWP with TID only already after the WAITPID. */
+ lp = add_lwp (ptid);
lp->cloned = cloned;
- target_post_attach (pid);
+ target_post_attach (GET_LWP (ptid)); + target_post_attach (GET_LWP (ptid));
+
+ lp->stopped = 1; lp->stopped = 1;
+ } -
+ else - if (debug_linux_nat)
+ { - {
+ /* We assume that the LWP representing the original process is - fprintf_unfiltered (gdb_stdlog,
+ already stopped. Mark it as stopped in the data structure - "LLAL: waitpid %s received %s\n",
+ that the GNU/linux ptrace layer uses to keep track of - target_pid_to_str (ptid),
+ threads. Note that this won't have already been done since - status_to_str (status));
+ the main thread will have, we assume, been stopped by an - }
+ attach from a different layer. */ }
+ if (lp == NULL) else
+ lp = add_lwp (ptid); {
+ lp->stopped = 1; @@ -998,44 +994,202 @@ lin_lwp_attach_lwp (ptid_t ptid)
+ } threads. Note that this won't have already been done since
+ the main thread will have, we assume, been stopped by an
+ if (verbose) attach from a different layer. */
+ printf_filtered (_("[New %s]\n"), target_pid_to_str (ptid)); - if (lp == NULL)
+ - lp = add_lwp (ptid);
+ return 0; lp->stopped = 1;
+} }
+
return 0;
}
+/* Detect `T (stopped)' in `/proc/PID/status'. +/* Detect `T (stopped)' in `/proc/PID/status'.
+ Other states including `T (tracing stop)' are reported as false. */ + Other states including `T (tracing stop)' are reported as false. */
+ +
@ -119,7 +144,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
+pid_is_stopped (pid_t pid) +pid_is_stopped (pid_t pid)
+{ +{
+ FILE *status_file; + FILE *status_file;
+ char buf[100]; + char buf[100];
+ int retval = 0; + int retval = 0;
+ +
+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid); + snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
@ -135,7 +160,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
+ have_state = 1; + have_state = 1;
+ break; + break;
+ } + }
+ } + }
+ if (have_state && strstr (buf, "T (stopped)") != NULL) + if (have_state && strstr (buf, "T (stopped)") != NULL)
+ retval = 1; + retval = 1;
+ fclose (status_file); + fclose (status_file);
@ -206,11 +231,11 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
+ Similiar processing is being done in this file by WAIT_LWP. */ + Similiar processing is being done in this file by WAIT_LWP. */
+ +
+static int +static int
+linux_ptrace_post_attach (struct lwp_info *lp) +linux_ptrace_post_attach (ptid_t ptid, int *cloned_return)
+{ +{
+ ptid_t ptid = lp->ptid;
+ unsigned long sig; + unsigned long sig;
+ int this_thread_was_stopped; + int this_thread_was_stopped;
+ int cloned = 0;
+ +
+ if (debug_linux_nat) + if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog,
@ -232,52 +257,33 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
+ { + {
+ pid_t pid; + pid_t pid;
+ int status; + int status;
+
pid = my_waitpid (GET_LWP (ptid), &status, 0); + pid = my_waitpid (GET_LWP (ptid), &status, 0);
if (pid == -1 && errno == ECHILD) + if (pid == -1 && errno == ECHILD)
@@ -974,13 +1133,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver + {
target_pid_to_str (ptid), safe_strerror (errno)); + /* Try again with __WCLONE to check cloned processes. */
lp->cloned = 1; + pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
} + cloned = 1;
- + }
- gdb_assert (pid == GET_LWP (ptid) +
- && WIFSTOPPED (status) && WSTOPSIG (status));
-
- target_post_attach (pid);
-
- lp->stopped = 1;
+ gdb_assert (pid == GET_LWP (ptid)); + gdb_assert (pid == GET_LWP (ptid));
+
if (debug_linux_nat) + if (debug_linux_nat)
{ + {
@@ -989,22 +1142,32 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver + fprintf_unfiltered (gdb_stdlog,
target_pid_to_str (ptid), + "LLAL: waitpid %s received %s\n",
status_to_str (status)); + target_pid_to_str (ptid),
} + status_to_str (status));
- } + }
- else +
- {
- /* We assume that the LWP representing the original process is
- already stopped. Mark it as stopped in the data structure
- that the GNU/linux ptrace layer uses to keep track of
- threads. Note that this won't have already been done since
- the main thread will have, we assume, been stopped by an
- attach from a different layer. */
- if (lp == NULL)
- lp = add_lwp (ptid);
- lp->stopped = 1;
- }
- if (verbose)
- printf_filtered (_("[New %s]\n"), target_pid_to_str (ptid));
+ /* Check if the thread has exited. */ + /* Check if the thread has exited. */
+ if (WIFEXITED (status) || WIFSIGNALED (status)) + if (WIFEXITED (status) || WIFSIGNALED (status))
+ return status; + return status;
+ gdb_assert (WIFSTOPPED (status)); + gdb_assert (WIFSTOPPED (status));
+ sig = WSTOPSIG (status); + sig = WSTOPSIG (status);
+ gdb_assert (sig != 0); + gdb_assert (sig != 0);
+ if (sig == SIGSTOP) + if (sig == SIGSTOP)
+ break; + break;
+ +
+ /* As the second signal for stopped processes we send SIGSTOP. */ + /* As the second signal for stopped processes we send SIGSTOP. */
+ if (this_thread_was_stopped && sig == SIGCONT) + if (this_thread_was_stopped && sig == SIGCONT)
@ -295,20 +301,22 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
+ if (ptrace (PTRACE_CONT, GET_LWP (ptid), NULL, (void *) sig) != 0) + if (ptrace (PTRACE_CONT, GET_LWP (ptid), NULL, (void *) sig) != 0)
+ perror_with_name (("ptrace")); + perror_with_name (("ptrace"));
+ } + }
+ *cloned_return = cloned;
return 0; + return 0;
} +}
@@ -1013,7 +1176,6 @@ static void +
static void
linux_nat_attach (char *args, int from_tty) linux_nat_attach (char *args, int from_tty)
{ {
struct lwp_info *lp; struct lwp_info *lp;
- pid_t pid; - pid_t pid;
int status; int status;
- int cloned = 0;
+ int cloned;
/* FIXME: We should probably accept a list of process id's, and /* FIXME: We should probably accept a list of process id's, and
@@ -1024,21 +1186,12 @@ linux_nat_attach (char *args, int from_t attach all of them. */
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)); linux_ops->to_attach (args, from_tty);
lp = add_lwp (inferior_ptid);
- /* Make sure the initial process is stopped. The user-level threads - /* Make sure the initial process is stopped. The user-level threads
- layer might want to poke around in the inferior, and that won't - layer might want to poke around in the inferior, and that won't
@ -320,21 +328,27 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
- -
- /* Try again with __WCLONE to check cloned processes. */ - /* Try again with __WCLONE to check cloned processes. */
- pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE); - pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
- lp->cloned = 1; - cloned = 1;
- } - }
- -
- gdb_assert (pid == GET_PID (inferior_ptid) - gdb_assert (pid == GET_PID (inferior_ptid)
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP); - && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
+ status = linux_ptrace_post_attach (lp); -
/* Add the initial process as the first LWP to the list. */
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
+
+ status = linux_ptrace_post_attach (inferior_ptid, &cloned);
+ if (status != 0) + if (status != 0)
+ error (_("Program %s exited: %s\n"), target_pid_to_str (inferior_ptid), + error (_("Program %s exited: %s\n"), target_pid_to_str (inferior_ptid),
+ status_to_str (status)); + status_to_str (status));
+ if (lp->cloned) + if (cloned)
+ warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid)); + warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid));
+
+ /* ADD_LWP with TID only already after the WAITPID. */
lp = add_lwp (inferior_ptid);
lp->cloned = cloned;
lp->stopped = 1; @@ -1046,8 +1200,8 @@ linux_nat_attach (char *args, int from_t
@@ -1047,8 +1200,8 @@ linux_nat_attach (char *args, int from_t
lp->resumed = 1; lp->resumed = 1;
if (debug_linux_nat) if (debug_linux_nat)
{ {
@ -345,7 +359,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
} }
} }
@@ -1093,6 +1246,9 @@ detach_callback (struct lwp_info *lp, vo @@ -1092,6 +1246,9 @@ detach_callback (struct lwp_info *lp, vo
overall process id just yet. */ overall process id just yet. */
if (GET_LWP (lp->ptid) != GET_PID (lp->ptid)) if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
{ {
@ -355,7 +369,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
errno = 0; errno = 0;
if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0, if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
WSTOPSIG (lp->status)) < 0) WSTOPSIG (lp->status)) < 0)
@@ -1121,6 +1277,9 @@ linux_nat_detach (char *args, int from_t @@ -1120,6 +1277,9 @@ linux_nat_detach (char *args, int from_t
trap_ptid = null_ptid; trap_ptid = null_ptid;
@ -365,9 +379,9 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
/* Destroy LWP info; it's no longer valid. */ /* Destroy LWP info; it's no longer valid. */
init_lwp_list (); init_lwp_list ();
@@ -1258,6 +1417,14 @@ linux_nat_resume (ptid_t ptid, int step_ @@ -1255,6 +1415,14 @@ linux_nat_resume (ptid_t ptid, int step_
lp->stopped = 0; resume_callback. */
} lp->stopped = 0;
+ /* At this point, we are going to resume the inferior and if we + /* At this point, we are going to resume the inferior and if we
+ have attached to a stopped process, we no longer should leave + have attached to a stopped process, we no longer should leave
@ -380,10 +394,11 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/
if (resume_all) if (resume_all)
iterate_over_lwps (resume_callback, NULL); iterate_over_lwps (resume_callback, NULL);
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/doc/gdb.texinfo gdb-6.5/gdb/doc/gdb.texinfo Index: gdb-6.8cvs20080219/gdb/doc/gdb.texinfo
--- gdb-6.5-unpatched/gdb/doc/gdb.texinfo 2008-01-09 18:26:07.000000000 +0100 ===================================================================
+++ gdb-6.5/gdb/doc/gdb.texinfo 2008-01-09 15:26:30.000000000 +0100 --- gdb-6.8cvs20080219.orig/gdb/doc/gdb.texinfo 2008-02-24 19:36:24.000000000 +0100
@@ -2190,16 +2190,29 @@ can step and continue; you can modify st +++ gdb-6.8cvs20080219/gdb/doc/gdb.texinfo 2008-02-24 19:36:26.000000000 +0100
@@ -2176,16 +2176,29 @@ can step and continue; you can modify st
process continue running, you may use the @code{continue} command after process continue running, you may use the @code{continue} command after
attaching @value{GDBN} to the process. attaching @value{GDBN} to the process.
@ -418,4 +433,4 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/doc/gdb.texinfo g
+@key{RET} again after executing the command. +@key{RET} again after executing the command.
@end table @end table
If you exit @value{GDBN} or use the @code{run} command while you have an If you exit @value{GDBN} while you have an attached process, you detach

View File

@ -1,13 +1,8 @@
Original patch was:
http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html
http://sourceware.org/ml/gdb-cvs/2007-12/msg00123.html http://sourceware.org/ml/gdb-cvs/2007-12/msg00123.html
2007-12-22 Jan Kratochvil <jan.kratochvil@redhat.com> extended for the RHEL safety:
* dwarf2read.c (scan_partial_symbols partial_die_parent_scope)
(add_partial_symbol, pdi_needs_namespace, process_die)
(is_type_tag_for_partial, load_partial_dies, new_symbol)
(read_type_die, determine_prefix): Extend the current code of
`DW_TAG_class_type' also for `DW_TAG_interface_type'.
2007-12-28 Jan Kratochvil <jan.kratochvil@redhat.com> 2007-12-28 Jan Kratochvil <jan.kratochvil@redhat.com>
@ -15,93 +10,10 @@ http://sourceware.org/ml/gdb-cvs/2007-12/msg00123.html
`DW_TAG_class_type'-type backing for `DW_TAG_interface_type', even for `DW_TAG_class_type'-type backing for `DW_TAG_interface_type', even for
namespaces which should not apply for Java `DW_TAG_interface_type'. namespaces which should not apply for Java `DW_TAG_interface_type'.
=================================================================== 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.242 Port to GDB-6.8pre.
retrieving revision 1.243
diff -u -r1.242 -r1.243
--- src/gdb/dwarf2read.c 2007/12/17 18:38:30 1.242
+++ src/gdb/dwarf2read.c 2007/12/22 20:58:30 1.243
@@ -1747,6 +1747,7 @@
}
break;
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
if (!pdi->is_declaration)
{
@@ -1829,6 +1830,7 @@
if (parent->tag == DW_TAG_namespace
|| parent->tag == DW_TAG_structure_type
|| parent->tag == DW_TAG_class_type
+ || parent->tag == DW_TAG_interface_type
|| parent->tag == DW_TAG_union_type)
{
if (grandparent_scope == NULL)
@@ -1976,6 +1978,7 @@
0, (CORE_ADDR) 0, cu->language, objfile);
break;
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_enumeration_type:
@@ -2057,6 +2060,7 @@
case DW_TAG_namespace:
case DW_TAG_typedef:
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_enumeration_type:
@@ -2676,6 +2680,7 @@
read_lexical_block_scope (die, cu);
break;
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
read_structure_type (die, cu);
@@ -5403,6 +5408,7 @@
#endif
case DW_TAG_base_type:
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_enumeration_type:
case DW_TAG_structure_type:
case DW_TAG_subrange_type:
@@ -5608,6 +5614,7 @@
|| last_die->tag == DW_TAG_enumeration_type
|| (cu->language != language_c
&& (last_die->tag == DW_TAG_class_type
+ || last_die->tag == DW_TAG_interface_type
|| last_die->tag == DW_TAG_structure_type
|| last_die->tag == DW_TAG_union_type))))
{
@@ -7358,6 +7365,7 @@
(FIXME?) */
break;
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_set_type:
@@ -7677,6 +7685,7 @@
switch (die->tag)
{
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
read_structure_type (die, cu);
@@ -7781,6 +7790,7 @@
}
break;
case DW_TAG_class_type:
+ case DW_TAG_interface_type:
case DW_TAG_structure_type:
{
if (parent->type != NULL && TYPE_TAG_NAME (parent->type) != NULL)
Index: ./gdb/dwarf2read.c Index: ./gdb/dwarf2read.c
=================================================================== ===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v RCS file: /cvs/src/src/gdb/dwarf2read.c,v

View File

@ -4,6 +4,10 @@ http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html
* gdb.arch/i386-interface.S, gdb.arch/i386-interface.exp: New files. * gdb.arch/i386-interface.S, gdb.arch/i386-interface.exp: New files.
2008-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-interface.exp: Fix a testcase race.
--- /dev/null 1 Jan 1970 00:00:00 -0000 --- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-interface.S 22 Dec 2007 19:07:28 -0000 +++ ./gdb/testsuite/gdb.arch/i386-interface.S 22 Dec 2007 19:07:28 -0000
@@ -0,0 +1,628 @@ @@ -0,0 +1,628 @@
@ -693,14 +697,14 @@ http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html
+ +
+set test "ptype Interface" +set test "ptype Interface"
+gdb_test_multiple $test $test { +gdb_test_multiple $test $test {
+ -re "type = class Interface *extends java.lang.Object \{" { + -re "type = class Interface *extends java.lang.Object \{.*$gdb_prompt $" {
+ pass $test + pass $test
+ } + }
+} +}
+ +
+set test "ptype Class" +set test "ptype Class"
+gdb_test_multiple $test $test { +gdb_test_multiple $test $test {
+ -re "type = class Class *extends java.lang.Object implements Interface \{" { + -re "type = class Class *extends java.lang.Object implements Interface \{.*$gdb_prompt $" {
+ pass $test + pass $test
+ } + }
+} +}

View File

@ -1,61 +0,0 @@
diff -up gdb-6.7.1/gdb/ia64-tdep.c.broken gdb-6.7.1/gdb/ia64-tdep.c
--- gdb-6.7.1/gdb/ia64-tdep.c.broken 2008-01-15 15:13:54.558100457 -0500
+++ gdb-6.7.1/gdb/ia64-tdep.c 2008-01-15 15:14:23.701740030 -0500
@@ -2009,6 +2009,7 @@ ia64_sigtramp_frame_prev_register (struc
{
char dummy_valp[MAX_REGISTER_SIZE];
char buf[MAX_REGISTER_SIZE];
+ int nat_bit;
struct ia64_frame_cache *cache =
ia64_sigtramp_frame_cache (next_frame, this_cache);
@@ -2088,7 +2089,6 @@ ia64_sigtramp_frame_prev_register (struc
/* Compute address of nat collection bits */
CORE_ADDR nat_collection;
nat_addr = gr_addr | 0x1f8;
- int nat_bit;
/* If our nat collection address is bigger than bsp, we have to get
the nat collection from rnat. Otherwise, we fetch the nat
collection from the computed address. FIXME: Do not know if
diff -up gdb-6.7.1/gdb/libunwind-frame.c.broken gdb-6.7.1/gdb/libunwind-frame.c
--- gdb-6.7.1/gdb/libunwind-frame.c.broken 2008-01-15 15:39:32.341093035 -0500
+++ gdb-6.7.1/gdb/libunwind-frame.c 2008-01-15 15:48:25.254244213 -0500
@@ -133,7 +133,7 @@ static struct libunwind_frame_cache *
libunwind_frame_cache (struct frame_info *next_frame, void **this_cache)
{
unw_accessors_t *acc;
- unw_addr_space_t as;
+ unw_addr_space_t as = NULL;
unw_cursor_t *cursor_addr;
unw_word_t fp, sp;
unw_regnum_t uw_sp_regnum;
diff -up gdb-6.7.1/gdb/ia64-linux-nat.c.broken gdb-6.7.1/gdb/ia64-linux-nat.c
--- gdb-6.7.1/gdb/ia64-linux-nat.c.broken 2008-01-15 15:23:11.933209405 -0500
+++ gdb-6.7.1/gdb/ia64-linux-nat.c 2008-01-15 15:38:42.846709176 -0500
@@ -661,7 +661,7 @@ ia64_linux_remove_watchpoint_callback (s
struct linux_watchpoint *args = (struct linux_watchpoint *)data;
return ia64_linux_remove_one_watchpoint (lwp->ptid, args->addr,
- args->len);
+ args->len, args->type);
}
/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child
@@ -672,7 +672,7 @@ static int ia64_linux_detach_breakpoints
/* Remove a watchpoint for all threads. */
static int
-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len)
+ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw)
{
struct linux_watchpoint args;
@@ -925,7 +925,7 @@ ia64_linux_save_sigtrap_info (void *queu
if (lp->saved_trap_data == NULL)
lp->saved_trap_data = xmalloc (sizeof(struct siginfo));
- ptrace (PTRACE_GETSIGINFO, ptid_get_lwp (lp->ptid), (PTRACE_ARG3_TYPE) 0,
+ ptrace (PTRACE_GETSIGINFO, ptid_get_lwp (lp->ptid), (PTRACE_TYPE_ARG3) 0,
lp->saved_trap_data);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,477 @@
http://sourceware.org/ml/gdb-patches/2008-02/msg00472.html
2008-02-28 Daniel Jacobowitz <dan@codesourcery.com>
* breakpoint.c (fetch_watchpoint_value): New function.
(update_watchpoint): Set and clear val_valid. Use
fetch_watchpoint_value. Handle unreadable values on the
value chain. Correct check for user-requested array watchpoints.
(breakpoint_init_inferior): Clear val_valid.
(watchpoint_value_print): New function.
(print_it_typical): Use it. Do not free or clear old_val. Print
watchpoints even if old_val == NULL.
(watchpoint_check): Use fetch_watchpoint_value. Check for values
becoming readable or unreadable.
(watch_command_1): Use fetch_watchpoint_value. Set val_valid.
(do_enable_watchpoint): Likewise.
* breakpoint.h (struct breakpoint): Update comment for val. Add
val_valid.
* NEWS: Mention watchpoints on inaccessible memory.
2008-02-28 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/watchpoint.c (global_ptr, func4): New.
(main): Call func4.
* gdb.base/watchpoint.exp: Call test_inaccessible_watchpoint.
(test_inaccessible_watchpoint): New.
[ Backported for GDB-6.8pre. ]
It fixes the regression since GDB-6.7.1rh on x86_64 -m64 -fPIE/-pie:
-PASS: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
+FAIL: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/NEWS gdb-6.7.50.20080227-dynwatch/gdb/NEWS
--- gdb-6.7.50.20080227-orig/gdb/NEWS 2008-03-03 08:42:11.000000000 +0100
+++ gdb-6.7.50.20080227-dynwatch/gdb/NEWS 2008-03-03 08:38:18.000000000 +0100
@@ -1,6 +1,9 @@
What has changed in GDB?
(Organized release by release)
+* Watchpoints can now be set on unreadable memory locations, e.g. addresses
+which will be allocated using malloc later in program execution.
+
*** Changes since GDB 6.7
* New native configurations
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoint.c gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.c
--- gdb-6.7.50.20080227-orig/gdb/breakpoint.c 2008-03-03 08:42:10.000000000 +0100
+++ gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.c 2008-03-03 08:37:33.000000000 +0100
@@ -55,6 +55,7 @@
#include "memattr.h"
#include "ada-lang.h"
#include "top.h"
+#include "wrapper.h"
#include "gdb-events.h"
#include "mi/mi-common.h"
@@ -826,7 +827,65 @@ is_hardware_watchpoint (struct breakpoin
|| bpt->type == bp_access_watchpoint);
}
-/* Assuming that B is a hardware breakpoint:
+/* Find the current value of a watchpoint on EXP. Return the value in
+ *VALP and *RESULTP and the chain of intermediate and final values
+ in *VAL_CHAIN. RESULTP and VAL_CHAIN may be NULL if the caller does
+ not need them.
+
+ If an error occurs while evaluating the expression, *RESULTP will
+ be set to NULL. *RESULTP may be a lazy value, if the result could
+ not be read from memory. It is used to determine whether a value
+ is user-specified (we should watch the whole value) or intermediate
+ (we should watch only the bit used to locate the final value).
+
+ If the final value, or any intermediate value, could not be read
+ from memory, *VALP will be set to NULL. *VAL_CHAIN will still be
+ set to any referenced values. *VALP will never be a lazy value.
+ This is the value which we store in struct breakpoint.
+
+ If VAL_CHAIN is non-NULL, *VAL_CHAIN will be released from the
+ value chain. The caller must free the values individually. If
+ VAL_CHAIN is NULL, all generated values will be left on the value
+ chain. */
+
+static void
+fetch_watchpoint_value (struct expression *exp, struct value **valp,
+ struct value **resultp, struct value **val_chain)
+{
+ struct value *mark, *new_mark, *result;
+
+ *valp = NULL;
+ if (resultp)
+ *resultp = NULL;
+ if (val_chain)
+ *val_chain = NULL;
+
+ /* Evaluate the expression. */
+ mark = value_mark ();
+ result = NULL;
+ gdb_evaluate_expression (exp, &result);
+ new_mark = value_mark ();
+ if (mark == new_mark)
+ return;
+ if (resultp)
+ *resultp = result;
+
+ /* Make sure it's not lazy, so that after the target stops again we
+ have a non-lazy previous value to compare with. */
+ if (result != NULL
+ && (!value_lazy (result) || gdb_value_fetch_lazy (result)))
+ *valp = result;
+
+ if (val_chain)
+ {
+ /* Return the chain of intermediate values. We use this to
+ decide which addresses to watch. */
+ *val_chain = new_mark;
+ value_release_to_mark (mark);
+ }
+}
+
+/* Assuming that B is a hardware watchpoint:
- Reparse watchpoint expression, is REPARSE is non-zero
- Evaluate expression and store the result in B->val
- Update the list of values that must be watched in B->loc.
@@ -837,7 +896,6 @@ static void
update_watchpoint (struct breakpoint *b, int reparse)
{
int within_current_scope;
- struct value *mark = value_mark ();
struct frame_id saved_frame_id;
struct bp_location *loc;
bpstat bs;
@@ -889,9 +947,9 @@ update_watchpoint (struct breakpoint *b,
to the user when the old value and the new value may actually
be completely different objects. */
value_free (b->val);
- b->val = NULL;
+ b->val = NULL;
+ b->val_valid = 0;
}
-
/* If we failed to parse the expression, for example because
it refers to a global variable in a not-yet-loaded shared library,
@@ -900,43 +958,37 @@ update_watchpoint (struct breakpoint *b,
is different from out-of-scope watchpoint. */
if (within_current_scope && b->exp)
{
- struct value *v, *next;
+ struct value *val_chain, *v, *result, *next;
+
+ fetch_watchpoint_value (b->exp, &v, &result, &val_chain);
- /* Evaluate the expression and make sure it's not lazy, so that
- after target stops again, we have a non-lazy previous value
- to compare with. Also, making the value non-lazy will fetch
- intermediate values as needed, which we use to decide which
- addresses to watch.
-
- The value returned by evaluate_expression is stored in b->val.
- In addition, we look at all values which were created
- during evaluation, and set watchoints at addresses as needed.
- Those values are explicitly deleted here. */
- v = evaluate_expression (b->exp);
/* Avoid setting b->val if it's already set. The meaning of
b->val is 'the last value' user saw, and we should update
it only if we reported that last value to user. As it
happens, the code that reports it updates b->val directly. */
- if (b->val == NULL)
- b->val = v;
- value_contents (v);
- value_release_to_mark (mark);
+ if (!b->val_valid)
+ {
+ b->val = v;
+ b->val_valid = 1;
+ }
/* Look at each value on the value chain. */
- for (; v; v = value_next (v))
+ for (v = val_chain; v; v = value_next (v))
{
/* If it's a memory location, and GDB actually needed
its contents to evaluate the expression, then we
- must watch it. */
+ must watch it. If the first value returned is
+ still lazy, that means an error occurred reading it;
+ watch it anyway in case it becomes readable. */
if (VALUE_LVAL (v) == lval_memory
- && ! value_lazy (v))
+ && (v == val_chain || ! value_lazy (v)))
{
struct type *vtype = check_typedef (value_type (v));
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
appear in the middle of some value chain. */
- if (v == b->val
+ if (v == result
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
{
@@ -1682,6 +1734,7 @@ breakpoint_init_inferior (enum inf_conte
if (b->val)
value_free (b->val);
b->val = NULL;
+ b->val_valid = 0;
}
break;
default:
@@ -2104,6 +2157,17 @@ top:
do_cleanups (old_chain);
}
+/* Print out the (old or new) value associated with a watchpoint. */
+
+static void
+watchpoint_value_print (struct value *val, struct ui_file *stream)
+{
+ if (val == NULL)
+ fprintf_unfiltered (stream, _("<unreadable>"));
+ else
+ value_print (val, stream, 0, Val_pretty_default);
+}
+
/* This is the normal print function for a bpstat. In the future,
much of this logic could (should?) be moved to bpstat_stop_status,
by having it set different print_it values.
@@ -2222,26 +2286,21 @@ print_it_typical (bpstat bs)
case bp_watchpoint:
case bp_hardware_watchpoint:
- if (bs->old_val != NULL)
- {
- annotate_watchpoint (b->number);
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
- mention (b);
- ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
- ui_out_text (uiout, "\nOld value = ");
- value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
- ui_out_field_stream (uiout, "old", stb);
- ui_out_text (uiout, "\nNew value = ");
- value_print (b->val, stb->stream, 0, Val_pretty_default);
- ui_out_field_stream (uiout, "new", stb);
- do_cleanups (ui_out_chain);
- ui_out_text (uiout, "\n");
- value_free (bs->old_val);
- bs->old_val = NULL;
- }
+ annotate_watchpoint (b->number);
+ if (ui_out_is_mi_like_p (uiout))
+ ui_out_field_string
+ (uiout, "reason",
+ async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+ mention (b);
+ ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
+ ui_out_text (uiout, "\nOld value = ");
+ watchpoint_value_print (bs->old_val, stb->stream);
+ ui_out_field_stream (uiout, "old", stb);
+ ui_out_text (uiout, "\nNew value = ");
+ watchpoint_value_print (b->val, stb->stream);
+ ui_out_field_stream (uiout, "new", stb);
+ do_cleanups (ui_out_chain);
+ ui_out_text (uiout, "\n");
/* More than one watchpoint may have been triggered. */
return PRINT_UNKNOWN;
break;
@@ -2254,7 +2313,7 @@ print_it_typical (bpstat bs)
mention (b);
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nValue = ");
- value_print (b->val, stb->stream, 0, Val_pretty_default);
+ watchpoint_value_print (b->val, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (ui_out_chain);
ui_out_text (uiout, "\n");
@@ -2262,7 +2321,7 @@ print_it_typical (bpstat bs)
break;
case bp_access_watchpoint:
- if (bs->old_val != NULL)
+ if (bs->old_val != NULL)
{
annotate_watchpoint (b->number);
if (ui_out_is_mi_like_p (uiout))
@@ -2272,10 +2331,8 @@ print_it_typical (bpstat bs)
mention (b);
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
- value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
+ watchpoint_value_print (bs->old_val, stb->stream);
ui_out_field_stream (uiout, "old", stb);
- value_free (bs->old_val);
- bs->old_val = NULL;
ui_out_text (uiout, "\nNew value = ");
}
else
@@ -2288,7 +2345,7 @@ print_it_typical (bpstat bs)
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nValue = ");
}
- value_print (b->val, stb->stream, 0,Val_pretty_default);
+ watchpoint_value_print (b->val, stb->stream);
ui_out_field_stream (uiout, "new", stb);
do_cleanups (ui_out_chain);
ui_out_text (uiout, "\n");
@@ -2575,13 +2632,20 @@ watchpoint_check (void *p)
we might be in the middle of evaluating a function call. */
struct value *mark = value_mark ();
- struct value *new_val = evaluate_expression (b->exp);
- if (!value_equal (b->val, new_val))
+ struct value *new_val;
+
+ fetch_watchpoint_value (b->exp, &new_val, NULL, NULL);
+ if ((b->val != NULL) != (new_val != NULL)
+ || (b->val != NULL && !value_equal (b->val, new_val)))
{
- release_value (new_val);
- value_free_to_mark (mark);
+ if (new_val != NULL)
+ {
+ release_value (new_val);
+ value_free_to_mark (mark);
+ }
bs->old_val = b->val;
b->val = new_val;
+ b->val_valid = 1;
/* We will stop here */
return WP_VALUE_CHANGED;
}
@@ -5780,10 +5844,9 @@ watch_command_1 (char *arg, int accessfl
exp_end = arg;
exp_valid_block = innermost_block;
mark = value_mark ();
- val = evaluate_expression (exp);
- release_value (val);
- if (value_lazy (val))
- value_fetch_lazy (val);
+ fetch_watchpoint_value (exp, &val, NULL, NULL);
+ if (val != NULL)
+ release_value (val);
tok = arg;
while (*tok == ' ' || *tok == '\t')
@@ -5872,6 +5935,7 @@ watch_command_1 (char *arg, int accessfl
b->exp_valid_block = exp_valid_block;
b->exp_string = savestring (exp_start, exp_end - exp_start);
b->val = val;
+ b->val_valid = 1;
b->loc->cond = cond;
if (cond_start)
b->cond_string = savestring (cond_start, cond_end - cond_start);
@@ -7755,11 +7819,11 @@ is valid is not currently in scope.\n"),
if (bpt->val)
value_free (bpt->val);
mark = value_mark ();
- bpt->val = evaluate_expression (bpt->exp);
- release_value (bpt->val);
- if (value_lazy (bpt->val))
- value_fetch_lazy (bpt->val);
-
+ fetch_watchpoint_value (bpt->exp, &bpt->val, NULL, NULL);
+ if (bpt->val)
+ release_value (bpt->val);
+ bpt->val_valid = 1;
+
if (bpt->type == bp_hardware_watchpoint ||
bpt->type == bp_read_watchpoint ||
bpt->type == bp_access_watchpoint)
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoint.h gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.h
--- gdb-6.7.50.20080227-orig/gdb/breakpoint.h 2008-03-03 08:42:10.000000000 +0100
+++ gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.h 2008-03-03 08:34:20.000000000 +0100
@@ -392,8 +392,13 @@ struct breakpoint
/* The largest block within which it is valid, or NULL if it is
valid anywhere (e.g. consists just of global symbols). */
struct block *exp_valid_block;
- /* Value of the watchpoint the last time we checked it. */
+ /* Value of the watchpoint the last time we checked it, or NULL
+ when we do not know the value yet or the value was not
+ readable. VAL is never lazy. */
struct value *val;
+ /* Nonzero if VAL is valid. If VAL_VALID is set but VAL is NULL,
+ then an error occurred reading the value. */
+ int val_valid;
/* Holds the address of the related watchpoint_scope breakpoint
when using watchpoints on local variables (might the concept
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.c gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.c
--- gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.c 2003-03-17 20:51:58.000000000 +0100
+++ gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.c 2008-03-03 08:34:20.000000000 +0100
@@ -39,6 +39,8 @@ struct foo struct1, struct2, *ptr1, *ptr
int doread = 0;
+char *global_ptr;
+
void marker1 ()
{
}
@@ -110,6 +112,14 @@ func1 ()
return 73;
}
+void
+func4 ()
+{
+ buf[0] = 3;
+ global_ptr = buf;
+ buf[0] = 7;
+}
+
int main ()
{
#ifdef usestubs
@@ -185,5 +195,7 @@ int main ()
func3 ();
+ func4 ();
+
return 0;
}
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.exp gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.exp
--- gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.exp 2008-01-01 23:53:19.000000000 +0100
+++ gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.exp 2008-03-03 08:34:20.000000000 +0100
@@ -645,6 +645,30 @@ proc test_watchpoint_and_breakpoint {} {
}
}
+proc test_inaccessible_watchpoint {} {
+ global gdb_prompt
+
+ # This is a test for watchpoints on currently inaccessible (but later
+ # valid) memory.
+
+ if [runto func4] then {
+ gdb_test "watch *global_ptr" ".*atchpoint \[0-9\]+: \\*global_ptr"
+ gdb_test "next" ".*global_ptr = buf.*"
+ gdb_test_multiple "next" "next over ptr init" {
+ -re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = .*\r\nNew value = 3 .*\r\n.*$gdb_prompt $" {
+ # We can not test for <unknown> here because NULL may be readable.
+ # This test does rely on *NULL != 3.
+ pass "next over ptr init"
+ }
+ }
+ gdb_test_multiple "next" "next over buffer set" {
+ -re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = 3 .*\r\nNew value = 7 .*\r\n.*$gdb_prompt $" {
+ pass "next over buffer set"
+ }
+ }
+ }
+}
+
# Start with a fresh gdb.
gdb_exit
@@ -655,6 +679,7 @@ set prev_timeout $timeout
set timeout 600
verbose "Timeout now 600 sec.\n"
+gdb_test "set debug solib 1"
if [initialize] then {
test_simple_watchpoint
@@ -797,6 +822,8 @@ if [initialize] then {
}
}
+ test_inaccessible_watchpoint
+
# See above.
if [istarget "mips-idt-*"] then {
gdb_exit

View File

@ -8,14 +8,14 @@ Name: gdb%{?_with_debug:-debug}
# Set version to contents of gdb/version.in. # Set version to contents of gdb/version.in.
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
Version: 6.7.1 Version: 6.7.50.20080227
# The release always contains a leading reserved number, start it at 1. # The release always contains a leading reserved number, start it at 1.
Release: 16%{?dist} Release: 1%{?dist}
License: GPL License: GPL
Group: Development/Debuggers Group: Development/Debuggers
Source: ftp://ftp.gnu.org/gnu/gdb/gdb-6.7.1.tar.bz2 Source: ftp://sourceware.org/pub/gdb/snapshots/current/gdb-6.7.50.20080227.tar.bz2
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
URL: http://gnu.org/software/gdb/ URL: http://gnu.org/software/gdb/
@ -82,10 +82,6 @@ Patch105: gdb-6.3-ppc64syscall-20040622.patch
# Stop a backtrace when a zero PC is encountered. # Stop a backtrace when a zero PC is encountered.
Patch106: gdb-6.3-framepczero-20040927.patch Patch106: gdb-6.3-framepczero-20040927.patch
# Pass the pc's section into the symbol search code; stops the lookup
# finding a symbol from the wrong section.
Patch108: gdb-6.3-ppc64section-20041026.patch
# Include the pc's section when doing a symbol lookup so that the # Include the pc's section when doing a symbol lookup so that the
# correct symbol is found. # correct symbol is found.
Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch
@ -95,9 +91,6 @@ Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
# Make upstream `set scheduler-locking step' as default. # Make upstream `set scheduler-locking step' as default.
Patch260: gdb-6.6-scheduler_locking-step-is-default.patch Patch260: gdb-6.6-scheduler_locking-step-is-default.patch
# Threaded watchpoint support
Patch113: gdb-6.3-threaded-watchpoints-20041213.patch
# Continue removing breakpoints even when failure occurs. # Continue removing breakpoints even when failure occurs.
Patch117: gdb-6.3-removebp-20041130.patch Patch117: gdb-6.3-removebp-20041130.patch
@ -112,7 +105,6 @@ Patch119: gdb-6.3-lwp-cache-20041216.patch
Patch120: gdb-6.3-type-fix-20041213.patch Patch120: gdb-6.3-type-fix-20041213.patch
# VSYSCALL and PIE # VSYSCALL and PIE
Patch122: gdb-6.3-test-pie-20050107.patch
Patch124: gdb-6.3-pie-20050110.patch Patch124: gdb-6.3-pie-20050110.patch
# Get selftest working with sep-debug-info # Get selftest working with sep-debug-info
@ -140,9 +132,6 @@ Patch259: gdb-6.3-step-thread-exit-20050211-test.patch
# Prevent gdb from being pushed into background # Prevent gdb from being pushed into background
Patch142: gdb-6.3-terminal-fix-20050214.patch Patch142: gdb-6.3-terminal-fix-20050214.patch
# Allow sibling threads to set threaded watchpoints for x86 and x86-64
Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch
# Fix unexpected compiler warning messages. # Fix unexpected compiler warning messages.
Patch147: gdb-6.3-warnings-20050317.patch Patch147: gdb-6.3-warnings-20050317.patch
@ -162,9 +151,6 @@ Patch157: gdb-6.3-security-errata-20050610.patch
# IA64 sigtramp prev register patch # IA64 sigtramp prev register patch
Patch158: gdb-6.3-ia64-sigtramp-frame-20050708.patch Patch158: gdb-6.3-ia64-sigtramp-frame-20050708.patch
# IA64 sigaltstack patch
Patch159: gdb-6.3-ia64-sigaltstack-20050711.patch
# IA64 gcore speed-up patch # IA64 gcore speed-up patch
Patch160: gdb-6.3-ia64-gcore-speedup-20050714.patch Patch160: gdb-6.3-ia64-gcore-speedup-20050714.patch
@ -263,7 +249,7 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported post gdb-6.7 release fixups. # Backported post gdb-6.7 release fixups.
Patch232: gdb-6.7.1-upstream.patch #Patch232: gdb-6.7.1-upstream.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
@ -271,9 +257,6 @@ Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
# Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) # Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832)
Patch235: gdb-6.3-bz231832-obstack-2gb.patch Patch235: gdb-6.3-bz231832-obstack-2gb.patch
# Suggest SELinux permissions problem; no assertion failure anymore (BZ 232371).
Patch236: gdb-6.6-bz232371-selinux-thread-error.patch
# Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783). # Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783).
Patch240: gdb-6.6-bz225783-prelink-path.patch Patch240: gdb-6.6-bz225783-prelink-path.patch
@ -283,18 +266,12 @@ Patch241: gdb-6.6-bz225783-gdb-debuginfo-paths.patch
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). # Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch
# Fix testcase for watchpoints in threads (for BZ 237096).
Patch246: gdb-6.6-bz237096-watchthreads-testcasefix.patch
# Notify user of a child forked process being detached (BZ 235197). # Notify user of a child forked process being detached (BZ 235197).
Patch247: gdb-6.6-bz235197-fork-detach-info.patch Patch247: gdb-6.6-bz235197-fork-detach-info.patch
# New testcase for gcore of 32bit inferiors on 64bit hosts. # New testcase for gcore of 32bit inferiors on 64bit hosts.
Patch249: gdb-6.6-gcore32-test.patch Patch249: gdb-6.6-gcore32-test.patch
# Enable PowerPC to print 128-bit long double variables (BZ 237872).
Patch251: gdb-6.5-bz237872-ppc-long-double.patch
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". # Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
Patch254: gdb-6.6-testsuite-timeouts.patch Patch254: gdb-6.6-testsuite-timeouts.patch
@ -325,9 +302,6 @@ Patch276: gdb-6.6-bfd-vdso8k.patch
# Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in'). # Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in').
Patch277: gdb-6.6-vdso-i386-on-amd64-warning.patch Patch277: gdb-6.6-vdso-i386-on-amd64-warning.patch
# Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64).
Patch278: gdb-6.6-cu-ranges.patch
# Fix hardware watchpoints after inferior forks-off some process. # Fix hardware watchpoints after inferior forks-off some process.
# Threaded `set follow-fork-mode child' still not fixed there, glibc fixes reqd. # Threaded `set follow-fork-mode child' still not fixed there, glibc fixes reqd.
# `set detach-on-fork off' not fixed there in general - it already assert-fails. # `set detach-on-fork off' not fixed there in general - it already assert-fails.
@ -362,12 +336,15 @@ Patch298: gdb-6.6-threads-static-test.patch
# Fix false `(no debugging symbols found)' on `-readnever' runs. # Fix false `(no debugging symbols found)' on `-readnever' runs.
Patch301: gdb-6.6-buildid-readnever-silent.patch Patch301: gdb-6.6-buildid-readnever-silent.patch
# ia64 build fixes from Doug Chapman (BZ 428882).
Patch303: gdb-6.7-bz428882-ia64-fix.patch
# Fix #include <asm/ptrace.h> on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64. # Fix #include <asm/ptrace.h> on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64.
Patch304: gdb-6.7-kernel-headers-compat.patch Patch304: gdb-6.7-kernel-headers-compat.patch
# Fix/implement the Fortran dynamic arrays support (BZ 377541).
Patch305: gdb-6.8-bz377541-fortran-dynamic-arrays.patch
# Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables.
Patch306: gdb-6.8-watchpoint-inaccessible-memory.patch
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
BuildRequires: flex bison sharutils expat-devel BuildRequires: flex bison sharutils expat-devel
Requires: readline Requires: readline
@ -378,7 +355,7 @@ BuildRequires: rpm-devel
# BuildRequires are set here only for the complete testsuite run. # BuildRequires are set here only for the complete testsuite run.
%if 0%{?_with_testsuite:1} %if 0%{?_with_testsuite:1}
# gcc-objc++ is not covered by the GDB testsuite. # gcc-objc++ is not covered by the GDB testsuite.
BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc fpc
# Copied from gcc-4.1.2-32 # Copied from gcc-4.1.2-32
%ifarch %{ix86} x86_64 ia64 ppc alpha %ifarch %{ix86} x86_64 ia64 ppc alpha
BuildRequires: gcc-gnat BuildRequires: gcc-gnat
@ -429,7 +406,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
# Apply patches defined above. # Apply patches defined above.
%patch232 -p1 #%patch232 -p1
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
@ -440,15 +417,12 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch104 -p1 %patch104 -p1
%patch105 -p1 %patch105 -p1
%patch106 -p1 %patch106 -p1
%patch108 -p1
%patch111 -p1 %patch111 -p1
%patch112 -p1 %patch112 -p1
%patch113 -p1
%patch117 -p1 %patch117 -p1
%patch118 -p1 %patch118 -p1
%patch119 -p1 %patch119 -p1
%patch120 -p1 %patch120 -p1
%patch122 -p1
%patch124 -p1 %patch124 -p1
%patch125 -p1 %patch125 -p1
%patch128 -p1 %patch128 -p1
@ -458,7 +432,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch141 -p1 %patch141 -p1
%patch259 -p1 %patch259 -p1
%patch142 -p1 %patch142 -p1
%patch145 -p1
%patch147 -p1 %patch147 -p1
%patch148 -p1 %patch148 -p1
%patch150 -p1 %patch150 -p1
@ -466,7 +439,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch153 -p1 %patch153 -p1
%patch157 -p1 %patch157 -p1
%patch158 -p1 %patch158 -p1
%patch159 -p1
%patch160 -p1 %patch160 -p1
%patch161 -p1 %patch161 -p1
%patch162 -p1 %patch162 -p1
@ -501,14 +473,11 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch231 -p1 %patch231 -p1
%patch234 -p1 %patch234 -p1
%patch235 -p1 %patch235 -p1
%patch236 -p1
%patch240 -p1 %patch240 -p1
%patch241 -p1 %patch241 -p1
%patch245 -p1 %patch245 -p1
%patch246 -p1
%patch247 -p1 %patch247 -p1
%patch249 -p1 %patch249 -p1
%patch251 -p1
%patch254 -p1 %patch254 -p1
%patch256 -p1 %patch256 -p1
%patch258 -p1 %patch258 -p1
@ -521,7 +490,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch275 -p1 %patch275 -p1
%patch276 -p1 %patch276 -p1
%patch277 -p1 %patch277 -p1
%patch278 -p1
%patch280 -p1 %patch280 -p1
%patch282 -p1 %patch282 -p1
%patch283 -p1 %patch283 -p1
@ -533,17 +501,22 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch296 -p1 %patch296 -p1
%patch298 -p1 %patch298 -p1
%patch301 -p1 %patch301 -p1
%patch303 -p1
%patch304 -p1 %patch304 -p1
%patch305 -p1
%patch306 -p1
# Change the version that gets printed at GDB startup, so it is RedHat find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
# Change the version that gets printed at GDB startup, so it is Fedora
# specific. # specific.
cat > gdb/version.in << _FOO cat > gdb/version.in << _FOO
Red Hat Linux (%{version}-%{release}rh) Fedora (%{version}-%{release})
_FOO _FOO
# Remove the info and other generated files added by the FSF release # Remove the info and other generated files added by the FSF release
# process. # process.
rm -f libdecnumber/gstdint.h
rm -f bfd/doc/*.info rm -f bfd/doc/*.info
rm -f bfd/doc/*.info-* rm -f bfd/doc/*.info-*
rm -f gdb/doc/*.info rm -f gdb/doc/*.info
@ -591,6 +564,7 @@ enable_build_warnings="$enable_build_warnings,-Werror"
--disable-sim \ --disable-sim \
--disable-rpath \ --disable-rpath \
--with-system-readline \ --with-system-readline \
--with-expat \
%ifarch ia64 %ifarch ia64
--with-libunwind \ --with-libunwind \
%else %else
@ -763,6 +737,14 @@ fi
%{_mandir}/*/gdbserver.1* %{_mandir}/*/gdbserver.1*
%changelog %changelog
* Mon Mar 3 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.7.50.20080227-1
- Upgrade to the upstream gdb-6.8 prerelease.
- Cleanup the leftover `.orig' files during %%prep.
- Add expat-devel check by the configure script (for the other-arch builds).
- `--with testsuite' now also BuildRequires: fpc
- Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables.
- Update the printed GDB version string to be Fedora specific.
* Sat Mar 1 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.7.1-16 * Sat Mar 1 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.7.1-16
- Run the full testsuite also in the `-fPIE -pie' mode. - Run the full testsuite also in the `-fPIE -pie' mode.

View File

@ -1 +1 @@
30a6bf36eded4ae5a152d7d71b86dc14 gdb-6.7.1.tar.bz2 79c01091740eda9b2ecf4981b603c477 gdb-6.7.50.20080227.tar.bz2