diff --git a/.cvsignore b/.cvsignore index 4e63393..1d7423f 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -gdb-6.7.1.tar.bz2 +gdb-6.7.50.20080227.tar.bz2 diff --git a/gdb-6.3-catch-debug-registers-error-20060527.patch b/gdb-6.3-catch-debug-registers-error-20060527.patch index 2d29595..aa49494 100644 --- a/gdb-6.3-catch-debug-registers-error-20060527.patch +++ b/gdb-6.3-catch-debug-registers-error-20060527.patch @@ -6,52 +6,153 @@ from Alexandre Oliva (i386_linux_set_debug_regs_for_thread): ... this, and add new function to catch exceptions in the old one. -Index: gdb-6.5/gdb/i386-linux-nat.c +2008-02-24 Jan Kratochvil + + 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.5/gdb/i386-linux-nat.c 2006-07-11 05:24:29.000000000 -0300 -@@ -27,6 +27,7 @@ - #include "observer.h" +--- gdb-6.8cvs20080219.orig/gdb/i386-linux-nat.c 2008-01-10 19:19:02.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/i386-linux-nat.c 2008-02-24 09:23:09.000000000 +0100 +@@ -24,6 +24,7 @@ + #include "regcache.h" #include "target.h" #include "linux-nat.h" +#include "exceptions.h" #include "gdb_assert.h" #include "gdb_string.h" -@@ -695,14 +696,33 @@ struct i386_debug_register_state - unsigned long control; - }; +@@ -611,20 +612,40 @@ i386_linux_dr_get (ptid_t ptid, int regn + return value; + } -static void --i386_linux_set_debug_regs_for_thread (ptid_t ptid, -- struct i386_debug_register_state *dbs) -+struct i386_debug_register_for_thread -+{ -+ ptid_t ptid; -+ struct i386_debug_register_state *dbs; -+}; -+ +-i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) +-{ +- int tid; ++struct i386_linux_dr_set ++ { ++ int tid; ++ int regnum; ++ unsigned long value; ++ }; + +- tid = TIDGET (ptid); +- if (tid == 0) +- tid = PIDGET (ptid); +static int -+i386_linux_set_dr_for_thread (void *drp) - { -+ ptid_t ptid = ((struct i386_debug_register_for_thread *)drp)->ptid; -+ struct i386_debug_register_state *dbs -+ = ((struct i386_debug_register_for_thread *)drp)->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); ++i386_linux_dr_set_core (void *data_pointer) ++{ ++ struct i386_linux_dr_set *data = data_pointer; + + errno = 0; +- ptrace (PTRACE_POKEUSER, tid, +- offsetof (struct user, u_debugreg[regnum]), value); ++ ptrace (PTRACE_POKEUSER, data->tid, ++ offsetof (struct user, u_debugreg[data->regnum]), data->value); + if (errno != 0) + perror_with_name (_("Couldn't write debug register")); + return 1; +} + +static int -+i386_linux_set_debug_regs_for_thread (ptid_t ptid, -+ struct i386_debug_register_state *dbs) ++i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) +{ -+ struct i386_debug_register_for_thread dr; -+ dr.ptid = ptid; -+ dr.dbs = dbs; -+ return catch_errors (i386_linux_set_dr_for_thread, &dr, "", RETURN_MASK_ALL); ++ struct i386_linux_dr_set data; ++ int tid; ++ ++ 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) \ diff --git a/gdb-6.3-dwattype0-20050201.patch b/gdb-6.3-dwattype0-20050201.patch index 3d299f6..20c17a5 100644 --- a/gdb-6.3-dwattype0-20050201.patch +++ b/gdb-6.3-dwattype0-20050201.patch @@ -3,11 +3,17 @@ * dwarf2read.c (die_type): Tolerate a type reference to location <0> and treat as unknown type. ---- gdb-6.3/gdb/dwarf2read.c.fix Tue Feb 1 16:48:49 2005 -+++ 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 +2008-02-24 Jan Kratochvil + + 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. */ - return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu); + return builtin_type (current_gdbarch)->builtin_void; } + else if (DW_ADDR (type_attr) == 0) + /* If we have an invalid reference to 0, ignore it and treat diff --git a/gdb-6.3-ia64-info-frame-fix-20050725.patch b/gdb-6.3-ia64-info-frame-fix-20050725.patch index 3111dc8..3b2bd9a 100644 --- a/gdb-6.3-ia64-info-frame-fix-20050725.patch +++ b/gdb-6.3-ia64-info-frame-fix-20050725.patch @@ -9,6 +9,10 @@ testsuite: * gdb.arch/ia64-sigtramp.exp: New test. * gdb.arch/ia64-sigtramp.c: Ditto. +2008-02-24 Jan Kratochvil + + 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 2005-07-25 16:42:08.000000000 -0400 @@ -0,0 +1,23 @@ @@ -104,17 +108,3 @@ testsuite: +gdb_test "f 1" ".*signal handler called.*" "frame 1" +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; - } - diff --git a/gdb-6.3-ia64-sigaltstack-20050711.patch b/gdb-6.3-ia64-sigaltstack-20050711.patch deleted file mode 100644 index 1da10ac..0000000 --- a/gdb-6.3-ia64-sigaltstack-20050711.patch +++ /dev/null @@ -1,204 +0,0 @@ -2005-07-11 Jeff Johnston - - * 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 - - 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; - }; diff --git a/gdb-6.3-ia64-sigtramp-fp-20050926.patch b/gdb-6.3-ia64-sigtramp-fp-20050926.patch index e96c5b6..5328a3f 100644 --- a/gdb-6.3-ia64-sigtramp-fp-20050926.patch +++ b/gdb-6.3-ia64-sigtramp-fp-20050926.patch @@ -16,10 +16,14 @@ Port to GDB-6.7. -Index: gdb-6.7/gdb/libunwind-frame.c +2008-02-24 Jan Kratochvil + + 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.7/gdb/libunwind-frame.c 2007-10-15 00:13:29.000000000 +0200 +--- gdb-6.8cvs20080219.orig/gdb/libunwind-frame.c 2008-01-02 00:04:03.000000000 +0100 ++++ 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) struct libunwind_frame_cache { @@ -28,19 +32,19 @@ Index: gdb-6.7/gdb/libunwind-frame.c CORE_ADDR func_addr; unw_cursor_t cursor; 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_addr_space_t as; - unw_cursor_t *cursor_addr; -- unw_word_t fp; + unw_word_t fp; + unw_word_t fp, sp; unw_regnum_t uw_sp_regnum; struct libunwind_frame_cache *cache; struct libunwind_descr *descr; -@@ -183,14 +184,29 @@ libunwind_frame_cache (struct frame_info - else /* make copy */ - cache->cursor = *cursor_addr; +@@ -171,14 +173,30 @@ libunwind_frame_cache (struct frame_info + : __LITTLE_ENDIAN); + unw_init_remote_p (&cache->cursor, as, next_frame); ++ + /* For the base address, we have a small problem. The majority + 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 @@ -50,7 +54,7 @@ Index: gdb-6.7/gdb/libunwind-frame.c + sigaltstack as we want. To handle this, we record the stack + address so the caller may calculate a more correct base address + 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); + if (ret < 0) + { @@ -65,11 +69,11 @@ Index: gdb-6.7/gdb/libunwind-frame.c } - /* 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); 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.")); } @@ -77,7 +81,7 @@ Index: gdb-6.7/gdb/libunwind-frame.c cache->base = (CORE_ADDR)fp; 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); } @@ -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. */ const struct frame_unwind * 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); unw_destroy_addr_space_p (as); if (ret > 0) @@ -118,11 +122,11 @@ Index: gdb-6.7/gdb/libunwind-frame.c 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.7/gdb/libunwind-frame.h 2007-10-15 00:08:36.000000000 +0200 -@@ -48,6 +48,9 @@ void libunwind_frame_set_descr (struct g +--- gdb-6.8cvs20080219.orig/gdb/libunwind-frame.h 2008-01-02 00:04:03.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/libunwind-frame.h 2008-02-24 20:23:47.000000000 +0100 +@@ -47,6 +47,9 @@ void libunwind_frame_set_descr (struct g void libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache, 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, int regnum, int *optimizedp, 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.7/gdb/ia64-tdep.c 2007-10-15 00:08:36.000000000 +0200 -@@ -2968,7 +2968,7 @@ ia64_libunwind_sigtramp_frame_this_id (s +--- gdb-6.8cvs20080219.orig/gdb/ia64-tdep.c 2008-02-24 20:23:40.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/ia64-tdep.c 2008-02-24 20:23:47.000000000 +0100 +@@ -2942,7 +2942,7 @@ ia64_libunwind_sigtramp_frame_this_id (s struct frame_id id; CORE_ADDR prev_ip; @@ -145,7 +149,7 @@ Index: gdb-6.7/gdb/ia64-tdep.c if (frame_id_eq (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); bsp = extract_unsigned_integer (buf, 8); diff --git a/gdb-6.3-nonthreaded-wp-20050117.patch b/gdb-6.3-nonthreaded-wp-20050117.patch index e073b8a..8ec23fb 100644 --- a/gdb-6.3-nonthreaded-wp-20050117.patch +++ b/gdb-6.3-nonthreaded-wp-20050117.patch @@ -13,10 +13,14 @@ Port to GDB-6.7. -Index: gdb-6.7/gdb/doc/observer.texi +2008-02-24 Jan Kratochvil + + 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.7/gdb/doc/observer.texi 2007-10-14 23:24:52.000000000 +0200 +--- gdb-6.8cvs20080219.orig/gdb/doc/observer.texi 2007-10-09 13:06:07.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 haven't been loaded yet. @end deftypefun @@ -28,11 +32,19 @@ Index: gdb-6.7/gdb/doc/observer.texi @deftypefun void solib_unloaded (struct so_list *@var{solib}) The shared library specified by @var{solib} has been unloaded. @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.7/gdb/linux-nat.c 2007-10-14 23:24:52.000000000 +0200 -@@ -742,11 +742,26 @@ iterate_over_lwps (int (*callback) (stru +--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-21 17:45:45.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-22 08:12:57.000000000 +0100 +@@ -37,6 +37,7 @@ + #include "regset.h" + #include "inf-ptrace.h" + #include "auxv.h" ++#include "observer.h" + #include /* for MAXPATHLEN */ + #include /* 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; @@ -62,8 +74,8 @@ Index: gdb-6.7/gdb/linux-nat.c } return NULL; -@@ -3272,6 +3284,18 @@ linux_nat_add_target (struct target_ops - thread_db_init (t); +@@ -3319,6 +3335,18 @@ linux_nat_get_siginfo (ptid_t ptid) + return &lp->siginfo; } +/* Observer function for a mourn inferior event. This is needed @@ -81,7 +93,7 @@ Index: gdb-6.7/gdb/linux-nat.c 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\ all -- list all available /proc info.")); @@ -90,10 +102,10 @@ Index: gdb-6.7/gdb/linux-nat.c /* Save the original signal 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.7/gdb/target.c 2007-10-14 23:25:13.000000000 +0200 +--- gdb-6.8cvs20080219.orig/gdb/target.c 2008-02-14 23:04:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/target.c 2008-02-22 08:10:37.000000000 +0100 @@ -39,6 +39,7 @@ #include "gdbcore.h" #include "exceptions.h" @@ -116,11 +128,11 @@ Index: gdb-6.7/gdb/target.c static int nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, 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.7/gdb/target.h 2007-10-14 23:24:52.000000000 +0200 -@@ -864,8 +864,7 @@ int target_follow_fork (int follow_child +--- gdb-6.8cvs20080219.orig/gdb/target.h 2008-01-02 00:04:05.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/target.h 2008-02-22 08:10:37.000000000 +0100 +@@ -861,8 +861,7 @@ int target_follow_fork (int follow_child /* 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? */ -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 ---- 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 +Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c +=================================================================== +--- /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 @@ +/* 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 + 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. @@ -163,9 +176,10 @@ diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.bas + sleep (60); + 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 ---- 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 +Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp +=================================================================== +--- /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 @@ +# 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 +# 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 { + 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 + } +} +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) \ diff --git a/gdb-6.3-pie-20050110.patch b/gdb-6.3-pie-20050110.patch index 1386770..be5b413 100644 --- a/gdb-6.3-pie-20050110.patch +++ b/gdb-6.3-pie-20050110.patch @@ -10,11 +10,19 @@ * 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 + + Port to GDB-6.8pre. + +2008-02-27 Jan Kratochvil + + 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.1/gdb/dwarf2read.c 2007-11-02 15:24:19.000000000 +0100 -@@ -1226,7 +1226,7 @@ dwarf2_build_psymtabs (struct objfile *o +--- gdb-6.7.50.20080227.orig/gdb/dwarf2read.c 2008-02-27 08:57:20.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/dwarf2read.c 2008-02-27 08:57:31.000000000 +0100 +@@ -1217,7 +1217,7 @@ dwarf2_build_psymtabs (struct objfile *o else dwarf2_per_objfile->loc_buffer = NULL; @@ -23,10 +31,10 @@ Index: gdb-6.7.1/gdb/dwarf2read.c || (objfile->global_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.1/gdb/auxv.c 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/auxv.c 2008-01-16 17:27:37.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 Return 1 if an entry was read into *TYPEP and *VALP. */ int @@ -89,7 +97,7 @@ Index: gdb-6.7.1/gdb/auxv.c { #define TAG(tag, text, kind) \ 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 ", @@ -98,10 +106,10 @@ Index: gdb-6.7.1/gdb/auxv.c switch (flavor) { 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.1/gdb/auxv.h 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/auxv.h 2008-01-01 23:53:09.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 Return 1 if an entry was read into *TYPEP and *VALP. */ 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. */ 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.1/gdb/breakpoint.h 2007-11-02 15:24:59.000000000 +0100 -@@ -150,6 +150,7 @@ enum enable_state +--- gdb-6.7.50.20080227.orig/gdb/breakpoint.h 2008-02-01 17:24:46.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/breakpoint.h 2008-02-27 08:57:31.000000000 +0100 +@@ -144,6 +144,7 @@ enum enable_state automatically enabled and reset when the call "lands" (either completes, or stops at another eventpoint). */ @@ -131,7 +139,7 @@ Index: gdb-6.7.1/gdb/breakpoint.h bp_permanent /* There is a breakpoint instruction hard-wired into the target's code. Don't try to write another 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); @@ -139,13 +147,13 @@ Index: gdb-6.7.1/gdb/breakpoint.h + +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.1/gdb/symfile-mem.c +Index: gdb-6.7.50.20080227/gdb/symfile-mem.c =================================================================== ---- gdb-6.7.1.orig/gdb/symfile-mem.c 2007-08-23 20:08:39.000000000 +0200 -+++ gdb-6.7.1/gdb/symfile-mem.c 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/symfile-mem.c 2008-01-01 23:53:13.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 } @@ -155,11 +163,11 @@ Index: gdb-6.7.1/gdb/symfile-mem.c /* This might change our ideas about frames already looked at. */ 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.1/gdb/infrun.c 2007-11-02 15:24:19.000000000 +0100 -@@ -2298,6 +2298,11 @@ process_event_stop_test: +--- gdb-6.7.50.20080227.orig/gdb/infrun.c 2008-02-27 08:57:20.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/infrun.c 2008-02-27 08:57:31.000000000 +0100 +@@ -2277,6 +2277,11 @@ process_event_stop_test: #endif target_terminal_inferior (); @@ -171,13 +179,13 @@ Index: gdb-6.7.1/gdb/infrun.c /* If requested, stop when the dynamic linker notifies gdb of events. This allows the user to get control 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.1/gdb/objfiles.c 2007-11-02 15:24:19.000000000 +0100 -@@ -48,6 +48,9 @@ - #include "dictionary.h" +--- gdb-6.7.50.20080227.orig/gdb/objfiles.c 2008-01-01 23:53:12.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/objfiles.c 2008-02-27 08:57:31.000000000 +0100 +@@ -49,6 +49,9 @@ #include "source.h" + #include "addrmap.h" +#include "auxv.h" +#include "elf/common.h" @@ -185,7 +193,7 @@ Index: gdb-6.7.1/gdb/objfiles.c /* Prototypes for local functions */ 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 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. -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.1/gdb/solib-svr4.c 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-02-27 08:57:19.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-02-27 08:59:06.000000000 +0100 @@ -31,6 +31,8 @@ #include "gdbcore.h" #include "target.h" @@ -219,7 +227,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c #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 */ @@ -229,7 +237,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c 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; long dyn_tag; CORE_ADDR dyn_ptr, dyn_addr; @@ -242,7 +250,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c if (abfd == NULL) 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) 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. */ 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; 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; } 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 (); @@ -376,41 +384,40 @@ Index: gdb-6.7.1/gdb/solib-svr4.c return read_memory_typed_address (debug_base + lmo->r_map_offset, 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; CORE_ADDR ldsomap = 0; + const char *filename = exec_bfd ? exec_bfd->filename : ""; - ++ + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: exec_bfd %s\n", filename); -+ - /* Make sure we've looked up the inferior's dynamic linker's base - structure. */ + + /* Always locate the debug struct, in case it has moved. */ + 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) -@@ -713,11 +817,20 @@ 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) -- return svr4_default_sos (); -+ { -+ if (debug_solib) -+ fprintf_unfiltered (gdb_stdlog, -+ "svr4_current_sos: no DT_DEBUG found in %s -- return now\n", -+ filename); -+ return svr4_default_sos (); -+ } - } +- return svr4_default_sos (); ++ { ++ if (debug_solib) ++ 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 `struct so_list' nodes. */ + if (debug_solib) + 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 (); 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); 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, SO_NAME_MAX_PATH_SIZE - 1, &errcode); if (errcode != 0) -@@ -757,23 +951,35 @@ svr4_current_sos (void) +@@ -764,23 +957,35 @@ svr4_current_sos (void) safe_strerror (errcode)); 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 -@@ -789,6 +995,9 @@ svr4_current_sos (void) +@@ -796,6 +1001,9 @@ svr4_current_sos (void) if (head == NULL) return svr4_default_sos (); @@ -578,7 +585,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c 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 the main executable file is by looking at its name. Return 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 match_main (char *soname) { -@@ -882,6 +1093,7 @@ match_main (char *soname) +@@ -889,6 +1097,7 @@ match_main (char *soname) 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 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 into the old breakpoint at symbol code. */ 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) { unsigned int interp_sect_size; -@@ -1018,6 +1235,9 @@ enable_break (void) +@@ -1074,6 +1288,9 @@ enable_break (void) if (tmp_fd >= 0) 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) goto bkpt_at_symbol; -@@ -1115,6 +1335,9 @@ enable_break (void) +@@ -1180,6 +1397,9 @@ enable_break (void) if (sym_addr != 0) { create_solib_event_breakpoint (load_addr + sym_addr); @@ -627,7 +634,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c 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); stop_soon = NO_STOP_QUIETLY; #endif /* defined(_SCO_DS) */ @@ -636,7 +643,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c } 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; } @@ -712,20 +719,19 @@ Index: gdb-6.7.1/gdb/solib-svr4.c struct target_so_ops svr4_so_ops; -@@ -1592,4 +1886,8 @@ _initialize_svr4_solib (void) - - /* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */ - current_target_so_ops = &svr4_so_ops; +@@ -1678,4 +1969,7 @@ _initialize_svr4_solib (void) + svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code; + svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol; + svr4_so_ops.same = svr4_same; + + 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.1/gdb/varobj.c 2007-11-02 15:24:19.000000000 +0100 -@@ -1116,6 +1116,62 @@ install_new_value (struct varobj *var, s +--- gdb-6.7.50.20080227.orig/gdb/varobj.c 2008-02-04 08:49:04.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/varobj.c 2008-02-27 08:57:31.000000000 +0100 +@@ -1078,6 +1078,62 @@ install_new_value (struct varobj *var, s 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 two-pronged attack. First, re-parse the value for the root's 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.1/gdb/solist.h 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/solist.h 2008-01-07 16:19:58.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 bfd *abfd; 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 section_table *sections; 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. */ 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 */ 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, struct symtab **symtab); +/* Controls the printing of debugging output. */ +extern int debug_solib; #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.1/gdb/varobj.h 2007-11-02 15:24:19.000000000 +0100 -@@ -114,4 +114,6 @@ extern int varobj_update (struct varobj +--- gdb-6.7.50.20080227.orig/gdb/varobj.h 2008-01-30 08:17:31.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/varobj.h 2008-02-27 08:57:31.000000000 +0100 +@@ -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); + #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.1/gdb/symfile.c 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/symfile.c 2008-01-29 23:47:20.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/symfile.c 2008-02-27 08:57:31.000000000 +0100 @@ -47,6 +47,7 @@ #include "readline/readline.h" #include "gdb_assert.h" @@ -847,7 +853,7 @@ Index: gdb-6.7.1/gdb/symfile.c #include "observer.h" #include "exec.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. */ @@ -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 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 happens for the PA64 port. */ @@ -865,7 +871,7 @@ Index: gdb-6.7.1/gdb/symfile.c { asection *lower_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 old main symbol file. Otherwise it is sufficient to fixup all the 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. */ 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. */ if ((have_full_symbols () || have_partial_symbols ()) @@ -898,7 +904,7 @@ Index: gdb-6.7.1/gdb/symfile.c && from_tty && !query ("Load new symbol table from \"%s\"? ", name)) 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) : !query (_("Discard symbol table? ")))) error (_("Not confirmed.")); @@ -909,7 +915,7 @@ Index: gdb-6.7.1/gdb/symfile.c free_all_objfiles (); /* 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 (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 and now, we *want* this to be out of date, so don't call stat again now. */ -@@ -2837,6 +2848,7 @@ clear_symtab_users (void) +@@ -2834,6 +2845,7 @@ clear_symtab_users (void) breakpoint_re_set (); set_default_breakpoint (0, 0, 0, 0); clear_pc_function_cache (); @@ -926,101 +932,20 @@ Index: gdb-6.7.1/gdb/symfile.c observer_notify_new_objfile (NULL); /* 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.1/gdb/breakpoint.c 2007-11-02 15:26:50.000000000 +0100 -@@ -847,15 +847,15 @@ insert_watchpoints_for_new_thread (ptid_ - struct value *v = b->owner->val_chain; +--- gdb-6.7.50.20080227.orig/gdb/breakpoint.c 2008-02-27 08:57:20.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/breakpoint.c 2008-02-27 08:57:31.000000000 +0100 +@@ -923,7 +923,7 @@ update_watchpoint (struct breakpoint *b, + value_release_to_mark (mark); - /* Look at each value on the value chain. */ -- for (; v; v = v->next) -+ for (; 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. */ - 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 + /* Look at each value on the value chain. */ +- for (; v; v = next) ++ for (; v; v = value_next (v)) + { + /* If it's a memory location, and GDB actually needed + its contents to evaluate the expression, then we +@@ -3882,7 +3882,8 @@ describe_other_breakpoints (CORE_ADDR pc printf_filtered (" (thread %d)", b->thread); printf_filtered ("%s%s ", ((b->enable_state == bp_disabled || @@ -1030,7 +955,7 @@ Index: gdb-6.7.1/gdb/breakpoint.c ? " (disabled)" : b->enable_state == bp_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 - solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname, - char *cond_string, enum bptype bp_kind) -Index: gdb-6.7.1/gdb/solib.c + create_fork_vfork_event_catchpoint (int tempflag, char *cond_string, + enum bptype bp_kind) +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.1/gdb/solib.c 2007-11-02 15:24:19.000000000 +0100 -@@ -78,6 +78,8 @@ set_solib_ops (struct gdbarch *gdbarch, +--- gdb-6.7.50.20080227.orig/gdb/solib.c 2008-01-07 16:19:58.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/solib.c 2008-02-27 08:57:31.000000000 +0100 +@@ -79,6 +79,8 @@ set_solib_ops (struct gdbarch *gdbarch, /* 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 configuration needs to call set_solib_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); } @@ -1115,7 +1040,7 @@ Index: gdb-6.7.1/gdb/solib.c /* GLOBAL FUNCTION -@@ -394,7 +398,6 @@ free_so (struct so_list *so) +@@ -391,7 +395,6 @@ free_so (struct so_list *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. */ struct so_list * master_so_list (void) -@@ -402,7 +405,6 @@ master_so_list (void) +@@ -399,7 +402,6 @@ master_so_list (void) 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. */ 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? */ ALL_OBJFILES (so->objfile) { @@ -1175,18 +1100,18 @@ Index: gdb-6.7.1/gdb/solib.c free_section_addr_info (sap); return (1); -@@ -550,6 +577,10 @@ update_solib_list (int from_tty, struct - the inferior's current list. */ - while (i) - { -+ if (debug_solib) -+ fprintf_unfiltered (gdb_stdlog, -+ "update_solib_list: compare gdb:%s and inferior:%s\n", -+ gdb->so_original_name, i->so_original_name); - if (! strcmp (gdb->so_original_name, i->so_original_name)) - break; - -@@ -603,28 +634,7 @@ update_solib_list (int from_tty, struct +@@ -545,6 +572,10 @@ update_solib_list (int from_tty, struct + } + else + { ++ if (debug_solib) ++ fprintf_unfiltered (gdb_stdlog, ++ "update_solib_list: compare gdb:%s and inferior:%s\n", ++ gdb->so_original_name, i->so_original_name); + if (! strcmp (gdb->so_original_name, i->so_original_name)) + break; + } +@@ -599,28 +630,7 @@ update_solib_list (int from_tty, struct /* Fill in the rest of each of the `struct so_list' nodes. */ 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 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, show_solib_search_path, &setlist, &showlist); @@ -1271,11 +1196,11 @@ Index: gdb-6.7.1/gdb/solib.c + NULL, NULL, + &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.1/gdb/elfread.c 2007-11-02 15:24:19.000000000 +0100 -@@ -611,7 +611,7 @@ elf_symfile_read (struct objfile *objfil +--- gdb-6.7.50.20080227.orig/gdb/elfread.c 2008-01-01 23:53:09.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/elfread.c 2008-02-27 08:57:31.000000000 +0100 +@@ -644,7 +644,7 @@ elf_symfile_read (struct objfile *objfil /* If we are reinitializing, or if we have never loaded syms yet, set table to empty. MAINLINE is cleared so that *_read_psymtab 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); 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.1/gdb/Makefile.in 2007-11-02 15:24:19.000000000 +0100 -@@ -1819,7 +1819,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a +--- gdb-6.7.50.20080227.orig/gdb/Makefile.in 2008-02-27 08:57:20.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/Makefile.in 2008-02-27 08:57:31.000000000 +0100 +@@ -1914,7 +1914,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a $(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_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) \ $(gdbtypes_h) $(breakpoint_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.1/gdb/amd64-tdep.c 2007-11-02 15:24:19.000000000 +0100 +--- gdb-6.7.50.20080227.orig/gdb/amd64-tdep.c 2008-02-27 08:57:19.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/amd64-tdep.c 2008-02-27 08:57:31.000000000 +0100 @@ -36,6 +36,7 @@ #include "symfile.h" #include "dwarf2-frame.h" @@ -1309,7 +1234,7 @@ Index: gdb-6.7.1/gdb/amd64-tdep.c #include "amd64-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 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); -@@ -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 (current_pc <= pc + 1) diff --git a/gdb-6.3-ppc64section-20041026.patch b/gdb-6.3-ppc64section-20041026.patch deleted file mode 100644 index 155bde4..0000000 --- a/gdb-6.3-ppc64section-20041026.patch +++ /dev/null @@ -1,99 +0,0 @@ -2004-10-26 Andrew Cagney - - * 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. diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch deleted file mode 100644 index 1a0643d..0000000 --- a/gdb-6.3-test-pie-20050107.patch +++ /dev/null @@ -1,2128 +0,0 @@ -2007-10-13 Jan Kratochvil - - Port to GDB-6.7. - -2007-11-02 Jan Kratochvil - - Port to post-GDB-6.7.1 multi-PC breakpoints. - -Index: gdb-6.7/gdb/testsuite/configure.ac -=================================================================== ---- gdb-6.7.orig/gdb/testsuite/configure.ac 2007-08-23 19:58:44.000000000 +0200 -+++ gdb-6.7/gdb/testsuite/configure.ac 2007-10-13 05:28:28.000000000 +0200 -@@ -114,5 +114,5 @@ AC_OUTPUT([Makefile \ - gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \ - gdb.fortran/Makefile gdb.server/Makefile \ - gdb.java/Makefile gdb.mi/Makefile \ -- gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile \ -+ gdb.objc/Makefile gdb.pie/Makefile gdb.threads/Makefile gdb.trace/Makefile \ - gdb.xml/Makefile]) -Index: gdb-6.7/gdb/testsuite/configure -=================================================================== ---- gdb-6.7.orig/gdb/testsuite/configure 2007-01-23 18:11:54.000000000 +0100 -+++ gdb-6.7/gdb/testsuite/configure 2007-10-13 05:29:11.000000000 +0200 -@@ -3102,7 +3102,7 @@ done - - - -- ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.objc/Makefile gdb.pie/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure - # tests run on this system so they can be shared between configure -@@ -3666,6 +3666,7 @@ do - "gdb.java/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.java/Makefile" ;; - "gdb.mi/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;; - "gdb.objc/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;; -+ "gdb.pie/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;; - "gdb.threads/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;; - "gdb.trace/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.trace/Makefile" ;; - "gdb.xml/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.xml/Makefile" ;; -Index: gdb-6.7/gdb/testsuite/gdb.pie/attach.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/attach.c 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,20 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return 0; -+} -Index: gdb-6.7/gdb/testsuite/gdb.pie/attach2.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/attach2.c 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,24 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+#include -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ sleep( 10 ); /* System call causes register fetch to fail */ -+ /* This is a known HPUX "feature" */ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return (0); -+} -Index: gdb-6.7/gdb/testsuite/gdb.pie/break.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/break.c 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,146 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 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. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#ifdef vxworks -+ -+# include -+ -+/* VxWorks does not supply atoi. */ -+static int -+atoi (z) -+ char *z; -+{ -+ int i = 0; -+ -+ while (*z >= '0' && *z <= '9') -+ i = i * 10 + (*z++ - '0'); -+ return i; -+} -+ -+/* I don't know of any way to pass an array to VxWorks. This function -+ can be called directly from gdb. */ -+ -+vxmain (arg) -+char *arg; -+{ -+ char *argv[2]; -+ -+ argv[0] = ""; -+ argv[1] = arg; -+ main (2, argv, (char **) 0); -+} -+ -+#else /* ! vxworks */ -+# include -+# include -+#endif /* ! vxworks */ -+ -+#ifdef PROTOTYPES -+extern int marker1 (void); -+extern int marker2 (int a); -+extern void marker3 (char *a, char *b); -+extern void marker4 (long d); -+#else -+extern int marker1 (); -+extern int marker2 (); -+extern void marker3 (); -+extern void marker4 (); -+#endif -+ -+/* -+ * This simple classical example of recursion is useful for -+ * testing stack backtraces and such. -+ */ -+ -+#ifdef PROTOTYPES -+int factorial(int); -+ -+int -+main (int argc, char **argv, char **envp) -+#else -+int -+main (argc, argv, envp) -+int argc; -+char *argv[], **envp; -+#endif -+{ -+#ifdef usestubs -+ set_debug_traps(); /* set breakpoint 5 here */ -+ breakpoint(); -+#endif -+ if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ -+ fprintf (stderr, "usage: factorial \n"); -+ return 1; -+ } -+ printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ -+ /* set breakpoint 12 here */ -+ marker1 (); /* set breakpoint 11 here */ -+ marker2 (43); /* set breakpoint 20 here */ -+ marker3 ("stack", "trace"); /* set breakpoint 21 here */ -+ marker4 (177601976L); -+ argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ -+ return argc; /* set breakpoint 10 here */ -+} -+ -+#ifdef PROTOTYPES -+int factorial (int value) -+#else -+int factorial (value) -+int value; -+#endif -+{ -+ if (value > 1) { /* set breakpoint 7 here */ -+ value *= factorial (value - 1); -+ } -+ return (value); /* set breakpoint 19 here */ -+} -+ -+#ifdef PROTOTYPES -+int multi_line_if_conditional (int a, int b, int c) -+#else -+int multi_line_if_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ if (a /* set breakpoint 3 here */ -+ && b -+ && c) -+ return 0; -+ else -+ return 1; -+} -+ -+#ifdef PROTOTYPES -+int multi_line_while_conditional (int a, int b, int c) -+#else -+int multi_line_while_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ while (a /* set breakpoint 4 here */ -+ && b -+ && c) -+ { -+ a--, b--, c--; -+ } -+ return 0; -+} -Index: gdb-6.7/gdb/testsuite/gdb.pie/break1.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/break1.c 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,44 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 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. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+/* The code for this file was extracted from the gdb testsuite -+ testcase "break.c". */ -+ -+/* The following functions do nothing useful. They are included -+ simply as places to try setting breakpoints at. They are -+ explicitly "one-line functions" to verify that this case works -+ (some versions of gcc have or have had problems with this). -+ -+ These functions are in a separate source file to prevent an -+ optimizing compiler from inlining them and optimizing them away. */ -+ -+#ifdef PROTOTYPES -+int marker1 (void) { return (0); } /* set breakpoint 15 here */ -+int marker2 (int a) { return (1); } /* set breakpoint 8 here */ -+void marker3 (char *a, char *b) {} /* set breakpoint 17 here */ -+void marker4 (long d) {} /* set breakpoint 14 here */ -+#else -+int marker1 () { return (0); } /* set breakpoint 16 here */ -+int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ -+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ -+void marker4 (d) long d; {} /* set breakpoint 13 here */ -+#endif -Index: gdb-6.7/gdb/testsuite/gdb.pie/coremaker.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/coremaker.c 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,142 @@ -+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 -+ Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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. */ -+ -+/* Simple little program that just generates a core dump from inside some -+ nested function calls. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifndef __STDC__ -+#define const /**/ -+#endif -+ -+#define MAPSIZE (8 * 1024) -+ -+/* Don't make these automatic vars or we will have to walk back up the -+ stack to access them. */ -+ -+char *buf1; -+char *buf2; -+ -+int coremaker_data = 1; /* In Data section */ -+int coremaker_bss; /* In BSS section */ -+ -+const int coremaker_ro = 201; /* In Read-Only Data section */ -+ -+/* Note that if the mapping fails for any reason, we set buf2 -+ to -1 and the testsuite notices this and reports it as -+ a failure due to a mapping error. This way we don't have -+ to test for specific errors when running the core maker. */ -+ -+void -+mmapdata () -+{ -+ int j, fd; -+ -+ /* Allocate and initialize a buffer that will be used to write -+ the file that is later mapped in. */ -+ -+ buf1 = (char *) malloc (MAPSIZE); -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ buf1[j] = j; -+ } -+ -+ /* Write the file to map in */ -+ -+ fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666); -+ if (fd == -1) -+ { -+ perror ("coremmap.data open failed"); -+ buf2 = (char *) -1; -+ return; -+ } -+ write (fd, buf1, MAPSIZE); -+ -+ /* Now map the file into our address space as buf2 */ -+ -+ buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); -+ if (buf2 == (char *) -1) -+ { -+ perror ("mmap failed"); -+ return; -+ } -+ -+ /* Verify that the original data and the mapped data are identical. -+ If not, we'd rather fail now than when trying to access the mapped -+ data from the core file. */ -+ -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ if (buf1[j] != buf2[j]) -+ { -+ fprintf (stderr, "mapped data is incorrect"); -+ buf2 = (char *) -1; -+ return; -+ } -+ } -+} -+ -+void -+func2 () -+{ -+ int coremaker_local[5]; -+ int i; -+ -+#ifdef SA_FULLDUMP -+ /* Force a corefile that includes the data section for AIX. */ -+ { -+ struct sigaction sa; -+ -+ sigaction (SIGABRT, (struct sigaction *)0, &sa); -+ sa.sa_flags |= SA_FULLDUMP; -+ sigaction (SIGABRT, &sa, (struct sigaction *)0); -+ } -+#endif -+ -+ /* Make sure that coremaker_local doesn't get optimized away. */ -+ for (i = 0; i < 5; i++) -+ coremaker_local[i] = i; -+ coremaker_bss = 0; -+ for (i = 0; i < 5; i++) -+ coremaker_bss += coremaker_local[i]; -+ coremaker_data = coremaker_ro + 1; -+ abort (); -+} -+ -+void -+func1 () -+{ -+ func2 (); -+} -+ -+int main () -+{ -+ mmapdata (); -+ func1 (); -+ return 0; -+} -+ -Index: gdb-6.7/gdb/testsuite/gdb.pie/attach.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/attach.exp 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,432 @@ -+# Copyright 1997, 1999, 2002 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. */ -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+if $tracelevel then { -+ strace $tracelevel -+ } -+ -+set prms_id 0 -+set bug_id 0 -+ -+# On HP-UX 11.0, this test is causing a process running the program -+# "attach" to be left around spinning. Until we figure out why, I am -+# commenting out the test to avoid polluting tiamat (our 11.0 nightly -+# test machine) with these processes. RT -+# -+# Setting the magic bit in the target app should work. I added a -+# "kill", and also a test for the R3 register warning. JB -+if { [istarget "hppa*-*-hpux*"] } { -+ return 0 -+} -+ -+# are we on a target board -+if [is_remote target] then { -+ return 0 -+} -+ -+set testfile "attach" -+set srcfile ${testfile}.c -+set srcfile2 ${testfile}2.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binfile2 ${objdir}/${subdir}/${testfile}2 -+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] -+set cleanupfile ${objdir}/${subdir}/${testfile}.awk -+ -+#execute_anywhere "rm -f ${binfile} ${binfile2}" -+remote_exec build "rm -f ${binfile} ${binfile2}" -+# For debugging this test -+# -+#log_user 1 -+ -+# Clean out any old files from past runs. -+# -+remote_exec build "${cleanupfile}" -+ -+# build the first test case -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags= -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Build the in-system-call test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug "additional_flags= -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+proc do_attach_tests {} { -+ global gdb_prompt -+ global binfile -+ global escapedbinfile -+ global srcfile -+ global testfile -+ global objdir -+ global subdir -+ global timeout -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ -+ # Verify that we cannot attach to nonsense. -+ # -+ send_gdb "attach abc\n" -+ gdb_expect { -+ -re ".*Illegal process-id: abc.*$gdb_prompt $"\ -+ {pass "attach to nonsense is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonsense is prohibited" -+ } -+ -re "Attaching to.*$gdb_prompt $"\ -+ {fail "attach to nonsense is prohibited (bogus pid allowed)"} -+ -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"} -+ timeout {fail "(timeout) attach to nonsense is prohibited"} -+ } -+ -+ # Verify that we cannot attach to what appears to be a valid -+ # process ID, but is a process that doesn't exist. Traditionally, -+ # most systems didn't have a process with ID 0, so we take that as -+ # the default. However, there are a few exceptions. -+ # -+ set boguspid 0 -+ if { [istarget "*-*-*bsd*"] } { -+ # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead -+ # (which should have the desired effect on any version of -+ # FreeBSD, and probably other *BSD's too). -+ set boguspid -1 -+ } -+ send_gdb "attach $boguspid\n" -+ gdb_expect { -+ -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\ -+ { -+ # Response expected on ptrace-based systems (i.e. HP-UX 10.20). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\ -+ { -+ # Response expected on ttrace-based systems (i.e. HP-UX 11.0). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} -+ timeout { -+ fail "(timeout) attach to nonexistent process is prohibited" -+ } -+ } -+ -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with -+ # the process ID. -+ # -+ # (Actually, the test system appears to do this automatically -+ # for us. So, we must also be prepared to be asked if we want -+ # to discard an existing set of symbols.) -+ # -+ send_gdb "file $binfile\n" -+ gdb_expect { -+ -re "Load new symbol table from.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "(re)set file, before attach1"} -+ -re "$gdb_prompt $" {fail "(re)set file, before attach1"} -+ timeout {fail "(timeout) (re)set file, before attach1"} -+ } -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "set file, before attach1"} -+ -re "$gdb_prompt $" {fail "set file, before attach1"} -+ timeout {fail "(timeout) set file, before attach1"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\ -+ {pass "attach1, after setting file"} -+ -re "$gdb_prompt $" {fail "attach1, after setting file"} -+ timeout {fail "(timeout) attach1, after setting file"} -+ } -+ -+ # Verify that we can "see" the variable "should_exit" in the -+ # program, and that it is zero. -+ # -+ send_gdb "print should_exit\n" -+ gdb_expect { -+ -re ".* = 0.*$gdb_prompt $"\ -+ {pass "after attach1, print should_exit"} -+ -re "$gdb_prompt $" {fail "after attach1, print should_exit"} -+ timeout {fail "(timeout) after attach1, print should_exit"} -+ } -+ -+ # Detach the process. -+ # -+ send_gdb "detach\n" -+ gdb_expect { -+ -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\ -+ {pass "attach1 detach"} -+ -re "$gdb_prompt $" {fail "attach1 detach"} -+ timeout {fail "(timeout) attach1 detach"} -+ } -+ -+ # Wait a bit for gdb to finish detaching -+ # -+ exec sleep 5 -+ -+ # Purge the symbols from gdb's brain. (We want to be certain -+ # the next attach, which won't be preceded by a "file" command, -+ # is really getting the executable file without our help.) -+ # -+ set old_timeout $timeout -+ set timeout 15 -+ send_gdb "file\n" -+ gdb_expect { -+ -re ".*gdb internal error.*$" { -+ fail "Internal error, prob. Memory corruption" -+ } -+ -re "No executable file now.*Discard symbol table.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "No symbol file now.*$gdb_prompt $"\ -+ {pass "attach1, purging symbols after detach"} -+ -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"} -+ timeout {fail "(timeout) attach1, purging symbols after detach"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "attach1, purging file after detach"} -+ timeout { -+ fail "(timeout) attach1, purging file after detach" -+ } -+ } -+ set timeout $old_timeout -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. -+ # -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach2"} -+ -re "$gdb_prompt $" {fail "attach2"} -+ timeout {fail "(timeout) attach2"} -+ } -+ -+ # Verify that we can modify the variable "should_exit" in the -+ # program. -+ # -+ send_gdb "set should_exit=1\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach2, set should_exit"} -+ timeout {fail "(timeout) after attach2, set should_exit"} -+ } -+ -+ # Verify that the modification really happened. -+ # -+ send_gdb "tbreak 19\n" -+ gdb_expect { -+ -re "Breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $"\ -+ {pass "after attach2, set tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"} -+ timeout {fail "(timeout) after attach2, set tbreak postloop"} -+ } -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "main.*at.*$srcfile:19.*$gdb_prompt $"\ -+ {pass "after attach2, reach tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"} -+ timeout {fail "(timeout) after attach2, reach tbreak postloop"} -+ } -+ -+ # Allow the test process to exit, to cleanup after ourselves. -+ # -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "Program exited normally.*$gdb_prompt $"\ -+ {pass "after attach2, exit"} -+ -re "$gdb_prompt $" {fail "after attach2, exit"} -+ timeout {fail "(timeout) after attach2, exit"} -+ } -+ -+ # Make sure we don't leave a process around to confuse -+ # the next test run (and prevent the compile by keeping -+ # the text file busy), in case the "set should_exit" didn't -+ # work. -+ # -+ remote_exec build "kill -9 ${testpid}" -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ -+ # Verify that we can attach to the process, and find its a.out -+ # when we're cd'd to some directory that doesn't contain the -+ # a.out. (We use the source path set by the "dir" command.) -+ # -+ send_gdb "dir ${objdir}/${subdir}\n" -+ gdb_expect { -+ -re ".*Source directories searched: .*$gdb_prompt $"\ -+ {pass "set source path"} -+ -re "$gdb_prompt $" {fail "set source path"} -+ timeout {fail "(timeout) set source path"} -+ } -+ -+ send_gdb "cd /tmp\n" -+ gdb_expect { -+ -re ".*Working directory /tmp.*$gdb_prompt $"\ -+ {pass "cd away from process' a.out"} -+ -re "$gdb_prompt $" {fail "cd away from process' a.out"} -+ timeout {fail "(timeout) cd away from process' a.out"} -+ } -+ -+ # Explicitly flush out any knowledge of the previous attachment. -+ send_gdb "symbol\n" -+ gdb_expect { -+ -re ".*Discard symbol table from.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ } -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ send_gdb "exec\n" -+ gdb_expect { -+ -re ".*No executable file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush exec"} -+ -re "$gdb_prompt $" {fail "before attach3, flush exec"} -+ timeout {fail "(timeout) before attach3, flush exec"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach when process' a.out not in cwd"} -+ -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"} -+ timeout {fail "(timeout) attach when process' a.out not in cwd"} -+ } -+ -+ send_gdb "kill\n" -+ gdb_expect { -+ -re ".*Kill the program being debugged.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ -+ # Another "don't leave a process around" -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+proc do_call_attach_tests {} { -+ global gdb_prompt -+ global binfile2 -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile2 &] -+ exec sleep 2 -+ -+ # Attach -+ # -+ gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary" -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" { -+ fail "attach call, read register 3 error" -+ } -+ -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" { -+ pass "attach call" -+ } -+ -re "$gdb_prompt $" {fail "attach call"} -+ timeout {fail "(timeout) attach call"} -+ } -+ -+ # See if other registers are problems -+ # -+ send_gdb "i r r3\n" -+ gdb_expect { -+ -re ".*warning: reading register.*$gdb_prompt $" { -+ pass "CHFts23490: known bug" -+ } -+ -re ".*r3.*$gdb_prompt $" { -+ pass "Bug fixed, Yayyy!" -+ } -+ timeout { fail "timeout on info reg" } -+ } -+ -+ # Get rid of the process -+ # -+ gdb_test "p should_exit = 1" ".*" -+ gdb_test "c" ".*Program exited normally.*" -+ -+ # Be paranoid -+ # -+ remote_exec build "kill -9 ${testpid}" -+ -+} -+ -+ -+# Start with a fresh gdb -+# -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# This is a test of gdb's ability to attach to a running process. -+# -+do_attach_tests -+ -+# Test attaching when the target is inside a system call -+# -+gdb_exit -+gdb_start -+ -+gdb_reinitialize_dir $srcdir/$subdir -+do_call_attach_tests -+ -+return 0 -Index: gdb-6.7/gdb/testsuite/gdb.pie/break.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/break.exp 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,973 @@ -+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, -+# 2000, 2002, 2003, 2004 -+# 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. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Rob Savoye. (rob@cygnus.com) -+ -+# Test the same stuff but with PIE executables -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+ -+# -+# test running programs -+# -+set prms_id 0 -+set bug_id 0 -+ -+set testfile "break" -+set srcfile ${testfile}.c -+set srcfile1 ${testfile}1.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+# -+# test simple breakpoint setting commands -+# -+ -+# Test deleting all breakpoints when there are none installed, -+# GDB should not prompt for confirmation. -+# Note that gdb-init.exp provides a "delete_breakpoints" proc -+# for general use elsewhere. -+ -+send_gdb "delete breakpoints\n" -+gdb_expect { -+ -re "Delete all breakpoints.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" { -+ fail "Delete all breakpoints when none (unexpected prompt)" -+ } -+ timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } -+ } -+ } -+ -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } -+ timeout { fail "Delete all breakpoints when none (timeout)" } -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function" -+ -+# -+# test break at quoted function -+# -+gdb_test "break \"marker2\"" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint quoted function" -+ -+# -+# test break at function in file -+# -+gdb_test "break $srcfile:factorial" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function in file" -+ -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+ -+# -+# test break at line number -+# -+# Note that the default source file is the last one whose source text -+# was printed. For native debugging, before we've executed the -+# program, this is the file containing main, but for remote debugging, -+# it's wherever the processor was stopped when we connected to the -+# board. So, to be sure, we do a list command. -+# -+gdb_test "list main" \ -+ ".*main \\(argc, argv, envp\\).*" \ -+ "use `list' to establish default source file" -+gdb_test "break $bp_location1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint line number" -+ -+# -+# test duplicate breakpoint -+# -+gdb_test "break $bp_location1" \ -+ "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint duplicate" -+ -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+# -+# test break at line number in file -+# -+gdb_test "break $srcfile:$bp_location2" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ -+ "breakpoint line number in file" -+ -+set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] -+set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] -+ -+# -+# Test putting a break at the start of a multi-line if conditional. -+# Verify the breakpoint was put at the start of the conditional. -+# -+gdb_test "break multi_line_if_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ -+ "breakpoint at start of multi line if conditional" -+ -+gdb_test "break multi_line_while_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ -+ "breakpoint at start of multi line while conditional" -+ -+set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] -+set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] -+ -+# -+# check to see what breakpoints are set -+# -+if [target_info exists gdb_stub] { -+ set main_line $bp_location5 -+} else { -+ set main_line $bp_location6 -+} -+ -+if {$hp_aCC_compiler} { -+ set proto "\\(int\\)" -+} else { -+ set proto "" -+} -+ -+set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] -+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] -+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] -+ -+gdb_test "info break" \ -+ "Num\[\t \]+Type\[\t \]+Disp\[\t \]+Enb\[\t \]+Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* -+\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ -+ "breakpoint info" -+ -+# FIXME: The rest of this test doesn't work with anything that can't -+# handle arguments. -+# Huh? There doesn't *appear* to be anything that passes arguments -+# below. -+if [istarget "mips-idt-*"] then { -+ return -+} -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint" } -+ timeout { fail "run until function breakpoint (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue" -+ } -+} -+ -+# -+# run until the breakpoint at a line number -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ -+ "run until breakpoint set at a line number" -+ -+# -+# Run until the breakpoint set in a function in a file -+# -+for {set i 6} {$i >= 1} {incr i -1} { -+ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ -+ "run until file:function($i) breakpoint" -+} -+ -+# -+# Run until the breakpoint set at a quoted function -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ -+ "run until quoted breakpoint" -+# -+# run until the file:function breakpoint at a line number in a file -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ -+ "run until file:linenum breakpoint" -+ -+# Test break at offset +1 -+set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] -+ -+gdb_test "break +1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ -+ "breakpoint offset +1" -+ -+# Check to see if breakpoint is hit when stepped onto -+ -+gdb_test "step" \ -+ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ -+ "step onto breakpoint" -+ -+# -+# delete all breakpoints so we can start over, course this can be a test too -+# -+delete_breakpoints -+ -+# -+# test temporary breakpoint at function -+# -+ -+gdb_test "tbreak main" "Breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function" -+ -+# -+# test break at function in file -+# -+ -+gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "Temporary breakpoint function in file" -+ -+# -+# test break at line number -+# -+send_gdb "tbreak $bp_location1\n" -+gdb_expect { -+ -re "Breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ timeout { fail "breakpoint line number #1 (timeout)" } -+} -+ -+gdb_test "tbreak $bp_location6" "Breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" -+ -+# -+# test break at line number in file -+# -+send_gdb "tbreak $srcfile:$bp_location2\n" -+gdb_expect { -+ -re "Breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } -+} -+ -+set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] -+gdb_test "tbreak $srcfile:$bp_location11" "Breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" -+ -+# -+# check to see what breakpoints are set (temporary this time) -+# -+gdb_test "info break" "Num\[\t \]+Type.*Disp\[\t \]+Enb\[\t \]+Address.*What.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ -+ "Temporary breakpoint info" -+ -+ -+#*********** -+ -+# Verify that catchpoints for fork, vfork and exec don't trigger -+# inappropriately. (There are no calls to those system functions -+# in this test program.) -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "catch\n" -+gdb_expect { -+ -re "Catch requires an event name.*$gdb_prompt $"\ -+ {pass "catch requires an event name"} -+ -re "$gdb_prompt $"\ -+ {fail "catch requires an event name"} -+ timeout {fail "(timeout) catch requires an event name"} -+} -+ -+ -+set name "set catch fork, never expected to trigger" -+send_gdb "catch fork\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of fork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+ -+set name "set catch vfork, never expected to trigger" -+send_gdb "catch vfork\n" -+ -+# If we are on HP-UX 10.20, we expect an error message to be -+# printed if we type "catch vfork" at the gdb gdb_prompt. This is -+# because on HP-UX 10.20, we cannot catch vfork events. -+ -+if [istarget "hppa*-hp-hpux10.20"] then { -+ gdb_expect { -+ -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} else { -+ gdb_expect { -+ -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of vfork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} -+ -+set name "set catch exec, never expected to trigger" -+send_gdb "catch exec\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of exec not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+# Verify that GDB responds gracefully when asked to set a breakpoint -+# on a nonexistent source line. -+# -+send_gdb "break 999\n" -+gdb_expect { -+ -re "No line 999 in file .*$gdb_prompt $"\ -+ {pass "break on non-existent source line"} -+ -re "$gdb_prompt $"\ -+ {fail "break on non-existent source line"} -+ timeout {fail "(timeout) break on non-existent source line"} -+} -+ -+# Run to the desired default location. If not positioned here, the -+# tests below don't work. -+# -+gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" -+ -+ -+# Verify that GDB allows one to just say "break", which is treated -+# as the "default" breakpoint. Note that GDB gets cute when printing -+# the informational message about other breakpoints at the same -+# location. We'll hit that bird with this stone too. -+# -+send_gdb "break\n" -+gdb_expect { -+ -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 1st time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 1st time"} -+ timeout {fail "(timeout) break on default location, 1st time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 2nd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 2nd time"} -+ timeout {fail "(timeout) break on default location, 2nd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 3rd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 3rd time"} -+ timeout {fail "(timeout) break on default location, 3rd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 4th time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 4th time"} -+ timeout {fail "(timeout) break on default location, 4th time"} -+} -+ -+# Verify that a "silent" breakpoint can be set, and that GDB is indeed -+# "silent" about its triggering. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "break $bp_location1\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ -+ {pass "set to-be-silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "set to-be-silent break bp_location1"} -+ timeout {fail "(timeout) set to-be-silent break bp_location1"} -+} -+ -+send_gdb "commands $expect_out(1,string)\n" -+send_gdb "silent\n" -+send_gdb "end\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "set silent break bp_location1"} -+ timeout {fail "(timeout) set silent break bp_location1"} -+} -+ -+send_gdb "info break $expect_out(1,string)\n" -+gdb_expect { -+ -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ -+ {pass "info silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "info silent break bp_location1"} -+ timeout {fail "(timeout) info silent break bp_location1"} -+} -+send_gdb "continue\n" -+gdb_expect { -+ -re "Continuing.\r\n$gdb_prompt $"\ -+ {pass "hit silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "hit silent break bp_location1"} -+ timeout {fail "(timeout) hit silent break bp_location1"} -+} -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ -+ {pass "stopped for silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "stopped for silent break bp_location1"} -+ timeout {fail "(timeout) stopped for silent break bp_location1"} -+} -+ -+# Verify that GDB can at least parse a breakpoint with the -+# "thread" keyword. (We won't attempt to test here that a -+# thread-specific breakpoint really triggers appropriately. -+# The gdb.threads subdirectory contains tests for that.) -+# -+set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] -+send_gdb "break $bp_location12 thread 999\n" -+gdb_expect { -+ -re "Unknown thread 999.*$gdb_prompt $"\ -+ {pass "thread-specific breakpoint on non-existent thread disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "thread-specific breakpoint on non-existent thread disallowed"} -+ timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} -+} -+send_gdb "break $bp_location12 thread foo\n" -+gdb_expect { -+ -re "Junk after thread keyword..*$gdb_prompt $"\ -+ {pass "thread-specific breakpoint on bogus thread ID disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "thread-specific breakpoint on bogus thread ID disallowed"} -+ timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a breakpoint command with -+# trailing garbage. -+# -+send_gdb "break $bp_location12 foo\n" -+gdb_expect { -+ -re "Junk at end of arguments..*$gdb_prompt $"\ -+ {pass "breakpoint with trailing garbage disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "breakpoint with trailing garbage disallowed"} -+ timeout {fail "(timeout) breakpoint with trailing garbage disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a "clear" command that has -+# no matching breakpoint. (First, get us off the current source line, -+# which we know has a breakpoint.) -+# -+send_gdb "next\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "step over breakpoint"} -+ timeout {fail "(timeout) step over breakpoint"} -+} -+send_gdb "clear 81\n" -+gdb_expect { -+ -re "No breakpoint at 81..*$gdb_prompt $"\ -+ {pass "clear line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear line has no breakpoint disallowed"} -+} -+send_gdb "clear\n" -+gdb_expect { -+ -re "No breakpoint at this line..*$gdb_prompt $"\ -+ {pass "clear current line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear current line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear current line has no breakpoint disallowed"} -+} -+ -+# Verify that we can set and clear multiple breakpoints. -+# -+# We don't test that it deletes the correct breakpoints. We do at -+# least test that it deletes more than one breakpoint. -+# -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" -+gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} -+ -+# Verify that a breakpoint can be set via a convenience variable. -+# -+send_gdb "set \$foo=$bp_location11\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to bp_location11"} -+ timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ -+ {pass "set breakpoint via convenience variable"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via convenience variable"} -+ timeout {fail "(timeout) set breakpoint via convenience variable"} -+} -+ -+# Verify that GDB responds gracefully to an attempt to set a -+# breakpoint via a convenience variable whose type is not integer. -+# -+send_gdb "set \$foo=81.5\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to 81.5"} -+ timeout {fail "(timeout) set convenience variable \$foo to 81.5"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\ -+ {pass "set breakpoint via non-integer convenience variable disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via non-integer convenience variable disallowed"} -+ timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"} -+} -+ -+# Verify that we can set and trigger a breakpoint in a user-called function. -+# -+send_gdb "break marker2\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ -+ {pass "set breakpoint on to-be-called function"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint on to-be-called function"} -+ timeout {fail "(timeout) set breakpoint on to-be-called function"} -+} -+send_gdb "print marker2(99)\n" -+gdb_expect { -+ -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ -+ {pass "hit breakpoint on called function"} -+ -re "$gdb_prompt $"\ -+ {fail "hit breakpoint on called function"} -+ timeout {fail "(timeout) hit breakpoint on called function"} -+} -+ -+# As long as we're stopped (breakpointed) in a called function, -+# verify that we can successfully backtrace & such from here. -+# -+# In this and the following test, the _sr4export check apparently is needed -+# for hppa*-*-hpux. -+# -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "$gdb_prompt $"\ -+ {fail "backtrace while in called function"} -+ timeout {fail "(timeout) backtrace while in called function"} -+} -+ -+# Return from the called function. For remote targets, it's important to do -+# this before runto_main, which otherwise may silently stop on the dummy -+# breakpoint inserted by GDB at the program's entry point. -+# -+send_gdb "finish\n" -+gdb_expect { -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "$gdb_prompt $"\ -+ {fail "finish from called function"} -+ timeout {fail "(timeout) finish from called function"} -+} -+ -+# Verify that GDB responds gracefully to a "finish" command with -+# arguments. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "finish 123\n" -+gdb_expect { -+ -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ -+ {pass "finish with arguments disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "finish with arguments disallowed"} -+ timeout {fail "(timeout) finish with arguments disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a request to "finish" from -+# the outermost frame. On a stub that never exits, this will just -+# run to the stubs routine, so we don't get this error... Thus the -+# second condition. -+# -+ -+send_gdb "finish\n" -+gdb_expect { -+ -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ -+ {pass "finish from outermost frame disallowed"} -+ -re "Run till exit from.*\r\n$gdb_prompt $" { -+ pass "finish from outermost frame disallowed" -+ } -+ -re "$gdb_prompt $"\ -+ {fail "finish from outermost frame disallowed"} -+ timeout {fail "(timeout) finish from outermost frame disallowed"} -+} -+ -+# Verify that we can explicitly ask GDB to stop on all shared library -+# events, and that it does so. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "set stop-on-solib-events 1\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set stop-on-solib-events"} -+ timeout {fail "(timeout) set stop-on-solib-events"} -+ } -+ -+ send_gdb "run\n" -+ gdb_expect { -+ -re ".*Start it from the beginning.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*Stopped due to shared library event.*$gdb_prompt $"\ -+ {pass "triggered stop-on-solib-events"} -+ -re "$gdb_prompt $"\ -+ {fail "triggered stop-on-solib-events"} -+ timeout {fail "(timeout) triggered stop-on-solib-events"} -+ } -+ } -+ -re "$gdb_prompt $"\ -+ {fail "rerun for stop-on-solib-events"} -+ timeout {fail "(timeout) rerun for stop-on-solib-events"} -+ } -+ -+ send_gdb "set stop-on-solib-events 0\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "reset stop-on-solib-events"} -+ timeout {fail "(timeout) reset stop-on-solib-events"} -+ } -+} -+ -+# Hardware breakpoints are unsupported on HP-UX. Verify that GDB -+# gracefully responds to requests to create them. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "hbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "hw breaks disallowed"} -+ timeout {fail "(timeout) hw breaks disallowed"} -+ } -+ -+ send_gdb "thbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "temporary hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "temporary hw breaks disallowed"} -+ timeout {fail "(timeout) temporary hw breaks disallowed"} -+ } -+} -+ -+#******** -+ -+ -+# -+# Test "next" over recursive function call. -+# -+ -+proc test_next_with_recursion {} { -+ global gdb_prompt -+ global decimal -+ global binfile -+ -+ if [target_info exists use_gdb_stub] { -+ # Reload the program. -+ delete_breakpoints -+ gdb_load ${binfile}; -+ } else { -+ # FIXME: should be using runto -+ gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" -+ -+ delete_breakpoints -+ } -+ -+ gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial" -+ -+ # Run until we call factorial with 6 -+ -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"6\"\n" -+ } else { -+ gdb_run_cmd -+ } -+ gdb_expect { -+ -re "Break.* factorial .value=6. .*$gdb_prompt $" {} -+ -re ".*$gdb_prompt $" { -+ fail "run to factorial(6)"; -+ gdb_suppress_tests; -+ } -+ timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests } -+ } -+ -+ # Continue until we call factorial recursively with 5. -+ -+ if [gdb_test "continue" \ -+ "Continuing.*Break.* factorial .value=5. .*" \ -+ "continue to factorial(5)"] then { gdb_suppress_tests } -+ -+ # Do a backtrace just to confirm how many levels deep we are. -+ -+ if [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=5..*" \ -+ "backtrace from factorial(5)"] then { gdb_suppress_tests } -+ -+ # Now a "next" should position us at the recursive call, which -+ # we will be performing with 4. -+ -+ if [gdb_test "next" \ -+ ".* factorial .value - 1.;.*" \ -+ "next to recursive call"] then { gdb_suppress_tests } -+ -+ # Disable the breakpoint at the entry to factorial by deleting them all. -+ # The "next" should run until we return to the next line from this -+ # recursive call to factorial with 4. -+ # Buggy versions of gdb will stop instead at the innermost frame on -+ # the line where we are trying to "next" to. -+ -+ delete_breakpoints -+ -+ if [istarget "mips*tx39-*"] { -+ set timeout 60 -+ } -+ # We used to set timeout here for all other targets as well. This -+ # is almost certainly wrong. The proper timeout depends on the -+ # target system in use, and how we communicate with it, so there -+ # is no single value appropriate for all targets. The timeout -+ # should be established by the Dejagnu config file(s) for the -+ # board, and respected by the test suite. -+ # -+ # For example, if I'm running GDB over an SSH tunnel talking to a -+ # portmaster in California talking to an ancient 68k board running -+ # a crummy ROM monitor (a situation I can only wish were -+ # hypothetical), then I need a large timeout. But that's not the -+ # kind of knowledge that belongs in this file. -+ -+ gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \ -+ "next over recursive call" -+ -+ # OK, we should be back in the same stack frame we started from. -+ # Do a backtrace just to confirm. -+ -+ set result [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \ -+ "backtrace from factorial(5.1)"] -+ if { $result != 0 } { gdb_suppress_tests } -+ -+ if [target_info exists gdb,noresults] { gdb_suppress_tests } -+ gdb_continue_to_end "recursive next test" -+ gdb_stop_suppressing_tests; -+} -+ -+test_next_with_recursion -+ -+ -+#******** -+ -+# build a new file with optimization enabled so that we can try breakpoints -+# on targets with optimized prologues -+ -+set binfileo2 ${objdir}/${subdir}/${testfile}o2 -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfileo2}] { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfileo2} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function, optimized file" -+ -+# -+# test break at function -+# -+gdb_test "break marker4" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint small function, optimized file" -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file" } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file (code motion)" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" } -+ timeout { fail "run until function breakpoint, optimized file (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file" -+ } -+} -+ -+# -+# run until the breakpoint at a small function -+# -+ -+# -+# Add a second pass pattern. The behavior differs here between stabs -+# and dwarf for one-line functions. Stabs preserves two line symbols -+# (one before the prologue and one after) with the same line number, -+# but dwarf regards these as duplicates and discards one of them. -+# Therefore the address after the prologue (where the breakpoint is) -+# has no exactly matching line symbol, and GDB reports the breakpoint -+# as if it were in the middle of a line rather than at the beginning. -+ -+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] -+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] -+send_gdb "continue\n" -+gdb_expect { -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { -+ # marker4() is defined at line 46 when compiled with -DPROTOTYPES -+ pass "run until breakpoint set at small function, optimized file (line bp_location14)" -+ } -+ -re ".*$gdb_prompt " { -+ fail "run until breakpoint set at small function, optimized file" -+ } -+ timeout { -+ fail "run until breakpoint set at small function, optimized file (timeout)" -+ } -+} -+ -+ -+# Reset the default arguments for VxWorks -+if [istarget "*-*-vxworks*"] { -+ set timeout 10 -+ verbose "Timeout is now $timeout seconds" 2 -+ send_gdb "set args main\n" -+ gdb_expect -re ".*$gdb_prompt $" {} -+} -Index: gdb-6.7/gdb/testsuite/gdb.pie/corefile.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/corefile.exp 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,243 @@ -+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 -+# 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. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Fred Fish. (fnf@cygnus.com) -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+# are we on a target board -+if ![isnative] then { -+ return -+} -+ -+set testfile "coremaker" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Create and source the file that provides information about the compiler -+# used to compile the test case. -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+# Create a core file named "corefile" rather than just "core", to -+# avoid problems with sys admin types that like to regularly prune all -+# files named "core" from the system. -+# -+# Arbitrarily try setting the core size limit to "unlimited" since -+# this does not hurt on systems where the command does not work and -+# allows us to generate a core on systems where it does. -+# -+# Some systems append "core" to the name of the program; others append -+# the name of the program to "core"; still others (like Linux, as of -+# May 2003) create cores named "core.PID". In the latter case, we -+# could have many core files lying around, and it may be difficult to -+# tell which one is ours, so let's run the program in a subdirectory. -+set found 0 -+set coredir "${objdir}/${subdir}/coredir.[getpid]" -+file mkdir $coredir -+catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" -+# remote_exec host "${binfile}" -+foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+} -+# Check for "core.PID". -+if { $found == 0 } { -+ set names [glob -nocomplain -directory $coredir core.*] -+ if {[llength $names] == 1} { -+ set corefile [file join $coredir [lindex $names 0]] -+ remote_exec build "mv $corefile ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+} -+if { $found == 0 } { -+ # The braindamaged HPUX shell quits after the ulimit -c above -+ # without executing ${binfile}. So we try again without the -+ # ulimit here if we didn't find a core file above. -+ # Oh, I should mention that any "braindamaged" non-Unix system has -+ # the same problem. I like the cd bit too, it's really neat'n stuff. -+ catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\"" -+ foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+ } -+} -+ -+# Try to clean up after ourselves. -+remote_file build delete [file join $coredir coremmap.data] -+remote_exec build "rmdir $coredir" -+ -+if { $found == 0 } { -+ warning "can't generate a core file - core tests suppressed - check ulimit -c" -+ return 0 -+} -+ -+# -+# Test that we can simply startup with a "-core=corefile" command line arg -+# and recognize that the core file is a valid, usable core file. -+# To do this, we must shutdown the currently running gdb and restart -+# with the -core args. We can't use gdb_start because it looks for -+# the first gdb prompt, and the message we are looking for occurs -+# before the first prompt. Also, we can't include GDBFLAGS because -+# if it is empty, this confuses gdb with an empty argument that it -+# grumbles about (said grumbling currently being ignored in gdb_start). -+# **FIXME** -+# -+# Another problem is that on some systems (solaris for example), there -+# is apparently a limit on the length of a fully specified path to -+# the coremaker executable, at about 80 chars. For this case, consider -+# it a pass, but note that the program name is bad. -+ -+gdb_exit -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n" -+} -+ -+set oldtimeout $timeout -+set timeout [expr "$timeout + 60"] -+verbose "Timeout is now $timeout seconds" 2 -+eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile" -+expect { -+ -re "Couldn't find .* registers in core file.*$gdb_prompt $" { -+ fail "args: -core=corefile (couldn't find regs)" -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+ -+ -+# -+# Test that startup with both an executable file and -core argument. -+# See previous comments above, they are still applicable. -+# -+ -+close; -+ -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n" -+} -+ -+ -+eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile"; -+expect { -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: execfile -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+set timeout $oldtimeout -+verbose "Timeout is now $timeout seconds" 2 -+ -+close; -+ -+# Now restart normally. -+ -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Test basic corefile recognition via core-file command. -+ -+send_gdb "core-file $objdir/$subdir/corefile\n" -+gdb_expect { -+ -re ".* program is being debugged already.*y or n. $" { -+ # gdb_load may connect us to a gdbserver. -+ send_gdb "y\n" -+ exp_continue; -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "core-file command (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "core-file command" } -+ timeout { fail "(timeout) core-file command" } -+} -+ -+# Test correct mapping of corefile sections by printing some variables. -+ -+gdb_test "print coremaker_data" "\\\$$decimal = 202" -+gdb_test "print coremaker_bss" "\\\$$decimal = 10" -+gdb_test "print coremaker_ro" "\\\$$decimal = 201" -+ -+gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}" -+ -+# Somehow we better test the ability to read the registers out of the core -+# file correctly. I don't think the other tests do this. -+ -+gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp" -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp" -+ -+# Test ability to read mmap'd data -+ -+gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file" -+setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*" -+set test "accessing mmapped data in core file" -+gdb_test_multiple "x/8bd buf2" "$test" { -+ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" { -+ pass "$test" -+ } -+ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" { -+ fail "$test (mapping failed at runtime)" -+ } -+ -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" { -+ fail "$test (mapping address not found in core file)" -+ } -+} -+ -+# test reinit_frame_cache -+ -+gdb_load ${binfile} -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)" -+ -+gdb_test "core" "No core file now." -Index: gdb-6.7/gdb/testsuite/gdb.pie/Makefile.in -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7/gdb/testsuite/gdb.pie/Makefile.in 2007-10-13 05:27:45.000000000 +0200 -@@ -0,0 +1,19 @@ -+VPATH = @srcdir@ -+srcdir = @srcdir@ -+ -+EXECUTABLES = -+MISCELLANEOUS = arch.inc -+ -+all info install-info dvi install uninstall installcheck check: -+ @echo "Nothing to be done for $@..." -+ -+clean mostlyclean: -+ -rm -f *~ *.o a.out *.x *.ci *.tmp -+ -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES) -+ -rm -f $(MISCELLANEOUS) -+ -+distclean maintainer-clean realclean: clean -+ -rm -f *~ core -+ -rm -f Makefile config.status config.log -+ -rm -f *-init.exp -+ -rm -fr *.log summary detail *.plog *.sum *.psum site.* diff --git a/gdb-6.3-threaded-watchpoints-20041213.patch b/gdb-6.3-threaded-watchpoints-20041213.patch deleted file mode 100644 index 26780cc..0000000 --- a/gdb-6.3-threaded-watchpoints-20041213.patch +++ /dev/null @@ -1,1099 +0,0 @@ -2004-12-13 Jeff Johnston - - * linux-nat.c: (stop_wait_callback, linux-nat-wait): Notify - observers of a sigtrap. - (delete_lwp): Free the saved_trap_data if present. - * linux-nat.h (struct lwp_info): Add saved_trap_data field. - (struct linux_watchpoint): New struct. - * linux-thread-db.c: Add support to always keep lwp info in ptids. - (attach_thread): Notify observers of a linux - new thread. - (thread_db_wait): Call check_event if SIGILL occurs. - * infrun.c: (handle_inferior_event): For platforms that - hit watchpoints prior to the data write, mark the watchpoints - so we know to check them after we step through the write. - * breakpoint.c (bpstat_stop_status): Fix up watchpoint code. - (insert_watchpoints_for_new_thread): New function. - (mark_triggered_watchpoints): Ditto. - * breakpoint.h (insert_watchpoints_for_new_thread): New prototype. - (mark_triggered_watchpoints): Ditto. - * i386-linux-nat.c (i386_linux_dr_get, i386_linux_dr_set): Use - TIDGET to get PTRACE lpw, otherwise fall back to PIDGET. - * amd64-linux-nat.c (amd64_linux_dr_get, amd64_linux_dr_set): Ditto. - * ia64-linux-nat.c: Add support for removing and inserting watchpoints - on all threads. - * s390-nat.c: Ditto. - * Makefile.in: Add observer.h and linux-nat.h to ia64-linux-nat.o - and s390-nat.o. - * doc/observer.texi: Add two new observers for linux_new_thread - and sigtrap. - -2007-10-13 Jan Kratochvil - - Port to GDB-6.7. - -2007-11-02 Jan Kratochvil - - Port to post-GDB-6.7.1 multi-PC breakpoints. - -Index: gdb-6.7.1/gdb/doc/observer.texi -=================================================================== ---- gdb-6.7.1.orig/gdb/doc/observer.texi 2007-05-11 21:55:20.000000000 +0200 -+++ gdb-6.7.1/gdb/doc/observer.texi 2007-11-02 15:21:57.000000000 +0100 -@@ -129,3 +129,12 @@ Called with @var{objfile} equal to @code - previously loaded symbol table data has now been invalidated. - @end deftypefun - -+@deftypefun void linux_new_thread (ptid_t @var{ptid}) -+A new linux thread described by @var{ptid} has been officially attached -+to by gdb. -+@end deftypefun -+ -+@deftypefun void sigtrap (void * @var{data}) -+A low-level SIGTRAP has been discovered. This notification can be used to save -+additional state necessary if the trap is deferred for later handling. -+@end deftypefun -Index: gdb-6.7.1/gdb/infrun.c -=================================================================== ---- gdb-6.7.1.orig/gdb/infrun.c 2007-11-02 15:21:46.000000000 +0100 -+++ gdb-6.7.1/gdb/infrun.c 2007-11-02 15:21:57.000000000 +0100 -@@ -1781,9 +1781,19 @@ handle_inferior_event (struct execution_ - single step over a watchpoint without disabling the watchpoint. */ - if (HAVE_STEPPABLE_WATCHPOINT && STOPPED_BY_WATCHPOINT (ecs->ws)) - { -+ CORE_ADDR addr = 0; -+ - if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n"); -- resume (1, 0); -+ -+ target_stopped_data_address (¤t_target, &addr); -+ mark_triggered_watchpoints (addr); -+ registers_changed (); -+ target_resume (ecs->ptid, 1, TARGET_SIGNAL_0); /* Single step */ -+ -+ ecs->waiton_ptid = ecs->ptid; -+ ecs->wp = &(ecs->ws); -+ ecs->infwait_state = infwait_nonstep_watch_state; - prepare_to_wait (ecs); - return; - } -@@ -1794,6 +1804,8 @@ handle_inferior_event (struct execution_ - if (gdbarch_have_nonsteppable_watchpoint (current_gdbarch) - && STOPPED_BY_WATCHPOINT (ecs->ws)) - { -+ CORE_ADDR addr = 0; -+ - /* At this point, we are stopped at an instruction which has - attempted to write to a piece of memory under control of - a watchpoint. The instruction hasn't actually executed -@@ -1801,15 +1813,12 @@ handle_inferior_event (struct execution_ - now, we would get the old value, and therefore no change - would seem to have occurred. - -- In order to make watchpoints work `right', we really need -- to complete the memory write, and then evaluate the -- watchpoint expression. The following code does that by -- removing the watchpoint (actually, all watchpoints and -- breakpoints), single-stepping the target, re-inserting -- watchpoints, and then falling through to let normal -- single-step processing handle proceed. Since this -- includes evaluating watchpoints, things will come to a -- stop in the correct manner. */ -+ In order to make watchpoints work `right', we mark the -+ triggered watchpoints so that after we single step, -+ we will check for a value change. */ -+ -+ target_stopped_data_address (¤t_target, &addr); -+ mark_triggered_watchpoints (addr); - - if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n"); -@@ -1880,6 +1889,41 @@ handle_inferior_event (struct execution_ - } - } - -+ if (stop_signal == TARGET_SIGNAL_TRAP -+ && trap_expected -+ && gdbarch_single_step_through_delay_p (current_gdbarch) -+ && currently_stepping (ecs)) -+ { -+ /* We're trying to step of a breakpoint. Turns out that we're -+ also on an instruction that needs to be stepped multiple -+ times before it's been fully executing. E.g., architectures -+ with a delay slot. It needs to be stepped twice, once for -+ the instruction and once for the delay slot. */ -+ int step_through_delay -+ = gdbarch_single_step_through_delay (current_gdbarch, -+ get_current_frame ()); -+ if (debug_infrun && step_through_delay) -+ fprintf_unfiltered (gdb_stdlog, "infrun: step through delay\n"); -+ if (step_range_end == 0 && step_through_delay) -+ { -+ /* The user issued a continue when stopped at a breakpoint. -+ Set up for another trap and get out of here. */ -+ ecs->another_trap = 1; -+ keep_going (ecs); -+ return; -+ } -+ else if (step_through_delay) -+ { -+ /* The user issued a step when stopped at a breakpoint. -+ Maybe we should stop, maybe we should not - the delay -+ slot *might* correspond to a line of source. In any -+ case, don't decide that here, just set ecs->another_trap, -+ making sure we single-step again before breakpoints are -+ re-inserted. */ -+ ecs->another_trap = 1; -+ } -+ } -+ - /* Look at the cause of the stop, and decide what to do. - The alternatives are: - 1) break; to really stop and return to the debugger, -@@ -1932,6 +1976,8 @@ handle_inferior_event (struct execution_ - See more comments in inferior.h. */ - if (stop_soon == STOP_QUIETLY_NO_SIGSTOP) - { -+ if (debug_infrun) -+ fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n"); - stop_stepping (ecs); - if (stop_signal == TARGET_SIGNAL_STOP) - stop_signal = TARGET_SIGNAL_0; -Index: gdb-6.7.1/gdb/breakpoint.c -=================================================================== ---- gdb-6.7.1.orig/gdb/breakpoint.c 2007-11-02 15:21:45.000000000 +0100 -+++ gdb-6.7.1/gdb/breakpoint.c 2007-11-02 15:23:04.000000000 +0100 -@@ -813,6 +813,90 @@ insert_catchpoint (struct ui_out *uo, vo - } - } - -+/* External function to insert all existing watchpoints on a newly -+ attached thread. IWPFN is a callback function to perform -+ the target insert watchpoint. This function is used to support -+ platforms where a watchpoint must be inserted/removed on each -+ individual thread (e.g. ia64-linux and s390-linux). For -+ ia64 and s390 linux, this function is called via a new thread -+ observer. */ -+int -+insert_watchpoints_for_new_thread (ptid_t new_thread, -+ insert_watchpoint_ftype *iwpfn) -+{ -+ struct bp_location *b; -+ int val = 0; -+ int return_val = 0; -+ struct ui_file *tmp_error_stream = mem_fileopen (); -+ make_cleanup_ui_file_delete (tmp_error_stream); -+ -+ /* Explicitly mark the warning -- this will only be printed if -+ there was an error. */ -+ fprintf_unfiltered (tmp_error_stream, "Warning:\n"); -+ -+ ALL_BP_LOCATIONS (b) -+ { -+ /* Skip disabled breakpoints. */ -+ if (!breakpoint_enabled (b->owner)) -+ continue; -+ -+ /* For every active watchpoint, we need to insert the watchpoint on -+ the new thread. */ -+ if (b->loc_type == bp_loc_hardware_watchpoint) -+ { -+ struct value *v = b->owner->val_chain; -+ -+ /* Look at each value on the value chain. */ -+ for (; v; v = v->next) -+ { -+ /* If it's a memory location, and GDB actually needed -+ its contents to evaluate the expression, then we -+ must watch it. */ -+ if (VALUE_LVAL (v) == lval_memory -+ && ! 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->owner->val_chain -+ || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT -+ && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) -+ { -+ CORE_ADDR addr; -+ int len, type; -+ -+ 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; -+ else if (b->owner->type == bp_access_watchpoint) -+ type = hw_access; -+ val = (*iwpfn) (new_thread, addr, len, type); -+ } -+ } -+ } -+ } -+ -+ if (val) -+ return_val = val; -+ } -+ -+ /* Failure to insert a watchpoint on any memory value in the -+ value chain brings us here. */ -+ if (return_val) -+ { -+ fprintf_unfiltered (tmp_error_stream, -+ "%s\n", -+ "Could not insert hardware watchpoints on new thread."); -+ target_terminal_ours_for_output (); -+ error_stream (tmp_error_stream); -+ } -+ return return_val; -+} -+ - /* Helper routine: free the value chain for a breakpoint (watchpoint). */ - - static void -@@ -1301,6 +1385,7 @@ remove_breakpoints (void) - { - struct bp_location *b; - int val; -+ int return_val = 0; - - ALL_BP_LOCATIONS (b) - { -@@ -1308,10 +1393,10 @@ remove_breakpoints (void) - { - val = remove_breakpoint (b, mark_uninserted); - if (val != 0) -- return val; -+ return_val = val; - } - } -- return 0; -+ return return_val; - } - - int -@@ -2200,8 +2285,13 @@ print_it_typical (bpstat bs) - break; - - case bp_thread_event: -- /* Not sure how we will get here. -- GDB should not stop for these breakpoints. */ -+ /* We can only get here legitimately if something further on the bs -+ list has caused the stop status to be noisy. A valid example -+ of this is a new thread event and a software watchpoint have -+ both occurred. */ -+ if (bs->next) -+ return PRINT_UNKNOWN; -+ - printf_filtered (_("Thread Event Breakpoint: gdb should not stop!\n")); - return PRINT_NOTHING; - break; -@@ -2654,6 +2744,54 @@ which its expression is valid.\n"); - } - } - -+/* Check watchpoints for a match with a stopped data address. -+ -+ STOPPED_DATA_ADDRESS is the address of a triggered watchpoint. -+ A match with an existing watchpoint will cause that watchpoint -+ to be marked as triggered. -+ -+ This function is only used for platforms where a watchpoint -+ triggers prior to the data being accessed. */ -+ -+void -+mark_triggered_watchpoints (CORE_ADDR stopped_data_address) -+{ -+ struct breakpoint *b, *temp; -+ CORE_ADDR addr = stopped_data_address; -+ struct value *v; -+ -+ ALL_BREAKPOINTS_SAFE (b, temp) -+ { -+ if (b->type == bp_hardware_watchpoint -+ || b->type == bp_read_watchpoint -+ || b->type == bp_access_watchpoint) -+ { -+ for (v = b->val_chain; v; v = v->next) -+ { -+ if (VALUE_LVAL (v) == lval_memory -+ && ! VALUE_LAZY (v)) -+ { -+ struct type *vtype = check_typedef (VALUE_TYPE (v)); -+ -+ if (v == b->val_chain -+ || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT -+ && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) -+ { -+ CORE_ADDR vaddr; -+ -+ 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))) -+ b->watchpoint_triggered = 1; -+ } -+ } -+ } -+ } -+ } -+} -+ - /* Get a bpstat associated with having just stopped at address - BP_ADDR in thread PTID. STOPPED_BY_WATCHPOINT is 1 if the - target thinks we stopped due to a hardware watchpoint, 0 if we -@@ -2787,82 +2925,61 @@ bpstat_stop_status (CORE_ADDR bp_addr, p - bs->stop = 1; - bs->print = 1; - -- if (b->type == bp_watchpoint || -- b->type == bp_hardware_watchpoint) -- { -- char *message = xstrprintf ("Error evaluating expression for watchpoint %d\n", -- b->number); -- struct cleanup *cleanups = make_cleanup (xfree, message); -- int e = catch_errors (watchpoint_check, bs, message, -- RETURN_MASK_ALL); -- do_cleanups (cleanups); -- switch (e) -- { -- case WP_DELETED: -- /* We've already printed what needs to be printed. */ -- /* Actually this is superfluous, because by the time we -- call print_it_typical() the wp will be already deleted, -- and the function will return immediately. */ -- bs->print_it = print_it_done; -- /* Stop. */ -- break; -- case WP_VALUE_CHANGED: -- /* Stop. */ -- ++(b->hit_count); -- break; -- case WP_VALUE_NOT_CHANGED: -- /* Don't stop. */ -- bs->print_it = print_it_noop; -- bs->stop = 0; -- continue; -- default: -- /* Can't happen. */ -- /* FALLTHROUGH */ -- case 0: -- /* Error from catch_errors. */ -- printf_filtered (_("Watchpoint %d deleted.\n"), b->number); -- if (b->related_breakpoint) -- b->related_breakpoint->disposition = disp_del_at_next_stop; -- b->disposition = disp_del_at_next_stop; -- /* We've already printed what needs to be printed. */ -- bs->print_it = print_it_done; -- -- /* Stop. */ -- break; -- } -- } -- else if (b->type == bp_read_watchpoint || -- b->type == bp_access_watchpoint) -+ if (b->type == bp_watchpoint -+ || b->type == bp_read_watchpoint -+ || b->type == bp_access_watchpoint -+ || b->type == bp_hardware_watchpoint) - { - CORE_ADDR addr; - struct value *v; -- int found = 0; -+ int must_check_value = 0; - -- if (!target_stopped_data_address (¤t_target, &addr)) -- continue; -- for (v = b->val_chain; v; v = value_next (v)) -+ if (b->type == bp_watchpoint -+ || b->watchpoint_triggered -+ || (b->type == bp_hardware_watchpoint -+ && !target_stopped_data_address_p (¤t_target))) - { -- if (VALUE_LVAL (v) == lval_memory -- && ! value_lazy (v)) -+ /* We either have a software watchpoint, a triggered watchpoint -+ which we have stepped over, or we cannot ascertain what data -+ address causes a write watchpoint. In all these -+ cases, we must check the watchpoint value. */ -+ b->watchpoint_triggered = 0; -+ must_check_value = 1; -+ } -+ else -+ { -+ /* At this point, we know target_stopped_data_address () works or -+ we have a read or access watchpoint and have no alternatives. */ -+ if (!target_stopped_data_address (¤t_target, &addr)) - { -- struct type *vtype = check_typedef (value_type (v)); -- -- if (v == b->val_chain -- || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT -- && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) -+ bs->print_it = print_it_noop; -+ bs->stop = 0; -+ continue; -+ } -+ for (v = b->val_chain; v; v = v->next) -+ { -+ if (VALUE_LVAL (v) == lval_memory -+ && ! VALUE_LAZY (v)) - { -- CORE_ADDR vaddr; -- -- 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))) -- found = 1; -+ struct type *vtype = check_typedef (VALUE_TYPE (v)); -+ -+ if (v == b->val_chain -+ || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT -+ && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) -+ { -+ CORE_ADDR vaddr; -+ -+ 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))) -+ must_check_value = 1; -+ } - } - } - } -- if (found) -+ if (must_check_value) - { - char *message = xstrprintf ("Error evaluating expression for watchpoint %d\n", - b->number); -@@ -2891,6 +3008,15 @@ bpstat_stop_status (CORE_ADDR bp_addr, p - break; - case WP_VALUE_NOT_CHANGED: - /* Stop. */ -+ if (b->type == bp_hardware_watchpoint -+ || b->type == bp_watchpoint) -+ { -+ /* Don't stop: write watchpoints shouldn't fire if -+ the value hasn't changed. */ -+ bs->print_it = print_it_noop; -+ bs->stop = 0; -+ continue; -+ } - ++(b->hit_count); - break; - default: -@@ -2906,7 +3032,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p - break; - } - } -- else /* found == 0 */ -+ else /* must_check_value == 0 */ - { - /* This is a case where some watchpoint(s) triggered, - but not at the address of this watchpoint (FOUND -@@ -4292,6 +4418,7 @@ set_raw_breakpoint_without_location (enu - b->exec_pathname = NULL; - b->ops = NULL; - b->condition_not_parsed = 0; -+ b->watchpoint_triggered = 0; - - /* Add this breakpoint to the end of the chain - so that a list of breakpoints will come out in order -Index: gdb-6.7.1/gdb/breakpoint.h -=================================================================== ---- gdb-6.7.1.orig/gdb/breakpoint.h 2007-11-02 15:21:45.000000000 +0100 -+++ gdb-6.7.1/gdb/breakpoint.h 2007-11-02 15:22:24.000000000 +0100 -@@ -439,6 +439,11 @@ struct breakpoint - no location initially so had no context to parse - the condition in. */ - int condition_not_parsed; -+ -+ /* Has a watchpoint been triggered? This is only used for -+ non-continuable watchpoints which trigger prior to the data -+ being modified. */ -+ int watchpoint_triggered; - }; - - /* The following stuff is an abstract data type "bpstat" ("breakpoint -@@ -707,6 +712,14 @@ extern void tbreak_command (char *, int) - - extern int insert_breakpoints (void); - -+/* The following provides a callback mechanism to insert watchpoints -+ for a new thread. This is needed, for example, on ia64 linux. */ -+typedef int (insert_watchpoint_ftype) (ptid_t, CORE_ADDR, int, int); -+extern int insert_watchpoints_for_new_thread (ptid_t ptid, -+ insert_watchpoint_ftype *fn); -+ -+extern void mark_triggered_watchpoints (CORE_ADDR); -+ - extern int remove_breakpoints (void); - - /* This function can be used to physically insert eventpoints from the -Index: gdb-6.7.1/gdb/linux-nat.c -=================================================================== ---- gdb-6.7.1.orig/gdb/linux-nat.c 2007-11-02 15:21:46.000000000 +0100 -+++ gdb-6.7.1/gdb/linux-nat.c 2007-11-02 15:21:57.000000000 +0100 -@@ -34,6 +34,7 @@ - #include "gdbthread.h" - #include "gdbcmd.h" - #include "regcache.h" -+#include "observer.h" - #include "regset.h" - #include "inf-ptrace.h" - #include "auxv.h" -@@ -704,6 +705,9 @@ delete_lwp (ptid_t ptid) - else - lwp_list = lp->next; - -+ if (lp->saved_trap_data) -+ xfree (lp->saved_trap_data); -+ - xfree (lp); - } - -@@ -1501,6 +1505,13 @@ stop_wait_callback (struct lwp_info *lp, - user will delete or disable the breakpoint, but the - thread will have already tripped on it. */ - -+ /* Notify any observers that we have a SIGTRAP. -+ This is needed on platforms that must save more state -+ than just the trap. For example, ia64 linux uses -+ siginfo to determine if a watchpoint has occurred and -+ this information gets trashed by a SIGSTOP. */ -+ observer_notify_sigtrap (lp); -+ - /* Now resume this LWP and get the SIGSTOP event. */ - errno = 0; - ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); -@@ -2061,6 +2072,14 @@ retry: - target_pid_to_str (lp->ptid)); - } - -+ /* For platforms such as ia64, a hardware watchpoint is -+ determined by looking at special information available -+ at the time time of the trap (siginfo). This information -+ is not preserved if we choose to take an event on another -+ thread and later come back to this event, thus we must -+ notify an observer so the information can be stored. */ -+ observer_notify_sigtrap (lp); -+ - /* Handle GNU/Linux's extended waitstatus for trace events. */ - if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0) - { -Index: gdb-6.7.1/gdb/linux-nat.h -=================================================================== ---- gdb-6.7.1.orig/gdb/linux-nat.h 2007-11-02 15:21:46.000000000 +0100 -+++ gdb-6.7.1/gdb/linux-nat.h 2007-11-02 15:21:57.000000000 +0100 -@@ -61,6 +61,18 @@ struct lwp_info - - /* Next LWP in list. */ - struct lwp_info *next; -+ -+ /* Optional saved trap state for when a trap gets pushed back -+ due to multiple events occurring at the same time. */ -+ void *saved_trap_data; -+}; -+ -+/* Watchpoint description. */ -+struct linux_watchpoint -+{ -+ CORE_ADDR addr; -+ int len; -+ int type; - }; - - /* Attempt to initialize libthread_db. */ -Index: gdb-6.7.1/gdb/Makefile.in -=================================================================== ---- gdb-6.7.1.orig/gdb/Makefile.in 2007-09-05 02:14:02.000000000 +0200 -+++ gdb-6.7.1/gdb/Makefile.in 2007-11-02 15:21:57.000000000 +0100 -@@ -2160,7 +2160,7 @@ i387-tdep.o: i387-tdep.c $(defs_h) $(dou - $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h) - ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \ - $(target_h) $(gdbcore_h) $(regcache_h) $(ia64_tdep_h) $(gdb_wait_h) \ -- $(gregset_h) $(linux_nat_h) -+ $(gregset_h) $(observer_h) $(linux_nat_h) - ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \ - $(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h) $(solib_svr4_h) \ - $(symtab_h) -@@ -2541,7 +2541,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $ - rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(gdb_string_h) $(osabi_h) \ - $(regcache_h) $(regset_h) $(rs6000_tdep_h) $(ppc_tdep_h) - s390-nat.o: s390-nat.c $(defs_h) $(regcache_h) $(inferior_h) \ -- $(s390_tdep_h) $(target_h) $(linux_nat_h) -+ $(s390_tdep_h) $(target_h) $(linux_nat_h) $(observer_h) - s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ - $(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \ - $(floatformat_h) $(regcache_h) $(trad_frame_h) $(frame_base_h) \ -Index: gdb-6.7.1/gdb/linux-thread-db.c -=================================================================== ---- gdb-6.7.1.orig/gdb/linux-thread-db.c 2007-08-23 20:08:35.000000000 +0200 -+++ gdb-6.7.1/gdb/linux-thread-db.c 2007-11-02 15:21:57.000000000 +0100 -@@ -34,6 +34,7 @@ - #include "target.h" - #include "regcache.h" - #include "solib-svr4.h" -+#include "observer.h" - #include "gdbcore.h" - #include "observer.h" - #include "linux-nat.h" -@@ -673,6 +674,7 @@ attach_thread (ptid_t ptid, const td_thr - { - struct thread_info *tp; - td_err_e err; -+ ptid_t new_ptid; - - /* If we're being called after a TD_CREATE event, we may already - know about this thread. There are two ways this can happen. We -@@ -700,8 +702,10 @@ attach_thread (ptid_t ptid, const td_thr - if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE) - return; /* A zombie thread -- do not attach. */ - -+ new_ptid = BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)); -+ - /* Under GNU/Linux, we have to attach to each and every thread. */ -- if (lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)), 0) < 0) -+ if (lin_lwp_attach_lwp (new_ptid, 0) < 0) - return; - - /* Add the thread to GDB's thread list. */ -@@ -712,6 +716,11 @@ attach_thread (ptid_t ptid, const td_thr - if (verbose) - printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid)); - -+ /* Notify any observers of a new linux thread. This -+ would include any linux platforms that have to insert hardware -+ watchpoints on every thread. */ -+ observer_notify_linux_new_thread (new_ptid); -+ - /* Enable thread event reporting for this thread. */ - err = td_thr_event_enable_p (th_p, 1); - if (err != TD_OK) -@@ -891,7 +900,8 @@ thread_db_wait (ptid_t ptid, struct targ - thread_db_find_new_threads (); - - if (ourstatus->kind == TARGET_WAITKIND_STOPPED -- && ourstatus->value.sig == TARGET_SIGNAL_TRAP) -+ && (ourstatus->value.sig == TARGET_SIGNAL_TRAP -+ || ourstatus->value.sig == TARGET_SIGNAL_ILL)) - /* Check for a thread event. */ - check_event (ptid); - -Index: gdb-6.7.1/gdb/i386-linux-nat.c -=================================================================== ---- gdb-6.7.1.orig/gdb/i386-linux-nat.c 2007-08-23 20:08:34.000000000 +0200 -+++ gdb-6.7.1/gdb/i386-linux-nat.c 2007-11-02 15:21:57.000000000 +0100 -@@ -585,10 +585,9 @@ i386_linux_dr_get (int regnum) - int tid; - unsigned long value; - -- /* FIXME: kettenis/2001-01-29: It's not clear what we should do with -- multi-threaded processes here. For now, pretend there is just -- one thread. */ -- tid = PIDGET (inferior_ptid); -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); - - /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the - ptrace call fails breaks debugging remote targets. The correct -@@ -613,10 +612,9 @@ i386_linux_dr_set (int regnum, unsigned - { - int tid; - -- /* FIXME: kettenis/2001-01-29: It's not clear what we should do with -- multi-threaded processes here. For now, pretend there is just -- one thread. */ -- tid = PIDGET (inferior_ptid); -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); - - errno = 0; - ptrace (PTRACE_POKEUSER, tid, -Index: gdb-6.7.1/gdb/ia64-linux-nat.c -=================================================================== ---- gdb-6.7.1.orig/gdb/ia64-linux-nat.c 2007-08-23 20:08:35.000000000 +0200 -+++ gdb-6.7.1/gdb/ia64-linux-nat.c 2007-11-02 15:21:57.000000000 +0100 -@@ -27,6 +27,7 @@ - #include "regcache.h" - #include "ia64-tdep.h" - #include "linux-nat.h" -+#include "observer.h" - - #include - #include -@@ -550,10 +551,10 @@ is_power_of_2 (int val) - return onecount <= 1; - } - -+/* Internal routine to insert one watchpoint for a specified thread. */ - static int --ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw) -+ia64_linux_insert_one_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rw) - { -- ptid_t ptid = inferior_ptid; - int idx; - long dbr_addr, dbr_mask; - int max_watchpoints = 4; -@@ -598,10 +599,39 @@ ia64_linux_insert_watchpoint (CORE_ADDR - return 0; - } - -+/* Internal callback routine which can be used via iterate_over_lwps -+ to insert a specific watchpoint from all active threads. */ - static int --ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) -+ia64_linux_insert_watchpoint_callback (struct lwp_info *lwp, void *data) -+{ -+ struct linux_watchpoint *args = (struct linux_watchpoint *)data; -+ -+ return ia64_linux_insert_one_watchpoint (lwp->ptid, args->addr, -+ args->len, args->type); -+} -+ -+/* Insert a watchpoint for all threads. */ -+static int -+ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw) -+{ -+ struct linux_watchpoint args; -+ -+ args.addr = addr; -+ args.len = len; -+ args.type = rw; -+ -+ /* For ia64, watchpoints must be inserted/removed on each thread so -+ we iterate over the lwp list. */ -+ if (iterate_over_lwps (&ia64_linux_insert_watchpoint_callback, &args)) -+ return -1; -+ -+ return 0; -+} -+ -+/* Internal routine to remove one watchpoint for a specified thread. */ -+static int -+ia64_linux_remove_one_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int type) - { -- ptid_t ptid = inferior_ptid; - int idx; - long dbr_addr, dbr_mask; - int max_watchpoints = 4; -@@ -623,13 +653,55 @@ ia64_linux_remove_watchpoint (CORE_ADDR - return -1; - } - -+/* Internal callback routine which can be used via iterate_over_lwps -+ to remove a specific watchpoint from all active threads. */ -+static int -+ia64_linux_remove_watchpoint_callback (struct lwp_info *lwp, void *data) -+{ -+ struct linux_watchpoint *args = (struct linux_watchpoint *)data; -+ -+ return ia64_linux_remove_one_watchpoint (lwp->ptid, args->addr, -+ args->len); -+} -+ -+/* Remove a watchpoint for all threads. */ -+static int -+ia64_linux_remove_watchpoint (CORE_ADDR addr, int len) -+{ -+ struct linux_watchpoint args; -+ -+ args.addr = addr; -+ args.len = len; -+ -+ /* For ia64, watchpoints must be inserted/removed on each thread so -+ we iterate over the lwp list. */ -+ if (iterate_over_lwps (&ia64_linux_remove_watchpoint_callback, &args)) -+ return -1; -+ -+ return 0; -+} -+ -+/* Callback to find lwp_info struct for a given lwp. */ -+static int -+find_lwp_info (struct lwp_info *lp, void *data) -+{ -+ int lwp = *(int *)data; -+ -+ if (lwp == TIDGET (lp->ptid)) -+ return 1; -+ -+ return 0; -+} -+ - static int - ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) - { - CORE_ADDR psr; - int tid; - struct siginfo siginfo; -+ struct siginfo *siginfo_p; - ptid_t ptid = inferior_ptid; -+ struct lwp_info *lp; - struct regcache *regcache = get_current_regcache (); - - tid = TIDGET(ptid); -@@ -637,10 +709,19 @@ ia64_linux_stopped_data_address (struct - tid = PIDGET (ptid); - - errno = 0; -- ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_TYPE_ARG3) 0, &siginfo); -+ /* Check to see if we have already cached the siginfo for this -+ event. */ -+ lp = iterate_over_lwps (find_lwp_info, &tid); -+ if (lp && lp->saved_trap_data != NULL) -+ siginfo_p = (struct siginfo *)lp->saved_trap_data; -+ else -+ { -+ siginfo_p = &siginfo; -+ ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_TYPE_ARG3) 0, siginfo_p); -+ } - -- if (errno != 0 || siginfo.si_signo != SIGTRAP || -- (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) -+ if (errno != 0 || siginfo_p->si_signo != SIGTRAP || -+ (siginfo_p->si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) - return 0; - - regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr); -@@ -648,7 +729,7 @@ ia64_linux_stopped_data_address (struct - for the next instruction */ - regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr); - -- *addr_p = (CORE_ADDR)siginfo.si_addr; -+ *addr_p = (CORE_ADDR)siginfo_p->si_addr; - return 1; - } - -@@ -796,6 +877,31 @@ ia64_linux_xfer_partial (struct target_o - offset, len); - } - -+/* Observer function for a new thread attach. We need to insert -+ existing watchpoints on the new thread. */ -+static void -+ia64_linux_new_thread (ptid_t ptid) -+{ -+ insert_watchpoints_for_new_thread (ptid, -+ &ia64_linux_insert_one_watchpoint); -+} -+ -+/* For ia64 linux, we must save the siginfo data as part of the state -+ of a queued SIGTRAP. This is because siginfo is used to determine -+ if a watchpoint has occurred and the information will be lost if -+ a SIGSTOP is issued to the thread. */ -+void -+ia64_linux_save_sigtrap_info (void *queue_data) -+{ -+ struct lwp_info *lp = (struct lwp_info *)queue_data; -+ -+ 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, -+ lp->saved_trap_data); -+} -+ - void _initialize_ia64_linux_nat (void); - - void -@@ -834,4 +940,7 @@ _initialize_ia64_linux_nat (void) - - /* Register the target. */ - linux_nat_add_target (t); -+ -+ observer_attach_linux_new_thread (ia64_linux_new_thread); -+ observer_attach_sigtrap (ia64_linux_save_sigtrap_info); - } -Index: gdb-6.7.1/gdb/amd64-linux-nat.c -=================================================================== ---- gdb-6.7.1.orig/gdb/amd64-linux-nat.c 2007-08-23 20:08:26.000000000 +0200 -+++ gdb-6.7.1/gdb/amd64-linux-nat.c 2007-11-02 15:21:57.000000000 +0100 -@@ -240,10 +240,9 @@ amd64_linux_dr_get (int regnum) - int tid; - unsigned long value; - -- /* FIXME: kettenis/2001-01-29: It's not clear what we should do with -- multi-threaded processes here. For now, pretend there is just -- one thread. */ -- tid = PIDGET (inferior_ptid); -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); - - /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the - ptrace call fails breaks debugging remote targets. The correct -@@ -268,10 +267,9 @@ amd64_linux_dr_set (int regnum, unsigned - { - int tid; - -- /* FIXME: kettenis/2001-01-29: It's not clear what we should do with -- multi-threaded processes here. For now, pretend there is just -- one thread. */ -- tid = PIDGET (inferior_ptid); -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); - - errno = 0; - ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value); -Index: gdb-6.7.1/gdb/s390-nat.c -=================================================================== ---- gdb-6.7.1.orig/gdb/s390-nat.c 2007-08-23 20:08:37.000000000 +0200 -+++ gdb-6.7.1/gdb/s390-nat.c 2007-11-02 15:21:57.000000000 +0100 -@@ -27,6 +27,7 @@ - #include "linux-nat.h" - - #include "s390-tdep.h" -+#include "observer.h" - - #include - #include -@@ -111,14 +112,14 @@ fill_fpregset (const struct regcache *re - (char *)regp + regmap_fpregset[i]); - } - --/* Find the TID for the current inferior thread to use with ptrace. */ -+/* Find the TID for use with ptrace. */ - static int --s390_inferior_tid (void) -+s390_tid (ptid_t ptid) - { - /* GNU/Linux LWP ID's are process ID's. */ -- int tid = TIDGET (inferior_ptid); -+ int tid = TIDGET (ptid); - if (tid == 0) -- tid = PIDGET (inferior_ptid); /* Not a threaded program. */ -+ tid = PIDGET (ptid); /* Not a threaded program. */ - - return tid; - } -@@ -202,7 +203,7 @@ store_fpregs (const struct regcache *reg - static void - s390_linux_fetch_inferior_registers (struct regcache *regcache, int regnum) - { -- int tid = s390_inferior_tid (); -+ int tid = s390_tid (inferior_ptid); - - if (regnum == -1 - || (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1)) -@@ -218,7 +219,7 @@ s390_linux_fetch_inferior_registers (str - static void - s390_linux_store_inferior_registers (struct regcache *regcache, int regnum) - { -- int tid = s390_inferior_tid (); -+ int tid = s390_tid (inferior_ptid); - - if (regnum == -1 - || (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1)) -@@ -260,7 +261,7 @@ s390_stopped_by_watchpoint (void) - parea.len = sizeof (per_lowcore); - parea.process_addr = (addr_t) & per_lowcore; - parea.kernel_addr = offsetof (struct user_regs_struct, per_info.lowcore); -- if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea) < 0) -+ if (ptrace (PTRACE_PEEKUSR_AREA, s390_tid (inferior_ptid), &parea) < 0) - perror_with_name (_("Couldn't retrieve watchpoint status")); - - return per_lowcore.perc_storage_alteration == 1 -@@ -268,9 +269,9 @@ s390_stopped_by_watchpoint (void) - } - - static void --s390_fix_watch_points (void) -+s390_fix_watch_points (ptid_t ptid) - { -- int tid = s390_inferior_tid (); -+ int tid = s390_tid (ptid); - - per_struct per_info; - ptrace_area parea; -@@ -307,6 +308,16 @@ s390_fix_watch_points (void) - perror_with_name (_("Couldn't modify watchpoint status")); - } - -+/* Callback routine to use with iterate_over_lwps to insert a specified -+ watchpoint on all threads. */ -+static int -+s390_insert_watchpoint_callback (struct lwp_info *lwp, void *data) -+{ -+ s390_fix_watch_points (lwp->ptid); -+ return 0; -+} -+ -+/* Insert a specified watchpoint on all threads. */ - static int - s390_insert_watchpoint (CORE_ADDR addr, int len, int type) - { -@@ -320,10 +331,24 @@ s390_insert_watchpoint (CORE_ADDR addr, - area->next = watch_base; - watch_base = area; - -- s390_fix_watch_points (); -+ /* For the S390, a watchpoint must be inserted/removed for each -+ thread so we iterate over the list of existing lwps. */ -+ if (iterate_over_lwps (&s390_insert_watchpoint_callback, NULL)) -+ return -1; -+ - return 0; - } - -+/* Callback routine to use with iterate_over_lwps to remove a specified -+ watchpoint from all threads. */ -+static int -+s390_remove_watchpoint_callback (struct lwp_info *lwp, void *data) -+{ -+ s390_fix_watch_points (lwp->ptid); -+ return 0; -+} -+ -+/* Remove a specified watchpoint from all threads. */ - static int - s390_remove_watchpoint (CORE_ADDR addr, int len, int type) - { -@@ -345,7 +370,11 @@ s390_remove_watchpoint (CORE_ADDR addr, - *parea = area->next; - xfree (area); - -- s390_fix_watch_points (); -+ /* For the S390, a watchpoint must be inserted/removed for each -+ thread so we iterate over the list of existing lwps. */ -+ if (iterate_over_lwps (&s390_remove_watchpoint_callback, NULL)) -+ return -1; -+ - return 0; - } - -@@ -361,6 +390,15 @@ s390_region_ok_for_hw_watchpoint (CORE_A - return 1; - } - -+/* New thread observer that inserts all existing watchpoints on the -+ new thread. */ -+static void -+s390_linux_new_thread (ptid_t ptid) -+{ -+ /* Add existing watchpoints to new thread. */ -+ s390_fix_watch_points (ptid); -+} -+ - - void _initialize_s390_nat (void); - -@@ -386,4 +424,6 @@ _initialize_s390_nat (void) - - /* Register the target. */ - linux_nat_add_target (t); -+ -+ observer_attach_linux_new_thread (s390_linux_new_thread); - } diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch deleted file mode 100644 index e43cb8c..0000000 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ /dev/null @@ -1,861 +0,0 @@ -2005-02-28 Jeff Johnston - - * 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 - - 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 -+#include -+#include -+#include -+ -+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); diff --git a/gdb-6.5-bz181390-memory-address-width.patch b/gdb-6.5-bz181390-memory-address-width.patch index 5446728..ade16fb 100644 --- a/gdb-6.5-bz181390-memory-address-width.patch +++ b/gdb-6.5-bz181390-memory-address-width.patch @@ -1,6 +1,5 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390 - 2006-09-28 Jan Kratochvil * 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 to the target's address bit size, bugreport by John Reiser. +2008-03-02 Jan Kratochvil -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 -retrieving revision 1.169 -diff -u -p -r1.169 utils.c ---- 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) +--- gdb-6.7.50.20080227.orig/gdb/utils.c 2008-03-02 14:28:44.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/utils.c 2008-03-02 14:35:09.000000000 +0100 +@@ -2540,6 +2540,14 @@ paddr_nz (CORE_ADDR addr) const char * 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 larger or equal than the width of a CORE_ADDR. The local 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)) addr &= ((CORE_ADDR) 1 << addr_bit) - 1; @@ -41,30 +41,26 @@ diff -u -p -r1.169 utils.c 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 -retrieving revision 1.36 -diff -u -p -r1.36 value.c ---- 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.")); +--- gdb-6.7.50.20080227.orig/gdb/value.c 2008-01-18 18:07:40.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/value.c 2008-03-02 14:36:38.000000000 +0100 +@@ -983,11 +983,9 @@ value_as_double (struct value *val) return foo; } + -/* 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 - handles all the cases. */ -CORE_ADDR -value_as_address (struct value *val) -+ +/* See `value_as_address' below - core of value to C pointer extraction. */ +static CORE_ADDR +value_as_address_core (struct value *val) { /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure 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)); #endif } @@ -99,3 +95,103 @@ diff -u -p -r1.36 value.c /* Unpack raw data (copied from debugee, target byte order) at VALADDR 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 . ++ ++ 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 . ++ 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 . ++ ++# 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 . ++# 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" diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index d713087..d11b475 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -1,5 +1,8 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you 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 <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 -+++ ./gdb/dwarf2read.c 3 Nov 2007 21:03:43 -0000 -@@ -5550,8 +5550,8 @@ read_partial_die (struct partial_die_inf +Index: gdb-6.8cvs20080219/gdb/dwarf2read.c +=================================================================== +--- 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: @@ -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); break; 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); break; 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; case DW_AT_low_pc: 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; @@ -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); if (attr && DW_STRING (attr)) return DW_STRING (attr); - - - -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.7.1/gdb/gdbtypes.c 2007-11-04 01:43:03.000000000 +0100 -+++ 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 +Index: gdb-6.8cvs20080219/gdb/gdbtypes.c +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/gdbtypes.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/gdbtypes.c 2008-02-20 13:35:19.000000000 +0100 +@@ -3106,6 +3106,8 @@ gdbtypes_post_init (struct gdbarch *gdba 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); + builtin_type->builtin_int_ptr = + make_pointer_type (builtin_type->builtin_int, NULL); builtin_type->builtin_unsigned_int = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, -@@ -3559,6 +3561,11 @@ gdbtypes_post_init (struct gdbarch *gdba + gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, +@@ -3215,6 +3217,11 @@ gdbtypes_post_init (struct gdbarch *gdba "", NULL); TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol) = 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 = init_type (TYPE_CODE_INT, 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 ---- 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 -@@ -1008,6 +1008,7 @@ struct builtin_type +Index: gdb-6.8cvs20080219/gdb/gdbtypes.h +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/gdbtypes.h 2008-02-14 23:03:57.000000000 +0100 ++++ 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. */ 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_unknown_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_short; 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_signed_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 ---- 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 -@@ -424,7 +424,12 @@ write_exp_msymbol (struct minimal_symbol +Index: gdb-6.8cvs20080219/gdb/parse.c +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/parse.c 2008-01-02 00:04:03.000000000 +0100 ++++ 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_file_text: 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; 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 ---- 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 -@@ -819,6 +819,25 @@ pop_target (void) +Index: gdb-6.8cvs20080219/gdb/target.c +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/target.c 2008-02-19 17:22:33.000000000 +0100 ++++ 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")); } @@ -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; +} + - /* 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. */ 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 TLS is an ABI-specific thing. But we don't do that yet. */ 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; } -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 ---- 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 +Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.c +=================================================================== +--- /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 @@ +/* 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 */ +} -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 ---- 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 +Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +=================================================================== +--- /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 @@ +# Copyright 2007 Free Software Foundation, Inc. + diff --git a/gdb-6.5-bz237872-ppc-long-double.patch b/gdb-6.5-bz237872-ppc-long-double.patch deleted file mode 100644 index 19c7a0d..0000000 --- a/gdb-6.5-bz237872-ppc-long-double.patch +++ /dev/null @@ -1,177 +0,0 @@ -2007-04-20 Luis Machado - - * 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 - - 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 diff --git a/gdb-6.5-gcore-i386-on-amd64.patch b/gdb-6.5-gcore-i386-on-amd64.patch index 956e84c..8b00198 100644 --- a/gdb-6.5-gcore-i386-on-amd64.patch +++ b/gdb-6.5-gcore-i386-on-amd64.patch @@ -19,11 +19,15 @@ Port to GDB-6.7. -Index: gdb-6.7/gdb/Makefile.in +2008-02-24 Jan Kratochvil + + 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.7/gdb/Makefile.in 2007-10-16 15:46:48.000000000 +0200 -@@ -717,6 +717,7 @@ gdb_expat_h = gdb_expat.h +--- gdb-6.8cvs20080219.orig/gdb/Makefile.in 2008-02-19 16:52:21.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/Makefile.in 2008-02-20 13:39:08.000000000 +0100 +@@ -785,6 +785,7 @@ gdb_expat_h = gdb_expat.h gdb_locale_h = gdb_locale.h gdb_obstack_h = gdb_obstack.h $(obstack_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_regex_h = gdb_regex.h $(xregex_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 gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_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_wait_h = gdb_wait.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) \ $(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_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) \ $(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_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.7/gdb/amd64-linux-nat.c 2007-10-16 15:46:18.000000000 +0200 -@@ -51,6 +51,9 @@ +--- gdb-6.8cvs20080219.orig/gdb/amd64-linux-nat.c 2008-02-16 19:10:27.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/amd64-linux-nat.c 2008-02-20 13:39:08.000000000 +0100 +@@ -50,6 +50,9 @@ #include "amd64-tdep.h" #include "i386-linux-tdep.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 `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 little-endian we get away with that. */ @@ -99,7 +103,7 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c /* From on GNU/Linux i386. */ 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 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_store_registers = amd64_linux_store_inferior_registers; @@ -207,11 +211,11 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c + /* Register the target. */ linux_nat_add_target (t); - -Index: gdb-6.7/gdb/config.in + linux_nat_set_new_thread (t, amd64_linux_new_thread); +Index: gdb-6.8cvs20080219/gdb/config.in =================================================================== ---- gdb-6.7.orig/gdb/config.in 2007-06-18 17:46:37.000000000 +0200 -+++ gdb-6.7/gdb/config.in 2007-10-16 15:46:18.000000000 +0200 +--- gdb-6.8cvs20080219.orig/gdb/config.in 2008-01-10 19:17:06.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/config.in 2008-02-20 13:39:08.000000000 +0100 @@ -385,6 +385,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H @@ -232,11 +236,11 @@ Index: gdb-6.7/gdb/config.in /* Define to 1 if you have the header file. */ #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.7/gdb/configure 2007-10-16 15:46:18.000000000 +0200 -@@ -10439,6 +10439,157 @@ done +--- gdb-6.8cvs20080219.orig/gdb/configure 2008-02-14 23:03:56.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/configure 2008-02-20 13:39:08.000000000 +0100 +@@ -11140,6 +11140,157 @@ done @@ -394,11 +398,11 @@ Index: gdb-6.7/gdb/configure for ac_header in sys/wait.h wait.h do 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.7/gdb/configure.ac 2007-10-16 15:46:18.000000000 +0200 -@@ -424,6 +424,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [], +--- gdb-6.8cvs20080219.orig/gdb/configure.ac 2008-02-14 23:03:56.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/configure.ac 2008-02-20 13:39:08.000000000 +0100 +@@ -523,6 +523,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [], # include #endif ]) @@ -406,10 +410,10 @@ Index: gdb-6.7/gdb/configure.ac AC_CHECK_HEADERS(sys/wait.h wait.h) AC_CHECK_HEADERS(termios.h termio.h sgtty.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.7/gdb/gcore.c 2007-10-16 15:46:18.000000000 +0200 +--- gdb-6.8cvs20080219.orig/gdb/gcore.c 2008-02-19 16:52:21.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/gcore.c 2008-02-20 13:39:08.000000000 +0100 @@ -317,6 +317,11 @@ gcore_create_callback (CORE_ADDR vaddr, asection *osec; 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 when we later try to access it for read/write, we'll get an error 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 -+++ 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 @@ +#ifdef HAVE_SYS_PROCFS32_H +#include @@ -555,10 +559,10 @@ Index: gdb-6.7/gdb/gdb_procfs32.h +#endif /* _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 -+++ 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 @@ +#ifdef HAVE_SYS_USER32_H +#include @@ -668,11 +672,11 @@ Index: gdb-6.7/gdb/gdb_user32.h +#endif /* _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.7/gdb/linux-nat.c 2007-10-16 15:46:18.000000000 +0200 -@@ -98,6 +98,21 @@ static LONGEST (*super_xfer_partial) (st +--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-19 17:27:21.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-20 13:39:08.000000000 +0100 +@@ -104,6 +104,21 @@ static LONGEST (*super_xfer_partial) (st const gdb_byte *, ULONGEST, LONGEST); @@ -694,7 +698,7 @@ Index: gdb-6.7/gdb/linux-nat.c static int debug_linux_nat; static void 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 fill_gregset (regcache, &gregs, -1); @@ -711,7 +715,7 @@ Index: gdb-6.7/gdb/linux-nat.c if (core_regset_p && (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 fill_fpregset (regcache, &fpregs, -1); @@ -727,7 +731,7 @@ Index: gdb-6.7/gdb/linux-nat.c #ifdef FILL_FPXREGSET 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); } } @@ -740,16 +744,16 @@ Index: gdb-6.7/gdb/linux-nat.c } /* 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.7/gdb/linux-nat.h 2007-10-16 15:46:18.000000000 +0200 -@@ -110,3 +110,12 @@ void linux_nat_add_target (struct target - /* Update linux-nat internal state when changing from one fork - to another. */ - void linux_nat_switch_fork (ptid_t new_ptid); +--- gdb-6.8cvs20080219.orig/gdb/linux-nat.h 2008-02-19 14:26:32.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/linux-nat.h 2008-02-20 13:39:37.000000000 +0100 +@@ -124,3 +124,12 @@ void linux_nat_switch_fork (ptid_t new_p + + /* Return the saved siginfo associated with 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. */ +extern char *(*linux_elfcore_write_prpsinfo) + (bfd *, char *, int *, const char *, const char *); diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch index 739a91b..b9afbd9 100644 --- a/gdb-6.5-sharedlibrary-path.patch +++ b/gdb-6.5-sharedlibrary-path.patch @@ -16,17 +16,21 @@ The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. Port to GDB-6.7. -Index: gdb-6.7/gdb/solib-svr4.c +2008-02-27 Jan Kratochvil + + 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/gdb/solib-svr4.c 2007-10-16 15:43:56.000000000 +0200 -@@ -1009,10 +1009,14 @@ CORE_ADDR +--- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-02-27 08:59:06.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-02-27 09:00:44.000000000 +0100 +@@ -1017,10 +1017,14 @@ CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile) { CORE_ADDR lm; + int resolve; - if ((debug_base = locate_base ()) == 0) + if (locate_base () == 0) return 0; /* failed somehow... */ +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. */ lm = solib_svr4_r_map (); 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)); else { @@ -57,7 +61,7 @@ Index: gdb-6.7/gdb/solib-svr4.c /* Is this the linkmap for the file we want? */ /* If the file is not a shared library and has no name, 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); do_cleanups (old_chain); } @@ -67,10 +71,10 @@ Index: gdb-6.7/gdb/solib-svr4.c 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 -+++ 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 @@ +/* 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; +} -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 -+++ 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 @@ +/* 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 */ + +__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 -+++ 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 @@ +# Copyright 2006 Free Software Foundation, Inc. + diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index dd5148a..03c96b1 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -18,11 +18,16 @@ Provide its level 0 to disable the build-id messages. 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 ---- 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 -@@ -387,7 +387,7 @@ INSTALLED_LIBS=-lbfd -lreadline -lopcode - CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) \ +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. + +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@ \ $(LIBICONV) $(LIBEXPAT) \ - $(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) \ $(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) \ $(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \ $(exec_h) $(readline_h) $(gdb_assert_h) \ -- $(exceptions_h) $(solib_h) -+ $(exceptions_h) $(solib_h) $(auxv_h) $(elf_common_h) $(objfiles_h) \ -+ $(gdbcmd_h) +- $(exceptions_h) $(solib_h) $(filenames_h) ++ $(exceptions_h) $(solib_h) $(filenames_h) $(auxv_h) $(elf_common_h) \ ++ $(objfiles_h) $(gdbcmd_h) core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_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) \ -@@ -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) \ $(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_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) $(gdb_stdint_h) $(libbfd_h) \ -+ $(elf_bfd_h) $(elf_external_h) +- $(parser_defs_h) $(varobj_h) $(elf_bfd_h) $(solib_h) ++ $(parser_defs_h) $(varobj_h) $(elf_bfd_h) $(solib_h) $(gdb_stdint_h) \ ++ $(libbfd_h) $(elf_bfd_h) $(elf_external_h) symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \ $(objfiles_h) $(exceptions_h) $(gdbcmd_h) $(target_h) $(value_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 ---- 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 -@@ -44,6 +44,10 @@ - #include "gdb_assert.h" +Index: gdb-6.7.50.20080227/gdb/corelow.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/corelow.c 2008-02-09 14:45:33.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/corelow.c 2008-03-01 10:30:50.000000000 +0100 +@@ -45,6 +45,10 @@ #include "exceptions.h" #include "solib.h" + #include "filenames.h" +#include "auxv.h" +#include "elf/common.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 -@@ -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 */ } @@ -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. */ 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); 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 inferior for information such as symbols. */ 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) 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, + &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 ---- 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 -@@ -12074,6 +12074,27 @@ information files. +Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/doc/gdb.texinfo 2008-03-01 10:30:50.000000000 +0100 ++++ 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 @@ -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 debug link sections 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 ---- 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 -@@ -960,9 +960,34 @@ svr4_current_sos (void) +Index: gdb-6.7.50.20080227/gdb/solib-svr4.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-03-01 10:30:48.000000000 +0100 ++++ 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); 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) { 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 ---- 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 -@@ -53,6 +53,9 @@ - #include "parser-defs.h" +Index: gdb-6.7.50.20080227/gdb/symfile.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/symfile.c 2008-03-01 10:30:48.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/symfile.c 2008-03-01 10:47:02.000000000 +0100 +@@ -54,6 +54,9 @@ #include "varobj.h" #include "elf-bfd.h" + #include "solib.h" +#include "gdb_stdint.h" +#include "libbfd.h" +#include "elf/external.h" #include #include -@@ -61,6 +64,7 @@ +@@ -62,6 +65,7 @@ #include #include #include @@ -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); -@@ -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")); } @@ -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; -@@ -1287,6 +1340,348 @@ build_id_bfd_get (bfd *abfd) +@@ -1260,6 +1313,348 @@ build_id_bfd_get (bfd *abfd) 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. */ 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) 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) 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; } @@ -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; 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 */ 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); 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++ = '/'; while (size-- > 0) 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)) { -@@ -1350,9 +1750,202 @@ build_id_to_debug_filename (struct build +@@ -1323,9 +1723,202 @@ build_id_to_debug_filename (struct build 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 * 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; int i; 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); -@@ -1471,7 +2068,10 @@ find_separate_debug_file (struct objfile +@@ -1444,7 +2041,7 @@ find_separate_debug_file (struct objfile if (basename == NULL) /* There's no separate debug info, hence there's no way we could load it => no warning. */ - return NULL; -+ { -+ xfree (build_id_filename); -+ return NULL; -+ } ++ goto cleanup_return_debugfile; 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)) - { -+ xfree (build_id_filename); - xfree (basename); - xfree (dir); - return xstrdup (debugfile); -@@ -1513,6 +2114,7 @@ find_separate_debug_file (struct objfile +- { +- xfree (basename); +- xfree (dir); +- return xstrdup (debugfile); +- } ++ 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)) - { -+ xfree (build_id_filename); - xfree (basename); - xfree (dir); - return xstrdup (debugfile); -@@ -1526,6 +2128,7 @@ find_separate_debug_file (struct objfile +- { +- xfree (basename); +- xfree (dir); +- return xstrdup (debugfile); +- } ++ 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)) - { -+ xfree (build_id_filename); - xfree (basename); - xfree (dir); - return xstrdup (debugfile); -@@ -1545,6 +2148,7 @@ find_separate_debug_file (struct objfile +- { +- xfree (basename); +- xfree (dir); +- return xstrdup (debugfile); +- } ++ 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)) - { -+ xfree (build_id_filename); - xfree (canon_name); - xfree (basename); - xfree (dir); -@@ -1552,6 +2156,12 @@ find_separate_debug_file (struct objfile - } +- { +- xfree (canon_name); +- xfree (basename); +- xfree (dir); +- return xstrdup (debugfile); +- } ++ goto cleanup_return_debugfile; } - -+ if (build_id_filename != NULL) -+ { -+ build_id_print_missing (objfile->name, build_id_filename); -+ xfree (build_id_filename); -+ } -+ - if (canon_name) - xfree (canon_name); +- +- 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, show_debug_file_directory, &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); } -diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1-unpatched/gdb/symfile.h gdb-6.7.1-patched/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 -@@ -353,6 +353,13 @@ extern int symfile_map_offsets_to_segmen +Index: gdb-6.7.50.20080227/gdb/symfile.h +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/symfile.h 2008-02-03 23:13:29.000000000 +0100 ++++ 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); void free_symfile_segment_data (struct symfile_segment_data *data); diff --git a/gdb-6.6-bz232371-selinux-thread-error.patch b/gdb-6.6-bz232371-selinux-thread-error.patch deleted file mode 100644 index df85e42..0000000 --- a/gdb-6.6-bz232371-selinux-thread-error.patch +++ /dev/null @@ -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; - } - diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch index 950cce1..9d17778 100644 --- a/gdb-6.6-bz235197-fork-detach-info.patch +++ b/gdb-6.6-bz235197-fork-detach-info.patch @@ -1,26 +1,25 @@ ---- ./gdb/linux-nat.c 9 Feb 2007 20:52:16 -0000 1.56 -+++ ./gdb/linux-nat.c 22 Apr 2007 17:20:25 -0000 -@@ -378,9 +378,17 @@ child_follow_fork (struct target_ops *op +2008-03-01 Jan Kratochvil + + 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? */ if (detach_fork) { -+ static int advice_printed = 0; -+ -+ 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) +- if (info_verbose || debug_linux_nat) ++ if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat) { -- target_terminal_ours (); + target_terminal_ours (); fprintf_filtered (gdb_stdlog, - "Detaching after fork from child process %d.\n", - child_pid); ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/fork-detach.c 22 Apr 2007 17:20:25 -0000 +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +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 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -79,8 +78,10 @@ + } + return 0; +} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/fork-detach.exp 22 Apr 2007 17:20:25 -0000 +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp +=================================================================== +--- /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 @@ +# Copyright 2007 Free Software Foundation, Inc. + @@ -96,7 +97,7 @@ +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +if $tracelevel then { + strace $tracelevel @@ -123,5 +124,5 @@ +gdb_run_cmd +# `Starting program: .*' prefix is available since gdb-6.7. +gdb_test "" \ -+ "\\\[Detaching after fork from child process.*Program exited normally\\..*" \ ++ "Detaching after fork from child process.*Program exited normally\\..*" \ + "Info message caught" diff --git a/gdb-6.6-bz237096-watchthreads-testcasefix.patch b/gdb-6.6-bz237096-watchthreads-testcasefix.patch deleted file mode 100644 index ca86ad5..0000000 --- a/gdb-6.6-bz237096-watchthreads-testcasefix.patch +++ /dev/null @@ -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" - } - diff --git a/gdb-6.6-bz247354-leader-exit-fix.patch b/gdb-6.6-bz247354-leader-exit-fix.patch index 6cb383f..5d7c3af 100644 --- a/gdb-6.6-bz247354-leader-exit-fix.patch +++ b/gdb-6.6-bz247354-leader-exit-fix.patch @@ -6,9 +6,15 @@ (linux_xfer_partial_lwp): ... here. (linux_xfer_partial): New function wrapping LINUX_XFER_PARTIAL_LWP. ---- ./gdb/linux-nat.c 3 Jul 2007 17:01:55 -0000 1.65 -+++ ./gdb/linux-nat.c 7 Jul 2007 15:21:57 -0000 -@@ -1343,6 +1343,31 @@ linux_handle_extended_wait (struct lwp_i +2008-02-24 Jan Kratochvil + + 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); } @@ -40,7 +46,7 @@ /* Wait for LP to stop. Returns the wait status, or 0 if the LWP has exited. */ -@@ -1350,16 +1375,31 @@ static int +@@ -1577,16 +1602,31 @@ static int wait_lwp (struct lwp_info *lp) { pid_t pid; @@ -76,7 +82,7 @@ if (pid == -1 && errno == ECHILD) { /* 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); } @@ -92,7 +98,7 @@ { 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); } @@ -135,6 +141,6 @@ + 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. */ diff --git a/gdb-6.6-cu-ranges.patch b/gdb-6.6-cu-ranges.patch deleted file mode 100644 index bff659f..0000000 --- a/gdb-6.6-cu-ranges.patch +++ /dev/null @@ -1,422 +0,0 @@ -2007-10-09 Jan Kratochvil - - * 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 - - * 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 . -+ */ -+ -+ .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 . -+ -+# 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 . -+ */ -+ -+SECTIONS -+{ -+ .text._start : { *(.text._start) } -+ /* Create the hole. */ -+ . = . + 1; -+ .text.func : { *(.text.func) } -+} -+ENTRY(_start) diff --git a/gdb-6.6-multifork-debugreg.patch b/gdb-6.6-multifork-debugreg.patch index 43b0af0..9e002a1 100644 --- a/gdb-6.6-multifork-debugreg.patch +++ b/gdb-6.6-multifork-debugreg.patch @@ -14,38 +14,93 @@ http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html * gdb.texinfo (Setting Watchpoints): New paragraph on the software 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 ---- 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 -@@ -501,6 +501,12 @@ amd64_linux_insert_watchpoint (CORE_ADDR - return rc; +2008-03-01 Jan Kratochvil + + Port to GDB-6.8pre. + +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 + process of traced FORK. We must clear such watchpoints only once during + DETACH_BREAKPOINTS. */ + +static int amd64_linux_detach_breakpoints_pid; + - /* 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. */ -@@ -508,12 +514,33 @@ int - amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) - { - int 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) ++{ + 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_watchpoint (addr, len, type); - if (!rc) - amd64_linux_sync_debug_registers_across_threads (); - return rc; - } - ++ return i386_remove_watchpoint (addr, len, type); ++} ++ +static void +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); +} -+ - /* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, EBUSY on failure. */ - int -@@ -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 + + + /* This function is called by libthread_db as part of its handling of +@@ -520,6 +573,41 @@ amd64_linux_child_post_startup_inferior i386_cleanup_dregs (); 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. */ -@@ -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_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. */ linux_nat_add_target (t); - -diff -u -ruNp gdb-6.7.1-orig/gdb/config/i386/nm-i386.h gdb-6.7.1/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 -@@ -114,6 +114,8 @@ extern int i386_stopped_by_watchpoint (v - reset all debug registers by calling i386_cleanup_dregs (). */ - #define CHILD_POST_STARTUP_INFERIOR + linux_nat_set_new_thread (t, amd64_linux_new_thread); +Index: gdb-6.7.50.20080227/gdb/config/i386/nm-i386.h +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/config/i386/nm-i386.h 2008-03-01 10:38:02.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/config/i386/nm-i386.h 2008-03-01 10:50:39.000000000 +0100 +@@ -110,6 +110,8 @@ extern int i386_stopped_by_watchpoint (v + #define target_remove_hw_breakpoint(bp_tgt) \ + i386_remove_hw_breakpoint (bp_tgt) +extern void i386_detach_breakpoints (int detached_pid); + #endif /* I386_USE_GENERIC_WATCHPOINTS */ #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 ---- 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 -@@ -745,6 +745,12 @@ i386_linux_insert_watchpoint (CORE_ADDR - return rc; +Index: gdb-6.7.50.20080227/gdb/i386-linux-nat.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/i386-linux-nat.c 2008-03-01 10:38:02.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/i386-linux-nat.c 2008-03-01 16:33:40.000000000 +0100 +@@ -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 + process of traced FORK. We must clear such watchpoints only once during + DETACH_BREAKPOINTS. */ + +static int i386_linux_detach_breakpoints_pid; + - /* 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. */ -@@ -752,12 +758,33 @@ int - i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) - { - int 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) ++{ + if (ptid_get_pid (inferior_ptid) == i386_linux_detach_breakpoints_pid) + return 0; + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + i386_linux_detach_breakpoints_pid = 0; + - rc = i386_remove_watchpoint (addr, len, type); - if (!rc) - i386_linux_sync_debug_registers_across_threads (); - return rc; - } - ++ return i386_remove_watchpoint (addr, len, type); ++} ++ +static void +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); +} -+ - /* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, EBUSY on failure. */ - int -@@ -940,6 +967,40 @@ i386_linux_child_post_startup_inferior ( + + + /* Called by libthread_db. Returns a pointer to the thread local +@@ -833,6 +889,40 @@ i386_linux_child_post_startup_inferior ( 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 _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_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. */ linux_nat_add_target (t); - -diff -u -ruNp gdb-6.7.1-orig/gdb/i386-nat.c gdb-6.7.1/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 -@@ -545,6 +546,17 @@ i386_remove_watchpoint (CORE_ADDR addr, + linux_nat_set_new_thread (t, i386_linux_new_thread); +Index: gdb-6.7.50.20080227/gdb/i386-nat.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/i386-nat.c 2008-03-01 10:38:02.000000000 +0100 ++++ 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; } @@ -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 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 -+++ 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 - args->len); +Index: gdb-6.7.50.20080227/gdb/ia64-linux-nat.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/ia64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100 ++++ 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 @@ -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; + - /* 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 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) + return 0; + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + ia64_linux_detach_breakpoints_pid = 0; + - args.addr = addr; - args.len = len; + if (len <= 0 || !is_power_of_2 (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 +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 ia64_linux_new_thread (ptid_t ptid) { - insert_watchpoints_for_new_thread (ptid, -@@ -793,6 +820,40 @@ ia64_linux_save_sigtrap_info (void *queu - lp->saved_trap_data); + int i, any; +@@ -805,6 +832,40 @@ ia64_linux_xfer_partial (struct target_o + offset, len); } +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); /* -@@ -865,6 +926,9 @@ _initialize_ia64_linux_nat (void) - super_xfer_partial = t->to_xfer_partial; - t->to_xfer_partial = ia64_linux_xfer_partial; +@@ -899,6 +960,9 @@ _initialize_ia64_linux_nat (void) + t->to_insert_watchpoint = ia64_linux_insert_watchpoint; + t->to_remove_watchpoint = ia64_linux_remove_watchpoint; + ia64_linux_super_follow_fork = t->to_follow_fork; + t->to_follow_fork = ia64_linux_follow_fork; + /* Register the target. */ linux_nat_add_target (t); - -diff -u -ruNp gdb-6.7.1-orig/gdb/ppc-linux-nat.c gdb-6.7.1/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 -@@ -837,12 +837,23 @@ ppc_linux_insert_watchpoint (CORE_ADDR a - return ptrace (PTRACE_SET_DEBUGREG, tid, 0, dabr_value); + linux_nat_set_new_thread (t, ia64_linux_new_thread); +Index: gdb-6.7.50.20080227/gdb/ppc-linux-nat.c +=================================================================== +--- gdb-6.7.50.20080227.orig/gdb/ppc-linux-nat.c 2008-03-01 10:38:02.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/ppc-linux-nat.c 2008-03-01 10:50:39.000000000 +0100 +@@ -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 @@ -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 ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) { - int tid; - ptid_t ptid = inferior_ptid; +@@ -854,6 +860,11 @@ ppc_linux_remove_watchpoint (CORE_ADDR a + ptid_t ptid; + long dabr_value = 0; + if (ptid_get_pid (inferior_ptid) == ppc_linux_detach_breakpoints_pid) + return 0; + /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ + ppc_linux_detach_breakpoints_pid = 0; + - tid = TIDGET (ptid); - if (tid == 0) - tid = PIDGET (ptid); -@@ -850,6 +861,15 @@ ppc_linux_remove_watchpoint (CORE_ADDR a - return ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0); + saved_dabr_value = 0; + ALL_LWPS (lp, ptid) + if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0) +@@ -867,6 +878,15 @@ ppc_linux_new_thread (ptid_t ptid) + ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value); } +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 ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) { -@@ -945,6 +965,40 @@ fill_fpregset (const struct regcache *re - fpregsetp, sizeof (*fpregsetp)); +@@ -976,6 +996,40 @@ ppc_linux_read_description (struct targe + return NULL; } +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 -@@ -967,6 +1021,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; +@@ -1000,6 +1054,9 @@ _initialize_ppc_linux_nat (void) + + t->to_read_description = ppc_linux_read_description; + ppc_linux_super_follow_fork = t->to_follow_fork; + t->to_follow_fork = ppc_linux_follow_fork; + /* Register the target. */ linux_nat_add_target (t); - } ---- gdb-6.7.1-unpatched/gdb/s390-nat.c 2008-01-11 15:33:48.000000000 -0500 -+++ 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) + linux_nat_set_new_thread (t, ppc_linux_new_thread); +Index: gdb-6.7.50.20080227/gdb/s390-nat.c +=================================================================== +--- 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 -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; 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; struct watch_area *area; +- tid = TIDGET (ptid); +- if (tid == 0) +- tid = PIDGET (ptid); +- - for (area = watch_base; area; area = area->next) + for (area = area_list; area; area = area->next) { watch_lo_addr = min (watch_lo_addr, area->lo_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) 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.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")); } +static void +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 -@@ -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; } @@ -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; + - /* Remove a specified watchpoint from all threads. */ static int 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; + 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) if ((*parea)->lo_addr == addr && (*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; } @@ -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 s390_can_use_hw_breakpoint (int type, int cnt, int othertype) { -@@ -399,6 +423,39 @@ s390_linux_new_thread (ptid_t ptid) - s390_fix_watch_points (ptid); +@@ -387,6 +413,39 @@ s390_region_ok_for_hw_watchpoint (CORE_A + return 1; } +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); -@@ -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_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. */ linux_nat_add_target (t); - -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 ---- 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 + linux_nat_set_new_thread (t, s390_fix_watch_points); +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c +=================================================================== +--- /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 @@ +/* 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 +# error "!FOLLOW_PARENT && !FOLLOW_CHILD" +#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 ---- 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 +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +=================================================================== +--- /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 @@ +/* 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 i; + 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; +} -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 ---- 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 +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.c +=================================================================== +--- /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 @@ +/* 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; +} -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 ---- 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 +Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork.exp +=================================================================== +--- /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 @@ +# 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*"]} { + test child FOLLOW_CHILD +} +Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo =================================================================== -RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v -retrieving revision 1.434 -retrieving revision 1.435 -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 @@ +--- gdb-6.7.50.20080227.orig/gdb/doc/gdb.texinfo 2008-03-01 10:50:39.000000000 +0100 ++++ gdb-6.7.50.20080227/gdb/doc/gdb.texinfo 2008-03-01 10:50:39.000000000 +0100 +@@ -3386,6 +3386,14 @@ confident that no other thread can becom software watchpoints as usual. However, @value{GDBN} may not notice when a non-current thread's activity changes the expression. (Hardware 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 +changes cannot be caught. To get more reliable software watchpoints, please +use @code{set scheduler-locking on}. The default for Red Hat/Fedora @@ -1167,3 +1247,45 @@ diff -u -r1.434 -r1.435 @end quotation @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 */ diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 67cfa50..090d38f 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -17,9 +17,15 @@ * infrun.c (proceed): RESUME_STEP initialized for non-stepping. 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 -+++ ./gdb/inferior.h 25 Jun 2007 20:33:02 -0000 -@@ -194,7 +194,15 @@ extern void reopen_exec_file (void); +2008-02-24 Jan Kratochvil + + 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. Normally, use `proceed', which handles a lot of bookkeeping. */ @@ -36,9 +42,11 @@ /* From misc files */ ---- ./gdb/infrun.c 22 Jun 2007 12:47:48 -0000 1.243 -+++ ./gdb/infrun.c 25 Jun 2007 20:33:02 -0000 -@@ -76,7 +76,8 @@ static void set_schedlock_func (char *ar +Index: gdb-6.8cvs20080219/gdb/infrun.c +=================================================================== +--- 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; @@ -48,7 +56,7 @@ 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). SIG is the signal to give the inferior (zero for none). */ void @@ -70,7 +78,7 @@ /* 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; } @@ -83,7 +91,7 @@ { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -711,7 +716,7 @@ static CORE_ADDR prev_pc; +@@ -742,7 +747,7 @@ static CORE_ADDR prev_pc; void proceed (CORE_ADDR addr, enum target_signal siggnal, int step) { @@ -92,7 +100,7 @@ if (step > 0) 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 we do not stop right away (and report a second hit at this breakpoint). */ @@ -108,10 +116,10 @@ } 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 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; + resume_step = RESUME_STEP_USER; @@ -119,8 +127,8 @@ + if (resume_step == RESUME_STEP_USER) /* We will get a trace trap after one instruction. Continue it automatically and insert breakpoints then. */ - trap_expected = 1; -@@ -806,8 +812,13 @@ proceed (CORE_ADDR addr, enum target_sig + stepping_over_breakpoint = 1; +@@ -832,8 +837,13 @@ proceed (CORE_ADDR addr, enum target_sig updated correctly when the inferior is stopped. */ prev_pc = read_pc (); @@ -135,7 +143,7 @@ /* Wait for it to stop (if not standalone) 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? */ @@ -145,11 +153,12 @@ { - return ((!ecs->handling_longjmp - && ((step_range_end && step_resume_breakpoint == NULL) -- || trap_expected)) +- || stepping_over_breakpoint)) - || ecs->stepping_through_solib_after_catch - || bpstat_should_step ()); + 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; + + if (ecs->stepping_through_solib_after_catch) @@ -162,9 +171,11 @@ } /* 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 -+++ ./gdb/linux-nat.c 25 Jun 2007 20:33:02 -0000 -@@ -1720,7 +1720,10 @@ count_events_callback (struct lwp_info * +Index: gdb-6.8cvs20080219/gdb/linux-nat.c +=================================================================== +--- 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 select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { @@ -176,9 +187,11 @@ return 1; else return 0; ---- ./gdb/linux-nat.h 10 May 2007 21:36:00 -0000 1.18 -+++ ./gdb/linux-nat.h 25 Jun 2007 20:33:02 -0000 -@@ -53,8 +53,8 @@ struct lwp_info +Index: gdb-6.8cvs20080219/gdb/linux-nat.h +=================================================================== +--- 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. */ int status; @@ -187,5 +200,5 @@ + /* The kind of stepping of this LWP. */ + enum resume_step step; - /* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus - for this LWP's last event. This may correspond to STATUS above, + /* Non-zero si_signo if this LWP stopped with a trap. si_addr may + be the address of a hardware watchpoint. */ diff --git a/gdb-6.7-bz233852-attach-signalled-fix.patch b/gdb-6.7-bz233852-attach-signalled-fix.patch index 8446166..dc51a2b 100644 --- a/gdb-6.7-bz233852-attach-signalled-fix.patch +++ b/gdb-6.7-bz233852-attach-signalled-fix.patch @@ -18,10 +18,15 @@ * gdb.texinfo (Attach): Document the ATTACH and DETACH commands for 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 ---- 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 -@@ -9,6 +9,9 @@ Renesas M32C/M16C m32c-elf +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. + +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 @@ -31,30 +36,27 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/NEWS gdb-6.5/gdb/ * New commands 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 -+++ gdb-6.7.1/gdb/linux-nat.c 2008-01-10 00:08:07.000000000 +0100 -@@ -85,11 +85,20 @@ - #define __WALL 0x40000000 /* Wait for any child. */ +Index: gdb-6.8cvs20080219/gdb/linux-nat.c +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-24 19:36:26.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-24 19:45:01.000000000 +0100 +@@ -89,6 +89,15 @@ + #define PTRACE_GETSIGINFO 0x4202 #endif +#define STRINGIFY_ARG(x) #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); ++ ++/* 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 use of the multi-threaded target. */ static struct target_ops *linux_ops; - static struct target_ops linux_ops_saved; - -+/* 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 +@@ -539,6 +548,11 @@ linux_child_follow_fork (struct target_o } 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); } -@@ -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. */ if (GET_LWP (ptid) != GET_PID (ptid) && lp == NULL) { - pid_t pid; int status; +- int cloned = 0; ++ int cloned; 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) - lp = add_lwp (ptid); + { +@@ -958,37 +971,20 @@ lin_lwp_attach_lwp (ptid_t ptid) + return -1; + } - if (debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, - "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n", - 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) + { + error (_("Thread %s exited: %s"), target_pid_to_str (ptid), + 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)); -+ -+ lp->stopped = 1; -+ } -+ 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)); -+ -+ return 0; -+} -+ + + lp->stopped = 1; +- +- if (debug_linux_nat) +- { +- fprintf_unfiltered (gdb_stdlog, +- "LLAL: waitpid %s received %s\n", +- target_pid_to_str (ptid), +- status_to_str (status)); +- } + } + else + { +@@ -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 + attach from a different layer. */ +- if (lp == NULL) +- lp = add_lwp (ptid); + lp->stopped = 1; + } + + return 0; + } + +/* Detect `T (stopped)' in `/proc/PID/status'. + 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) +{ + FILE *status_file; -+ char buf[100]; ++ char buf[100]; + int retval = 0; + + 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; + break; + } -+ } ++ } + if (have_state && strstr (buf, "T (stopped)") != NULL) + retval = 1; + 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. */ + +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; + int this_thread_was_stopped; ++ int cloned = 0; + + if (debug_linux_nat) + 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; + int status; - - pid = my_waitpid (GET_LWP (ptid), &status, 0); - 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)); - lp->cloned = 1; - } -- -- gdb_assert (pid == GET_LWP (ptid) -- && WIFSTOPPED (status) && WSTOPSIG (status)); -- -- target_post_attach (pid); -- -- lp->stopped = 1; ++ ++ 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; ++ } ++ + gdb_assert (pid == GET_LWP (ptid)); - - if (debug_linux_nat) - { -@@ -989,22 +1142,32 @@ lin_lwp_attach_lwp (ptid_t ptid, int ver - 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)); ++ ++ if (debug_linux_nat) ++ { ++ fprintf_unfiltered (gdb_stdlog, ++ "LLAL: waitpid %s received %s\n", ++ target_pid_to_str (ptid), ++ status_to_str (status)); ++ } ++ + /* Check if the thread has exited. */ + if (WIFEXITED (status) || WIFSIGNALED (status)) -+ return status; ++ return status; + gdb_assert (WIFSTOPPED (status)); + sig = WSTOPSIG (status); + gdb_assert (sig != 0); + if (sig == SIGSTOP) -+ break; ++ break; + + /* As the second signal for stopped processes we send SIGSTOP. */ + 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) + perror_with_name (("ptrace")); + } - - return 0; - } -@@ -1013,7 +1176,6 @@ static void ++ *cloned_return = cloned; ++ return 0; ++} ++ + static void linux_nat_attach (char *args, int from_tty) { struct lwp_info *lp; - pid_t pid; int status; +- int cloned = 0; ++ int cloned; /* FIXME: We should probably accept a list of process id's, and -@@ -1024,21 +1186,12 @@ linux_nat_attach (char *args, int from_t - inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)); - lp = add_lwp (inferior_ptid); + attach all of them. */ + linux_ops->to_attach (args, from_tty); - /* Make sure the initial process is stopped. The user-level threads - 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. */ - pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE); -- lp->cloned = 1; +- cloned = 1; - } - - gdb_assert (pid == GET_PID (inferior_ptid) - && 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) + error (_("Program %s exited: %s\n"), target_pid_to_str (inferior_ptid), + status_to_str (status)); -+ if (lp->cloned) ++ if (cloned) + 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; - -@@ -1047,8 +1200,8 @@ linux_nat_attach (char *args, int from_t +@@ -1046,8 +1200,8 @@ linux_nat_attach (char *args, int from_t lp->resumed = 1; 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. */ 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; if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 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; @@ -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. */ init_lwp_list (); -@@ -1258,6 +1417,14 @@ linux_nat_resume (ptid_t ptid, int step_ - lp->stopped = 0; - } +@@ -1255,6 +1415,14 @@ linux_nat_resume (ptid_t ptid, int step_ + resume_callback. */ + lp->stopped = 0; + /* At this point, we are going to resume the inferior and if we + 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) 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 ---- 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 -@@ -2190,16 +2190,29 @@ can step and continue; you can modify st +Index: gdb-6.8cvs20080219/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-6.8cvs20080219.orig/gdb/doc/gdb.texinfo 2008-02-24 19:36:24.000000000 +0100 ++++ 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 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. @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 diff --git a/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch b/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch index a371b39..f99486c 100644 --- a/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch +++ b/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch @@ -1,13 +1,8 @@ +Original patch was: http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html http://sourceware.org/ml/gdb-cvs/2007-12/msg00123.html -2007-12-22 Jan Kratochvil - - * 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'. +extended for the RHEL safety: 2007-12-28 Jan Kratochvil @@ -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 namespaces which should not apply for Java `DW_TAG_interface_type'. -=================================================================== -RCS file: /cvs/src/src/gdb/dwarf2read.c,v -retrieving revision 1.242 -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) +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. + Index: ./gdb/dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v diff --git a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch b/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch index 52c9472..2e344ca 100644 --- a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch +++ b/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch @@ -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. +2008-03-02 Jan Kratochvil + + * gdb.arch/i386-interface.exp: Fix a testcase race. + --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ./gdb/testsuite/gdb.arch/i386-interface.S 22 Dec 2007 19:07:28 -0000 @@ -0,0 +1,628 @@ @@ -693,14 +697,14 @@ http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html + +set test "ptype Interface" +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 + } +} + +set test "ptype Class" +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 + } +} diff --git a/gdb-6.7-bz428882-ia64-fix.patch b/gdb-6.7-bz428882-ia64-fix.patch deleted file mode 100644 index 97a4cdc..0000000 --- a/gdb-6.7-bz428882-ia64-fix.patch +++ /dev/null @@ -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); - } - diff --git a/gdb-6.7.1-upstream.patch b/gdb-6.7.1-upstream.patch deleted file mode 100644 index 86aa474..0000000 --- a/gdb-6.7.1-upstream.patch +++ /dev/null @@ -1,5396 +0,0 @@ -Fix: - FAIL: gdb.arch/powerpc-power6.exp: Power6 disassembly dsub - FAIL: gdb.arch/powerpc-power6.exp: Power6 disassembly dmul - FAIL: gdb.arch/powerpc-power6.exp: Power6 disassembly ddiv - FAIL: gdb.arch/powerpc-power6.exp: Power6 disassembly dcmpu - -2007-10-15 Peter Bergner - - * ppc-opc.c (powerpc_opcodes): Fix the first two operands of - dquaiq. to use the TE and FRT macros. - ---- ./opcodes/ppc-opc.c 16 Oct 2007 02:26:30 -0000 1.100 -+++ ./opcodes/ppc-opc.c 16 Oct 2007 02:55:30 -0000 1.101 -@@ -4680,7 +4680,7 @@ const struct powerpc_opcode powerpc_opco - { "dscliq.", ZRC(63,66,1), Z_MASK, POWER6, { FRT, FRA, SH16 } }, - - { "dquaiq", ZRC(63,67,0), Z2_MASK, POWER6, { TE, FRT, FRB, RMC } }, --{ "dquaiq.", ZRC(63,67,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, -+{ "dquaiq.", ZRC(63,67,1), Z2_MASK, POWER6, { TE, FRT, FRB, RMC } }, - - { "mtfsb0", XRC(63,70,0), XRARB_MASK, COM, { BT } }, - { "mtfsb0.", XRC(63,70,1), XRARB_MASK, COM, { BT } }, - -2007-10-15 Peter Bergner - - * ppc-opc.c (TE): Correct signedness. - (powerpc_opcodes): Sort psq_st and psq_stu according to major - opcode number. - ---- ./opcodes/ppc-opc.c 24 Aug 2007 00:56:30 -0000 1.99 -+++ ./opcodes/ppc-opc.c 16 Oct 2007 02:26:30 -0000 1.100 -@@ -492,13 +492,13 @@ const struct powerpc_operand powerpc_ope - #define VS VD - { 0x1f, 21, NULL, NULL, PPC_OPERAND_VR }, - -- /* The SIMM field in a VX form instruction. */ -+ /* The SIMM field in a VX form instruction, and TE in Z form. */ - #define SIMM VD + 1 -+#define TE SIMM - { 0x1f, 16, NULL, NULL, PPC_OPERAND_SIGNED}, - -- /* The UIMM field in a VX form instruction, and TE in Z form. */ -+ /* The UIMM field in a VX form instruction. */ - #define UIMM SIMM + 1 --#define TE UIMM - { 0x1f, 16, NULL, NULL, 0 }, - - /* The SHB field in a VA form instruction. */ -@@ -4495,9 +4495,6 @@ const struct powerpc_opcode powerpc_opco - { "fnmadds", A(59,31,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - { "fnmadds.",A(59,31,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - --{ "psq_st", OP(60), OP_MASK, PPCPS, { FRS, PSD, RA, PSW, PSQ } }, --{ "psq_stu", OP(61), OP_MASK, PPCPS, { FRS, PSD, RA, PSW, PSQ } }, -- - { "dmul", XRC(59,34,0), X_MASK, POWER6, { FRT, FRA, FRB } }, - { "dmul.", XRC(59,34,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -@@ -4561,6 +4558,9 @@ const struct powerpc_opcode powerpc_opco - - { "stfq", OP(60), OP_MASK, POWER2, { FRS, D, RA } }, - -+{ "psq_st", OP(60), OP_MASK, PPCPS, { FRS, PSD, RA, PSW, PSQ } }, -+{ "psq_stu", OP(61), OP_MASK, PPCPS, { FRS, PSD, RA, PSW, PSQ } }, -+ - { "stfqu", OP(61), OP_MASK, POWER2, { FRS, D, RA } }, - - { "stfdp", OP(61), OP_MASK, POWER6, { FRT, D, RA0 } }, - - - -2007-09-22 Vladimir Prus - - Associate bp_stat with bp_location, not breakpoint. - * breakpoint.h (breakpoint_at): Change type - to bp_location*. - * breakpoint.c (bpstat_alloc): Take bp_location, - not breakpoint. - (bpstat_find_breakpoint): Look at bpstat's location's - owner, not at bpstat->breakpoint_at. - (bpstat_find_step_resume_breakpoint): Likewise. - (bpstat_num): Likewise. - (print_it_typical): Likewise. - (print_bp_stop_message): Likewise. - (watchpoint_check): Likewise. - (bpstat_what): Likewise. - (bpstat_get_triggered_catchpoints): Likewise. - (breakpoint_auto_delete): Likewise. - (delete_breakpoint): Likewise. - (bpstat_stop_status): Pass location, not breakpoint, - to bpstat_alloc. Look at bpstat's location's - owner, not at bpstat->breakpoint_at. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.263 -retrieving revision 1.264 -diff -u -r1.263 -r1.264 ---- src/gdb/breakpoint.c 2007/08/29 22:07:47 1.263 -+++ src/gdb/breakpoint.c 2007/09/22 17:49:40 1.264 -@@ -109,7 +109,7 @@ - - static void breakpoint_1 (int, int); - --static bpstat bpstat_alloc (struct breakpoint *, bpstat); -+static bpstat bpstat_alloc (struct bp_location *, bpstat); - - static int breakpoint_cond_eval (void *); - -@@ -1968,7 +1968,7 @@ - - for (; bsp != NULL; bsp = bsp->next) - { -- if (bsp->breakpoint_at == breakpoint) -+ if (bsp->breakpoint_at && bsp->breakpoint_at->owner == breakpoint) - return bsp; - } - return NULL; -@@ -1994,10 +1994,10 @@ - for (; bsp != NULL; bsp = bsp->next) - { - if ((bsp->breakpoint_at != NULL) && -- (bsp->breakpoint_at->type == bp_step_resume) && -- (bsp->breakpoint_at->thread == current_thread || -- bsp->breakpoint_at->thread == -1)) -- return bsp->breakpoint_at; -+ (bsp->breakpoint_at->owner->type == bp_step_resume) && -+ (bsp->breakpoint_at->owner->thread == current_thread || -+ bsp->breakpoint_at->owner->thread == -1)) -+ return bsp->breakpoint_at->owner; - } - - internal_error (__FILE__, __LINE__, _("No step_resume breakpoint found.")); -@@ -2021,7 +2021,11 @@ - if ((*bsp) == NULL) - return 0; /* No more breakpoint values */ - -- b = (*bsp)->breakpoint_at; -+ /* We assume we'll never have several bpstats that -+ correspond to a single breakpoint -- otherwise, -+ this function might return the same number more -+ than once and this will look ugly. */ -+ b = (*bsp)->breakpoint_at ? (*bsp)->breakpoint_at->owner : NULL; - *bsp = (*bsp)->next; - if (b == NULL) - return -1; /* breakpoint that's been deleted since */ -@@ -2152,6 +2156,7 @@ - print_it_typical (bpstat bs) - { - struct cleanup *old_chain, *ui_out_chain; -+ struct breakpoint *b; - struct ui_stream *stb; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); -@@ -2159,21 +2164,22 @@ - which has since been deleted. */ - if (bs->breakpoint_at == NULL) - return PRINT_UNKNOWN; -+ b = bs->breakpoint_at->owner; - -- switch (bs->breakpoint_at->type) -+ switch (b->type) - { - case bp_breakpoint: - case bp_hardware_breakpoint: -- if (bs->breakpoint_at->loc->address != bs->breakpoint_at->loc->requested_address) -- breakpoint_adjustment_warning (bs->breakpoint_at->loc->requested_address, -- bs->breakpoint_at->loc->address, -- bs->breakpoint_at->number, 1); -- annotate_breakpoint (bs->breakpoint_at->number); -+ if (b->loc->address != b->loc->requested_address) -+ breakpoint_adjustment_warning (b->loc->requested_address, -+ b->loc->address, -+ b->number, 1); -+ annotate_breakpoint (b->number); - ui_out_text (uiout, "\nBreakpoint "); - if (ui_out_is_mi_like_p (uiout)) - ui_out_field_string (uiout, "reason", - async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); -- ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number); -+ ui_out_field_int (uiout, "bkptno", b->number); - ui_out_text (uiout, ", "); - return PRINT_SRC_AND_LOC; - break; -@@ -2200,42 +2206,42 @@ - break; - - case bp_catch_load: -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (loaded %s), "), -- bs->breakpoint_at->number, -- bs->breakpoint_at->triggered_dll_pathname); -+ b->number, -+ b->triggered_dll_pathname); - return PRINT_SRC_AND_LOC; - break; - - case bp_catch_unload: -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (unloaded %s), "), -- bs->breakpoint_at->number, -- bs->breakpoint_at->triggered_dll_pathname); -+ b->number, -+ b->triggered_dll_pathname); - return PRINT_SRC_AND_LOC; - break; - - case bp_catch_fork: -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (forked process %d), "), -- bs->breakpoint_at->number, -- bs->breakpoint_at->forked_inferior_pid); -+ b->number, -+ b->forked_inferior_pid); - return PRINT_SRC_AND_LOC; - break; - - case bp_catch_vfork: -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (vforked process %d), "), -- bs->breakpoint_at->number, -- bs->breakpoint_at->forked_inferior_pid); -+ b->number, -+ b->forked_inferior_pid); - return PRINT_SRC_AND_LOC; - break; - - case bp_catch_exec: -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (exec'd %s), "), -- bs->breakpoint_at->number, -- bs->breakpoint_at->exec_pathname); -+ b->number, -+ b->exec_pathname); - return PRINT_SRC_AND_LOC; - break; - -@@ -2243,9 +2249,9 @@ - if (current_exception_event && - (CURRENT_EXCEPTION_KIND == EX_EVENT_CATCH)) - { -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (exception caught), "), -- bs->breakpoint_at->number); -+ b->number); - if (CURRENT_EXCEPTION_THROW_PC && CURRENT_EXCEPTION_THROW_LINE) - printf_filtered (_("throw location %s:%d, "), - CURRENT_EXCEPTION_THROW_FILE, -@@ -2274,9 +2280,9 @@ - if (current_exception_event && - (CURRENT_EXCEPTION_KIND == EX_EVENT_THROW)) - { -- annotate_catchpoint (bs->breakpoint_at->number); -+ annotate_catchpoint (b->number); - printf_filtered (_("\nCatchpoint %d (exception thrown), "), -- bs->breakpoint_at->number); -+ b->number); - if (CURRENT_EXCEPTION_THROW_PC && CURRENT_EXCEPTION_THROW_LINE) - printf_filtered (_("throw location %s:%d, "), - CURRENT_EXCEPTION_THROW_FILE, -@@ -2305,18 +2311,18 @@ - case bp_hardware_watchpoint: - if (bs->old_val != NULL) - { -- annotate_watchpoint (bs->breakpoint_at->number); -+ 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 (bs->breakpoint_at); -+ 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 (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default); -+ 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"); -@@ -2332,10 +2338,10 @@ - ui_out_field_string - (uiout, "reason", - async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER)); -- mention (bs->breakpoint_at); -+ mention (b); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value"); - ui_out_text (uiout, "\nValue = "); -- value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default); -+ value_print (b->val, stb->stream, 0, Val_pretty_default); - ui_out_field_stream (uiout, "value", stb); - do_cleanups (ui_out_chain); - ui_out_text (uiout, "\n"); -@@ -2345,12 +2351,12 @@ - case bp_access_watchpoint: - if (bs->old_val != NULL) - { -- annotate_watchpoint (bs->breakpoint_at->number); -+ annotate_watchpoint (b->number); - if (ui_out_is_mi_like_p (uiout)) - ui_out_field_string - (uiout, "reason", - async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER)); -- mention (bs->breakpoint_at); -+ 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); -@@ -2361,7 +2367,7 @@ - } - else - { -- mention (bs->breakpoint_at); -+ mention (b); - if (ui_out_is_mi_like_p (uiout)) - ui_out_field_string - (uiout, "reason", -@@ -2369,7 +2375,7 @@ - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value"); - ui_out_text (uiout, "\nValue = "); - } -- value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default); -+ 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"); -@@ -2429,14 +2435,19 @@ - break; - - case print_it_normal: -- /* Normal case. Call the breakpoint's print_it method, or -- print_it_typical. */ -- if (bs->breakpoint_at != NULL && bs->breakpoint_at->ops != NULL -- && bs->breakpoint_at->ops->print_it != NULL) -- return bs->breakpoint_at->ops->print_it (bs->breakpoint_at); -- else -- return print_it_typical (bs); -- break; -+ { -+ struct bp_location *bl = bs->breakpoint_at; -+ struct breakpoint *b = bl ? bl->owner : NULL; -+ -+ /* Normal case. Call the breakpoint's print_it method, or -+ print_it_typical. */ -+ /* FIXME: how breakpoint can ever be NULL here? */ -+ if (b != NULL && b->ops != NULL && b->ops->print_it != NULL) -+ return b->ops->print_it (b); -+ else -+ return print_it_typical (bs); -+ } -+ break; - - default: - internal_error (__FILE__, __LINE__, -@@ -2505,13 +2516,13 @@ - /* Allocate a new bpstat and chain it to the current one. */ - - static bpstat --bpstat_alloc (struct breakpoint *b, bpstat cbs /* Current "bs" value */ ) -+bpstat_alloc (struct bp_location *bl, bpstat cbs /* Current "bs" value */ ) - { - bpstat bs; - - bs = (bpstat) xmalloc (sizeof (*bs)); - cbs->next = bs; -- bs->breakpoint_at = b; -+ bs->breakpoint_at = bl; - /* If the condition is false, etc., don't do the commands. */ - bs->commands = NULL; - bs->old_val = NULL; -@@ -2541,7 +2552,7 @@ - struct frame_info *fr; - int within_current_scope; - -- b = bs->breakpoint_at; -+ b = bs->breakpoint_at->owner; - - if (b->exp_valid_block == NULL) - within_current_scope = 1; -@@ -2588,7 +2599,7 @@ - we might be in the middle of evaluating a function call. */ - - struct value *mark = value_mark (); -- struct value *new_val = evaluate_expression (bs->breakpoint_at->exp); -+ struct value *new_val = evaluate_expression (b->exp); - if (!value_equal (b->val, new_val)) - { - release_value (new_val); -@@ -2624,7 +2635,7 @@ - ui_out_field_string - (uiout, "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE)); - ui_out_text (uiout, "\nWatchpoint "); -- ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number); -+ ui_out_field_int (uiout, "wpnum", b->number); - ui_out_text (uiout, " deleted because the program has left the block in\n\ - which its expression is valid.\n"); - -@@ -2760,7 +2771,7 @@ - - /* Come here if it's a watchpoint, or if the break address matches */ - -- bs = bpstat_alloc (b, bs); /* Alloc a bpstat to explain stop */ -+ bs = bpstat_alloc (b->loc, bs); /* Alloc a bpstat to explain stop */ - - /* Watchpoints may change this, if not found to have triggered. */ - bs->stop = 1; -@@ -2971,9 +2982,9 @@ - /* The value of a hardware watchpoint hasn't changed, but the - intermediate memory locations we are watching may have. */ - if (bs && !bs->stop && -- (bs->breakpoint_at->type == bp_hardware_watchpoint || -- bs->breakpoint_at->type == bp_read_watchpoint || -- bs->breakpoint_at->type == bp_access_watchpoint)) -+ (bs->breakpoint_at->owner->type == bp_hardware_watchpoint || -+ bs->breakpoint_at->owner->type == bp_read_watchpoint || -+ bs->breakpoint_at->owner->type == bp_access_watchpoint)) - { - remove_breakpoints (); - insert_breakpoints (); -@@ -3134,7 +3145,7 @@ - /* I suspect this can happen if it was a momentary breakpoint - which has since been deleted. */ - continue; -- switch (bs->breakpoint_at->type) -+ switch (bs->breakpoint_at->owner->type) - { - case bp_none: - continue; -@@ -3289,7 +3300,7 @@ - for (; ep_list != NULL; ep_list = ep_list->next) - { - /* Is this eventpoint a catchpoint? If not, ignore it. */ -- ep = ep_list->breakpoint_at; -+ ep = ep_list->breakpoint_at->owner; - if (ep == NULL) - break; - if ((ep->type != bp_catch_load) && -@@ -3300,7 +3311,7 @@ - continue; - - /* Yes; add it to the list. */ -- bs = bpstat_alloc (ep, bs); -+ bs = bpstat_alloc (ep_list->breakpoint_at, bs); - *bs = *ep_list; - bs->next = NULL; - bs = root_bs->next; -@@ -6849,9 +6860,9 @@ - struct breakpoint *b, *temp; - - for (; bs; bs = bs->next) -- if (bs->breakpoint_at && bs->breakpoint_at->disposition == disp_del -+ if (bs->breakpoint_at && bs->breakpoint_at->owner->disposition == disp_del - && bs->stop) -- delete_breakpoint (bs->breakpoint_at); -+ delete_breakpoint (bs->breakpoint_at->owner); - - ALL_BREAKPOINTS_SAFE (b, temp) - { -@@ -7041,7 +7052,7 @@ - in event-top.c won't do anything, and temporary breakpoints - with commands won't work. */ - for (bs = stop_bpstat; bs; bs = bs->next) -- if (bs->breakpoint_at == bpt) -+ if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt) - { - bs->breakpoint_at = NULL; - bs->old_val = NULL; -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.h,v -retrieving revision 1.47 -retrieving revision 1.48 -diff -u -r1.47 -r1.48 ---- src/gdb/breakpoint.h 2007/08/23 18:08:26 1.47 -+++ src/gdb/breakpoint.h 2007/09/22 17:49:41 1.48 -@@ -603,7 +603,7 @@ - place, and a bpstat reflects the fact that both have been hit. */ - bpstat next; - /* Breakpoint that we are at. */ -- struct breakpoint *breakpoint_at; -+ struct bp_location *breakpoint_at; - /* Commands left to be done. */ - struct command_line *commands; - /* Old value associated with a watchpoint. */ - -2007-09-22 Vladimir Prus - - * breakpoint.h (struct breakpoint): Move the cond - field to... - (struct bp_location): Here. - * breakpoint.c (condition_command, bpstat_stop_status) - (print_one_breakpoint, allocate_bp_location) - (solib_load_unload_1, create_fork_vfork_event_catchpoint) - (create_exec_event_catchpoint, create_breakpoints) - (break_command_1, watch_command_1, handle_gnu_v3_exceptions) - (create_ada_exception_breakpoint, set_breakpoint_sal) - (delete_breakpoint, breakpoint_re_set_one): Adjust. - * tui/tui-winsource.c (tui_update_breakpoint_info): Adjust. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.264 -retrieving revision 1.265 -diff -u -r1.264 -r1.265 ---- src/gdb/breakpoint.c 2007/09/22 17:49:40 1.264 -+++ src/gdb/breakpoint.c 2007/09/22 19:06:59 1.265 -@@ -569,17 +569,17 @@ - ALL_BREAKPOINTS (b) - if (b->number == bnum) - { -- if (b->cond) -+ struct bp_location *loc = b->loc; -+ if (loc->cond) - { -- xfree (b->cond); -- b->cond = 0; -+ xfree (loc->cond); -+ loc->cond = 0; - } - if (b->cond_string != NULL) - xfree (b->cond_string); - - if (*p == 0) - { -- b->cond = 0; - b->cond_string = NULL; - if (from_tty) - printf_filtered (_("Breakpoint %d now unconditional.\n"), bnum); -@@ -592,7 +592,8 @@ - b->cond_string = savestring (arg, strlen (arg)); - if (!b->pending) - { -- b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -+ b->loc->cond = parse_exp_1 (&arg, -+ block_for_pc (b->loc->address), 0); - if (*arg) - error (_("Junk at end of expression")); - } -@@ -2923,19 +2924,19 @@ - { - int value_is_zero = 0; - -- if (b->cond) -+ if (b->loc->cond) - { - /* Need to select the frame, with all that implies - so that the conditions will have the right context. */ - select_frame (get_current_frame ()); - value_is_zero -- = catch_errors (breakpoint_cond_eval, (b->cond), -+ = catch_errors (breakpoint_cond_eval, (b->loc->cond), - "Error in testing breakpoint condition:\n", - RETURN_MASK_ALL); - /* FIXME-someday, should give breakpoint # */ - free_all_values (); - } -- if (b->cond && value_is_zero) -+ if (b->loc->cond && value_is_zero) - { - bs->stop = 0; - /* Don't consider this a hit. */ -@@ -3606,14 +3607,14 @@ - ui_out_text (uiout, "\n"); - } - -- if (b->cond && !ada_exception_catchpoint_p (b)) -+ if (b->loc->cond && !ada_exception_catchpoint_p (b)) - { - /* We do not print the condition for Ada exception catchpoints - because the condition is an internal implementation detail - that we do not want to expose to the user. */ - annotate_field (7); - ui_out_text (uiout, "\tstop only if "); -- print_expression (b->cond, stb->stream); -+ print_expression (b->loc->cond, stb->stream); - ui_out_field_stream (uiout, "cond", stb); - ui_out_text (uiout, "\n"); - } -@@ -4085,6 +4086,7 @@ - memset (loc, 0, sizeof (*loc)); - - loc->owner = bpt; -+ loc->cond = NULL; - - switch (bp_type) - { -@@ -4604,7 +4606,6 @@ - b = set_raw_breakpoint (sals.sals[0], bp_kind); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = NULL; - b->cond_string = (cond_string == NULL) ? - NULL : savestring (cond_string, strlen (cond_string)); - b->thread = thread; -@@ -4661,7 +4662,6 @@ - b = set_raw_breakpoint (sal, bp_kind); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = NULL; - b->cond_string = (cond_string == NULL) ? - NULL : savestring (cond_string, strlen (cond_string)); - b->thread = thread; -@@ -4700,7 +4700,6 @@ - b = set_raw_breakpoint (sal, bp_catch_exec); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = NULL; - b->cond_string = (cond_string == NULL) ? - NULL : savestring (cond_string, strlen (cond_string)); - b->thread = thread; -@@ -5033,7 +5032,7 @@ - b = set_raw_breakpoint (sal, type); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = cond[i]; -+ b->loc->cond = cond[i]; - b->thread = thread; - if (addr_string[i]) - b->addr_string = addr_string[i]; -@@ -5056,7 +5055,7 @@ - { - arg = pending_bp->cond_string; - b->cond_string = savestring (arg, strlen (arg)); -- b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -+ b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); - if (*arg) - error (_("Junk at end of pending breakpoint condition expression")); - } -@@ -5399,7 +5398,7 @@ - : bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = *cond; -+ b->loc->cond = *cond; - b->thread = thread; - b->addr_string = *addr_string; - b->cond_string = *cond_string; -@@ -5792,7 +5791,7 @@ - b->exp_valid_block = exp_valid_block; - b->exp_string = savestring (exp_start, exp_end - exp_start); - b->val = val; -- b->cond = cond; -+ b->loc->cond = cond; - if (cond_start) - b->cond_string = savestring (cond_start, cond_end - cond_start); - else -@@ -6352,7 +6351,6 @@ - b = set_raw_breakpoint (*sal, bptype); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = NULL; - b->cond_string = (cond_string == NULL) ? - NULL : savestring (cond_string, strlen (cond_string)); - b->thread = thread; -@@ -6432,7 +6430,6 @@ - b = set_raw_breakpoint (sals.sals[0], bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = NULL; - b->cond_string = (cond_string == NULL) ? - NULL : savestring (cond_string, strlen (cond_string)); - b->thread = -1; -@@ -6519,7 +6516,7 @@ - b->disposition = tempflag ? disp_del : disp_donttouch; - b->number = breakpoint_count; - b->ignore_count = 0; -- b->cond = cond; -+ b->loc->cond = cond; - b->addr_string = addr_string; - b->language = language_ada; - b->cond_string = cond_string; -@@ -6701,7 +6698,6 @@ - b = set_raw_breakpoint (sal, bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->cond = 0; - b->thread = -1; - return b; - } -@@ -7021,8 +7017,6 @@ - } - - free_command_lines (&bpt->commands); -- if (bpt->cond) -- xfree (bpt->cond); - if (bpt->cond_string != NULL) - xfree (bpt->cond_string); - if (bpt->addr_string != NULL) -@@ -7062,6 +7056,8 @@ - bp, we mark it as deleted before freeing its storage. */ - bpt->type = bp_none; - -+ if (bpt->loc->cond) -+ xfree (bpt->loc->cond); - xfree (bpt->loc); - xfree (bpt); - } -@@ -7215,14 +7211,14 @@ - if (b->cond_string != NULL) - { - s = b->cond_string; -- if (b->cond) -+ if (b->loc->cond) - { -- xfree (b->cond); -+ xfree (b->loc->cond); - /* Avoid re-freeing b->exp if an error during the call - to parse_exp_1. */ -- b->cond = NULL; -+ b->loc->cond = NULL; - } -- b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); -+ b->loc->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); - } - - /* We need to re-set the breakpoint if the address changes... */ -@@ -7314,14 +7310,14 @@ - if (b->cond_string != NULL) - { - s = b->cond_string; -- if (b->cond) -+ if (b->loc->cond) - { -- xfree (b->cond); -+ xfree (b->loc->cond); - /* Avoid re-freeing b->exp if an error during the call - to parse_exp_1. */ -- b->cond = NULL; -+ b->loc->cond = NULL; - } -- b->cond = parse_exp_1 (&s, (struct block *) 0, 0); -+ b->loc->cond = parse_exp_1 (&s, (struct block *) 0, 0); - } - if (breakpoint_enabled (b)) - mention (b); -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.h,v -retrieving revision 1.48 -retrieving revision 1.49 -diff -u -r1.48 -r1.49 ---- src/gdb/breakpoint.h 2007/09/22 17:49:41 1.48 -+++ src/gdb/breakpoint.h 2007/09/22 19:06:59 1.49 -@@ -243,6 +243,13 @@ - than reference counting. */ - struct breakpoint *owner; - -+ /* Conditional. Break only if this expression's value is nonzero. -+ Unlike string form of condition, which is associated with breakpoint, -+ this is associated with location, since if breakpoint has several -+ locations, the evaluation of expression can be different for -+ different locations. */ -+ struct expression *cond; -+ - /* Nonzero if this breakpoint is now inserted. */ - char inserted; - -@@ -341,8 +348,6 @@ - /* Stack depth (address of frame). If nonzero, break only if fp - equals this. */ - struct frame_id frame_id; -- /* Conditional. Break only if this expression's value is nonzero. */ -- struct expression *cond; - - /* String we used to set the breakpoint (malloc'd). */ - char *addr_string; -=================================================================== -RCS file: /cvs/src/src/gdb/tui/tui-winsource.c,v -retrieving revision 1.28 -retrieving revision 1.29 -diff -u -r1.28 -r1.29 ---- src/gdb/tui/tui-winsource.c 2007/08/23 18:08:50 1.28 -+++ src/gdb/tui/tui-winsource.c 2007/09/22 19:06:59 1.29 -@@ -449,7 +449,7 @@ - mode |= TUI_BP_ENABLED; - if (bp->hit_count) - mode |= TUI_BP_HIT; -- if (bp->cond) -+ if (bp->loc->cond) - mode |= TUI_BP_CONDITIONAL; - if (bp->type == bp_hardware_breakpoint) - mode |= TUI_BP_HARDWARE; - -2007-09-22 Vladimir Prus - - * breakpoint.c (create_breakpoint): Split from - create_breakpoints, implementing most of its logic. - Take just a single sal, single address string and - single condition. Do not take parsed condition at - all. - (create_breakpoints): Just call create_breakpoint - for each sal. - (find_condition_and_thread): New. - (break_command_1): Use find_condition_and_thread. - Do not keep parsed conditions. - (do_captured_breakpoint): Don't convert - condition string to struct expression. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.265 -retrieving revision 1.266 -diff -u -r1.265 -r1.266 ---- src/gdb/breakpoint.c 2007/09/22 19:06:59 1.265 -+++ src/gdb/breakpoint.c 2007/09/22 19:10:05 1.266 -@@ -4984,93 +4984,125 @@ - } - - --/* Add SALS.nelts breakpoints to the breakpoint table. For each -- SALS.sal[i] breakpoint, include the corresponding ADDR_STRING[i], -- COND[i] and COND_STRING[i] values. - -+/* Create a breakpoint with SAL as location. Use ADDR_STRING -+ as textual description of the location, and COND_STRING -+ as condition expression. -+ -+ The paramter PENDING_BP is same as for the -+ create_breakpoints function. */ -+ -+static void -+create_breakpoint (struct symtab_and_line sal, char *addr_string, -+ char *cond_string, -+ enum bptype type, enum bpdisp disposition, -+ int thread, int ignore_count, int from_tty, -+ struct breakpoint *pending_bp) -+{ -+ struct breakpoint *b; -+ -+ if (type == bp_hardware_breakpoint) -+ { -+ int i = hw_breakpoint_used_count (); -+ int target_resources_ok = -+ TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint, -+ i + 1, 0); -+ if (target_resources_ok == 0) -+ error (_("No hardware breakpoint support in the target.")); -+ else if (target_resources_ok < 0) -+ error (_("Hardware breakpoints used exceeds limit.")); -+ } -+ -+ if (from_tty) -+ describe_other_breakpoints (sal.pc, sal.section, thread); -+ -+ b = set_raw_breakpoint (sal, type); -+ set_breakpoint_count (breakpoint_count + 1); -+ b->number = breakpoint_count; -+ b->thread = thread; -+ -+ b->cond_string = cond_string; -+ b->ignore_count = ignore_count; -+ b->enable_state = bp_enabled; -+ b->disposition = disposition; -+ /* If resolving a pending breakpoint, a check must be made to see if -+ the user has specified a new condition or commands for the -+ breakpoint. A new condition will override any condition that was -+ initially specified with the initial breakpoint command. */ -+ if (pending_bp) -+ { -+ if (pending_bp->cond_string) -+ b->cond_string = savestring (pending_bp->cond_string, -+ strlen (pending_bp->cond_string)); -+ -+ /* If there are commands associated with the breakpoint, they should -+ be copied too. */ -+ if (pending_bp->commands) -+ b->commands = copy_command_lines (pending_bp->commands); -+ -+ /* We have to copy over the ignore_count and thread as well. */ -+ b->ignore_count = pending_bp->ignore_count; -+ b->thread = pending_bp->thread; -+ } -+ -+ if (b->cond_string) -+ { -+ char *arg = b->cond_string; -+ b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -+ if (*arg) -+ { -+ if (pending_bp) -+ error (_("Junk at end of pending breakpoint condition expression")); -+ else -+ error (_("Garbage %s follows condition"), arg); -+ } -+ } -+ -+ if (addr_string) -+ b->addr_string = addr_string; -+ else -+ /* addr_string has to be used or breakpoint_re_set will delete -+ me. */ -+ b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address)); -+ -+ mention (b); -+} -+ -+/* Add SALS.nelts breakpoints to the breakpoint table. For each -+ SALS.sal[i] breakpoint, include the corresponding ADDR_STRING[i] -+ value. COND_STRING, if not NULL, specified the condition to be -+ used for all breakpoints. Essentially the only case where -+ SALS.nelts is not 1 is when we set a breakpoint on an overloaded -+ function. In that case, it's still not possible to specify -+ separate conditions for different overloaded functions, so -+ we take just a single condition string. -+ - The parameter PENDING_BP points to a pending breakpoint that is - the basis of the breakpoints currently being created. The pending - breakpoint may contain a separate condition string or commands - that were added after the initial pending breakpoint was created. - - NOTE: If the function succeeds, the caller is expected to cleanup -- the arrays ADDR_STRING, COND_STRING, COND and SALS (but not the -+ the arrays ADDR_STRING, COND_STRING, and SALS (but not the - array contents). If the function fails (error() is called), the - caller is expected to cleanups both the ADDR_STRING, COND_STRING, - COND and SALS arrays and each of those arrays contents. */ - - static void - create_breakpoints (struct symtabs_and_lines sals, char **addr_string, -- struct expression **cond, char **cond_string, -+ char *cond_string, - enum bptype type, enum bpdisp disposition, - int thread, int ignore_count, int from_tty, - struct breakpoint *pending_bp) - { -- if (type == bp_hardware_breakpoint) -+ int i; -+ for (i = 0; i < sals.nelts; ++i) - { -- int i = hw_breakpoint_used_count (); -- int target_resources_ok = -- TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint, -- i + sals.nelts, 0); -- if (target_resources_ok == 0) -- error (_("No hardware breakpoint support in the target.")); -- else if (target_resources_ok < 0) -- error (_("Hardware breakpoints used exceeds limit.")); -+ create_breakpoint (sals.sals[i], addr_string[i], -+ cond_string, type, disposition, -+ thread, ignore_count, from_tty, -+ pending_bp); - } -- -- /* Now set all the breakpoints. */ -- { -- int i; -- for (i = 0; i < sals.nelts; i++) -- { -- struct breakpoint *b; -- struct symtab_and_line sal = sals.sals[i]; -- -- if (from_tty) -- describe_other_breakpoints (sal.pc, sal.section, thread); -- -- b = set_raw_breakpoint (sal, type); -- set_breakpoint_count (breakpoint_count + 1); -- b->number = breakpoint_count; -- b->loc->cond = cond[i]; -- b->thread = thread; -- if (addr_string[i]) -- b->addr_string = addr_string[i]; -- else -- /* addr_string has to be used or breakpoint_re_set will delete -- me. */ -- b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address)); -- b->cond_string = cond_string[i]; -- b->ignore_count = ignore_count; -- b->enable_state = bp_enabled; -- b->disposition = disposition; -- /* If resolving a pending breakpoint, a check must be made to see if -- the user has specified a new condition or commands for the -- breakpoint. A new condition will override any condition that was -- initially specified with the initial breakpoint command. */ -- if (pending_bp) -- { -- char *arg; -- if (pending_bp->cond_string) -- { -- arg = pending_bp->cond_string; -- b->cond_string = savestring (arg, strlen (arg)); -- b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -- if (*arg) -- error (_("Junk at end of pending breakpoint condition expression")); -- } -- /* If there are commands associated with the breakpoint, they should -- be copied too. */ -- if (pending_bp->commands) -- b->commands = copy_command_lines (pending_bp->commands); -- -- /* We have to copy over the ignore_count and thread as well. */ -- b->ignore_count = pending_bp->ignore_count; -- b->thread = pending_bp->thread; -- } -- mention (b); -- } -- } - } - - /* Parse ARG which is assumed to be a SAL specification possibly -@@ -5192,6 +5224,59 @@ - args->not_found_ptr); - } - -+/* Given TOK, a string specification of condition and thread, as -+ accepted by the 'break' command, extract the condition -+ string and thread number and set *COND_STRING and *THREAD. -+ PC identifies the context at which the condition should be parsed. -+ If no condition is found, *COND_STRING is set to NULL. -+ If no thread is found, *THREAD is set to -1. */ -+static void -+find_condition_and_thread (char *tok, CORE_ADDR pc, -+ char **cond_string, int *thread) -+{ -+ *cond_string = NULL; -+ *thread = -1; -+ while (tok && *tok) -+ { -+ char *end_tok; -+ int toklen; -+ char *cond_start = NULL; -+ char *cond_end = NULL; -+ while (*tok == ' ' || *tok == '\t') -+ tok++; -+ -+ end_tok = tok; -+ -+ while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000') -+ end_tok++; -+ -+ toklen = end_tok - tok; -+ -+ if (toklen >= 1 && strncmp (tok, "if", toklen) == 0) -+ { -+ tok = cond_start = end_tok + 1; -+ parse_exp_1 (&tok, block_for_pc (pc), 0); -+ cond_end = tok; -+ *cond_string = savestring (cond_start, -+ cond_end - cond_start); -+ } -+ else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0) -+ { -+ char *tmptok; -+ -+ tok = end_tok + 1; -+ tmptok = tok; -+ *thread = strtol (tok, &tok, 0); -+ if (tok == tmptok) -+ error (_("Junk after thread keyword.")); -+ if (!valid_thread_id (*thread)) -+ error (_("Unknown thread %d."), *thread); -+ } -+ else -+ error (_("Junk at end of arguments.")); -+ } -+} -+ - /* Set a breakpoint according to ARG (function, linenum or *address) - flag: first bit : 0 non-temporary, 1 temporary. - second bit : 0 normal breakpoint, 1 hardware breakpoint. -@@ -5205,9 +5290,8 @@ - struct gdb_exception e; - int tempflag, hardwareflag; - struct symtabs_and_lines sals; -- struct expression **cond = 0; - struct symtab_and_line pending_sal; -- char **cond_string = (char **) NULL; -+ char *cond_string = NULL; - char *copy_arg; - char *err_msg; - char *addr_start = arg; -@@ -5297,14 +5381,6 @@ - make_cleanup (xfree, addr_string); - } - -- /* Allocate space for all the cond expressions. */ -- cond = xcalloc (sals.nelts, sizeof (struct expression *)); -- make_cleanup (xfree, cond); -- -- /* Allocate space for all the cond strings. */ -- cond_string = xcalloc (sals.nelts, sizeof (char **)); -- make_cleanup (xfree, cond_string); -- - /* ----------------------------- SNIP ----------------------------- - Anything added to the cleanup chain beyond this point is assumed - to be part of a breakpoint. If the breakpoint create succeeds -@@ -5328,56 +5404,16 @@ - /* Verify that condition can be parsed, before setting any - breakpoints. Allocate a separate condition expression for each - breakpoint. */ -- thread = -1; /* No specific thread yet */ - if (!pending) - { -- for (i = 0; i < sals.nelts; i++) -- { -- char *tok = arg; -- while (tok && *tok) -- { -- char *end_tok; -- int toklen; -- char *cond_start = NULL; -- char *cond_end = NULL; -- while (*tok == ' ' || *tok == '\t') -- tok++; -- -- end_tok = tok; -- -- while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000') -- end_tok++; -- -- toklen = end_tok - tok; -- -- if (toklen >= 1 && strncmp (tok, "if", toklen) == 0) -- { -- tok = cond_start = end_tok + 1; -- cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), -- 0); -- make_cleanup (xfree, cond[i]); -- cond_end = tok; -- cond_string[i] = savestring (cond_start, -- cond_end - cond_start); -- make_cleanup (xfree, cond_string[i]); -- } -- else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0) -- { -- char *tmptok; -- -- tok = end_tok + 1; -- tmptok = tok; -- thread = strtol (tok, &tok, 0); -- if (tok == tmptok) -- error (_("Junk after thread keyword.")); -- if (!valid_thread_id (thread)) -- error (_("Unknown thread %d."), thread); -- } -- else -- error (_("Junk at end of arguments.")); -- } -- } -- create_breakpoints (sals, addr_string, cond, cond_string, -+ /* Here we only parse 'arg' to separate condition -+ from thread number, so parsing in context of first -+ sal is OK. When setting the breakpoint we'll -+ re-parse it in context of each sal. */ -+ find_condition_and_thread (arg, sals.sals[0].pc, &cond_string, &thread); -+ if (cond_string) -+ make_cleanup (xfree, cond_string); -+ create_breakpoints (sals, addr_string, cond_string, - hardwareflag ? bp_hardware_breakpoint - : bp_breakpoint, - tempflag ? disp_del : disp_donttouch, -@@ -5398,10 +5434,10 @@ - : bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->loc->cond = *cond; -+ b->loc->cond = NULL; - b->thread = thread; -- b->addr_string = *addr_string; -- b->cond_string = *cond_string; -+ b->addr_string = addr_string[0]; -+ b->cond_string = cond_string; - b->ignore_count = ignore_count; - b->pending = 1; - b->disposition = tempflag ? disp_del : disp_donttouch; -@@ -5445,7 +5481,7 @@ - struct cleanup *breakpoint_chain = NULL; - int i; - char **addr_string; -- char **cond_string; -+ char *cond_string; - - char *address_end; - -@@ -5502,22 +5538,13 @@ - /* Resolve all line numbers to PC's. */ - breakpoint_sals_to_pc (&sals, args->address); - -- /* Verify that conditions can be parsed, before setting any -- breakpoints. */ -- for (i = 0; i < sals.nelts; i++) -+ if (args->condition != NULL) - { -- if (args->condition != NULL) -- { -- char *tok = args->condition; -- cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0); -- if (*tok != '\0') -- error (_("Garbage %s follows condition"), tok); -- make_cleanup (xfree, cond[i]); -- cond_string[i] = xstrdup (args->condition); -- } -+ cond_string = xstrdup (args->condition); -+ make_cleanup (xfree, cond_string); - } - -- create_breakpoints (sals, addr_string, cond, cond_string, -+ create_breakpoints (sals, addr_string, args->condition, - args->hardwareflag ? bp_hardware_breakpoint : bp_breakpoint, - args->tempflag ? disp_del : disp_donttouch, - args->thread, args->ignore_count, 0/*from-tty*/, - -2007-09-22 Vladimir Prus - - * breakpoint.c (do_restore_lang_radix_cleanup): Remove. - (resolve_pending_breakpoint): Remove. - (re_enable_breakpoints_in_shlibs): Remove. - (unlink_locations_from_global_list): New. - (update_breakpoint_locations): New. - (breakpoint_re_set_one): Don't bail out on pending breakpoints. - Use parse_condition and update_breakpoint_location to - reset breakpoint. Ignore 'symbol not found' error from - decode_line_1. - (breakpoint_re_set): Don't emit newline before the - reason why breakpoint is not reset. - (do_enable_breakpoint): Don't specially process pending - breakpoints. - (free_bp_location): New. - (break_command_1): For pending breakpoints, initialize - all fields of a sal with zeroes. - * breakpoint.h (re_enable_breakpoints_in_shlibs): Remove. - * infcmd.c (post_create_inferior): Don't call - re_enable_breakpoints_in_shlibs. - * infrun.c (handle_inferior_event): Likewise. - * solib-irix.c (irix_solib_create_inferior_hook): Likewise. - * solib-osf.c (osf_solib_create_inferior_hook): Likewise. - * win32-nat.c (get_win32_debug_event): Likewise. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.266 -retrieving revision 1.267 -diff -u -r1.266 -r1.267 ---- src/gdb/breakpoint.c 2007/09/22 19:10:05 1.266 -+++ src/gdb/breakpoint.c 2007/09/22 19:33:31 1.267 -@@ -203,6 +203,8 @@ - - static int single_step_breakpoint_inserted_here_p (CORE_ADDR pc); - -+static void free_bp_location (struct bp_location *loc); -+ - /* Prototypes for exported functions. */ - - /* If FALSE, gdb will not use hardware support for watchpoints, even -@@ -4140,6 +4142,13 @@ - return loc; - } - -+static void free_bp_location (struct bp_location *loc) -+{ -+ if (loc->cond) -+ xfree (loc->cond); -+ xfree (loc); -+} -+ - /* set_raw_breakpoint() is a low level routine for allocating and - partially initializing a breakpoint of type BPTYPE. The newly - created breakpoint's address, section, source file name, and line -@@ -4396,51 +4405,6 @@ - int radix; - }; - --/* Cleanup helper routine to restore the current language and -- input radix. */ --static void --do_restore_lang_radix_cleanup (void *old) --{ -- struct lang_and_radix *p = old; -- set_language (p->lang); -- input_radix = p->radix; --} -- --/* Try and resolve a pending breakpoint. */ --static int --resolve_pending_breakpoint (struct breakpoint *b) --{ -- /* Try and reparse the breakpoint in case the shared library -- is now loaded. */ -- struct symtabs_and_lines sals; -- struct symtab_and_line pending_sal; -- char **cond_string = (char **) NULL; -- char *copy_arg = b->addr_string; -- char **addr_string; -- char *errmsg; -- int rc; -- int not_found = 0; -- struct ui_file *old_gdb_stderr; -- struct lang_and_radix old_lr; -- struct cleanup *old_chain; -- -- /* Set language, input-radix, then reissue breakpoint command. -- Ensure the language and input-radix are restored afterwards. */ -- old_lr.lang = current_language->la_language; -- old_lr.radix = input_radix; -- old_chain = make_cleanup (do_restore_lang_radix_cleanup, &old_lr); -- -- set_language (b->language); -- input_radix = b->input_radix; -- rc = break_command_1 (b->addr_string, b->flag, b->from_tty, b); -- -- if (rc == GDB_RC_OK) -- /* Pending breakpoint has been resolved. */ -- printf_filtered (_("Pending breakpoint \"%s\" resolved\n"), b->addr_string); -- -- do_cleanups (old_chain); -- return rc; --} - - void - remove_solib_event_breakpoints (void) -@@ -4523,37 +4487,6 @@ - } - } - --/* Try to reenable any breakpoints in shared libraries. */ --void --re_enable_breakpoints_in_shlibs (void) --{ -- struct breakpoint *b, *tmp; -- -- ALL_BREAKPOINTS_SAFE (b, tmp) -- { -- if (b->enable_state == bp_shlib_disabled) -- { -- gdb_byte buf[1]; -- char *lib; -- -- /* Do not reenable the breakpoint if the shared library is -- still not mapped in. */ --#ifdef PC_SOLIB -- lib = PC_SOLIB (b->loc->address); --#else -- lib = solib_address (b->loc->address); --#endif -- if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0) -- b->enable_state = bp_enabled; -- } -- else if (b->pending && (b->enable_state == bp_enabled)) -- { -- if (resolve_pending_breakpoint (b) == GDB_RC_OK) -- delete_breakpoint (b); -- } -- } --} -- - static void - solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname, - char *cond_string, enum bptype bp_kind) -@@ -5422,12 +5355,9 @@ - } - else - { -- struct symtab_and_line sal; -+ struct symtab_and_line sal = {0}; - struct breakpoint *b; - -- sal.symtab = NULL; -- sal.pc = 0; -- - make_cleanup (xfree, copy_arg); - - b = set_raw_breakpoint (sal, hardwareflag ? bp_hardware_breakpoint -@@ -7153,6 +7083,97 @@ - map_breakpoint_numbers (arg, delete_breakpoint); - } - -+static void -+unlink_locations_from_global_list (struct breakpoint *bpt) -+ /* Remove locations of this breakpoint from the list of -+ all breakpoint locations. */ -+{ -+ struct bp_location **tmp = &bp_location_chain; -+ struct bp_location *here = bpt->loc; -+ -+ if (here == NULL) -+ return; -+ -+ for (; *tmp && *tmp != here; tmp = &((*tmp)->next)); -+ gdb_assert (*tmp); -+ -+ *tmp = here->next; -+} -+ -+ -+static void -+update_breakpoint_location (struct breakpoint *b, -+ struct symtabs_and_lines sals) -+{ -+ int i; -+ char *s; -+ /* FIXME: memleak. */ -+ struct bp_location *existing = b->loc; -+ struct bp_location *loc; -+ struct symtab_and_line sal; -+ -+ if (b->enable_state == bp_shlib_disabled && sals.nelts == 0) -+ return; -+ -+ unlink_locations_from_global_list (b); -+ b->loc = NULL; -+ -+ gdb_assert (sals.nelts == 0 || sals.nelts == 1); -+ if (sals.nelts == 0) -+ return; -+ sal = sals.sals[0]; -+ -+ loc = allocate_bp_location (b, b->type); -+ loc->requested_address = sal.pc; -+ loc->address = adjust_breakpoint_address (loc->requested_address, -+ b->type); -+ loc->section = sal.section; -+ b->loc = loc; -+ -+ /* Reparse conditions, they might contain references to the -+ old symtab. */ -+ if (b->cond_string != NULL) -+ { -+ struct gdb_exception e; -+ -+ s = b->cond_string; -+ TRY_CATCH (e, RETURN_MASK_ERROR) -+ { -+ loc->cond = parse_exp_1 (&s, block_for_pc (sal.pc), -+ 0); -+ } -+ if (e.reason < 0) -+ { -+ warning (_("failed to reevaluate condition for breakpoint %d: %s"), -+ b->number, e.message); -+ b->enable_state = bp_disabled; -+ } -+ } -+ -+ if (b->source_file != NULL) -+ xfree (b->source_file); -+ if (sal.symtab == NULL) -+ b->source_file = NULL; -+ else -+ b->source_file = -+ savestring (sal.symtab->filename, -+ strlen (sal.symtab->filename)); -+ -+ if (b->line_number == 0) -+ b->line_number = sal.line; -+ -+ if (b->enable_state == bp_shlib_disabled) -+ b->enable_state = bp_enabled; -+ -+ b->pending = 0; -+ -+ check_duplicates (b); -+ -+ if (existing) -+ free_bp_location (existing); -+} -+ -+ - /* Reset a breakpoint given it's struct breakpoint * BINT. - The value we return ends up being the return value from catch_errors. - Unused in this case. */ -@@ -7164,11 +7185,13 @@ - struct breakpoint *b = (struct breakpoint *) bint; - struct value *mark; - int i; -- int not_found; -- int *not_found_ptr = NULL; -- struct symtabs_and_lines sals; -+ int not_found = 0; -+ int *not_found_ptr = ¬_found; -+ struct symtabs_and_lines sals = {}; - char *s; - enum enable_state save_enable; -+ struct gdb_exception e; -+ - - switch (b->type) - { -@@ -7186,115 +7209,59 @@ - delete_breakpoint (b); - return 0; - } -- /* HACK: cagney/2001-11-11: kettenis/2001-11-11: MarkK wrote: -- -- ``And a hack it is, although Apple's Darwin version of GDB -- contains an almost identical hack to implement a "future -- break" command. It seems to work in many real world cases, -- but it is easy to come up with a test case where the patch -- doesn't help at all.'' -- -- ``It seems that the way GDB implements breakpoints - in - -- shared - libraries was designed for a.out shared library -- systems (SunOS 4) where shared libraries were loaded at a -- fixed address in memory. Since ELF shared libraries can (and -- will) be loaded at any address in memory, things break. -- Fixing this is not trivial. Therefore, I'm not sure whether -- we should add this hack to the branch only. I cannot -- guarantee that things will be fixed on the trunk in the near -- future.'' -- -- In case we have a problem, disable this breakpoint. We'll -- restore its status if we succeed. Don't disable a -- shlib_disabled breakpoint though. There's a fair chance we -- can't re-set it if the shared library it's in hasn't been -- loaded yet. */ -- -- if (b->pending) -- break; -- -- save_enable = b->enable_state; -- if (b->enable_state != bp_shlib_disabled) -- b->enable_state = bp_disabled; -- else -- /* If resetting a shlib-disabled breakpoint, we don't want to -- see an error message if it is not found since we will expect -- this to occur until the shared library is finally reloaded. -- We accomplish this by giving decode_line_1 a pointer to use -- for silent notification that the symbol is not found. */ -- not_found_ptr = ¬_found; - - set_language (b->language); - input_radix = b->input_radix; - s = b->addr_string; -- sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL, -- not_found_ptr); -- for (i = 0; i < sals.nelts; i++) -- { -- resolve_sal_pc (&sals.sals[i]); -- -- /* Reparse conditions, they might contain references to the -- old symtab. */ -- if (b->cond_string != NULL) -- { -- s = b->cond_string; -- if (b->loc->cond) -- { -- xfree (b->loc->cond); -- /* Avoid re-freeing b->exp if an error during the call -- to parse_exp_1. */ -- b->loc->cond = NULL; -- } -- b->loc->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); -- } -+ TRY_CATCH (e, RETURN_MASK_ERROR) -+ { -+ sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL, -+ not_found_ptr); -+ } -+ if (e.reason < 0) -+ { -+ int not_found_and_ok = 0; -+ /* For pending breakpoints, it's expected that parsing -+ will fail until the right shared library is loaded. -+ User has already told to create pending breakpoints and -+ don't need extra messages. If breakpoint is in bp_shlib_disabled -+ state, then user already saw the message about that breakpoint -+ being disabled, and don't want to see more errors. */ -+ if (not_found && (b->pending || b->enable_state == bp_shlib_disabled -+ || b->enable_state == bp_disabled)) -+ not_found_and_ok = 1; - -- /* We need to re-set the breakpoint if the address changes... */ -- if (b->loc->address != sals.sals[i].pc -- /* ...or new and old breakpoints both have source files, and -- the source file name or the line number changes... */ -- || (b->source_file != NULL -- && sals.sals[i].symtab != NULL -- && (strcmp (b->source_file, sals.sals[i].symtab->filename) != 0 -- || b->line_number != sals.sals[i].line) -- ) -- /* ...or we switch between having a source file and not having -- one. */ -- || ((b->source_file == NULL) != (sals.sals[i].symtab == NULL)) -- ) -+ if (!not_found_and_ok) - { -- if (b->source_file != NULL) -- xfree (b->source_file); -- if (sals.sals[i].symtab == NULL) -- b->source_file = NULL; -- else -- b->source_file = -- savestring (sals.sals[i].symtab->filename, -- strlen (sals.sals[i].symtab->filename)); -- b->line_number = sals.sals[i].line; -- b->loc->requested_address = sals.sals[i].pc; -- b->loc->address -- = adjust_breakpoint_address (b->loc->requested_address, -- b->type); -- -- /* Used to check for duplicates here, but that can -- cause trouble, as it doesn't check for disabled -- breakpoints. */ -- -- mention (b); -- -- /* Might be better to do this just once per breakpoint_re_set, -- rather than once for every breakpoint. */ -- breakpoints_changed (); -+ /* We surely don't want to warn about the same breakpoint -+ 10 times. One solution, implemented here, is disable -+ the breakpoint on error. Another solution would be to -+ have separate 'warning emitted' flag. Since this -+ happens only when a binary has changed, I don't know -+ which approach is better. */ -+ b->enable_state = bp_disabled; -+ throw_exception (e); - } -- b->loc->section = sals.sals[i].section; -- b->enable_state = save_enable; /* Restore it, this worked. */ -+ } - -+ if (not_found) -+ break; -+ -+ gdb_assert (sals.nelts == 1); -+ resolve_sal_pc (&sals.sals[0]); -+ if (b->pending && s && s[0]) -+ { -+ char *cond_string = 0; -+ int thread = -1; -+ find_condition_and_thread (s, sals.sals[0].pc, -+ &cond_string, &thread); -+ if (cond_string) -+ b->cond_string = cond_string; -+ b->thread = thread; -+ } - -- /* Now that this is re-enabled, check_duplicates -- can be used. */ -- check_duplicates (b); -+ update_breakpoint_location (b, sals); - -- } - xfree (sals.sals); - break; - -@@ -7408,7 +7375,7 @@ - ALL_BREAKPOINTS_SAFE (b, temp) - { - /* Format possible error msg */ -- char *message = xstrprintf ("Error in re-setting breakpoint %d:\n", -+ char *message = xstrprintf ("Error in re-setting breakpoint %d: ", - b->number); - struct cleanup *cleanups = make_cleanup (xfree, message); - catch_errors (breakpoint_re_set_one, b, message, RETURN_MASK_ALL); -@@ -7635,88 +7602,68 @@ - error (_("Hardware breakpoints used exceeds limit.")); - } - -- if (bpt->pending) -+ if (bpt->enable_state != bp_permanent) -+ bpt->enable_state = bp_enabled; -+ bpt->disposition = disposition; -+ check_duplicates (bpt); -+ breakpoints_changed (); -+ -+ if (bpt->type == bp_watchpoint || -+ bpt->type == bp_hardware_watchpoint || -+ bpt->type == bp_read_watchpoint || -+ bpt->type == bp_access_watchpoint) - { -- if (bpt->enable_state != bp_enabled) -+ struct frame_id saved_frame_id; -+ -+ saved_frame_id = get_frame_id (get_selected_frame (NULL)); -+ if (bpt->exp_valid_block != NULL) - { -- /* When enabling a pending breakpoint, we need to check if the breakpoint -- is resolvable since shared libraries could have been loaded -- after the breakpoint was disabled. */ -- breakpoints_changed (); -- if (resolve_pending_breakpoint (bpt) == GDB_RC_OK) -+ struct frame_info *fr = -+ fr = frame_find_by_id (bpt->watchpoint_frame); -+ if (fr == NULL) - { -- delete_breakpoint (bpt); -+ printf_filtered (_("\ -+Cannot enable watchpoint %d because the block in which its expression\n\ -+is valid is not currently in scope.\n"), bpt->number); -+ bpt->enable_state = bp_disabled; - return; - } -- bpt->enable_state = bp_enabled; -- bpt->disposition = disposition; -+ select_frame (fr); - } -- } -- else /* Not a pending breakpoint. */ -- { -- if (bpt->enable_state != bp_permanent) -- bpt->enable_state = bp_enabled; -- bpt->disposition = disposition; -- check_duplicates (bpt); -- breakpoints_changed (); - -- if (bpt->type == bp_watchpoint || -- bpt->type == bp_hardware_watchpoint || -- bpt->type == bp_read_watchpoint || -+ 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); -+ -+ if (bpt->type == bp_hardware_watchpoint || -+ bpt->type == bp_read_watchpoint || - bpt->type == bp_access_watchpoint) - { -- struct frame_id saved_frame_id; -- -- saved_frame_id = get_frame_id (get_selected_frame (NULL)); -- if (bpt->exp_valid_block != NULL) -- { -- struct frame_info *fr = -- fr = frame_find_by_id (bpt->watchpoint_frame); -- if (fr == NULL) -- { -- printf_filtered (_("\ --Cannot enable watchpoint %d because the block in which its expression\n\ --is valid is not currently in scope.\n"), bpt->number); -- bpt->enable_state = bp_disabled; -- return; -- } -- select_frame (fr); -- } -- -- 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); -+ int i = hw_watchpoint_used_count (bpt->type, &other_type_used); -+ int mem_cnt = can_use_hardware_watchpoint (bpt->val); - -- if (bpt->type == bp_hardware_watchpoint || -- bpt->type == bp_read_watchpoint || -- bpt->type == bp_access_watchpoint) -+ /* Hack around 'unused var' error for some targets here */ -+ (void) mem_cnt, (void) i; -+ target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT ( -+ bpt->type, i + mem_cnt, other_type_used); -+ /* we can consider of type is bp_hardware_watchpoint, convert to -+ bp_watchpoint in the following condition */ -+ if (target_resources_ok < 0) - { -- int i = hw_watchpoint_used_count (bpt->type, &other_type_used); -- int mem_cnt = can_use_hardware_watchpoint (bpt->val); -- -- /* Hack around 'unused var' error for some targets here */ -- (void) mem_cnt, (void) i; -- target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT ( -- bpt->type, i + mem_cnt, other_type_used); -- /* we can consider of type is bp_hardware_watchpoint, convert to -- bp_watchpoint in the following condition */ -- if (target_resources_ok < 0) -- { -- printf_filtered (_("\ -+ printf_filtered (_("\ - Cannot enable watchpoint %d because target watch resources\n\ - have been allocated for other watchpoints.\n"), bpt->number); -- bpt->enable_state = bp_disabled; -- value_free_to_mark (mark); -- return; -- } -+ bpt->enable_state = bp_disabled; -+ value_free_to_mark (mark); -+ return; - } -- -- select_frame (frame_find_by_id (saved_frame_id)); -- value_free_to_mark (mark); - } -+ -+ select_frame (frame_find_by_id (saved_frame_id)); -+ value_free_to_mark (mark); - } - - if (deprecated_modify_breakpoint_hook) -@@ -7724,6 +7671,7 @@ - breakpoint_modify_event (bpt->number); - } - -+ - void - enable_breakpoint (struct breakpoint *bpt) - { -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.h,v -retrieving revision 1.49 -retrieving revision 1.50 -diff -u -r1.49 -r1.50 ---- src/gdb/breakpoint.h 2007/09/22 19:06:59 1.49 -+++ src/gdb/breakpoint.h 2007/09/22 19:33:31 1.50 -@@ -799,8 +799,6 @@ - - extern void disable_breakpoints_in_shlibs (void); - --extern void re_enable_breakpoints_in_shlibs (void); -- - extern void create_solib_load_event_breakpoint (char *, int, char *, char *); - - extern void create_solib_unload_event_breakpoint (char *, int, -=================================================================== -RCS file: /cvs/src/src/gdb/infcmd.c,v -retrieving revision 1.158 -retrieving revision 1.159 -diff -u -r1.158 -r1.159 ---- src/gdb/infcmd.c 2007/09/04 01:38:07 1.158 -+++ src/gdb/infcmd.c 2007/09/22 19:33:31 1.159 -@@ -433,10 +433,6 @@ - #else - solib_create_inferior_hook (); - #endif -- -- /* Enable any breakpoints which were disabled when the -- underlying shared library was deleted. */ -- re_enable_breakpoints_in_shlibs (); - } - - observer_notify_inferior_created (target, from_tty); -=================================================================== -RCS file: /cvs/src/src/gdb/infrun.c,v -retrieving revision 1.247 -retrieving revision 1.248 -diff -u -r1.247 -r1.248 ---- src/gdb/infrun.c 2007/09/17 19:44:20 1.247 -+++ src/gdb/infrun.c 2007/09/22 19:33:31 1.248 -@@ -1337,10 +1337,6 @@ - #endif - target_terminal_inferior (); - -- /* Try to reenable shared library breakpoints, additional -- code segments in shared libraries might be mapped in now. */ -- re_enable_breakpoints_in_shlibs (); -- - /* If requested, stop when the dynamic linker notifies - gdb of events. This allows the user to get control - and place breakpoints in initializer routines for -@@ -2276,10 +2272,6 @@ - #endif - target_terminal_inferior (); - -- /* Try to reenable shared library breakpoints, additional -- code segments in shared libraries might be mapped in now. */ -- re_enable_breakpoints_in_shlibs (); -- - /* If requested, stop when the dynamic linker notifies - gdb of events. This allows the user to get control - and place breakpoints in initializer routines for -=================================================================== -RCS file: /cvs/src/src/gdb/solib-irix.c,v -retrieving revision 1.14 -retrieving revision 1.15 -diff -u -r1.14 -r1.15 ---- src/gdb/solib-irix.c 2007/08/23 18:08:38 1.14 -+++ src/gdb/solib-irix.c 2007/09/22 19:33:31 1.15 -@@ -457,7 +457,6 @@ - suppresses the warning. */ - solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); - stop_soon = NO_STOP_QUIETLY; -- re_enable_breakpoints_in_shlibs (); - } - - /* LOCAL FUNCTION -=================================================================== -RCS file: /cvs/src/src/gdb/solib-osf.c,v -retrieving revision 1.11 -retrieving revision 1.12 -diff -u -r1.11 -r1.12 ---- src/gdb/solib-osf.c 2007/08/23 18:08:38 1.11 -+++ src/gdb/solib-osf.c 2007/09/22 19:33:31 1.12 -@@ -336,9 +336,6 @@ - suppresses the warning. */ - solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); - stop_soon = NO_STOP_QUIETLY; -- -- /* Enable breakpoints disabled (unnecessarily) by clear_solib(). */ -- re_enable_breakpoints_in_shlibs (); - } - - /* target_so_ops callback. Do additional symbol handling, lookup, etc. after - -2007-09-22 Vladimir Prus - - * gdb.base/pending.exp: No longer expect "Pending breakpoint resolved" - messages. - * gdb.base/chng-syms.exp: Likewise. - * gdb.base/unload.exp: Likewise. - -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/chng-syms.exp,v -retrieving revision 1.8 -retrieving revision 1.9 -diff -u -r1.8 -r1.9 ---- src/gdb/testsuite/gdb.base/chng-syms.exp 2007/08/23 18:14:16 1.8 -+++ src/gdb/testsuite/gdb.base/chng-syms.exp 2007/09/22 19:33:32 1.9 -@@ -105,10 +105,10 @@ - - gdb_run_cmd - gdb_expect { -- -re "Error in re-setting .*No symbol .var1..*Program exited normally.*$gdb_prompt $" { -+ -re ".*No symbol .var1..*Program exited normally.*$gdb_prompt $" { - pass "running with invalidated bpt condition after executable changes" - } -- -re "Error in re-setting .*No symbol .var1..*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" { -+ -re "No symbol .var1..*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" { - pass "running with invalidated bpt condition after executable changes" - } - -re "$gdb_prompt $" { -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pending.exp,v -retrieving revision 1.10 -retrieving revision 1.11 -diff -u -r1.10 -r1.11 ---- src/gdb/testsuite/gdb.base/pending.exp 2007/08/23 18:14:17 1.10 -+++ src/gdb/testsuite/gdb.base/pending.exp 2007/09/22 19:33:32 1.11 -@@ -194,9 +194,7 @@ - - gdb_run_cmd - gdb_test "" \ --"Breakpoint.*at.* --Pending breakpoint \"pendshr.c:$bp2_loc if x > 3\" resolved.* --Breakpoint.*, main.*$mainline.*" \ -+".*Breakpoint.*, main.*$mainline.*" \ - "running to main" - - # -@@ -204,8 +202,7 @@ - # - - gdb_test "enable 1" \ --"Breakpoint.*at.* --Pending breakpoint \"pendfunc1.* resolved.*" \ -+"" \ - "re-enabling pending breakpoint that can resolve instantly" - - # -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/unload.exp,v -retrieving revision 1.11 -retrieving revision 1.12 -diff -u -r1.11 -r1.12 ---- src/gdb/testsuite/gdb.base/unload.exp 2007/08/23 18:14:17 1.11 -+++ src/gdb/testsuite/gdb.base/unload.exp 2007/09/22 19:33:32 1.12 -@@ -89,9 +89,7 @@ - - gdb_run_cmd - gdb_test "" \ --"Breakpoint.*at.* --Pending breakpoint \"shrfunc1\" resolved.* --Breakpoint.*, shrfunc1 \\\(x=3\\\).*unloadshr.c:$unloadshr_line.*" \ -+".*Breakpoint.*, shrfunc1 \\\(x=3\\\).*unloadshr.c:$unloadshr_line.*" \ - "running program" - - gdb_test "continue" \ - -2007-09-23 Vladimir Prus - - Allow a code breakpoint to have several locations - associated with it. - * breakpoint.h (enum enable_state): Remove the - bp_shlib_disabled enumerator. - (struct bp_location): New members shlib_disabled, - global_next, enabled and function_name. - Rename pending to condition_not_parsed. - - * breakpoint.c (ALL_BP_LOCATIONS): Iterate over global_next. - (ALL_BP_LOCATIONS_SAFE): Likewise. - (breakpoint_enabled): Don't check for pending. - (condition_command): Free and update all locations of - a breakpoint. - (insert_bp_location): Adjust. - (software_breakpoint_inserted_here_p): Don't care - if breakpoint is enabled, as soon as it's inserted. - (print_it_typical): Print bpstat's location, not - bpstat's breakpoint's location. - (bpstat_stop_status): Iterate over all locations, not - all breakpoints. - (print_breakpoint_location): New. - (print_one_breakpoint): Renamed to - (print_one_breakpoint_location): ...this. Take - parameters to describe which location is being - printed. Modify code to properly print header - for several locations and individual locations. - (print_one_breakpoint): Print all locations. - (breakpoint_has_pc): New. - (describe_other_breakpoints): Use the above. - (check_duplicates): Renamed to... - (check_duplicates_for): .. this. - (check_duplicates): Use check_duplicates_for. - (allocate_bp_location): Adjust. - (set_raw_breakpoint_without_location): New, - extracted from set_raw_breakpoint. - (set_breakpoint_location_function): New. - (set_raw_breakpoint): Use - set_raw_breakpoint_without_location. - (make_breakpoint_permanent): Mark all locations - as inserted. - (disable_breakpoints_in_shlibs): Iterate over - locations. - (disable_breakpoints_in_unloaded_shlib): Likewise. - (re_enable_breakpoints_in_shlibs): Likewise. - (mention): Say "pending" when breakpoint has - zero locations. If breakpoint has more than one - location, say so. - (add_location_to_breakpoint): New. - (create_breakpoint): Accept symtabs_and_lines, not - symtab_and_line. Pass extra sals to - add_location_to_breakpoint. - (create_breakpoints): Pass symtabs_and_lines to - create_breakpoints. - (break_command_1): Make pending breakpoints - have zero locations. - (do_captured_breakpoint): Remove wrong allocation. - (clear_command): Iterate over all locations. - (unlink_locations_from_global_list): Renamed - from unlink_location_from_global_list. Remove - all locations. - (delete_breakpoint): Remove all locations. - Iterate over all locations when deciding which - other location to re-enable. - (all_locations_are_pending): New. - (update_breakpoint_locations): Renamed from - update_breakpoint_location. Try to match old - and new locations using names of containing - functions. - (breakpoint_re_set_one): Adjust. - (find_location_by_number): New. - (disable_command): Allow disabling individual location. - (enable_command): Allow enabling individual location. - * breakpoint.c: Adjust all uses of breakpoint's - enable state to for bp_shlib_disabled change. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.267 -retrieving revision 1.268 -diff -u -r1.267 -r1.268 ---- src/gdb/breakpoint.c 2007/09/22 19:33:31 1.267 -+++ src/gdb/breakpoint.c 2007/09/23 07:56:22 1.268 -@@ -275,11 +275,11 @@ - - /* Similar iterators for the low-level breakpoints. */ - --#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->next) -+#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->global_next) - - #define ALL_BP_LOCATIONS_SAFE(B,TMP) \ - for (B = bp_location_chain; \ -- B ? (TMP=B->next, 1): 0; \ -+ B ? (TMP=B->global_next, 1): 0; \ - B = TMP) - - /* True if breakpoint hit counts should be displayed in breakpoint info. */ -@@ -356,7 +356,7 @@ - static int - breakpoint_enabled (struct breakpoint *b) - { -- return (b->enable_state == bp_enabled && !b->pending); -+ return (b->enable_state == bp_enabled); - } - - /* Set breakpoint count to NUM. */ -@@ -572,10 +572,13 @@ - if (b->number == bnum) - { - struct bp_location *loc = b->loc; -- if (loc->cond) -+ for (; loc; loc = loc->next) - { -- xfree (loc->cond); -- loc->cond = 0; -+ if (loc->cond) -+ { -+ xfree (loc->cond); -+ loc->cond = 0; -+ } - } - if (b->cond_string != NULL) - xfree (b->cond_string); -@@ -592,10 +595,11 @@ - /* I don't know if it matters whether this is the string the user - typed in or the decompiled expression. */ - b->cond_string = savestring (arg, strlen (arg)); -- if (!b->pending) -+ b->condition_not_parsed = 0; -+ for (loc = b->loc; loc; loc = loc->next) - { -- b->loc->cond = parse_exp_1 (&arg, -- block_for_pc (b->loc->address), 0); -+ arg = p; -+ loc->cond = parse_exp_1 (&arg, block_for_pc (loc->address), 0); - if (*arg) - error (_("Junk at end of expression")); - } -@@ -846,7 +850,7 @@ - if (!breakpoint_enabled (bpt->owner)) - return 0; - -- if (bpt->inserted || bpt->duplicate) -+ if (!bpt->enabled || bpt->shlib_disabled || bpt->inserted || bpt->duplicate) - return 0; - - /* Initialize the target-specific information. */ -@@ -969,7 +973,7 @@ - { - /* See also: disable_breakpoints_in_shlibs. */ - val = 0; -- bpt->owner->enable_state = bp_shlib_disabled; -+ bpt->shlib_disabled = 1; - if (!*disabled_breaks) - { - fprintf_unfiltered (tmp_error_stream, -@@ -1808,9 +1812,7 @@ - if (bpt->loc_type != bp_loc_software_breakpoint) - continue; - -- if ((breakpoint_enabled (bpt->owner) -- || bpt->owner->enable_state == bp_permanent) -- && bpt->inserted -+ if (bpt->inserted - && bpt->address == pc) /* bp is enabled and matches pc */ - { - if (overlay_debugging -@@ -2160,6 +2162,7 @@ - { - struct cleanup *old_chain, *ui_out_chain; - struct breakpoint *b; -+ struct bp_location *bl; - struct ui_stream *stb; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); -@@ -2167,15 +2170,16 @@ - which has since been deleted. */ - if (bs->breakpoint_at == NULL) - return PRINT_UNKNOWN; -- b = bs->breakpoint_at->owner; -+ bl = bs->breakpoint_at; -+ b = bl->owner; - - switch (b->type) - { - case bp_breakpoint: - case bp_hardware_breakpoint: -- if (b->loc->address != b->loc->requested_address) -- breakpoint_adjustment_warning (b->loc->requested_address, -- b->loc->address, -+ if (bl->address != bl->requested_address) -+ breakpoint_adjustment_warning (bl->requested_address, -+ bl->address, - b->number, 1); - annotate_breakpoint (b->number); - ui_out_text (uiout, "\nBreakpoint "); -@@ -2672,7 +2676,8 @@ - bpstat - bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint) - { -- struct breakpoint *b, *temp; -+ struct breakpoint *b = NULL; -+ struct bp_location *bl; - /* True if we've hit a breakpoint (as opposed to a watchpoint). */ - int real_breakpoint = 0; - /* Root of the chain of bpstat's */ -@@ -2681,8 +2686,10 @@ - bpstat bs = root_bs; - int thread_id = pid_to_thread_id (ptid); - -- ALL_BREAKPOINTS_SAFE (b, temp) -+ ALL_BP_LOCATIONS (bl) - { -+ b = bl->owner; -+ gdb_assert (b); - if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) - continue; - -@@ -2697,11 +2704,11 @@ - && b->type != bp_catch_catch - && b->type != bp_catch_throw) /* a non-watchpoint bp */ - { -- if (b->loc->address != bp_addr) /* address doesn't match */ -+ if (bl->address != bp_addr) /* address doesn't match */ - continue; - if (overlay_debugging /* unmapped overlay section */ -- && section_is_overlay (b->loc->section) -- && !section_is_mapped (b->loc->section)) -+ && section_is_overlay (bl->section) -+ && !section_is_mapped (bl->section)) - continue; - } - -@@ -2719,11 +2726,11 @@ - - if (b->type == bp_hardware_breakpoint) - { -- if (b->loc->address != bp_addr) -+ if (bl->address != bp_addr) - continue; - if (overlay_debugging /* unmapped overlay section */ -- && section_is_overlay (b->loc->section) -- && !section_is_mapped (b->loc->section)) -+ && section_is_overlay (bl->section) -+ && !section_is_mapped (bl->section)) - continue; - } - -@@ -2774,7 +2781,7 @@ - - /* Come here if it's a watchpoint, or if the break address matches */ - -- bs = bpstat_alloc (b->loc, bs); /* Alloc a bpstat to explain stop */ -+ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ - - /* Watchpoints may change this, if not found to have triggered. */ - bs->stop = 1; -@@ -2926,19 +2933,19 @@ - { - int value_is_zero = 0; - -- if (b->loc->cond) -+ if (bl->cond) - { - /* Need to select the frame, with all that implies - so that the conditions will have the right context. */ - select_frame (get_current_frame ()); - value_is_zero -- = catch_errors (breakpoint_cond_eval, (b->loc->cond), -+ = catch_errors (breakpoint_cond_eval, (bl->cond), - "Error in testing breakpoint condition:\n", - RETURN_MASK_ALL); - /* FIXME-someday, should give breakpoint # */ - free_all_values (); - } -- if (b->loc->cond && value_is_zero) -+ if (bl->cond && value_is_zero) - { - bs->stop = 0; - /* Don't consider this a hit. */ -@@ -2985,9 +2992,9 @@ - /* The value of a hardware watchpoint hasn't changed, but the - intermediate memory locations we are watching may have. */ - if (bs && !bs->stop && -- (bs->breakpoint_at->owner->type == bp_hardware_watchpoint || -- bs->breakpoint_at->owner->type == bp_read_watchpoint || -- bs->breakpoint_at->owner->type == bp_access_watchpoint)) -+ (b->type == bp_hardware_watchpoint || -+ b->type == bp_read_watchpoint || -+ b->type == bp_access_watchpoint)) - { - remove_breakpoints (); - insert_breakpoints (); -@@ -3349,10 +3356,54 @@ - *cp_list = bs; - } - -+static void print_breakpoint_location (struct breakpoint *b, -+ struct bp_location *loc, -+ char *wrap_indent, -+ struct ui_stream *stb) -+{ -+ if (b->source_file) -+ { -+ struct symbol *sym -+ = find_pc_sect_function (loc->address, loc->section); -+ if (sym) -+ { -+ ui_out_text (uiout, "in "); -+ ui_out_field_string (uiout, "func", -+ SYMBOL_PRINT_NAME (sym)); -+ ui_out_wrap_hint (uiout, wrap_indent); -+ ui_out_text (uiout, " at "); -+ } -+ ui_out_field_string (uiout, "file", b->source_file); -+ ui_out_text (uiout, ":"); -+ -+ if (ui_out_is_mi_like_p (uiout)) -+ { -+ struct symtab_and_line sal = find_pc_line (loc->address, 0); -+ char *fullname = symtab_to_fullname (sal.symtab); -+ -+ if (fullname) -+ ui_out_field_string (uiout, "fullname", fullname); -+ } -+ -+ ui_out_field_int (uiout, "line", b->line_number); -+ } -+ else if (!b->loc) -+ { -+ ui_out_field_string (uiout, "pending", b->addr_string); -+ } -+ else -+ { -+ print_address_symbolic (loc->address, stb->stream, demangle, ""); -+ ui_out_field_stream (uiout, "at", stb); -+ } -+} -+ - /* Print B to gdb_stdout. */ - static void --print_one_breakpoint (struct breakpoint *b, -- CORE_ADDR *last_addr) -+print_one_breakpoint_location (struct breakpoint *b, -+ struct bp_location *loc, -+ int loc_number, -+ CORE_ADDR *last_addr) - { - struct command_line *l; - struct symbol *sym; -@@ -3397,30 +3448,80 @@ - struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb); - struct cleanup *bkpt_chain; - -+ int header_of_multiple = 0; -+ int part_of_multiple = (loc != NULL); -+ -+ gdb_assert (!loc || loc_number != 0); -+ /* See comment in print_one_breakpoint concerning -+ treatment of breakpoints with single disabled -+ location. */ -+ if (loc == NULL -+ && (b->loc != NULL -+ && (b->loc->next != NULL || !b->loc->enabled))) -+ header_of_multiple = 1; -+ if (loc == NULL) -+ loc = b->loc; -+ - annotate_record (); - bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt"); - - /* 1 */ - annotate_field (0); -- ui_out_field_int (uiout, "number", b->number); -+ if (part_of_multiple) -+ { -+ char *formatted; -+ asprintf (&formatted, "%d.%d", b->number, loc_number); -+ ui_out_field_string (uiout, "number", formatted); -+ xfree (formatted); -+ } -+ else -+ { -+ ui_out_field_int (uiout, "number", b->number); -+ } - - /* 2 */ - annotate_field (1); -- if (((int) b->type >= (sizeof (bptypes) / sizeof (bptypes[0]))) -- || ((int) b->type != bptypes[(int) b->type].type)) -- internal_error (__FILE__, __LINE__, -- _("bptypes table does not describe type #%d."), -- (int) b->type); -- ui_out_field_string (uiout, "type", bptypes[(int) b->type].description); -+ if (part_of_multiple) -+ ui_out_field_skip (uiout, "type"); -+ else -+ { -+ if (((int) b->type >= (sizeof (bptypes) / sizeof (bptypes[0]))) -+ || ((int) b->type != bptypes[(int) b->type].type)) -+ internal_error (__FILE__, __LINE__, -+ _("bptypes table does not describe type #%d."), -+ (int) b->type); -+ ui_out_field_string (uiout, "type", bptypes[(int) b->type].description); -+ } - - /* 3 */ - annotate_field (2); -- ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); -+ if (part_of_multiple) -+ ui_out_field_skip (uiout, "disp"); -+ else -+ ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); -+ - - /* 4 */ - annotate_field (3); -- ui_out_field_fmt (uiout, "enabled", "%c", bpenables[(int) b->enable_state]); -- ui_out_spaces (uiout, 2); -+ if (part_of_multiple) -+ ui_out_field_string (uiout, "enabled", -+ loc->shlib_disabled -+ ? (loc->enabled ? "y(p)" : "n(p)") -+ : (loc->enabled ? "y" : "n")); -+ else -+ { -+ int pending = (b->loc == NULL || b->loc->shlib_disabled); -+ /* For header of multiple, there's no point showing pending -+ state -- it will be apparent from the locations. */ -+ if (header_of_multiple) -+ pending = 0; -+ ui_out_field_fmt (uiout, "enabled", "%c%s", -+ bpenables[(int) b->enable_state], -+ pending ? "(p)" : ""); -+ if (!pending) -+ ui_out_spaces (uiout, 3); -+ } -+ - - /* 5 and 6 */ - strcpy (wrap_indent, " "); -@@ -3433,7 +3534,14 @@ - } - - if (b->ops != NULL && b->ops->print_one != NULL) -- b->ops->print_one (b, last_addr); -+ { -+ /* Although the print_one can possibly print -+ all locations, calling it here is not likely -+ to get any nice result. So, make sure there's -+ just one location. */ -+ gdb_assert (b->loc == NULL || b->loc->next == NULL); -+ b->ops->print_one (b, last_addr); -+ } - else - switch (b->type) - { -@@ -3545,51 +3653,22 @@ - if (addressprint) - { - annotate_field (4); -- if (b->pending) -+ if (b->loc == NULL) - ui_out_field_string (uiout, "addr", ""); -+ else if (header_of_multiple) -+ ui_out_field_string (uiout, "addr", ""); - else -- ui_out_field_core_addr (uiout, "addr", b->loc->address); -+ ui_out_field_core_addr (uiout, "addr", loc->address); - } - annotate_field (5); -- *last_addr = b->loc->address; -- if (b->source_file) -- { -- sym = find_pc_sect_function (b->loc->address, b->loc->section); -- if (sym) -- { -- ui_out_text (uiout, "in "); -- ui_out_field_string (uiout, "func", -- SYMBOL_PRINT_NAME (sym)); -- ui_out_wrap_hint (uiout, wrap_indent); -- ui_out_text (uiout, " at "); -- } -- ui_out_field_string (uiout, "file", b->source_file); -- ui_out_text (uiout, ":"); -- -- if (ui_out_is_mi_like_p (uiout)) -- { -- struct symtab_and_line sal = find_pc_line (b->loc->address, 0); -- char *fullname = symtab_to_fullname (sal.symtab); -- -- if (fullname) -- ui_out_field_string (uiout, "fullname", fullname); -- } -- -- ui_out_field_int (uiout, "line", b->line_number); -- } -- else if (b->pending) -- { -- ui_out_field_string (uiout, "pending", b->addr_string); -- } -- else -- { -- print_address_symbolic (b->loc->address, stb->stream, demangle, ""); -- ui_out_field_stream (uiout, "at", stb); -- } -+ if (!header_of_multiple) -+ print_breakpoint_location (b, loc, wrap_indent, stb); -+ if (b->loc) -+ *last_addr = b->loc->address; - break; - } - -- if (b->thread != -1) -+ if (!part_of_multiple && b->thread != -1) - { - /* FIXME: This seems to be redundant and lost here; see the - "stop only in" line a little further down. */ -@@ -3599,7 +3678,7 @@ - - ui_out_text (uiout, "\n"); - -- if (frame_id_p (b->frame_id)) -+ if (part_of_multiple && frame_id_p (b->frame_id)) - { - annotate_field (6); - ui_out_text (uiout, "\tstop only in stack frame at "); -@@ -3609,27 +3688,18 @@ - ui_out_text (uiout, "\n"); - } - -- if (b->loc->cond && !ada_exception_catchpoint_p (b)) -+ if (!part_of_multiple && b->cond_string && !ada_exception_catchpoint_p (b)) - { - /* We do not print the condition for Ada exception catchpoints - because the condition is an internal implementation detail - that we do not want to expose to the user. */ - annotate_field (7); - ui_out_text (uiout, "\tstop only if "); -- print_expression (b->loc->cond, stb->stream); -- ui_out_field_stream (uiout, "cond", stb); -- ui_out_text (uiout, "\n"); -- } -- -- if (b->pending && b->cond_string) -- { -- annotate_field (7); -- ui_out_text (uiout, "\tstop only if "); - ui_out_field_string (uiout, "cond", b->cond_string); - ui_out_text (uiout, "\n"); - } - -- if (b->thread != -1) -+ if (!part_of_multiple && b->thread != -1) - { - /* FIXME should make an annotation for this */ - ui_out_text (uiout, "\tstop only in thread "); -@@ -3637,7 +3707,7 @@ - ui_out_text (uiout, "\n"); - } - -- if (show_breakpoint_hit_counts && b->hit_count) -+ if (!part_of_multiple && show_breakpoint_hit_counts && b->hit_count) - { - /* FIXME should make an annotation for this */ - if (ep_is_catchpoint (b)) -@@ -3655,10 +3725,10 @@ - /* Output the count also if it is zero, but only if this is - mi. FIXME: Should have a better test for this. */ - if (ui_out_is_mi_like_p (uiout)) -- if (show_breakpoint_hit_counts && b->hit_count == 0) -+ if (!part_of_multiple && show_breakpoint_hit_counts && b->hit_count == 0) - ui_out_field_int (uiout, "times", b->hit_count); - -- if (b->ignore_count) -+ if (!part_of_multiple && b->ignore_count) - { - annotate_field (8); - ui_out_text (uiout, "\tignore next "); -@@ -3666,7 +3736,7 @@ - ui_out_text (uiout, " hits\n"); - } - -- if ((l = b->commands)) -+ if (!part_of_multiple && (l = b->commands)) - { - struct cleanup *script_chain; - -@@ -3679,6 +3749,35 @@ - do_cleanups (old_chain); - } - -+static void -+print_one_breakpoint (struct breakpoint *b, -+ CORE_ADDR *last_addr) -+{ -+ print_one_breakpoint_location (b, NULL, 0, last_addr); -+ -+ /* If this breakpoint has custom print function, -+ it's already printed. Otherwise, print individual -+ locations, if any. */ -+ if (b->ops == NULL || b->ops->print_one == NULL) -+ { -+ /* If breakpoint has a single location that is -+ disabled, we print it as if it had -+ several locations, since otherwise it's hard to -+ represent "breakpoint enabled, location disabled" -+ situation. */ -+ if (b->loc -+ && (b->loc->next || !b->loc->enabled) -+ && !ui_out_is_mi_like_p (uiout)) -+ { -+ struct bp_location *loc; -+ int n = 1; -+ for (loc = b->loc; loc; loc = loc->next, ++n) -+ print_one_breakpoint_location (b, loc, n, last_addr); -+ } -+ } -+} -+ -+ - struct captured_breakpoint_query_args - { - int bnum; -@@ -3771,7 +3870,7 @@ - annotate_breakpoints_headers (); - if (nr_printable_breakpoints > 0) - annotate_field (0); -- ui_out_table_header (uiout, 3, ui_left, "number", "Num"); /* 1 */ -+ ui_out_table_header (uiout, 7, ui_left, "number", "Num"); /* 1 */ - if (nr_printable_breakpoints > 0) - annotate_field (1); - ui_out_table_header (uiout, 14, ui_left, "type", "Type"); /* 2 */ -@@ -3780,7 +3879,7 @@ - ui_out_table_header (uiout, 4, ui_left, "disp", "Disp"); /* 3 */ - if (nr_printable_breakpoints > 0) - annotate_field (3); -- ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */ -+ ui_out_table_header (uiout, 4, ui_left, "enabled", "Enb"); /* 4 */ - if (addressprint) - { - if (nr_printable_breakpoints > 0) -@@ -3852,6 +3951,19 @@ - breakpoint_1 (bnum, 1); - } - -+static int -+breakpoint_has_pc (struct breakpoint *b, CORE_ADDR pc, asection *section) -+{ -+ struct bp_location *bl = b->loc; -+ for (; bl; bl = bl->next) -+ { -+ if (bl->address == pc -+ && (!overlay_debugging || bl->section == section)) -+ return 1; -+ } -+ return 0; -+} -+ - /* Print a message describing any breakpoints set at PC. */ - - static void -@@ -3861,9 +3973,7 @@ - struct breakpoint *b; - - ALL_BREAKPOINTS (b) -- if (b->loc->address == pc) /* address match / overlay match */ -- if (!b->pending && (!overlay_debugging || b->loc->section == section)) -- others++; -+ others += breakpoint_has_pc (b, pc, section); - if (others > 0) - { - if (others == 1) -@@ -3871,26 +3981,24 @@ - else /* if (others == ???) */ - printf_filtered (_("Note: breakpoints ")); - ALL_BREAKPOINTS (b) -- if (b->loc->address == pc) /* address match / overlay match */ -- if (!b->pending && (!overlay_debugging || b->loc->section == section)) -- { -- others--; -- printf_filtered ("%d", b->number); -- if (b->thread == -1 && thread != -1) -- printf_filtered (" (all threads)"); -- else if (b->thread != -1) -- printf_filtered (" (thread %d)", b->thread); -- printf_filtered ("%s%s ", -- ((b->enable_state == bp_disabled || -- b->enable_state == bp_shlib_disabled || -- b->enable_state == bp_call_disabled) -- ? " (disabled)" -- : b->enable_state == bp_permanent -- ? " (permanent)" -- : ""), -- (others > 1) ? "," -- : ((others == 1) ? " and" : "")); -- } -+ if (breakpoint_has_pc (b, pc, section)) -+ { -+ others--; -+ printf_filtered ("%d", b->number); -+ if (b->thread == -1 && thread != -1) -+ printf_filtered (" (all threads)"); -+ else if (b->thread != -1) -+ printf_filtered (" (thread %d)", b->thread); -+ printf_filtered ("%s%s ", -+ ((b->enable_state == bp_disabled || -+ b->enable_state == bp_call_disabled) -+ ? " (disabled)" -+ : b->enable_state == bp_permanent -+ ? " (permanent)" -+ : ""), -+ (others > 1) ? "," -+ : ((others == 1) ? " and" : "")); -+ } - printf_filtered (_("also set at pc ")); - deprecated_print_address_numeric (pc, 1, gdb_stdout); - printf_filtered (".\n"); -@@ -3951,22 +4059,17 @@ - that one the official one, and the rest as duplicates. */ - - static void --check_duplicates (struct breakpoint *bpt) -+check_duplicates_for (CORE_ADDR address, asection *section) - { - struct bp_location *b; - int count = 0; - struct bp_location *perm_bp = 0; -- CORE_ADDR address = bpt->loc->address; -- asection *section = bpt->loc->section; -- -- if (! breakpoint_address_is_meaningful (bpt)) -- return; - - ALL_BP_LOCATIONS (b) - if (b->owner->enable_state != bp_disabled -- && b->owner->enable_state != bp_shlib_disabled -- && !b->owner->pending - && b->owner->enable_state != bp_call_disabled -+ && b->enabled -+ && !b->shlib_disabled - && b->address == address /* address / overlay match */ - && (!overlay_debugging || b->section == section) - && breakpoint_address_is_meaningful (b->owner)) -@@ -3999,9 +4102,8 @@ - if (b != perm_bp) - { - if (b->owner->enable_state != bp_disabled -- && b->owner->enable_state != bp_shlib_disabled -- && !b->owner->pending - && b->owner->enable_state != bp_call_disabled -+ && b->enabled && !b->shlib_disabled - && b->address == address /* address / overlay match */ - && (!overlay_debugging || b->section == section) - && breakpoint_address_is_meaningful (b->owner)) -@@ -4018,6 +4120,18 @@ - } - - static void -+check_duplicates (struct breakpoint *bpt) -+{ -+ struct bp_location *bl = bpt->loc; -+ -+ if (! breakpoint_address_is_meaningful (bpt)) -+ return; -+ -+ for (; bl; bl = bl->next) -+ check_duplicates_for (bl->address, bl->section); -+} -+ -+static void - breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, - int bnum, int have_bnum) - { -@@ -4089,6 +4203,8 @@ - - loc->owner = bpt; - loc->cond = NULL; -+ loc->shlib_disabled = 0; -+ loc->enabled = 1; - - switch (bp_type) - { -@@ -4134,9 +4250,9 @@ - bp_location_chain = loc; - else - { -- while (loc_p->next) -- loc_p = loc_p->next; -- loc_p->next = loc; -+ while (loc_p->global_next) -+ loc_p = loc_p->global_next; -+ loc_p->global_next = loc; - } - - return loc; -@@ -4149,53 +4265,21 @@ - xfree (loc); - } - --/* set_raw_breakpoint() is a low level routine for allocating and -- partially initializing a breakpoint of type BPTYPE. The newly -- created breakpoint's address, section, source file name, and line -- number are provided by SAL. The newly created and partially -- initialized breakpoint is added to the breakpoint chain and -- is also returned as the value of this function. -- -- It is expected that the caller will complete the initialization of -- the newly created breakpoint struct as well as output any status -- information regarding the creation of a new breakpoint. In -- particular, set_raw_breakpoint() does NOT set the breakpoint -- number! Care should be taken to not allow an error() to occur -- prior to completing the initialization of the breakpoint. If this -- should happen, a bogus breakpoint will be left on the chain. */ -+/* Helper to set_raw_breakpoint below. Creates a breakpoint -+ that has type BPTYPE and has no locations as yet. */ - - struct breakpoint * --set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) -+set_raw_breakpoint_without_location (enum bptype bptype) - { - struct breakpoint *b, *b1; -- CORE_ADDR adjusted_address; - - b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint)); - memset (b, 0, sizeof (*b)); - -- /* Adjust the breakpoint's address prior to allocating a location. -- Once we call allocate_bp_location(), that mostly uninitialized -- location will be placed on the location chain. Adjustment of the -- breakpoint may cause read_memory_nobpt() to be called and we do -- not want its scan of the location chain to find a breakpoint and -- location that's only been partially initialized. */ -- adjusted_address = adjust_breakpoint_address (sal.pc, bptype); -- -- b->loc = allocate_bp_location (b, bptype); -- b->loc->requested_address = sal.pc; -- b->loc->address = adjusted_address; -- -- if (sal.symtab == NULL) -- b->source_file = NULL; -- else -- b->source_file = savestring (sal.symtab->filename, -- strlen (sal.symtab->filename)); -- b->loc->section = sal.section; - b->type = bptype; - b->language = current_language->la_language; - b->input_radix = input_radix; - b->thread = -1; -- b->line_number = sal.line; - b->enable_state = bp_enabled; - b->next = 0; - b->silent = 0; -@@ -4207,7 +4291,7 @@ - b->forked_inferior_pid = 0; - b->exec_pathname = NULL; - b->ops = NULL; -- b->pending = 0; -+ b->condition_not_parsed = 0; - - /* Add this breakpoint to the end of the chain - so that a list of breakpoints will come out in order -@@ -4222,6 +4306,65 @@ - b1 = b1->next; - b1->next = b; - } -+ return b; -+} -+ -+/* Initialize loc->function_name. */ -+static void -+set_breakpoint_location_function (struct bp_location *loc) -+{ -+ if (loc->owner->type == bp_breakpoint -+ || loc->owner->type == bp_hardware_breakpoint) -+ { -+ find_pc_partial_function (loc->address, &(loc->function_name), -+ NULL, NULL); -+ if (loc->function_name) -+ loc->function_name = xstrdup (loc->function_name); -+ } -+} -+ -+/* set_raw_breakpoint is a low level routine for allocating and -+ partially initializing a breakpoint of type BPTYPE. The newly -+ created breakpoint's address, section, source file name, and line -+ number are provided by SAL. The newly created and partially -+ initialized breakpoint is added to the breakpoint chain and -+ is also returned as the value of this function. -+ -+ It is expected that the caller will complete the initialization of -+ the newly created breakpoint struct as well as output any status -+ information regarding the creation of a new breakpoint. In -+ particular, set_raw_breakpoint does NOT set the breakpoint -+ number! Care should be taken to not allow an error to occur -+ prior to completing the initialization of the breakpoint. If this -+ should happen, a bogus breakpoint will be left on the chain. */ -+ -+struct breakpoint * -+set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) -+{ -+ struct breakpoint *b = set_raw_breakpoint_without_location (bptype); -+ CORE_ADDR adjusted_address; -+ -+ /* Adjust the breakpoint's address prior to allocating a location. -+ Once we call allocate_bp_location(), that mostly uninitialized -+ location will be placed on the location chain. Adjustment of the -+ breakpoint may cause read_memory_nobpt() to be called and we do -+ not want its scan of the location chain to find a breakpoint and -+ location that's only been partially initialized. */ -+ adjusted_address = adjust_breakpoint_address (sal.pc, bptype); -+ -+ b->loc = allocate_bp_location (b, bptype); -+ b->loc->requested_address = sal.pc; -+ b->loc->address = adjusted_address; -+ -+ if (sal.symtab == NULL) -+ b->source_file = NULL; -+ else -+ b->source_file = savestring (sal.symtab->filename, -+ strlen (sal.symtab->filename)); -+ b->loc->section = sal.section; -+ b->line_number = sal.line; -+ -+ set_breakpoint_location_function (b->loc); - - check_duplicates (b); - breakpoints_changed (); -@@ -4235,10 +4378,16 @@ - void - make_breakpoint_permanent (struct breakpoint *b) - { -+ struct bp_location *bl; - b->enable_state = bp_permanent; - -- /* By definition, permanent breakpoints are already present in the code. */ -- b->loc->inserted = 1; -+ /* By definition, permanent breakpoints are already present in the code. -+ Mark all locations as inserted. For now, make_breakpoint_permanent -+ is called in just one place, so it's hard to say if it's reasonable -+ to have permanent breakpoint with multiple locations or not, -+ but it's easy to implmement. */ -+ for (bl = b->loc; bl; bl = bl->next) -+ bl->inserted = 1; - } - - static struct breakpoint * -@@ -4431,20 +4580,28 @@ - void - disable_breakpoints_in_shlibs (void) - { -- struct breakpoint *b; -+ struct bp_location *loc; - int disabled_shlib_breaks = 0; - -- ALL_BREAKPOINTS (b) -+ ALL_BP_LOCATIONS (loc) - { -+ struct breakpoint *b = loc->owner; -+ /* We apply the check to all breakpoints, including disabled -+ for those with loc->duplicate set. This is so that when breakpoint -+ becomes enabled, or the duplicate is removed, gdb will try to insert -+ all breakpoints. If we don't set shlib_disabled here, we'll try -+ to insert those breakpoints and fail. */ - if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint)) -- && breakpoint_enabled (b) && !b->loc->duplicate -+ && !loc->shlib_disabled - #ifdef PC_SOLIB -- && PC_SOLIB (b->loc->address) -+ && PC_SOLIB (loc->address) - #else -- && solib_address (b->loc->address) -+ && solib_address (loc->address) - #endif - ) -- b->enable_state = bp_shlib_disabled; -+ { -+ loc->shlib_disabled = 1; -+ } - } - } - -@@ -4454,27 +4611,28 @@ - void - disable_breakpoints_in_unloaded_shlib (struct so_list *solib) - { -- struct breakpoint *b; -+ struct bp_location *loc; - int disabled_shlib_breaks = 0; - -- ALL_BREAKPOINTS (b) -+ ALL_BP_LOCATIONS (loc) - { -- if ((b->loc->loc_type == bp_loc_hardware_breakpoint -- || b->loc->loc_type == bp_loc_software_breakpoint) -- && breakpoint_enabled (b) && !b->loc->duplicate) -+ struct breakpoint *b = loc->owner; -+ if ((loc->loc_type == bp_loc_hardware_breakpoint -+ || loc->loc_type == bp_loc_software_breakpoint) -+ && !loc->shlib_disabled) - { - #ifdef PC_SOLIB -- char *so_name = PC_SOLIB (b->loc->address); -+ char *so_name = PC_SOLIB (loc->address); - #else -- char *so_name = solib_address (b->loc->address); -+ char *so_name = solib_address (loc->address); - #endif - if (so_name && !strcmp (so_name, solib->so_name)) - { -- b->enable_state = bp_shlib_disabled; -+ loc->shlib_disabled = 1; - /* At this point, we cannot rely on remove_breakpoint - succeeding so we must mark the breakpoint as not inserted - to prevent future errors occurring in remove_breakpoints. */ -- b->loc->inserted = 0; -+ loc->inserted = 0; - if (!disabled_shlib_breaks) - { - target_terminal_ours_for_output (); -@@ -4894,7 +5052,7 @@ - { - /* i18n: cagney/2005-02-11: Below needs to be merged into a - single string. */ -- if (b->pending) -+ if (b->loc == NULL) - { - printf_filtered (_(" (%s) pending."), b->addr_string); - } -@@ -4908,6 +5066,16 @@ - if (b->source_file) - printf_filtered (": file %s, line %d.", - b->source_file, b->line_number); -+ -+ if (b->loc->next) -+ { -+ struct bp_location *loc = b->loc; -+ int n = 0; -+ for (; loc; loc = loc->next) -+ ++n; -+ printf_filtered (" (%d locations)", n); -+ } -+ - } - } - do_cleanups (old_chain); -@@ -4917,6 +5085,24 @@ - } - - -+static struct bp_location * -+add_location_to_breakpoint (struct breakpoint *b, enum bptype bptype, -+ const struct symtab_and_line *sal) -+{ -+ struct bp_location *loc, **tmp; -+ -+ loc = allocate_bp_location (b, bptype); -+ for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) -+ ; -+ *tmp = loc; -+ loc->requested_address = sal->pc; -+ loc->address = adjust_breakpoint_address (loc->requested_address, -+ bptype); -+ loc->section = sal->section; -+ -+ set_breakpoint_location_function (loc); -+ return loc; -+} - - /* Create a breakpoint with SAL as location. Use ADDR_STRING - as textual description of the location, and COND_STRING -@@ -4926,13 +5112,14 @@ - create_breakpoints function. */ - - static void --create_breakpoint (struct symtab_and_line sal, char *addr_string, -+create_breakpoint (struct symtabs_and_lines sals, char *addr_string, - char *cond_string, - enum bptype type, enum bpdisp disposition, - int thread, int ignore_count, int from_tty, - struct breakpoint *pending_bp) - { -- struct breakpoint *b; -+ struct breakpoint *b = NULL; -+ int i; - - if (type == bp_hardware_breakpoint) - { -@@ -4946,50 +5133,46 @@ - error (_("Hardware breakpoints used exceeds limit.")); - } - -- if (from_tty) -- describe_other_breakpoints (sal.pc, sal.section, thread); -- -- b = set_raw_breakpoint (sal, type); -- set_breakpoint_count (breakpoint_count + 1); -- b->number = breakpoint_count; -- b->thread = thread; -+ for (i = 0; i < sals.nelts; ++i) -+ { -+ struct symtab_and_line sal = sals.sals[i]; -+ struct bp_location *loc; -+ -+ if (from_tty) -+ describe_other_breakpoints (sal.pc, sal.section, thread); -+ -+ if (i == 0) -+ { -+ b = set_raw_breakpoint (sal, type); -+ set_breakpoint_count (breakpoint_count + 1); -+ b->number = breakpoint_count; -+ b->thread = thread; - -- b->cond_string = cond_string; -- b->ignore_count = ignore_count; -- b->enable_state = bp_enabled; -- b->disposition = disposition; -- /* If resolving a pending breakpoint, a check must be made to see if -- the user has specified a new condition or commands for the -- breakpoint. A new condition will override any condition that was -- initially specified with the initial breakpoint command. */ -- if (pending_bp) -- { -- if (pending_bp->cond_string) -- b->cond_string = savestring (pending_bp->cond_string, -- strlen (pending_bp->cond_string)); -- -- /* If there are commands associated with the breakpoint, they should -- be copied too. */ -- if (pending_bp->commands) -- b->commands = copy_command_lines (pending_bp->commands); -- -- /* We have to copy over the ignore_count and thread as well. */ -- b->ignore_count = pending_bp->ignore_count; -- b->thread = pending_bp->thread; -- } -+ b->cond_string = cond_string; -+ b->ignore_count = ignore_count; -+ b->enable_state = bp_enabled; -+ b->disposition = disposition; - -- if (b->cond_string) -- { -- char *arg = b->cond_string; -- b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -- if (*arg) -+ loc = b->loc; -+ } -+ else - { -- if (pending_bp) -- error (_("Junk at end of pending breakpoint condition expression")); -- else -- error (_("Garbage %s follows condition"), arg); -+ loc = add_location_to_breakpoint (b, type, &sal); - } -- } -+ -+ if (b->cond_string) -+ { -+ char *arg = b->cond_string; -+ b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -+ if (*arg) -+ { -+ if (pending_bp) -+ error (_("Junk at end of pending breakpoint condition expression")); -+ else -+ error (_("Garbage %s follows condition"), arg); -+ } -+ } -+ } - - if (addr_string) - b->addr_string = addr_string; -@@ -5031,7 +5214,11 @@ - int i; - for (i = 0; i < sals.nelts; ++i) - { -- create_breakpoint (sals.sals[i], addr_string[i], -+ struct symtabs_and_lines sals2; -+ sals2.sals = sals.sals + i; -+ sals2.nelts = 1; -+ -+ create_breakpoint (sals2, addr_string[i], - cond_string, type, disposition, - thread, ignore_count, from_tty, - pending_bp); -@@ -5360,19 +5547,19 @@ - - make_cleanup (xfree, copy_arg); - -- b = set_raw_breakpoint (sal, hardwareflag ? bp_hardware_breakpoint -- : bp_breakpoint); -+ b = set_raw_breakpoint_without_location (hardwareflag -+ ? bp_hardware_breakpoint -+ : bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; -- b->loc->cond = NULL; - b->thread = thread; - b->addr_string = addr_string[0]; - b->cond_string = cond_string; - b->ignore_count = ignore_count; -- b->pending = 1; - b->disposition = tempflag ? disp_del : disp_donttouch; - b->from_tty = from_tty; - b->flag = flag; -+ b->condition_not_parsed = 1; - mention (b); - } - -@@ -5411,7 +5598,7 @@ - struct cleanup *breakpoint_chain = NULL; - int i; - char **addr_string; -- char *cond_string; -+ char *cond_string = 0; - - char *address_end; - -@@ -5440,10 +5627,6 @@ - cond = xcalloc (sals.nelts, sizeof (struct expression *)); - make_cleanup (xfree, cond); - -- /* Allocate space for all the cond strings. */ -- cond_string = xcalloc (sals.nelts, sizeof (char **)); -- make_cleanup (xfree, cond_string); -- - /* ----------------------------- SNIP ----------------------------- - Anything added to the cleanup chain beyond this point is assumed - to be part of a breakpoint. If the breakpoint create goes -@@ -6733,23 +6916,35 @@ - breakpoint chain, and add them to the 'found' chain. */ - ALL_BREAKPOINTS_SAFE (b, tmp) - { -+ int match = 0; - /* Are we going to delete b? */ - if (b->type != bp_none - && b->type != bp_watchpoint - && b->type != bp_hardware_watchpoint - && b->type != bp_read_watchpoint -- && b->type != bp_access_watchpoint -- /* Not if b is a watchpoint of any sort... */ -- && (((sal.pc && (b->loc->address == sal.pc)) -- && (!section_is_overlay (b->loc->section) -- || b->loc->section == sal.section)) -- /* Yes, if sal.pc matches b (modulo overlays). */ -- || ((default_match || (0 == sal.pc)) -- && b->source_file != NULL -- && sal.symtab != NULL -- && strcmp (b->source_file, sal.symtab->filename) == 0 -- && b->line_number == sal.line))) -- /* Yes, if sal source file and line matches b. */ -+ && b->type != bp_access_watchpoint) -+ { -+ struct bp_location *loc = b->loc; -+ for (; loc; loc = loc->next) -+ { -+ int pc_match = sal.pc -+ && (loc->address == sal.pc) -+ && (!section_is_overlay (loc->section) -+ || loc->section == sal.section); -+ int line_match = ((default_match || (0 == sal.pc)) -+ && b->source_file != NULL -+ && sal.symtab != NULL -+ && strcmp (b->source_file, sal.symtab->filename) == 0 -+ && b->line_number == sal.line); -+ if (pc_match || line_match) -+ { -+ match = 1; -+ break; -+ } -+ } -+ } -+ -+ if (match) - { - /* Remove it from breakpoint_chain... */ - if (b == breakpoint_chain) -@@ -6824,6 +7019,35 @@ - } - } - -+/* Remove locations of breakpoint BPT from -+ the global list of breakpoint locations. */ -+ -+static void -+unlink_locations_from_global_list (struct breakpoint *bpt) -+{ -+ /* This code assumes that the locations -+ of a breakpoint are found in the global list -+ in the same order, but not necessary adjacent. */ -+ struct bp_location **tmp = &bp_location_chain; -+ struct bp_location *here = bpt->loc; -+ -+ if (here == NULL) -+ return; -+ -+ for (; *tmp && here;) -+ { -+ if (*tmp == here) -+ { -+ *tmp = here->global_next; -+ here = here->next; -+ } -+ else -+ { -+ tmp = &((*tmp)->global_next); -+ } -+ } -+} -+ - /* Delete a breakpoint and clean up all traces of it in the data - structures. */ - -@@ -6856,17 +7080,23 @@ - deprecated_delete_breakpoint_hook (bpt); - breakpoint_delete_event (bpt->number); - -- if (bpt->loc->inserted) -- remove_breakpoint (bpt->loc, mark_inserted); -+ for (loc = bpt->loc; loc; loc = loc->next) -+ { -+ if (loc->inserted) -+ remove_breakpoint (loc, mark_inserted); -+ -+ free_valchain (loc); - -- free_valchain (bpt->loc); -+ if (loc->cond) -+ xfree (loc->cond); -+ -+ if (loc->function_name) -+ xfree (loc->function_name); -+ } - - if (breakpoint_chain == bpt) - breakpoint_chain = bpt->next; - -- if (bp_location_chain == bpt->loc) -- bp_location_chain = bpt->loc->next; -- - /* If we have callback-style exception catchpoints, don't go through - the adjustments to the C++ runtime library etc. if the inferior - isn't actually running. target_enable_exception_callback for a -@@ -6896,82 +7126,83 @@ - break; - } - -- ALL_BP_LOCATIONS (loc) -- if (loc->next == bpt->loc) -- { -- loc->next = bpt->loc->next; -- break; -- } -+ unlink_locations_from_global_list (bpt); - - check_duplicates (bpt); -- /* If this breakpoint was inserted, and there is another breakpoint -- at the same address, we need to insert the other breakpoint. */ -- if (bpt->loc->inserted -- && bpt->type != bp_hardware_watchpoint -+ -+ if (bpt->type != bp_hardware_watchpoint - && bpt->type != bp_read_watchpoint - && bpt->type != bp_access_watchpoint - && bpt->type != bp_catch_fork - && bpt->type != bp_catch_vfork - && bpt->type != bp_catch_exec) -- { -- ALL_BREAKPOINTS (b) -- if (b->loc->address == bpt->loc->address -- && b->loc->section == bpt->loc->section -- && !b->loc->duplicate -- && b->enable_state != bp_disabled -- && b->enable_state != bp_shlib_disabled -- && !b->pending -- && b->enable_state != bp_call_disabled) -- { -- int val; -- -- /* We should never reach this point if there is a permanent -- breakpoint at the same address as the one being deleted. -- If there is a permanent breakpoint somewhere, it should -- always be the only one inserted. */ -- if (b->enable_state == bp_permanent) -- internal_error (__FILE__, __LINE__, -- _("another breakpoint was inserted on top of " -- "a permanent breakpoint")); -- -- memset (&b->loc->target_info, 0, sizeof (b->loc->target_info)); -- b->loc->target_info.placed_address = b->loc->address; -- if (b->type == bp_hardware_breakpoint) -- val = target_insert_hw_breakpoint (&b->loc->target_info); -- else -- val = target_insert_breakpoint (&b->loc->target_info); -+ for (loc = bpt->loc; loc; loc = loc->next) -+ { -+ /* If this breakpoint location was inserted, and there is -+ another breakpoint at the same address, we need to -+ insert the other breakpoint. */ -+ if (loc->inserted) -+ { -+ struct bp_location *loc2; -+ ALL_BP_LOCATIONS (loc2) -+ if (loc2->address == loc->address -+ && loc2->section == loc->section -+ && !loc->duplicate -+ && loc2->owner->enable_state != bp_disabled -+ && loc2->enabled -+ && !loc2->shlib_disabled -+ && loc2->owner->enable_state != bp_call_disabled) -+ { -+ int val; - -- /* If there was an error in the insert, print a message, then stop execution. */ -- if (val != 0) -- { -- struct ui_file *tmp_error_stream = mem_fileopen (); -- make_cleanup_ui_file_delete (tmp_error_stream); -- -+ /* We should never reach this point if there is a permanent -+ breakpoint at the same address as the one being deleted. -+ If there is a permanent breakpoint somewhere, it should -+ always be the only one inserted. */ -+ if (loc2->owner->enable_state == bp_permanent) -+ internal_error (__FILE__, __LINE__, -+ _("another breakpoint was inserted on top of " -+ "a permanent breakpoint")); -+ -+ memset (&loc2->target_info, 0, sizeof (loc2->target_info)); -+ loc2->target_info.placed_address = loc2->address; -+ if (b->type == bp_hardware_breakpoint) -+ val = target_insert_hw_breakpoint (&loc2->target_info); -+ else -+ val = target_insert_breakpoint (&loc2->target_info); - -- if (b->type == bp_hardware_breakpoint) -- { -- fprintf_unfiltered (tmp_error_stream, -- "Cannot insert hardware breakpoint %d.\n" -- "You may have requested too many hardware breakpoints.\n", -- b->number); -- } -- else -- { -- fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number); -- fprintf_filtered (tmp_error_stream, "Error accessing memory address "); -- deprecated_print_address_numeric (b->loc->address, 1, tmp_error_stream); -- fprintf_filtered (tmp_error_stream, ": %s.\n", -- safe_strerror (val)); -- } -- -- fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process."); -- target_terminal_ours_for_output (); -- error_stream(tmp_error_stream); -- } -- else -- b->loc->inserted = 1; -- } -- } -+ /* If there was an error in the insert, print a message, then stop execution. */ -+ if (val != 0) -+ { -+ struct ui_file *tmp_error_stream = mem_fileopen (); -+ make_cleanup_ui_file_delete (tmp_error_stream); -+ -+ -+ if (b->type == bp_hardware_breakpoint) -+ { -+ fprintf_unfiltered (tmp_error_stream, -+ "Cannot insert hardware breakpoint %d.\n" -+ "You may have requested too many hardware breakpoints.\n", -+ b->number); -+ } -+ else -+ { -+ fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number); -+ fprintf_filtered (tmp_error_stream, "Error accessing memory address "); -+ deprecated_print_address_numeric (loc2->address, 1, tmp_error_stream); -+ fprintf_filtered (tmp_error_stream, ": %s.\n", -+ safe_strerror (val)); -+ } -+ -+ fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process."); -+ target_terminal_ours_for_output (); -+ error_stream(tmp_error_stream); -+ } -+ else -+ loc2->inserted = 1; -+ } -+ } -+ } - - free_command_lines (&bpt->commands); - if (bpt->cond_string != NULL) -@@ -7013,9 +7244,12 @@ - bp, we mark it as deleted before freeing its storage. */ - bpt->type = bp_none; - -- if (bpt->loc->cond) -- xfree (bpt->loc->cond); -- xfree (bpt->loc); -+ for (loc = bpt->loc; loc;) -+ { -+ struct bp_location *loc_next = loc->next; -+ xfree (loc); -+ loc = loc_next; -+ } - xfree (bpt); - } - -@@ -7083,94 +7317,95 @@ - map_breakpoint_numbers (arg, delete_breakpoint); - } - --static void --unlink_locations_from_global_list (struct breakpoint *bpt) -- /* Remove locations of this breakpoint from the list of -- all breakpoint locations. */ -+static int -+all_locations_are_pending (struct bp_location *loc) - { -- struct bp_location **tmp = &bp_location_chain; -- struct bp_location *here = bpt->loc; -- -- if (here == NULL) -- return; -- -- for (; *tmp && *tmp != here; tmp = &((*tmp)->next)); -- gdb_assert (*tmp); -- -- *tmp = here->next; -+ for (; loc; loc = loc->next) -+ if (!loc->shlib_disabled) -+ return 0; -+ return 1; - } - -- - static void --update_breakpoint_location (struct breakpoint *b, -- struct symtabs_and_lines sals) -+update_breakpoint_locations (struct breakpoint *b, -+ struct symtabs_and_lines sals) - { - int i; - char *s; -- /* FIXME: memleak. */ -- struct bp_location *existing = b->loc; -- struct bp_location *loc; -- struct symtab_and_line sal; -- -- if (b->enable_state == bp_shlib_disabled && sals.nelts == 0) -+ struct bp_location *existing_locations = b->loc; -+ -+ /* If there's no new locations, and all existing locations -+ are pending, don't do anything. This optimizes -+ the common case where all locations are in the same -+ shared library, that was unloaded. We'd like to -+ retain the location, so that when the library -+ is loaded again, we don't loose the enabled/disabled -+ status of the individual locations. */ -+ if (all_locations_are_pending (existing_locations) && sals.nelts == 0) - return; - - unlink_locations_from_global_list (b); - b->loc = NULL; - -- gdb_assert (sals.nelts == 0 || sals.nelts == 1); -- if (sals.nelts == 0) -- return; -- sal = sals.sals[0]; -- -- loc = allocate_bp_location (b, b->type); -- loc->requested_address = sal.pc; -- loc->address = adjust_breakpoint_address (loc->requested_address, -- b->type); -- loc->section = sal.section; -- b->loc = loc; -- -- /* Reparse conditions, they might contain references to the -- old symtab. */ -- if (b->cond_string != NULL) -+ for (i = 0; i < sals.nelts; ++i) - { -- struct gdb_exception e; -- -- s = b->cond_string; -- TRY_CATCH (e, RETURN_MASK_ERROR) -- { -- loc->cond = parse_exp_1 (&s, block_for_pc (sal.pc), -- 0); -- } -- if (e.reason < 0) -- { -- warning (_("failed to reevaluate condition for breakpoint %d: %s"), -- b->number, e.message); -- b->enable_state = bp_disabled; -- } -- } -+ struct bp_location *new_loc = -+ add_location_to_breakpoint (b, b->type, &(sals.sals[i])); - -- if (b->source_file != NULL) -- xfree (b->source_file); -- if (sal.symtab == NULL) -- b->source_file = NULL; -- else -- b->source_file = -- savestring (sal.symtab->filename, -- strlen (sal.symtab->filename)); -+ /* Reparse conditions, they might contain references to the -+ old symtab. */ -+ if (b->cond_string != NULL) -+ { -+ struct gdb_exception e; - -- if (b->line_number == 0) -- b->line_number = sal.line; -+ s = b->cond_string; -+ TRY_CATCH (e, RETURN_MASK_ERROR) -+ { -+ new_loc->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), -+ 0); -+ } -+ if (e.reason < 0) -+ { -+ warning (_("failed to reevaluate condition for breakpoint %d: %s"), -+ b->number, e.message); -+ new_loc->enabled = 0; -+ } -+ } - -- if (b->enable_state == bp_shlib_disabled) -- b->enable_state = bp_enabled; -+ if (b->source_file != NULL) -+ xfree (b->source_file); -+ if (sals.sals[i].symtab == NULL) -+ b->source_file = NULL; -+ else -+ b->source_file = -+ savestring (sals.sals[i].symtab->filename, -+ strlen (sals.sals[i].symtab->filename)); - -- b->pending = 0; -+ if (b->line_number == 0) -+ b->line_number = sals.sals[i].line; -+ } - -- check_duplicates (b); -+ /* If possible, carry over 'disable' status from existing breakpoints. */ -+ { -+ struct bp_location *e = existing_locations; -+ for (; e; e = e->next) -+ { -+ if (!e->enabled && e->function_name) -+ { -+ struct bp_location *l = b->loc; -+ for (; l; l = l->next) -+ if (l->function_name -+ && strcmp (e->function_name, l->function_name) == 0) -+ { -+ l->enabled = 0; -+ break; -+ } -+ } -+ } -+ } - -- if (existing) -- free_bp_location (existing); -+ if (existing_locations) -+ free_bp_location (existing_locations); - } - - -@@ -7227,8 +7462,10 @@ - don't need extra messages. If breakpoint is in bp_shlib_disabled - state, then user already saw the message about that breakpoint - being disabled, and don't want to see more errors. */ -- if (not_found && (b->pending || b->enable_state == bp_shlib_disabled -- || b->enable_state == bp_disabled)) -+ if (not_found -+ && (b->condition_not_parsed -+ || (b->loc && b->loc->shlib_disabled) -+ || b->enable_state == bp_disabled)) - not_found_and_ok = 1; - - if (!not_found_and_ok) -@@ -7249,7 +7486,7 @@ - - gdb_assert (sals.nelts == 1); - resolve_sal_pc (&sals.sals[0]); -- if (b->pending && s && s[0]) -+ if (b->condition_not_parsed && s && s[0]) - { - char *cond_string = 0; - int thread = -1; -@@ -7258,9 +7495,14 @@ - if (cond_string) - b->cond_string = cond_string; - b->thread = thread; -+ b->condition_not_parsed = 0; - } - -- update_breakpoint_location (b, sals); -+ update_breakpoint_locations (b, sals); -+ -+ /* Now that this is re-enabled, check_duplicates -+ can be used. */ -+ check_duplicates (b); - - xfree (sals.sals); - break; -@@ -7524,6 +7766,48 @@ - } - } - -+static struct bp_location * -+find_location_by_number (char *number) -+{ -+ char *dot = strchr (number, '.'); -+ char *p1; -+ int bp_num; -+ int loc_num; -+ struct breakpoint *b; -+ struct bp_location *loc; -+ -+ *dot = '\0'; -+ -+ p1 = number; -+ bp_num = get_number_or_range (&p1); -+ if (bp_num == 0) -+ error (_("Bad breakpoint number '%s'"), number); -+ -+ ALL_BREAKPOINTS (b) -+ if (b->number == bp_num) -+ { -+ break; -+ } -+ -+ if (!b || b->number != bp_num) -+ error (_("Bad breakpoint number '%s'"), number); -+ -+ p1 = dot+1; -+ loc_num = get_number_or_range (&p1); -+ if (loc_num == 0) -+ error (_("Bad breakpoint location number '%s'"), number); -+ -+ --loc_num; -+ loc = b->loc; -+ for (;loc_num && loc; --loc_num, loc = loc->next) -+ ; -+ if (!loc) -+ error (_("Bad breakpoint location number '%s'"), dot+1); -+ -+ return loc; -+} -+ -+ - /* Set ignore-count of breakpoint number BPTNUM to COUNT. - If from_tty is nonzero, it prints a message to that effect, - which ends with a period (no newline). */ -@@ -7579,6 +7863,13 @@ - default: - continue; - } -+ else if (strchr (args, '.')) -+ { -+ struct bp_location *loc = find_location_by_number (args); -+ if (loc) -+ loc->enabled = 0; -+ check_duplicates (loc->owner); -+ } - else - map_breakpoint_numbers (args, disable_breakpoint); - } -@@ -7711,6 +8002,13 @@ - default: - continue; - } -+ else if (strchr (args, '.')) -+ { -+ struct bp_location *loc = find_location_by_number (args); -+ if (loc) -+ loc->enabled = 1; -+ check_duplicates (loc->owner); -+ } - else - map_breakpoint_numbers (args, enable_breakpoint); - } -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.h,v -retrieving revision 1.50 -retrieving revision 1.51 -diff -u -r1.50 -r1.51 ---- src/gdb/breakpoint.h 2007/09/22 19:33:31 1.50 -+++ src/gdb/breakpoint.h 2007/09/23 07:56:22 1.51 -@@ -143,9 +143,6 @@ - { - bp_disabled, /* The eventpoint is inactive, and cannot trigger. */ - bp_enabled, /* The eventpoint is active, and can trigger. */ -- bp_shlib_disabled, /* The eventpoint's address is in an unloaded solib. -- The eventpoint will be automatically enabled -- and reset when that solib is loaded. */ - bp_call_disabled, /* The eventpoint has been disabled while a call - into the inferior is "in flight", because some - eventpoints interfere with the implementation of -@@ -232,9 +229,14 @@ - - struct bp_location - { -- /* Chain pointer to the next breakpoint location. */ -+ /* Chain pointer to the next breakpoint location for -+ the same parent breakpoint. */ - struct bp_location *next; - -+ /* Pointer to the next breakpoint location, in a global -+ list of all breakpoint locations. */ -+ struct bp_location *global_next; -+ - /* Type of this breakpoint location. */ - enum bp_loc_type loc_type; - -@@ -249,6 +251,14 @@ - locations, the evaluation of expression can be different for - different locations. */ - struct expression *cond; -+ -+ /* This location's address is in an unloaded solib, and so this -+ location should not be inserted. It will be automatically -+ enabled when that solib is loaded. */ -+ char shlib_disabled; -+ -+ /* Is this particular location enabled. */ -+ char enabled; - - /* Nonzero if this breakpoint is now inserted. */ - char inserted; -@@ -281,6 +291,8 @@ - processor's architectual constraints. */ - CORE_ADDR requested_address; - -+ char *function_name; -+ - /* Details of the placed breakpoint, when inserted. */ - struct bp_target_info target_info; - -@@ -423,8 +435,10 @@ - second bit : 0 normal breakpoint, 1 hardware breakpoint. */ - int flag; - -- /* Is breakpoint pending on shlib loads? */ -- int pending; -+ /* Is breakpoint's condition not yet parsed because we found -+ no location initially so had no context to parse -+ the condition in. */ -+ int condition_not_parsed; - }; - - /* The following stuff is an abstract data type "bpstat" ("breakpoint - -2007-09-23 Vladimir Prus - - * gdb.base/annota1.exp: Adjust for 'info break' - format changes. - * gdb.base/annota3.exp: Likewise. - * gdb.base/break.exp: Likewise. - * gdb.base/condbreak.exp: Likewise. - * gdb.base/pending.exp: Likewise. - * gdb.base/sepdebug.exp: Likewise. - * gdb.base/unload.exp: Likewise. - * gdb.base/ovldbreak.exp: Likewise. - -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota1.exp,v -retrieving revision 1.24 -retrieving revision 1.25 -diff -u -r1.24 -r1.25 ---- src/gdb/testsuite/gdb.base/annota1.exp 2007/08/23 18:14:16 1.24 -+++ src/gdb/testsuite/gdb.base/annota1.exp 2007/09/23 07:56:22 1.25 -@@ -117,9 +117,9 @@ - # - send_gdb "info break\n" - gdb_expect { -- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ -+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ - {pass "breakpoint info"} -- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ -+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ - { setup_xfail "*-*-*" 1270 - fail "breakpoint info"} - -re ".*$gdb_prompt$" { fail "breakpoint info" } -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v -retrieving revision 1.14 -retrieving revision 1.15 -diff -u -r1.14 -r1.15 ---- src/gdb/testsuite/gdb.base/annota3.exp 2007/08/23 18:14:16 1.14 -+++ src/gdb/testsuite/gdb.base/annota3.exp 2007/09/23 07:56:22 1.15 -@@ -127,8 +127,8 @@ - send_gdb "info break\n" - gdb_expect_list "breakpoint info" "$gdb_prompt$" { - "\r\n\032\032post-prompt\r\n" -- "Num Type Disp Enb Address +What\r\n" -- "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:32\r\n" -+ "Num Type Disp Enb Address +What\r\n" -+ "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:32\r\n" - } - - -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v -retrieving revision 1.29 -retrieving revision 1.30 -diff -u -r1.29 -r1.30 ---- src/gdb/testsuite/gdb.base/break.exp 2007/08/23 18:14:16 1.29 -+++ src/gdb/testsuite/gdb.base/break.exp 2007/09/23 07:56:22 1.30 -@@ -179,7 +179,7 @@ - set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* - \[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* - \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* -@@ -309,7 +309,7 @@ - # - # check to see what breakpoints are set (temporary this time) - # --gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] -+gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/condbreak.exp,v -retrieving revision 1.8 -retrieving revision 1.9 -diff -u -r1.8 -r1.9 ---- src/gdb/testsuite/gdb.base/condbreak.exp 2007/08/23 18:14:16 1.8 -+++ src/gdb/testsuite/gdb.base/condbreak.exp 2007/09/23 07:56:22 1.9 -@@ -125,14 +125,14 @@ - } - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location6.* - \[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile1:($bp_location15|$bp_location16).* --\[\t \]+stop only if 1 == 1.* -+\[\t \]+stop only if \\(1==1\\).* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* --\[\t \]+stop only if 1 == 1.* -+\[\t \]+stop only if \\(1==1\\).* - \[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).* --\[\t \]+stop only if a == 43.*" \ -+\[\t \]+stop only if \\(a==43\\).*" \ - "breakpoint info" - - -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pending.exp,v -retrieving revision 1.11 -retrieving revision 1.12 -diff -u -r1.11 -r1.12 ---- src/gdb/testsuite/gdb.base/pending.exp 2007/09/22 19:33:32 1.11 -+++ src/gdb/testsuite/gdb.base/pending.exp 2007/09/23 07:56:22 1.12 -@@ -71,8 +71,8 @@ - } - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendfunc1.*" \ - "single pending breakpoint info" - - # -@@ -86,8 +86,8 @@ - "breakpoint function" - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendfunc1.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ - "pending plus real breakpoint info" - -@@ -108,8 +108,8 @@ - gdb_test "condition 1 k == 1" "" - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendfunc1.* - \[\t \]+stop only if k == 1.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ - "pending plus condition" -@@ -121,8 +121,8 @@ - gdb_test "disable 1" "" - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep n\\(p\\).*PENDING.*pendfunc1.* - \[\t \]+stop only if k == 1.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ - "pending disabled" -@@ -134,8 +134,8 @@ - "Set commands for pending breakpoint" - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep n\\(p\\).*PENDING.*pendfunc1.* - \[\t \]+stop only if k == 1.* - \[\t \]+print k.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ -@@ -154,12 +154,12 @@ - } - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep n\\(p\\).*PENDING.*pendfunc1.* - \[\t \]+stop only if k == 1.* - \[\t \]+print k.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.*" \ -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendshr.c:$bp2_loc if x > 3.*" \ - "multiple pending breakpoints" - - -@@ -179,13 +179,13 @@ - "set ignore count on pending breakpoint 3" - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep n\\(p\\).*PENDING.*pendfunc1.* - \[\t \]+stop only if k == 1.* - \[\t \]+print k.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp3_loc.*ignore next 2 hits.*" \ -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendshr.c:$bp2_loc if x > 3.* -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*pendshr.c:$bp3_loc.*ignore next 2 hits.*" \ - "multiple pending breakpoints 2" - - # -@@ -253,7 +253,7 @@ - rerun_to_main - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \ -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*imaginary.*" \ - "verify pending breakpoint after restart" -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sepdebug.exp,v -retrieving revision 1.10 -retrieving revision 1.11 -diff -u -r1.10 -r1.11 ---- src/gdb/testsuite/gdb.base/sepdebug.exp 2007/09/21 22:42:52 1.10 -+++ src/gdb/testsuite/gdb.base/sepdebug.exp 2007/09/23 07:56:22 1.11 -@@ -179,7 +179,7 @@ - set bp_location9 [gdb_get_line_number "set breakpoint 9 here"] - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* - \[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:($bp_location8|$bp_location9).* - \[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:$bp_location7.* -@@ -298,7 +298,7 @@ - # - # check to see what breakpoints are set (temporary this time) - # --gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] -+gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:$bp_location7.*\[\r\n\] - \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.base/unload.exp,v -retrieving revision 1.12 -retrieving revision 1.13 -diff -u -r1.12 -r1.13 ---- src/gdb/testsuite/gdb.base/unload.exp 2007/09/22 19:33:32 1.12 -+++ src/gdb/testsuite/gdb.base/unload.exp 2007/09/23 07:56:22 1.13 -@@ -81,8 +81,8 @@ - } - - gdb_test "info break" \ -- "Num Type\[ \]+Disp Enb Address\[ \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*shrfunc1.*" \ -+ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y\\(p\\).*PENDING.*shrfunc1.*" \ - "single pending breakpoint info" - - set unloadshr_line [gdb_get_line_number "unloadshr break" ${libsrcfile}] -=================================================================== -RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/ovldbreak.exp,v -retrieving revision 1.6 -retrieving revision 1.7 -diff -u -r1.6 -r1.7 ---- src/gdb/testsuite/gdb.cp/ovldbreak.exp 2007/08/23 18:14:17 1.6 -+++ src/gdb/testsuite/gdb.cp/ovldbreak.exp 2007/09/23 07:56:22 1.7 -@@ -153,7 +153,7 @@ - # Verify the breakpoints. - - gdb_test "info break" \ -- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r - \[\t \]+breakpoint already hit 1 time\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r -@@ -211,7 +211,7 @@ - } - - gdb_test "info break" \ -- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r - \[\t \]+breakpoint already hit 1 time\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r -@@ -290,7 +290,7 @@ - } - - gdb_test "info break" \ -- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r - -2007-09-24 Vladimir Prus - - * breakpoint.c (remove_sal): New. - (expand_line_sal_maybe): New. - (create_breakpoints): Call expand_line_sal_maybe. - (clear_command): Add comment. - (breakpoint_re_set_one): Call expand_line_sal_maybe. - * linespec.c (decode_indirect): Set explicit_pc to 1. - (decode_all_digits): Set explicit_line to 1. - (append_expanded_sal): New. - (expand_line_sal): New. - * linespec.h (expand_line_sal): Declare. - * symtab.c (init_sal): Initialize explicit_pc - and explicit_line. - * symtab.h (struct symtab_and_line): New fields - explicit_pc and explicit_line. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.268 -retrieving revision 1.269 -diff -u -r1.268 -r1.269 ---- src/gdb/breakpoint.c 2007/09/23 07:56:22 1.268 -+++ src/gdb/breakpoint.c 2007/09/24 07:40:32 1.269 -@@ -5184,6 +5184,128 @@ - mention (b); - } - -+/* Remove element at INDEX_TO_REMOVE from SAL, shifting other -+ elements to fill the void space. */ -+static void remove_sal (struct symtabs_and_lines *sal, int index_to_remove) -+{ -+ int i = index_to_remove+1; -+ int last_index = sal->nelts-1; -+ -+ for (;i <= last_index; ++i) -+ sal->sals[i-1] = sal->sals[i]; -+ -+ --(sal->nelts); -+} -+ -+/* If appropriate, obtains all sals that correspond -+ to the same file and line as SAL. This is done -+ only if SAL does not have explicit PC and has -+ line and file information. If we got just a single -+ expanded sal, return the original. -+ -+ Otherwise, if SAL.explicit_line is not set, filter out -+ all sals for which the name of enclosing function -+ is different from SAL. This makes sure that if we have -+ breakpoint originally set in template instantiation, say -+ foo(), we won't expand SAL to locations at the same -+ line in all existing instantiations of 'foo'. -+ -+*/ -+struct symtabs_and_lines -+expand_line_sal_maybe (struct symtab_and_line sal) -+{ -+ struct symtabs_and_lines expanded; -+ CORE_ADDR original_pc = sal.pc; -+ char *original_function = NULL; -+ int found; -+ int i; -+ -+ /* If we have explicit pc, don't expand. -+ If we have no line number, we can't expand. */ -+ if (sal.explicit_pc || sal.line == 0 || sal.symtab == NULL) -+ { -+ expanded.nelts = 1; -+ expanded.sals = xmalloc (sizeof (struct symtab_and_line)); -+ expanded.sals[0] = sal; -+ return expanded; -+ } -+ -+ sal.pc = 0; -+ find_pc_partial_function (original_pc, &original_function, NULL, NULL); -+ -+ expanded = expand_line_sal (sal); -+ if (expanded.nelts == 1) -+ { -+ /* We had one sal, we got one sal. Without futher -+ processing, just return the original sal. */ -+ xfree (expanded.sals); -+ expanded.nelts = 1; -+ expanded.sals = xmalloc (sizeof (struct symtab_and_line)); -+ sal.pc = original_pc; -+ expanded.sals[0] = sal; -+ return expanded; -+ } -+ -+ if (!sal.explicit_line) -+ { -+ CORE_ADDR func_addr, func_end; -+ for (i = 0; i < expanded.nelts; ++i) -+ { -+ CORE_ADDR pc = expanded.sals[i].pc; -+ char *this_function; -+ if (find_pc_partial_function (pc, &this_function, -+ &func_addr, &func_end)) -+ { -+ if (this_function && -+ strcmp (this_function, original_function) != 0) -+ { -+ remove_sal (&expanded, i); -+ --i; -+ } -+ else if (func_addr == pc) -+ { -+ /* We're at beginning of a function, and should -+ skip prologue. */ -+ struct symbol *sym = find_pc_function (pc); -+ if (sym) -+ expanded.sals[i] = find_function_start_sal (sym, 1); -+ else -+ expanded.sals[i].pc -+ = gdbarch_skip_prologue (current_gdbarch, pc); -+ } -+ } -+ } -+ } -+ -+ -+ if (expanded.nelts <= 1) -+ { -+ /* This is un ugly workaround. If we get zero -+ expanded sals then something is really wrong. -+ Fix that by returnign the original sal. */ -+ xfree (expanded.sals); -+ expanded.nelts = 1; -+ expanded.sals = xmalloc (sizeof (struct symtab_and_line)); -+ sal.pc = original_pc; -+ expanded.sals[0] = sal; -+ return expanded; -+ } -+ -+ if (original_pc) -+ { -+ found = 0; -+ for (i = 0; i < expanded.nelts; ++i) -+ if (expanded.sals[i].pc == original_pc) -+ { -+ found = 1; -+ break; -+ } -+ gdb_assert (found); -+ } -+ -+ return expanded; -+} -+ - /* Add SALS.nelts breakpoints to the breakpoint table. For each - SALS.sal[i] breakpoint, include the corresponding ADDR_STRING[i] - value. COND_STRING, if not NULL, specified the condition to be -@@ -5214,11 +5336,10 @@ - int i; - for (i = 0; i < sals.nelts; ++i) - { -- struct symtabs_and_lines sals2; -- sals2.sals = sals.sals + i; -- sals2.nelts = 1; -+ struct symtabs_and_lines expanded = -+ expand_line_sal_maybe (sals.sals[i]); - -- create_breakpoint (sals2, addr_string[i], -+ create_breakpoint (expanded, addr_string[i], - cond_string, type, disposition, - thread, ignore_count, from_tty, - pending_bp); -@@ -6889,6 +7010,23 @@ - default_match = 1; - } - -+ /* We don't call resolve_sal_pc here. That's not -+ as bad as it seems, because all existing breakpoints -+ typically have both file/line and pc set. So, if -+ clear is given file/line, we can match this to existing -+ breakpoint without obtaining pc at all. -+ -+ We only support clearing given the address explicitly -+ present in breakpoint table. Say, we've set breakpoint -+ at file:line. There were several PC values for that file:line, -+ due to optimization, all in one block. -+ We've picked one PC value. If "clear" is issued with another -+ PC corresponding to the same file:line, the breakpoint won't -+ be cleared. We probably can still clear the breakpoint, but -+ since the other PC value is never presented to user, user -+ can only find it by guessing, and it does not seem important -+ to support that. */ -+ - /* For each line spec given, delete bps which correspond - to it. Do it in two passes, solely to preserve the current - behavior that from_tty is forced true if we delete more than -@@ -7404,8 +7542,12 @@ - } - } - -- if (existing_locations) -- free_bp_location (existing_locations); -+ while (existing_locations) -+ { -+ struct bp_location *next = existing_locations->next; -+ free_bp_location (existing_locations); -+ existing_locations = next; -+ } - } - - -@@ -7423,6 +7565,7 @@ - int not_found = 0; - int *not_found_ptr = ¬_found; - struct symtabs_and_lines sals = {}; -+ struct symtabs_and_lines expanded; - char *s; - enum enable_state save_enable; - struct gdb_exception e; -@@ -7497,8 +7640,8 @@ - b->thread = thread; - b->condition_not_parsed = 0; - } -- -- update_breakpoint_locations (b, sals); -+ expanded = expand_line_sal_maybe (sals.sals[0]); -+ update_breakpoint_locations (b, expanded); - - /* Now that this is re-enabled, check_duplicates - can be used. */ -=================================================================== -RCS file: /cvs/src/src/gdb/linespec.c,v -retrieving revision 1.72 -retrieving revision 1.73 -diff -u -r1.72 -r1.73 ---- src/gdb/linespec.c 2007/08/23 18:08:35 1.72 -+++ src/gdb/linespec.c 2007/09/24 07:40:32 1.73 -@@ -963,6 +963,7 @@ - values.sals[0] = find_pc_line (pc, 0); - values.sals[0].pc = pc; - values.sals[0].section = find_pc_overlay (pc); -+ values.sals[0].explicit_pc = 1; - - return values; - } -@@ -1633,6 +1634,7 @@ - values.nelts = 1; - if (need_canonical) - build_canonical_line_spec (values.sals, NULL, canonical); -+ values.sals[0].explicit_line = 1; - return values; - } - -=================================================================== -RCS file: /cvs/src/src/gdb/symtab.c,v -retrieving revision 1.164 -retrieving revision 1.165 -diff -u -r1.164 -r1.165 ---- src/gdb/symtab.c 2007/08/29 18:34:46 1.164 -+++ src/gdb/symtab.c 2007/09/24 07:40:32 1.165 -@@ -691,6 +691,8 @@ - sal->line = 0; - sal->pc = 0; - sal->end = 0; -+ sal->explicit_pc = 0; -+ sal->explicit_line = 0; - } - - -@@ -4172,6 +4174,166 @@ - set_main_name (NULL); - } - -+/* Helper to expand_line_sal below. Appends new sal to SAL, -+ initializing it from SYMTAB, LINENO and PC. */ -+static void -+append_expanded_sal (struct symtabs_and_lines *sal, -+ struct symtab *symtab, -+ int lineno, CORE_ADDR pc) -+{ -+ CORE_ADDR func_addr, func_end; -+ -+ sal->sals = xrealloc (sal->sals, -+ sizeof (sal->sals[0]) -+ * (sal->nelts + 1)); -+ init_sal (sal->sals + sal->nelts); -+ sal->sals[sal->nelts].symtab = symtab; -+ sal->sals[sal->nelts].section = NULL; -+ sal->sals[sal->nelts].end = 0; -+ sal->sals[sal->nelts].line = lineno; -+ sal->sals[sal->nelts].pc = pc; -+ ++sal->nelts; -+} -+ -+/* Compute a set of all sals in -+ the entire program that correspond to same file -+ and line as SAL and return those. If there -+ are several sals that belong to the same block, -+ only one sal for the block is included in results. */ -+ -+struct symtabs_and_lines -+expand_line_sal (struct symtab_and_line sal) -+{ -+ struct symtabs_and_lines ret, this_line; -+ int i, j; -+ struct objfile *objfile; -+ struct partial_symtab *psymtab; -+ struct symtab *symtab; -+ int lineno; -+ int deleted = 0; -+ struct block **blocks = NULL; -+ int *filter; -+ -+ ret.nelts = 0; -+ ret.sals = NULL; -+ -+ if (sal.symtab == NULL || sal.line == 0 || sal.pc != 0) -+ { -+ ret.sals = xmalloc (sizeof (struct symtab_and_line)); -+ ret.sals[0] = sal; -+ ret.nelts = 1; -+ return ret; -+ } -+ else -+ { -+ struct linetable_entry *best_item = 0; -+ struct symtab *best_symtab = 0; -+ int exact = 0; -+ -+ lineno = sal.line; -+ -+ /* We meed to find all symtabs for a file which name -+ is described by sal. We cannot just directly -+ iterate over symtabs, since a symtab might not be -+ yet created. We also cannot iterate over psymtabs, -+ calling PSYMTAB_TO_SYMTAB and working on that symtab, -+ since PSYMTAB_TO_SYMTAB will return NULL for psymtab -+ corresponding to an included file. Therefore, we do -+ first pass over psymtabs, reading in those with -+ the right name. Then, we iterate over symtabs, knowing -+ that all symtabs we're interested in are loaded. */ -+ -+ ALL_PSYMTABS (objfile, psymtab) -+ { -+ if (strcmp (sal.symtab->filename, -+ psymtab->filename) == 0) -+ PSYMTAB_TO_SYMTAB (psymtab); -+ } -+ -+ -+ /* For each symtab, we add all pcs to ret.sals. I'm actually -+ not sure what to do if we have exact match in one symtab, -+ and non-exact match on another symtab. -+ */ -+ ALL_SYMTABS (objfile, symtab) -+ { -+ if (strcmp (sal.symtab->filename, -+ symtab->filename) == 0) -+ { -+ struct linetable *l; -+ int len; -+ l = LINETABLE (symtab); -+ if (!l) -+ continue; -+ len = l->nitems; -+ -+ for (j = 0; j < len; j++) -+ { -+ struct linetable_entry *item = &(l->item[j]); -+ -+ if (item->line == lineno) -+ { -+ exact = 1; -+ append_expanded_sal (&ret, symtab, lineno, item->pc); -+ } -+ else if (!exact && item->line > lineno -+ && (best_item == NULL || item->line < best_item->line)) -+ -+ { -+ best_item = item; -+ best_symtab = symtab; -+ } -+ } -+ } -+ } -+ if (!exact && best_item) -+ append_expanded_sal (&ret, best_symtab, lineno, best_item->pc); -+ } -+ -+ /* For optimized code, compiler can scatter one source line accross -+ disjoint ranges of PC values, even when no duplicate functions -+ or inline functions are involved. For example, 'for (;;)' inside -+ non-template non-inline non-ctor-or-dtor function can result -+ in two PC ranges. In this case, we don't want to set breakpoint -+ on first PC of each range. To filter such cases, we use containing -+ blocks -- for each PC found above we see if there are other PCs -+ that are in the same block. If yes, the other PCs are filtered out. */ -+ -+ filter = xmalloc (ret.nelts * sizeof (int)); -+ blocks = xmalloc (ret.nelts * sizeof (struct block *)); -+ for (i = 0; i < ret.nelts; ++i) -+ { -+ filter[i] = 1; -+ blocks[i] = block_for_pc (ret.sals[i].pc); -+ } -+ -+ for (i = 0; i < ret.nelts; ++i) -+ if (blocks[i] != NULL) -+ for (j = i+1; j < ret.nelts; ++j) -+ if (blocks[j] == blocks[i]) -+ { -+ filter[j] = 0; -+ ++deleted; -+ break; -+ } -+ -+ { -+ struct symtab_and_line *final = -+ xmalloc (sizeof (struct symtab_and_line) * (ret.nelts-deleted)); -+ -+ for (i = 0, j = 0; i < ret.nelts; ++i) -+ if (filter[i]) -+ final[j++] = ret.sals[i]; -+ -+ ret.nelts -= deleted; -+ xfree (ret.sals); -+ ret.sals = final; -+ } -+ -+ return ret; -+} -+ -+ - void - _initialize_symtab (void) - { -=================================================================== -RCS file: /cvs/src/src/gdb/symtab.h,v -retrieving revision 1.106 -retrieving revision 1.107 -diff -u -r1.106 -r1.107 ---- src/gdb/symtab.h 2007/08/23 18:08:45 1.106 -+++ src/gdb/symtab.h 2007/09/24 07:40:32 1.107 -@@ -1213,6 +1213,8 @@ - - CORE_ADDR pc; - CORE_ADDR end; -+ int explicit_pc; -+ int explicit_line; - }; - - extern void init_sal (struct symtab_and_line *sal); -@@ -1404,5 +1406,7 @@ - const domain_enum domain, - struct symtab **symtab); - -+extern struct symtabs_and_lines -+expand_line_sal (struct symtab_and_line sal); - - #endif /* !defined(SYMTAB_H) */ - -2007-09-24 Vladimir Prus - - * gdb.cp/mb-ctor.cc: New. - * gdb.cp/mb-ctor.exp: New. - * gdb.cp/mb-templates.cc: New. - * gdb.cp/mb-templates.exp: New. - -/cvs/src/src/gdb/testsuite/gdb.cp/mb-ctor.cc,v --> standard output -revision 1.1 ---- src/gdb/testsuite/gdb.cp/mb-ctor.cc -+++ - 2007-11-01 22:04:53.928594000 +0000 -@@ -0,0 +1,58 @@ -+ -+#include -+ -+class Base -+{ -+public: -+ Base(int k); -+ ~Base(); -+ virtual void foo() {} -+private: -+ int k; -+}; -+ -+Base::Base(int k) -+{ -+ this->k = k; -+} -+ -+Base::~Base() -+{ -+ printf("~Base\n"); -+} -+ -+class Derived : public virtual Base -+{ -+public: -+ Derived(int i); -+ ~Derived(); -+private: -+ int i; -+}; -+ -+Derived::Derived(int i) : Base(i) -+{ -+ this->i = i; -+} -+ -+Derived::~Derived() -+{ -+ printf("~Derived\n"); -+} -+ -+class DeeplyDerived : public Derived -+{ -+public: -+ DeeplyDerived(int i) : Base(i), Derived(i) {} -+}; -+ -+int main() -+{ -+ /* Invokes the Derived ctor that constructs both -+ Derived and Base. */ -+ Derived d(7); -+ /* Invokes the Derived ctor that constructs only -+ Derived. Base is constructed separately by -+ DeeplyDerived's ctor. */ -+ DeeplyDerived dd(15); -+} -/cvs/src/src/gdb/testsuite/gdb.cp/mb-ctor.exp,v --> standard output -revision 1.1 ---- src/gdb/testsuite/gdb.cp/mb-ctor.exp -+++ - 2007-11-01 22:04:54.490054000 +0000 -@@ -0,0 +1,86 @@ -+# 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 . -+ -+# Test that breakpoints on C++ constructors work, despite the -+# fact that gcc generates several versions of constructor function. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile "mb-ctor" -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile} "c++"] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested mb-ctor.exp -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Set a breakpoint with multiple locations -+# and a condition. -+ -+gdb_test "break 'Derived::Derived(int)'" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ -+ "set-breakpoint at ctor" -+ -+gdb_test "break 'Derived::~Derived()'" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ -+ "set-breakpoint at ctor" -+ -+gdb_run_cmd -+gdb_expect { -+ -re "Breakpoint \[0-9\]+,.*Derived.*i=7.*$gdb_prompt $" { -+ pass "run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "run to breakpoint" -+ } -+ timeout { -+ fail "run to breakpoint (timeout)" -+ } -+} -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*Derived.*i=15.*" \ -+ "run to breakpoint 2" -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*~Derived.*" \ -+ "run to breakpoint 3" -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*~Derived.*" \ -+ "run to breakpoint 4" -+ -+gdb_test "continue" \ -+ ".*exited normally.*" \ -+ "run to exit" -+ -+ -+ -/cvs/src/src/gdb/testsuite/gdb.cp/mb-templates.cc,v --> standard output -revision 1.1 ---- src/gdb/testsuite/gdb.cp/mb-templates.cc -+++ - 2007-11-01 22:04:55.064722000 +0000 -@@ -0,0 +1,19 @@ -+ -+#include -+using namespace std; -+ -+template -+void foo(T i) -+{ -+ std::cout << "hi\n"; // set breakpoint here -+} -+ -+int main() -+{ -+ foo(0); -+ foo(0); -+ foo(1); -+ foo(1); -+ foo(2); -+ foo(2); -+} -/cvs/src/src/gdb/testsuite/gdb.cp/mb-templates.exp,v --> standard output -revision 1.1 ---- src/gdb/testsuite/gdb.cp/mb-templates.exp -+++ - 2007-11-01 22:04:55.647560000 +0000 -@@ -0,0 +1,161 @@ -+# 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 . -+ -+# This test verifies that setting breakpoint on line in template -+# function will fire in all instantiations of that template. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile "mb-templates" -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile} "c++"] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested mb-templates.exp -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set bp_location [gdb_get_line_number "set breakpoint here"] -+ -+# Set a breakpoint with multiple locations -+# and a condition. -+ -+gdb_test "break $srcfile:$bp_location if i==1" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ -+ "initial condition: set breakpoint" -+ -+gdb_run_cmd -+gdb_expect { -+ -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" { -+ pass "initial condition: run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "initial condition: run to breakpoint" -+ } -+ timeout { -+ fail "initial condition: run to breakpoint (timeout)" -+ } -+} -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*foo \\(i=1\\).*" \ -+ "initial condition: run to breakpoint 2" -+ -+# Set breakpoint with multiple locations. -+# Separately set the condition. -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_test "break $srcfile:$bp_location" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ -+ "separate condition: set breakpoint" -+ -+gdb_test "condition 1 i==1" "" \ -+ "separate condition: set condition" -+ -+gdb_run_cmd -+gdb_expect { -+ -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" { -+ pass "separate condition: run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "separate condition: run to breakpoint" -+ } -+ timeout { -+ fail "separate condition: run to breakpoint (timeout)" -+ } -+} -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*foo \\(i=1\\).*" \ -+ "separate condition: run to breakpoint 2" -+ -+# Try disabling a single location. We also test -+# that at least in simple cases, the enable/disable -+# state of locations surive "run". -+gdb_test "disable 1.1" "" "disabling location: disable" -+ -+gdb_run_cmd -+gdb_expect { -+ -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" { -+ pass "disabling location: run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "disabling location: run to breakpoint" -+ } -+ timeout { -+ fail "disabling location: run to breakpoint (timeout)" -+ } -+} -+ -+# Try disabling entire breakpoint -+gdb_test "enable 1.1" "" "disabling location: enable" -+ -+ -+gdb_test "disable 1" "" "disable breakpoint: disable" -+ -+gdb_run_cmd -+gdb_expect { -+ -re "Program exited normally.*$gdb_prompt $" { -+ pass "disable breakpoint: run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "disable breakpoint: run to breakpoint" -+ } -+ timeout { -+ fail "disable breakpoint: run to breakpoint (timeout)" -+ } -+} -+ -+# Make sure breakpoint can be set on a specific instantion. -+delete_breakpoints -+gdb_test "break 'void foo(int)'" ".*" \ -+ "instantiation: set breakpoint" -+ -+ -+gdb_run_cmd -+gdb_expect { -+ -re ".*Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" { -+ pass "instantiation: run to breakpoint" -+ } -+ -re "$gdb_prompt $" { -+ fail "instantiation: run to breakpoint" -+ } -+ timeout { -+ fail "instantiation: run to breakpoint (timeout)" -+ } -+} -+ -+gdb_test "continue" \ -+ ".*Breakpoint.*foo \\(i=1\\).*" \ -+ "instantiation: run to breakpoint 2" -+ - -2007-09-26 Vladimir Prus - - * breakpoint.c (create_breakpoint): Set - condition on each location, not on the first - location of breakpoint. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.269 -retrieving revision 1.270 -diff -u -r1.269 -r1.270 ---- src/gdb/breakpoint.c 2007/09/24 07:40:32 1.269 -+++ src/gdb/breakpoint.c 2007/09/26 18:44:55 1.270 -@@ -5163,7 +5163,7 @@ - if (b->cond_string) - { - char *arg = b->cond_string; -- b->loc->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); -+ loc->cond = parse_exp_1 (&arg, block_for_pc (loc->address), 0); - if (*arg) - { - if (pending_bp) - -2007-09-28 Vladimir Prus - - * NEW: Mention pending breakpoint changes and - support for breakpoints at multiple locations. - -=================================================================== -RCS file: /cvs/src/src/gdb/NEWS,v -retrieving revision 1.239 -retrieving revision 1.240 -diff -u -r1.239 -r1.240 ---- src/gdb/NEWS 2007/09/17 19:30:05 1.239 -+++ src/gdb/NEWS 2007/09/28 06:24:20 1.240 -@@ -3,6 +3,13 @@ - - *** Changes since GDB 6.7 - -+* Pending breakpoints no longer change their number when their address -+ is resolved. -+ -+* GDB now supports breakpoints with multiple locations, -+ including breakpoints on C++ constructors, inside C++ templates, -+ and in inlined functions. -+ - *** Changes in GDB 6.6 - - * Resolved 101 resource leaks, null pointer dereferences, etc. in gdb, - -2007-09-28 Vladimir Prus - - * gdb.texinfo (Setting Breakpoints): Revise - documentation for pending breakpoints. Document - breakpoints with multiple locations. - -=================================================================== -RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v -retrieving revision 1.432 -retrieving revision 1.433 -diff -u -r1.432 -r1.433 ---- src/gdb/doc/gdb.texinfo 2007/09/16 14:59:30 1.432 -+++ src/gdb/doc/gdb.texinfo 2007/09/28 06:24:20 1.433 -@@ -2991,11 +2991,17 @@ - Whether the breakpoint is marked to be disabled or deleted when hit. - @item Enabled or Disabled - Enabled breakpoints are marked with @samp{y}. @samp{n} marks breakpoints --that are not enabled. -+that are not enabled. An optional @samp{(p)} suffix marks pending -+breakpoints --- breakpoints for which address is either not yet -+resolved, pending load of a shared library, or for which address was -+in a shared library that was since unloaded. Such breakpoint won't -+fire until a shared library that has the symbol or line referred by -+breakpoint is loaded. See below for details. - @item Address --Where the breakpoint is in your program, as a memory address. If the --breakpoint is pending (see below for details) on a future load of a shared library, the address --will be listed as @samp{}. -+Where the breakpoint is in your program, as a memory address. For a -+pending breakpoint whose address is not yet known, this field will -+contain @samp{}. A breakpoint with several locations will -+have @samp{} in this field --- see below for details. - @item What - Where the breakpoint is in the source for your program, as a file and - line number. For a pending breakpoint, the original string passed to -@@ -3032,23 +3038,83 @@ - the breakpoints are conditional, this is even useful - (@pxref{Conditions, ,Break Conditions}). - --@cindex pending breakpoints --If a specified breakpoint location cannot be found, it may be due to the fact --that the location is in a shared library that is yet to be loaded. In such --a case, you may want @value{GDBN} to create a special breakpoint (known as --a @dfn{pending breakpoint}) that --attempts to resolve itself in the future when an appropriate shared library --gets loaded. -- --Pending breakpoints are useful to set at the start of your --@value{GDBN} session for locations that you know will be dynamically loaded --later by the program being debugged. When shared libraries are loaded, --a check is made to see if the load resolves any pending breakpoint locations. --If a pending breakpoint location gets resolved, --a regular breakpoint is created and the original pending breakpoint is removed. -+It is possible that a breakpoint correspond to several locations -+in your program. Examples of this situation are: -+ -+@itemize @bullet -+ -+@item -+For a C@t{++} constructor, the @value{NGCC} compiler generates several -+instances of the function body, used in different cases. - --@value{GDBN} provides some additional commands for controlling pending --breakpoint support: -+@item -+For a C@t{++} template function, a given line in the function can -+correspond to any number of instantiations. -+ -+@item -+For an inlined function, a given source line can correspond to -+several places where that function is inlined. -+ -+@end itemize -+ -+In all those cases, @value{GDBN} will insert a breakpoint at all -+the relevant locations. -+ -+A breakpoint with multiple locations is displayed in the -+breakpoint table using several rows --- one header row, followed -+by one row for each breakpoint location. The header row -+has @samp{} in the address column. The rows for -+individual locations contain the actual addresses for locations, -+and say what functions those locations are in. The number -+column for a location has number in the format -+@var{breakpoint-number}.@var{location-number}. -+ -+For example: -+@smallexample -+Num Type Disp Enb Address What -+1 breakpoint keep y -+ stop only if i==1 -+ breakpoint already hit 1 time -+1.1 y 0x080486a2 in void foo() at t.cc:8 -+1.2 y 0x080486ca in void foo() at t.cc:8 -+@end smallexample -+ -+Each location can be individually enabled or disabled by passing -+@var{breakpoint-number}.@var{location-number} as argument to the -+@code{enable} and @code{disable} commands. -+ -+@cindex pending breakpoints -+It's quite common to have a breakpoint inside a shared library. -+The shared library may be loaded and unloaded explicitly, -+and possibly repeatedly, as the program is executed. To support -+this use case, @value{GDBN} updates breakpoint locations whenever -+any shared library is loaded or unloaded. Typically, you would -+set a breakpoint in a shared library at the beginning of your -+debugging session, when the library is not loaded, and when the -+symbols from the library are not available. When you try to set -+breakpoint, @value{GDBN} will ask you if you want to set -+a so called @dfn{pending breakpoint} --- breakpoint whose address -+is not yet resolved. -+ -+After the program is run, whenever a new shared library is loaded, -+@value{GDBN} reevaluates all the breakpoints. When a newly loaded -+shared library contains the symbol or line referred to by some -+pending breakpoint, that breakpoint is resolved and becomes an -+ordinary breakpoint. When a library is unloaded, all breakpoints -+that refer to its symbols or source lines become pending again. -+ -+This logic works for breakpoints with multiple locations, too. For -+example, if you have a breakpoint in a C@t{++} template function, and -+a newly loaded shared library has an instantiation of that template, -+a new location is added to the list of locations for the breakpoint. -+ -+Except for having unresolved address, pending breakpoints do not -+differ from regular breakpoints. You can set conditions or commands, -+enable and disable them and perform other breakpoint operations. -+ -+@value{GDBN} provides some additional commands for controlling what -+happens when the @samp{break} command cannot resolve breakpoint -+address specification to an address: - - @kindex set breakpoint pending - @kindex show breakpoint pending -@@ -3070,19 +3136,9 @@ - Show the current behavior setting for creating pending breakpoints. - @end table - --@cindex operations allowed on pending breakpoints --Normal breakpoint operations apply to pending breakpoints as well. You may --specify a condition for a pending breakpoint and/or commands to run when the --breakpoint is reached. You can also enable or disable --the pending breakpoint. When you specify a condition for a pending breakpoint, --the parsing of the condition will be deferred until the point where the --pending breakpoint location is resolved. Disabling a pending breakpoint --tells @value{GDBN} to not attempt to resolve the breakpoint on any subsequent --shared library load. When a pending breakpoint is re-enabled, --@value{GDBN} checks to see if the location is already resolved. --This is done because any number of shared library loads could have --occurred since the time the breakpoint was disabled and one or more --of these loads could resolve the location. -+The settings above only affect the @code{break} command and its -+variants. Once breakpoint is set, it will be automatically updated -+as shared libraries are loaded and unloaded. - - @cindex automatic hardware breakpoints - For some targets, @value{GDBN} can automatically decide if hardware or - -2007-10-08 Pierre Muller - - * breakpoint.c (print_one_breakpoint_location): ARI fix: - Replace asprintf by xstrprintf. - -=================================================================== -RCS file: /cvs/src/src/gdb/breakpoint.c,v -retrieving revision 1.271 -retrieving revision 1.272 -diff -u -r1.271 -r1.272 ---- src/gdb/breakpoint.c 2007/10/01 00:17:57 1.271 -+++ src/gdb/breakpoint.c 2007/10/08 15:23:42 1.272 -@@ -3526,7 +3526,7 @@ - if (part_of_multiple) - { - char *formatted; -- asprintf (&formatted, "%d.%d", b->number, loc_number); -+ formatted = xstrprintf ("%d.%d", b->number, loc_number); - ui_out_field_string (uiout, "number", formatted); - xfree (formatted); - } - -2007-09-17 Daniel Jacobowitz - - * schedlock.c (NUM): Change to 1. - (main): Use args[0] for the main thread. - * schedlock.exp: Only expect two threads. Only issue one pass or fail - regardless of the number of threads. - ---- ./gdb/testsuite/gdb.threads/schedlock.exp 23 Aug 2007 18:14:19 -0000 1.6 -+++ ./gdb/testsuite/gdb.threads/schedlock.exp 17 Sep 2007 15:38:05 -0000 1.7 -@@ -32,6 +32,9 @@ set testfile "schedlock" - set srcfile ${testfile}.c - set binfile ${objdir}/${subdir}/${testfile} - -+# The number of threads, including the main thread. -+set NUM 2 -+ - if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { - return -1 - } -@@ -44,11 +47,11 @@ proc get_args { } { - - send_gdb "print args\n" - gdb_expect { -- -re "\\\$\[0-9\]+ = {(\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+)}.*$gdb_prompt" -+ -re "\\\$\[0-9\]+ = {(\[0-9\]+), (\[0-9\]+)}.*$gdb_prompt" - { - set list_count [expr $list_count + 1] - pass "listed args ($list_count)" -- return [list $expect_out(1,string) $expect_out(2,string) $expect_out(3,string) $expect_out(4,string) $expect_out(5,string) $expect_out(6,string)] -+ return [list $expect_out(1,string) $expect_out(2,string)] - } - -re "$gdb_prompt" - { -@@ -112,7 +115,7 @@ proc my_continue { msg } { - stop_process "stop all threads ($msg)" - - # Make sure we're in one of the non-main looping threads. -- gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 5"] -+ gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 0"] - gdb_continue_to_breakpoint "return to loop ($msg)" - delete_breakpoints - } -@@ -198,13 +201,17 @@ my_continue "initial" - - set cont_args [get_args] - --for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} { -+set ok 1 -+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} { - if {[lindex $start_args $i] == [lindex $cont_args $i]} { -- fail "thread $i ran (didn't run)" -- } else { -- pass "thread $i ran" -+ set ok 0 - } - } -+if { $ok } { -+ pass "all threads alive" -+} else { -+ fail "all threads alive" -+} - - # We can't change threads, unfortunately, in current GDB. Use - # whichever we stopped in. -@@ -230,7 +237,7 @@ set start_args $cont_args - set cont_args [get_args] - - set num_other_threads 0 --for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} { -+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} { - if {[lindex $start_args $i] == [lindex $cont_args $i]} { - if {$i == $curthread} { - fail "current thread stepped (didn't run)" -@@ -248,9 +255,9 @@ for {set i 0} {[expr $i < 6]} {set i [ex - } - } - if {$num_other_threads > 0} { -- pass "other threads ran (1)" -+ pass "other threads ran - unlocked" - } else { -- fail "other threads ran (no other threads ran) (1)" -+ fail "other threads ran - unlocked" - } - - # Test continue with scheduler locking -@@ -269,21 +276,25 @@ if {$curthread == $newthread} { - set start_args $cont_args - set cont_args [get_args] - --for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} { -+set num_other_threads 0 -+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} { - if {[lindex $start_args $i] == [lindex $cont_args $i]} { - if {$i == $curthread} { - fail "current thread ran (didn't run)" -- } else { -- pass "other thread $i didn't run" - } - } else { - if {$i == $curthread} { - pass "current thread ran" - } else { -- fail "other thread $i didn't run (ran)" -+ incr num_other_threads - } - } - } -+if {$num_other_threads > 0} { -+ fail "other threads didn't run - locked" -+} else { -+ pass "other threads didn't run - locked" -+} - - # Test stepping with scheduler locking - step_ten_loops "locked" -@@ -299,12 +310,11 @@ if {$curthread == $newthread} { - set start_args $cont_args - set cont_args [get_args] - --for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} { -+set num_other_threads 0 -+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} { - if {[lindex $start_args $i] == [lindex $cont_args $i]} { - if {$i == $curthread} { - fail "current thread stepped locked (didn't run)" -- } else { -- pass "other thread $i didn't run (stepping)" - } - } else { - if {$i == $curthread} { -@@ -314,9 +324,14 @@ for {set i 0} {[expr $i < 6]} {set i [ex - fail "current thread stepped locked (wrong amount)" - } - } else { -- fail "other thread $i didn't run (stepping) (ran)" -+ incr num_other_threads - } - } - } -+if {$num_other_threads > 0} { -+ fail "other threads didn't run - step locked" -+} else { -+ pass "other threads didn't run - step locked" -+} - - return 0 ---- ./gdb/testsuite/gdb.threads/schedlock.c 23 Aug 2007 18:08:50 -0000 1.7 -+++ ./gdb/testsuite/gdb.threads/schedlock.c 17 Sep 2007 15:38:05 -0000 1.8 -@@ -22,7 +22,7 @@ - - void *thread_function(void *arg); /* Pointer to function executed by each thread */ - --#define NUM 5 -+#define NUM 1 - - unsigned int args[NUM+1]; - -@@ -32,7 +32,7 @@ int main() { - void *thread_result; - long i; - -- for (i = 0; i < NUM; i++) -+ for (i = 1; i <= NUM; i++) - { - args[i] = 1; - res = pthread_create(&threads[i], -@@ -42,8 +42,8 @@ int main() { - } - - /* schedlock.exp: last thread start. */ -- args[i] = 1; -- thread_function ((void *) i); -+ args[0] = 1; -+ thread_function ((void *) 0); - - exit(EXIT_SUCCESS); - } - -2007-12-10 Jan Kratochvil - - * lib/gdb.exp (build_id_debug_filename_get): OBJCOPY pipe being read - must be set to binary. - ---- ./gdb/testsuite/lib/gdb.exp 9 Dec 2007 11:21:21 -0000 1.93 -+++ ./gdb/testsuite/lib/gdb.exp 10 Dec 2007 00:14:55 -0000 -@@ -2500,6 +2500,7 @@ proc build_id_debug_filename_get { exec - return "" - } - set fi [open $tmp] -+ fconfigure $fi -translation binary - # Skip the NOTE header. - read $fi 16 - set data [read $fi] - -http://sourceware.org/ml/gdb-patches/2007-12/msg00485.html -http://sourceware.org/ml/gdb-cvs/2007-12/msg00166.html - -2007-12-31 Daniel Jacobowitz - - * remote.c (unpack_nibble): Use fromhex. - * symtab.c (find_line_common): Always set exact_match. - -=================================================================== -RCS file: /cvs/src/src/gdb/remote.c,v -retrieving revision 1.273 -retrieving revision 1.274 -diff -u -r1.273 -r1.274 ---- src/gdb/remote.c 2007/12/07 15:02:12 1.273 -+++ src/gdb/remote.c 2007/12/31 18:38:43 1.274 -@@ -1353,7 +1353,7 @@ - static char * - unpack_nibble (char *buf, int *val) - { -- ishex (*buf++, val); -+ *val = fromhex (*buf++); - return buf; - } - -=================================================================== -RCS file: /cvs/src/src/gdb/symtab.c,v -retrieving revision 1.168 -retrieving revision 1.169 -diff -u -r1.168 -r1.169 ---- src/gdb/symtab.c 2007/12/18 16:02:54 1.168 -+++ src/gdb/symtab.c 2007/12/31 18:38:43 1.169 -@@ -2424,6 +2424,8 @@ - int best_index = -1; - int best = 0; - -+ *exact_match = 0; -+ - if (lineno <= 0) - return -1; - if (l == 0) -@@ -2449,8 +2451,6 @@ - } - - /* If we got here, we didn't get an exact match. */ -- -- *exact_match = 0; - return best_index; - } - diff --git a/gdb-6.8-bz377541-fortran-dynamic-arrays.patch b/gdb-6.8-bz377541-fortran-dynamic-arrays.patch new file mode 100644 index 0000000..44808ff --- /dev/null +++ b/gdb-6.8-bz377541-fortran-dynamic-arrays.patch @@ -0,0 +1,2239 @@ +The last version posted upstream: + +0: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00438.html +1: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00439.html +2: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00440.html +3: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00441.html +4: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00442.html +5: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00443.html +6: http://sources.redhat.com/ml/gdb-patches/2007-11/msg00444.html + +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/Makefile.in gdb-6.8cvs20080219/gdb/Makefile.in +--- gdb-6.8cvs20080219-fortranless/gdb/Makefile.in 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/Makefile.in 2008-02-22 16:59:22.000000000 +0100 +@@ -758,6 +758,7 @@ disasm_h = disasm.h + doublest_h = doublest.h $(floatformat_h) + dummy_frame_h = dummy-frame.h + dfp_h = dfp.h ++dwarf2block_h = dwarf2block.h + dwarf2expr_h = dwarf2expr.h + dwarf2_frame_h = dwarf2-frame.h + dwarf2loc_h = dwarf2loc.h +@@ -1051,7 +1052,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $ + exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \ + dbxread.o coffread.o coff-pe-read.o \ + dwarf2read.o mipsread.o stabsread.o corefile.o \ +- dwarf2expr.o dwarf2loc.o dwarf2-frame.o \ ++ dwarf2block.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o \ + ada-lang.o c-lang.o f-lang.o objc-lang.o \ + ui-out.o cli-out.o \ + varobj.o vec.o wrapper.o \ +@@ -2086,6 +2087,8 @@ dummy-frame.o: dummy-frame.c $(defs_h) $ + $(command_h) $(gdbcmd_h) $(gdb_string_h) + dfp.o: dfp.c $(defs_h) $(expression_h) $(gdbtypes_h) $(value_h) $(dfp_h) \ + $(decimal128_h) $(decimal64_h) $(decimal32_h) ++dwarf2block.o: dwarf2block.c $(dwarf2block_h) $(defs_h) $(gdbcore_h) \ ++ $(dwarf2expr_h) $(exceptions_h) + dwarf2expr.o: dwarf2expr.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) \ + $(gdbcore_h) $(elf_dwarf2_h) $(dwarf2expr_h) + dwarf2-frame.o: dwarf2-frame.c $(defs_h) $(dwarf2expr_h) $(elf_dwarf2_h) \ +@@ -2096,13 +2099,14 @@ dwarf2-frame.o: dwarf2-frame.c $(defs_h) + dwarf2loc.o: dwarf2loc.c $(defs_h) $(ui_out_h) $(value_h) $(frame_h) \ + $(gdbcore_h) $(target_h) $(inferior_h) $(ax_h) $(ax_gdb_h) \ + $(regcache_h) $(objfiles_h) $(exceptions_h) $(elf_dwarf2_h) \ +- $(dwarf2expr_h) $(dwarf2loc_h) $(gdb_string_h) $(gdb_assert_h) ++ $(dwarf2expr_h) $(dwarf2loc_h) $(gdb_string_h) $(gdb_assert_h) \ ++ $(dwarf2block_h) + dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \ + $(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) $(demangle_h) \ + $(expression_h) $(filenames_h) $(macrotab_h) $(language_h) \ + $(complaints_h) $(bcache_h) $(dwarf2expr_h) $(dwarf2loc_h) \ + $(cp_support_h) $(hashtab_h) $(command_h) $(gdbcmd_h) \ +- $(gdb_string_h) $(gdb_assert_h) ++ $(gdb_string_h) $(gdb_assert_h) $(dwarf2block_h) $(f_lang_h) + elfread.o: elfread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(elf_bfd_h) \ + $(elf_mips_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \ + $(stabsread_h) $(gdb_stabs_h) $(complaints_h) $(demangle_h) \ +@@ -2138,10 +2142,10 @@ f-exp.o: f-exp.c $(defs_h) $(gdb_string_ + findvar.o: findvar.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(frame_h) \ + $(value_h) $(gdbcore_h) $(inferior_h) $(target_h) $(gdb_string_h) \ + $(gdb_assert_h) $(floatformat_h) $(symfile_h) $(regcache_h) \ +- $(user_regs_h) $(block_h) ++ $(user_regs_h) $(block_h) $(dwarf2block_h) + f-lang.o: f-lang.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ + $(expression_h) $(parser_defs_h) $(language_h) $(f_lang_h) \ +- $(valprint_h) $(value_h) ++ $(valprint_h) $(value_h) $(dwarf2block_h) + fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \ + $(inferior_h) $(target_h) $(gdb_wait_h) $(gdb_vfork_h) $(gdbcore_h) \ + $(terminal_h) $(gdbthread_h) $(command_h) $(solib_h) +@@ -2166,7 +2170,7 @@ frv-tdep.o: frv-tdep.c $(defs_h) $(gdb_s + $(frv_tdep_h) + f-typeprint.o: f-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ + $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ +- $(f_lang_h) $(gdb_string_h) ++ $(f_lang_h) $(gdb_string_h) $(dwarf2block_h) + f-valprint.o: f-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \ + $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \ + $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h) $(block_h) +@@ -2181,7 +2185,8 @@ gdb-events.o: gdb-events.c $(defs_h) $(g + gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \ + $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \ + $(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \ +- $(gdbcmd_h) $(wrapper_h) $(cp_abi_h) $(gdb_assert_h) $(hashtab_h) ++ $(gdbcmd_h) $(wrapper_h) $(cp_abi_h) $(gdb_assert_h) $(hashtab_h) \ ++ $(dwarf2block_h) + glibc-tdep.o: glibc-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ + $(objfiles_h) $(glibc_tdep_h) + gnu-nat.o: gnu-nat.c $(gdb_string_h) $(defs_h) $(inferior_h) $(symtab_h) \ +@@ -2939,7 +2944,7 @@ tramp-frame.o: tramp-frame.c $(defs_h) $ + typeprint.o: typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ + $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(command_h) \ + $(gdbcmd_h) $(target_h) $(language_h) $(cp_abi_h) $(typeprint_h) \ +- $(gdb_string_h) ++ $(gdb_string_h) $(dwarf2block_h) + ui-file.o: ui-file.c $(defs_h) $(ui_file_h) $(gdb_string_h) + ui-out.o: ui-out.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \ + $(ui_out_h) $(gdb_assert_h) +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/ada-lang.c gdb-6.8cvs20080219/gdb/ada-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/ada-lang.c 2008-02-14 23:03:56.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/ada-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -11012,6 +11012,7 @@ const struct language_defn ada_language_ + ada_language_arch_info, + ada_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/c-lang.c gdb-6.8cvs20080219/gdb/c-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/c-lang.c 2008-02-14 23:03:56.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/c-lang.c 2008-02-22 17:01:17.000000000 +0100 +@@ -427,6 +427,7 @@ const struct language_defn c_language_de + c_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +@@ -540,6 +541,7 @@ const struct language_defn cplus_languag + cplus_language_arch_info, + default_print_array_index, + cp_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +@@ -575,6 +577,7 @@ const struct language_defn asm_language_ + c_language_arch_info, /* FIXME: la_language_arch_info. */ + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +@@ -615,6 +618,7 @@ const struct language_defn minimal_langu + c_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2block.c gdb-6.8cvs20080219/gdb/dwarf2block.c +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2block.c 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2block.c 2008-02-22 16:49:35.000000000 +0100 +@@ -0,0 +1,153 @@ ++/* DWARF DW_FORM_block* expression evaluation. ++ ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#include "defs.h" ++#include "dwarf2block.h" ++#include "gdbcore.h" ++#include "dwarf2expr.h" ++#include "exceptions.h" ++ ++/* This is the baton used when performing dwarf2 DW_BLOCK evaluation. */ ++struct dwarf_block_baton ++{ ++ CORE_ADDR address; ++}; ++ ++/* Read memory at ADDR (length LEN) into BUF. */ ++ ++static void ++dwarf_block_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len) ++{ ++ read_memory (addr, buf, len); ++} ++ ++static CORE_ADDR ++dwarf_block_object_address (void *baton) ++{ ++ struct dwarf_block_baton *debaton = baton; ++ ++ /* The message is suppressed in DWARF_BLOCK_EXEC. */ ++ if (debaton->address == 0) ++ error (_("Cannot resolve DW_OP_push_object_address for a missing object")); ++ ++ return debaton->address; ++} ++ ++static CORE_ADDR ++dwarf_block_read_reg (void *baton, int regnum) ++{ ++ error (_("Unsupported operation for DW_FORM_block*: %s"), "read_reg"); ++ return 0; ++} ++ ++static void ++dwarf_block_get_frame_base (void *baton, gdb_byte **start, size_t *length) ++{ ++ error (_("Unsupported operation for DW_FORM_block*: %s"), "get_frame_base"); ++} ++ ++static CORE_ADDR ++dwarf_block_get_tls_address (void *baton, CORE_ADDR offset) ++{ ++ error (_("Unsupported operation for DW_FORM_block*: %s"), "get_tls_address"); ++ return 0; ++} ++ ++static CORE_ADDR dwarf_block_exec_core (struct dwarf_block *dwarf_block, ++ CORE_ADDR address) ++{ ++ struct dwarf_expr_context *ctx; ++ struct dwarf_block_baton baton; ++ struct cleanup *back_to; ++ CORE_ADDR retval; ++ ++ back_to = make_cleanup (null_cleanup, 0); ++ ++ baton.address = address; ++ ++ ctx = new_dwarf_expr_context (); ++ back_to = make_cleanup ((make_cleanup_ftype *) free_dwarf_expr_context, ctx); ++ ctx->baton = &baton; ++ ctx->read_mem = dwarf_block_read_mem; ++ ctx->get_object_address = dwarf_block_object_address; ++ ctx->read_reg = dwarf_block_read_reg; ++ ctx->get_frame_base = dwarf_block_get_frame_base; ++ ctx->get_tls_address = dwarf_block_get_tls_address; ++ ++ dwarf_expr_eval (ctx, dwarf_block->data, dwarf_block->size); ++ ++ if (ctx->num_pieces > 0) ++ error (_("DW_OP_piece is an unsupported result for DW_FORM_block*")); ++ if (ctx->in_reg) ++ error (_("DW_OP_reg* is an unsupported result for DW_FORM_block*")); ++ ++ retval = dwarf_expr_fetch (ctx, 0); ++ ++ do_cleanups (back_to); ++ ++ return retval; ++} ++ ++static CORE_ADDR object_address; ++ ++static void ++object_address_cleanup (void *prev_save_voidp) ++{ ++ CORE_ADDR *prev_save = prev_save_voidp; ++ ++ object_address = *prev_save; ++ xfree (prev_save); ++} ++ ++void ++object_address_set (CORE_ADDR address) ++{ ++ CORE_ADDR *prev_save; ++ ++ prev_save = xmalloc (sizeof *prev_save); ++ *prev_save = object_address; ++ make_cleanup (object_address_cleanup, prev_save); ++ ++ object_address = address; ++} ++ ++CORE_ADDR ++object_address_get (void) ++{ ++ return object_address; ++} ++ ++CORE_ADDR dwarf_block_exec (struct dwarf_block *dwarf_block) ++{ ++ volatile struct gdb_exception e; ++ volatile CORE_ADDR retval = 0; ++ ++ TRY_CATCH (e, RETURN_MASK_ERROR) ++ { ++ retval = dwarf_block_exec_core (dwarf_block, object_address); ++ } ++ /* CATCH_ERRORS would print the possible error message of ++ DWARF_BLOCK_OBJECT_ADDRESS. Sometimes it is valid as CHECK_TYPEDEF is ++ a very common call even if we still do not know any variable instance of ++ that type. We cannot fill in the right TYPE_LENGTH at that time. */ ++ if (e.reason < 0) ++ return 0; ++ ++ return retval; ++} +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2block.h gdb-6.8cvs20080219/gdb/dwarf2block.h +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2block.h 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2block.h 2008-02-22 16:49:35.000000000 +0100 +@@ -0,0 +1,36 @@ ++/* DWARF DW_FORM_block* expression evaluation. ++ ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#if !defined (DWARF2BLOCK_H) ++#define DWARF2BLOCK_H 1 ++ ++/* Blocks are a bunch of untyped bytes. */ ++struct dwarf_block ++ { ++ unsigned int size; ++ gdb_byte *data; ++ }; ++ ++extern CORE_ADDR dwarf_block_exec (struct dwarf_block *dwarf_block); ++ ++extern void object_address_set (CORE_ADDR address); ++ ++extern CORE_ADDR object_address_get (void); ++ ++#endif /* !defined(DWARF2BLOCK_H) */ +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2expr.c gdb-6.8cvs20080219/gdb/dwarf2expr.c +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2expr.c 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2expr.c 2008-02-22 16:49:35.000000000 +0100 +@@ -750,6 +750,13 @@ execute_stack_op (struct dwarf_expr_cont + ctx->initialized = 0; + goto no_push; + ++ case DW_OP_push_object_address: ++ if (ctx->get_object_address == NULL) ++ error (_("DWARF-2 expression error: DW_OP_push_object_address must " ++ "have a value to push.")); ++ result = (ctx->get_object_address) (ctx->baton); ++ break; ++ + default: + error (_("Unhandled dwarf expression opcode 0x%x"), op); + } +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2expr.h gdb-6.8cvs20080219/gdb/dwarf2expr.h +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2expr.h 2008-01-02 00:03:54.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2expr.h 2008-02-22 16:49:35.000000000 +0100 +@@ -61,10 +61,10 @@ struct dwarf_expr_context + The result must be live until the current expression evaluation + is complete. */ + unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length); ++#endif + + /* Return the `object address' for DW_OP_push_object_address. */ + CORE_ADDR (*get_object_address) (void *baton); +-#endif + + /* The current depth of dwarf expression recursion, via DW_OP_call*, + DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2loc.c gdb-6.8cvs20080219/gdb/dwarf2loc.c +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2loc.c 2008-01-02 00:03:54.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2loc.c 2008-02-22 16:49:35.000000000 +0100 +@@ -35,6 +35,7 @@ + #include "elf/dwarf2.h" + #include "dwarf2expr.h" + #include "dwarf2loc.h" ++#include "dwarf2block.h" + + #include "gdb_string.h" + #include "gdb_assert.h" +@@ -252,6 +253,9 @@ dwarf2_evaluate_loc_desc (struct symbol + { + CORE_ADDR address = dwarf_expr_fetch (ctx, 0); + ++ /* ADDR is set here for ALLOCATE_VALUE's CHECK_TYPEDEF for ++ DW_OP_push_object_address. */ ++ object_address_set (address); + retval = allocate_value (SYMBOL_TYPE (var)); + VALUE_LVAL (retval) = lval_memory; + set_value_lazy (retval, 1); +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/dwarf2read.c gdb-6.8cvs20080219/gdb/dwarf2read.c +--- gdb-6.8cvs20080219-fortranless/gdb/dwarf2read.c 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/dwarf2read.c 2008-02-22 16:59:22.000000000 +0100 +@@ -46,6 +46,8 @@ + #include "top.h" + #include "command.h" + #include "gdbcmd.h" ++#include "dwarf2block.h" ++#include "f-lang.h" + + #include + #include "gdb_string.h" +@@ -563,13 +565,6 @@ struct function_range + #define DW_SND(attr) ((attr)->u.snd) + #define DW_ADDR(attr) ((attr)->u.addr) + +-/* Blocks are a bunch of untyped bytes. */ +-struct dwarf_block +- { +- unsigned int size; +- gdb_byte *data; +- }; +- + #ifndef ATTR_ALLOC_CHUNK + #define ATTR_ALLOC_CHUNK 4 + #endif +@@ -1004,7 +999,14 @@ static void store_in_ref_table (unsigned + static unsigned int dwarf2_get_ref_die_offset (struct attribute *, + struct dwarf2_cu *); + +-static int dwarf2_get_attr_constant_value (struct attribute *, int); ++enum dwarf2_get_attr_constant_value ++ { ++ dwarf2_attr_unknown, ++ dwarf2_attr_const, ++ dwarf2_attr_block ++ }; ++static enum dwarf2_get_attr_constant_value dwarf2_get_attr_constant_value ++ (struct attribute *attr, int *val_return); + + static struct die_info *follow_die_ref (struct die_info *, + struct attribute *, +@@ -4383,6 +4385,56 @@ process_enumeration_scope (struct die_in + new_symbol (die, die->type, cu); + } + ++static void ++fortran_array_update (struct fortran_array_type **fortran_array_pointer, ++ struct die_info *die, struct dwarf2_cu *cu, ++ int read_data_location, struct type *memory_owner) ++{ ++ struct fortran_array_type *p; ++ struct fortran_array_type fortran_array_local; ++ /* Used only for checking if FORTRAN_ARRAY is non-zero. */ ++ static struct fortran_array_type fortran_array_zero; ++ struct attribute *attr; ++ ++ /* Prepare FORTRAN_ARRAY_POINTER. It needs to be present in all the subarray ++ types and in all the range types at least for ++ TYPE_VERIFY_VALID_ARRAY_OBJECT. */ ++ ++ if (*fortran_array_pointer != NULL) ++ p = *fortran_array_pointer; ++ else ++ { ++ memset (&fortran_array_local, 0, sizeof fortran_array_local); ++ p = &fortran_array_local; ++ } ++ ++ if (read_data_location) ++ { ++ attr = dwarf2_attr (die, DW_AT_data_location, cu); ++ if (attr) ++ p->data_location = DW_BLOCK (attr); ++ } ++ ++ attr = dwarf2_attr (die, DW_AT_allocated, cu); ++ if (attr) ++ p->allocated = DW_BLOCK (attr); ++ ++ attr = dwarf2_attr (die, DW_AT_associated, cu); ++ if (attr) ++ p->associated = DW_BLOCK (attr); ++ ++ if (p != &fortran_array_local) ++ {} ++ else if (memcmp (p, &fortran_array_zero, sizeof *p) == 0) ++ *fortran_array_pointer = NULL; ++ else ++ { ++ *fortran_array_pointer = TYPE_ALLOC (memory_owner, ++ sizeof **fortran_array_pointer); ++ **fortran_array_pointer = fortran_array_local; ++ } ++} ++ + /* Extract all information from a DW_TAG_array_type DIE and put it in + the DIE's type field. For now, this only handles one dimensional + arrays. */ +@@ -4399,6 +4451,7 @@ read_array_type (struct die_info *die, s + int ndim = 0; + struct cleanup *back_to; + char *name; ++ struct fortran_array_type *fortran_array; + + /* Return if we've already decoded this type. */ + if (die->type) +@@ -4408,6 +4461,13 @@ read_array_type (struct die_info *die, s + + element_type = die_type (die, cu); + ++ /* Prepare FORTRAN_ARRAY_POINTER. It needs to be present in all the subarray ++ types and in all the range types at least for ++ TYPE_VERIFY_VALID_ARRAY_OBJECT. */ ++ ++ fortran_array = NULL; ++ fortran_array_update (&fortran_array, die, cu, 1, element_type); ++ + /* Irix 6.2 native cc creates array types without children for + arrays with unspecified length. */ + if (die->child == NULL) +@@ -4416,6 +4476,9 @@ read_array_type (struct die_info *die, s + range_type = create_range_type (NULL, index_type, 0, -1); + set_die_type (die, create_array_type (NULL, element_type, range_type), + cu); ++ ++ TYPE_FORTRAN_ARRAY (range_type) = fortran_array; ++ TYPE_FORTRAN_ARRAY (die->type) = fortran_array; + return; + } + +@@ -4452,14 +4515,31 @@ read_array_type (struct die_info *die, s + + if (read_array_order (die, cu) == DW_ORD_col_major) + { +- int i = 0; +- while (i < ndim) +- type = create_array_type (NULL, type, range_types[i++]); ++ int i; ++ for (i = 0; i < ndim; i++) ++ { ++ type = create_array_type (NULL, type, range_types[i]); ++ TYPE_FORTRAN_ARRAY (range_types[i]) = fortran_array; ++ TYPE_FORTRAN_ARRAY (type) = fortran_array; ++ TYPE_ARRAY_UPPER_BOUND_TYPE (type) = ++ TYPE_ARRAY_UPPER_BOUND_TYPE (range_types[i]); ++ TYPE_ARRAY_LOWER_BOUND_TYPE (type) = ++ TYPE_ARRAY_LOWER_BOUND_TYPE (range_types[i]); ++ } + } + else + { +- while (ndim-- > 0) +- type = create_array_type (NULL, type, range_types[ndim]); ++ int i; ++ for (i = ndim - 1; i >= 0; i--) ++ { ++ type = create_array_type (NULL, type, range_types[i]); ++ TYPE_FORTRAN_ARRAY (range_types[i]) = fortran_array; ++ TYPE_FORTRAN_ARRAY (type) = fortran_array; ++ TYPE_ARRAY_UPPER_BOUND_TYPE (type) = ++ TYPE_ARRAY_UPPER_BOUND_TYPE (range_types[i]); ++ TYPE_ARRAY_LOWER_BOUND_TYPE (type) = ++ TYPE_ARRAY_LOWER_BOUND_TYPE (range_types[i]); ++ } + } + + /* Understand Dwarf2 support for vector types (like they occur on +@@ -4679,13 +4759,25 @@ read_tag_pointer_type (struct die_info * + struct attribute *attr_byte_size; + struct attribute *attr_address_class; + int byte_size, addr_class; ++ struct type *target_type; + + if (die->type) + { + return; + } + +- type = lookup_pointer_type (die_type (die, cu)); ++ target_type = die_type (die, cu); ++ ++ /* Intel Fortran Compiler 10.1.008 puts DW_AT_associated into ++ DW_TAG_pointer_type pointing to its target DW_TAG_array_type. ++ GDB supports DW_AT_associated and DW_AT_allocated only for the ++ DW_TAG_array_type tags. */ ++ if (TYPE_CODE (target_type) == TYPE_CODE_ARRAY ++ && TYPE_FORTRAN_ARRAY (target_type) != NULL) ++ fortran_array_update (&TYPE_FORTRAN_ARRAY (target_type), die, cu, 0, ++ target_type); ++ ++ type = lookup_pointer_type (target_type); + + attr_byte_size = dwarf2_attr (die, DW_AT_byte_size, cu); + if (attr_byte_size) +@@ -5048,9 +5140,9 @@ read_subrange_type (struct die_info *die + { + struct type *base_type; + struct type *range_type; +- struct attribute *attr; +- int low = 0; +- int high = -1; ++ struct attribute *attr, *byte_stride_attr; ++ int low, high, byte_stride_int; ++ enum dwarf2_get_attr_constant_value high_type, byte_stride_type; + char *name; + + /* If we have already decoded this die, then nothing more to do. */ +@@ -5067,42 +5159,99 @@ read_subrange_type (struct die_info *die + 0, NULL, cu->objfile); + } + +- if (cu->language == language_fortran) +- { +- /* FORTRAN implies a lower bound of 1, if not given. */ +- low = 1; +- } ++ /* DW_AT_bit_stride is unsupported as if it would be non-constant we would ++ have to wrap it by the division by 8 or provide another value type etc. */ ++ byte_stride_attr = dwarf2_attr (die, DW_AT_byte_stride, cu); ++ byte_stride_type = dwarf2_get_attr_constant_value (byte_stride_attr, ++ &byte_stride_int); ++ ++ range_type = create_range_type_nfields ++ (NULL, base_type, byte_stride_type == dwarf2_attr_unknown ? 2 : 3); + +- /* FIXME: For variable sized arrays either of these could be +- a variable rather than a constant value. We'll allow it, +- but we don't know how to handle it. */ + attr = dwarf2_attr (die, DW_AT_lower_bound, cu); +- if (attr) +- low = dwarf2_get_attr_constant_value (attr, 0); ++ switch (dwarf2_get_attr_constant_value (attr, &low)) ++ { ++ case dwarf2_attr_unknown: ++ if (cu->language == language_fortran) ++ { ++ /* FORTRAN implies a lower bound of 1, if not given. */ ++ low = 1; ++ } ++ else ++ { ++ /* According to DWARF3 we should assume the value 0 only for ++ LANGUAGE_C and LANGUAGE_CPLUS. */ ++ low = 0; ++ } ++ /* PASSTHRU */ ++ case dwarf2_attr_const: ++ TYPE_LOW_BOUND_RAW (range_type) = low; ++ if (low >= 0) ++ TYPE_FLAGS (range_type) |= TYPE_FLAG_UNSIGNED; ++ break; ++ case dwarf2_attr_block: ++ TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, 0) ++ |= TYPE_BOUND_IS_DWARF_BLOCK_MASK; ++ TYPE_FIELD_DWARF_BLOCK (range_type, 0) = DW_BLOCK (attr); ++ /* For auto-detection of possibly missing DW_AT_upper_bound. */ ++ low = 0; ++ break; ++ } + + attr = dwarf2_attr (die, DW_AT_upper_bound, cu); +- if (attr) +- { +- if (attr->form == DW_FORM_block1) +- { +- /* GCC encodes arrays with unspecified or dynamic length +- with a DW_FORM_block1 attribute. +- FIXME: GDB does not yet know how to handle dynamic +- arrays properly, treat them as arrays with unspecified +- length for now. +- +- FIXME: jimb/2003-09-22: GDB does not really know +- how to handle arrays of unspecified length +- either; we just represent them as zero-length +- arrays. Choose an appropriate upper bound given +- the lower bound we've computed above. */ +- high = low - 1; +- } +- else +- high = dwarf2_get_attr_constant_value (attr, 1); ++ high_type = dwarf2_get_attr_constant_value (attr, &high); ++ if (high_type == dwarf2_attr_unknown) ++ { ++ int count; ++ ++ attr = dwarf2_attr (die, DW_AT_count, cu); ++ high_type = dwarf2_get_attr_constant_value (attr, &count); ++ switch (high_type) ++ { ++ case dwarf2_attr_unknown: ++ break; ++ case dwarf2_attr_const: ++ /* We do not handle LOW being set as DW_BLOCK here. */ ++ high = low + count - 1; ++ /* PASSTHRU */ ++ case dwarf2_attr_block: ++ TYPE_HIGH_BOUND_IS_COUNT_VAR (range_type) ++ |= TYPE_HIGH_BOUND_IS_COUNT_MASK; ++ break; ++ } ++ } ++ switch (high_type) ++ { ++ case dwarf2_attr_unknown: ++ /* It needs to get propagated to he array type owning us. */ ++ TYPE_ARRAY_UPPER_BOUND_TYPE (range_type) = BOUND_CANNOT_BE_DETERMINED; ++ high = low - 1; ++ /* PASSTHRU */ ++ case dwarf2_attr_const: ++ TYPE_HIGH_BOUND_RAW (range_type) = high; ++ break; ++ case dwarf2_attr_block: ++ TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, 1) ++ |= TYPE_BOUND_IS_DWARF_BLOCK_MASK; ++ TYPE_FIELD_DWARF_BLOCK (range_type, 1) = DW_BLOCK (attr); ++ break; + } + +- range_type = create_range_type (NULL, base_type, low, high); ++ switch (byte_stride_type) ++ { ++ case dwarf2_attr_unknown: ++ break; ++ case dwarf2_attr_const: ++ if (byte_stride_int == 0) ++ warning (_("Found DW_AT_byte_stride with unsupported value 0")); ++ TYPE_HIGH_BOUND_RAW (range_type) = byte_stride_int; ++ break; ++ case dwarf2_attr_block: ++ TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, 2) ++ |= TYPE_BOUND_IS_DWARF_BLOCK_MASK; ++ TYPE_FIELD_DWARF_BLOCK (range_type, 2) = DW_BLOCK (byte_stride_attr); ++ break; ++ } + + name = dwarf2_name (die, cu); + if (name) +@@ -9058,26 +9207,35 @@ dwarf2_get_ref_die_offset (struct attrib + return result; + } + +-/* Return the constant value held by the given attribute. Return -1 +- if the value held by the attribute is not constant. */ ++/* *VAL_RETURN is filled only for DWARF2_ATTR_CONST. */ + +-static int +-dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) ++static enum dwarf2_get_attr_constant_value ++dwarf2_get_attr_constant_value (struct attribute *attr, int *val_return) + { ++ if (attr == NULL) ++ return dwarf2_attr_unknown; + if (attr->form == DW_FORM_sdata) +- return DW_SND (attr); +- else if (attr->form == DW_FORM_udata +- || attr->form == DW_FORM_data1 +- || attr->form == DW_FORM_data2 +- || attr->form == DW_FORM_data4 +- || attr->form == DW_FORM_data8) +- return DW_UNSND (attr); +- else + { +- complaint (&symfile_complaints, _("Attribute value is not a constant (%s)"), +- dwarf_form_name (attr->form)); +- return default_value; ++ *val_return = DW_SND (attr); ++ return dwarf2_attr_const; ++ } ++ if (attr->form == DW_FORM_udata ++ || attr->form == DW_FORM_data1 ++ || attr->form == DW_FORM_data2 ++ || attr->form == DW_FORM_data4 ++ || attr->form == DW_FORM_data8) ++ { ++ *val_return = DW_UNSND (attr); ++ return dwarf2_attr_const; + } ++ if (attr->form == DW_FORM_block ++ || attr->form == DW_FORM_block1 ++ || attr->form == DW_FORM_block2 ++ || attr->form == DW_FORM_block4) ++ return dwarf2_attr_block; ++ complaint (&symfile_complaints, _("Attribute value is not a constant (%s)"), ++ dwarf_form_name (attr->form)); ++ return dwarf2_attr_unknown; + } + + static struct die_info * +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/eval.c gdb-6.8cvs20080219/gdb/eval.c +--- gdb-6.8cvs20080219-fortranless/gdb/eval.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/eval.c 2008-02-22 16:59:22.000000000 +0100 +@@ -1643,9 +1643,12 @@ evaluate_subexp_standard (struct type *e + { + int subscript_array[MAX_FORTRAN_DIMS]; + int array_size_array[MAX_FORTRAN_DIMS]; ++ int byte_stride_array[MAX_FORTRAN_DIMS]; + int ndimensions = 1, i; + struct type *tmp_type; + int offset_item; /* The array offset where the item lives */ ++ CORE_ADDR offset_byte; /* byte_stride based offset */ ++ unsigned element_size; + + if (nargs > MAX_FORTRAN_DIMS) + error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); +@@ -1682,6 +1685,9 @@ evaluate_subexp_standard (struct type *e + if (retcode == BOUND_FETCH_ERROR) + error (_("Cannot obtain dynamic lower bound")); + ++ byte_stride_array[nargs - i - 1] = ++ TYPE_ARRAY_BYTE_STRIDE_VALUE (tmp_type); ++ + array_size_array[nargs - i - 1] = upper - lower + 1; + + /* Zero-normalize subscripts so that offsetting will work. */ +@@ -1702,11 +1708,22 @@ evaluate_subexp_standard (struct type *e + + /* Now let us calculate the offset for this item */ + +- offset_item = subscript_array[ndimensions - 1]; ++ offset_item = 0; ++ offset_byte = 0; ++ ++ for (i = ndimensions - 1; i >= 0; --i) ++ { ++ offset_item *= array_size_array[i]; ++ if (byte_stride_array[i] == 0) ++ offset_item += subscript_array[i]; ++ else ++ offset_byte += subscript_array[i] * byte_stride_array[i]; ++ } + +- for (i = ndimensions - 1; i > 0; --i) +- offset_item = +- array_size_array[i - 1] * offset_item + subscript_array[i - 1]; ++ element_size = TYPE_LENGTH (TYPE_TARGET_TYPE (tmp_type)); ++ if (offset_byte % element_size != 0) ++ warning (_("Fortran array stride not divisible by the element size")); ++ offset_item += offset_byte / element_size; + + /* Construct a value node with the value of the offset */ + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/f-lang.c gdb-6.8cvs20080219/gdb/f-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/f-lang.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/f-lang.c 2008-02-22 16:59:22.000000000 +0100 +@@ -31,6 +31,7 @@ + #include "f-lang.h" + #include "valprint.h" + #include "value.h" ++#include "dwarf2block.h" + + + /* Following is dubious stuff that had been in the xcoff reader. */ +@@ -222,6 +223,29 @@ f_printstr (struct ui_file *stream, cons + if (force_ellipses || i < length) + fputs_filtered ("...", stream); + } ++ ++static int ++f_value_address_get (struct type *type, CORE_ADDR *address_return) ++{ ++ if (f_type_object_valid_query (type) != NULL) ++ { ++ /* Do not try to evaluate DW_AT_data_location as it may even crash ++ (it would just return the value zero in the gfortran case). */ ++ return 0; ++ } ++ ++ /* Accelerated codepath. */ ++ if (address_return == NULL) ++ return 1; ++ ++ if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_FORTRAN_ARRAY (type) != NULL) ++ { ++ if (TYPE_FORTRAN_ARRAY_DATA_LOCATION (type) != NULL) ++ *address_return = dwarf_block_exec (TYPE_FORTRAN_ARRAY_DATA_LOCATION (type)); ++ } ++ ++ return 1; ++} + + + /* Table of operators and their precedences for printing expressions. */ +@@ -337,6 +361,7 @@ const struct language_defn f_language_de + f_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ f_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/f-lang.h gdb-6.8cvs20080219/gdb/f-lang.h +--- gdb-6.8cvs20080219-fortranless/gdb/f-lang.h 2008-01-02 00:03:54.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/f-lang.h 2008-02-22 16:59:22.000000000 +0100 +@@ -28,6 +28,11 @@ extern void f_error (char *); /* Defined + extern void f_print_type (struct type *, char *, struct ui_file *, int, + int); + ++extern const char *f_type_object_valid_query (struct type *type); ++extern const char *f_type_object_valid_to_stream (struct type *type, ++ struct ui_file *stream); ++extern void f_type_object_valid_error (struct type *type); ++ + extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); +@@ -47,6 +52,32 @@ enum f90_range_type + NONE_BOUND_DEFAULT /* "(low:high)" */ + }; + ++/* GNU Fortran specific - for TYPE_FORTRAN_ARRAY. ++ All the DWARF_BLOCK fields are passed for execution to DWARF_BLOCK_EXEC. */ ++ ++struct fortran_array_type ++{ ++ /* For DW_AT_data_location. This entry is more appropriate for generic ++ MAIN_TYPE but we save the MAIN_TYPE size as it is in practice not present ++ for the other types. */ ++ struct dwarf_block *data_location; ++ ++ /* For DW_AT_allocated. */ ++ struct dwarf_block *allocated; ++ ++ /* For DW_AT_associated. */ ++ struct dwarf_block *associated; ++}; ++ ++/* Be sure to check `TYPE_CODE (thistype) == TYPE_CODE_ARRAY ++ && TYPE_FORTRAN_ARRAY (thistype) != NULL'. */ ++#define TYPE_FORTRAN_ARRAY_DATA_LOCATION(thistype) \ ++ TYPE_FORTRAN_ARRAY (thistype)->data_location ++#define TYPE_FORTRAN_ARRAY_ALLOCATED(thistype) \ ++ TYPE_FORTRAN_ARRAY (thistype)->allocated ++#define TYPE_FORTRAN_ARRAY_ASSOCIATED(thistype) \ ++ TYPE_FORTRAN_ARRAY (thistype)->associated ++ + struct common_entry + { + struct symbol *symbol; /* The symbol node corresponding +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/f-typeprint.c gdb-6.8cvs20080219/gdb/f-typeprint.c +--- gdb-6.8cvs20080219-fortranless/gdb/f-typeprint.c 2008-01-02 00:03:54.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/f-typeprint.c 2008-02-22 16:59:22.000000000 +0100 +@@ -31,6 +31,7 @@ + #include "gdbcore.h" + #include "target.h" + #include "f-lang.h" ++#include "dwarf2block.h" + + #include "gdb_string.h" + #include +@@ -39,7 +40,7 @@ + static void f_type_print_args (struct type *, struct ui_file *); + #endif + +-static void f_type_print_varspec_suffix (struct type *, struct ui_file *, ++static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int, + int, int, int); + + void f_type_print_varspec_prefix (struct type *, struct ui_file *, +@@ -48,6 +49,50 @@ void f_type_print_varspec_prefix (struct + void f_type_print_base (struct type *, struct ui_file *, int, int); + + ++const char * ++f_type_object_valid_query (struct type *type) ++{ ++ if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_FORTRAN_ARRAY (type) != NULL) ++ { ++ /* DW_AT_associated has a preference over DW_AT_allocated. */ ++ if (TYPE_FORTRAN_ARRAY_ASSOCIATED (type) != NULL ++ && !dwarf_block_exec (TYPE_FORTRAN_ARRAY_ASSOCIATED (type))) ++ return N_("the array is not associated"); ++ ++ if (TYPE_FORTRAN_ARRAY_ALLOCATED (type) != NULL ++ && !dwarf_block_exec (TYPE_FORTRAN_ARRAY_ALLOCATED (type))) ++ return N_("the array is not allocated"); ++ } ++ return NULL; ++} ++ ++const char * ++f_type_object_valid_to_stream (struct type *type, struct ui_file *stream) ++{ ++ const char *msg; ++ ++ msg = f_type_object_valid_query (type); ++ if (msg != NULL) ++ { ++ /* Assuming the content printed to STREAM should not be localized. */ ++ fprintf_filtered (stream, "<%s>", msg); ++ } ++ ++ return msg; ++} ++ ++void ++f_type_object_valid_error (struct type *type) ++{ ++ const char *msg; ++ ++ msg = f_type_object_valid_query (type); ++ if (msg != NULL) ++ { ++ error (_("Unable to access the object because %s."), _(msg)); ++ } ++} ++ + /* LEVEL is the depth to indent lines by. */ + + void +@@ -57,6 +102,9 @@ f_print_type (struct type *type, char *v + enum type_code code; + int demangled_args; + ++ if (f_type_object_valid_to_stream (type, stream) != NULL) ++ return; ++ + f_type_print_base (type, stream, show, level); + code = TYPE_CODE (type); + if ((varstring != NULL && *varstring != '\0') +@@ -78,7 +126,7 @@ f_print_type (struct type *type, char *v + so don't print an additional pair of ()'s */ + + demangled_args = varstring[strlen (varstring) - 1] == ')'; +- f_type_print_varspec_suffix (type, stream, show, 0, demangled_args); ++ f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0); + } + + /* Print any asterisks or open-parentheses needed before the +@@ -147,12 +195,14 @@ f_type_print_varspec_prefix (struct type + + static void + f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +- int show, int passed_a_ptr, int demangled_args) ++ int show, int passed_a_ptr, int demangled_args, ++ int arrayprint_recurse_level) + { + int upper_bound, lower_bound; + int lower_bound_was_default = 0; +- static int arrayprint_recurse_level = 0; + int retcode; ++ /* No static variables (such as ARRAYPRINT_RECURSE_LEVEL) permitted as ERROR ++ may occur during the evaluation of DWARF_BLOCK values. */ + + if (type == 0) + return; +@@ -171,7 +221,8 @@ f_type_print_varspec_suffix (struct type + fprintf_filtered (stream, "("); + + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) +- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0); ++ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, ++ arrayprint_recurse_level); + + retcode = f77_get_dynamic_lowerbound (type, &lower_bound); + +@@ -205,7 +256,8 @@ f_type_print_varspec_suffix (struct type + } + + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) +- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0); ++ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, ++ arrayprint_recurse_level); + if (arrayprint_recurse_level == 1) + fprintf_filtered (stream, ")"); + else +@@ -215,13 +267,14 @@ f_type_print_varspec_suffix (struct type + + case TYPE_CODE_PTR: + case TYPE_CODE_REF: +- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0); ++ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0, ++ arrayprint_recurse_level); + fprintf_filtered (stream, ")"); + break; + + case TYPE_CODE_FUNC: + f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, +- passed_a_ptr, 0); ++ passed_a_ptr, 0, arrayprint_recurse_level); + if (passed_a_ptr) + fprintf_filtered (stream, ")"); + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/f-valprint.c gdb-6.8cvs20080219/gdb/f-valprint.c +--- gdb-6.8cvs20080219-fortranless/gdb/f-valprint.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/f-valprint.c 2008-02-22 16:59:22.000000000 +0100 +@@ -54,11 +54,11 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM + /* The following macro gives us the size of the nth dimension, Where + n is 1 based. */ + +-#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1]) ++#define F77_DIM_COUNT(n) (f77_array_offset_tbl[n][1]) + +-/* The following gives us the offset for row n where n is 1-based. */ ++/* The following gives us the element size for row n where n is 1-based. */ + +-#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0]) ++#define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) + + int + f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) +@@ -67,6 +67,8 @@ f77_get_dynamic_lowerbound (struct type + CORE_ADDR current_frame_addr; + CORE_ADDR ptr_to_lower_bound; + ++ f_type_object_valid_error (type); ++ + switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type)) + { + case BOUND_BY_VALUE_ON_STACK: +@@ -128,6 +130,8 @@ f77_get_dynamic_upperbound (struct type + CORE_ADDR current_frame_addr = 0; + CORE_ADDR ptr_to_upper_bound; + ++ f_type_object_valid_error (type); ++ + switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type)) + { + case BOUND_BY_VALUE_ON_STACK: +@@ -250,24 +254,29 @@ f77_create_arrayprint_offset_tbl (struct + if (retcode == BOUND_FETCH_ERROR) + error (_("Cannot obtain dynamic lower bound")); + +- F77_DIM_SIZE (ndimen) = upper - lower + 1; ++ F77_DIM_COUNT (ndimen) = upper - lower + 1; ++ ++ F77_DIM_BYTE_STRIDE (ndimen) = ++ TYPE_ARRAY_BYTE_STRIDE_VALUE (tmp_type); + + tmp_type = TYPE_TARGET_TYPE (tmp_type); + ndimen++; + } + +- /* Now we multiply eltlen by all the offsets, so that later we ++ /* Now we multiply eltlen by all the BYTE_STRIDEs, so that later we + can print out array elements correctly. Up till now we +- know an offset to apply to get the item but we also ++ know an eltlen to apply to get the item but we also + have to know how much to add to get to the next item */ + + ndimen--; + eltlen = TYPE_LENGTH (tmp_type); +- F77_DIM_OFFSET (ndimen) = eltlen; ++ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) ++ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; + while (--ndimen > 0) + { +- eltlen *= F77_DIM_SIZE (ndimen + 1); +- F77_DIM_OFFSET (ndimen) = eltlen; ++ eltlen *= F77_DIM_COUNT (ndimen + 1); ++ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) ++ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; + } + } + +@@ -287,33 +296,33 @@ f77_print_array_1 (int nss, int ndimensi + + if (nss != ndimensions) + { +- for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++) ++ for (i = 0; (i < F77_DIM_COUNT (nss) && (*elts) < print_max); i++) + { + fprintf_filtered (stream, "( "); + f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), +- valaddr + i * F77_DIM_OFFSET (nss), +- address + i * F77_DIM_OFFSET (nss), ++ valaddr + i * F77_DIM_BYTE_STRIDE (nss), ++ address + i * F77_DIM_BYTE_STRIDE (nss), + stream, format, deref_ref, recurse, pretty, elts); + fprintf_filtered (stream, ") "); + } +- if (*elts >= print_max && i < F77_DIM_SIZE (nss)) ++ if (*elts >= print_max && i < F77_DIM_COUNT (nss)) + fprintf_filtered (stream, "..."); + } + else + { +- for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < print_max; ++ for (i = 0; i < F77_DIM_COUNT (nss) && (*elts) < print_max; + i++, (*elts)++) + { + val_print (TYPE_TARGET_TYPE (type), +- valaddr + i * F77_DIM_OFFSET (ndimensions), ++ valaddr + i * F77_DIM_BYTE_STRIDE (ndimensions), + 0, +- address + i * F77_DIM_OFFSET (ndimensions), ++ address + i * F77_DIM_BYTE_STRIDE (ndimensions), + stream, format, deref_ref, recurse, pretty); + +- if (i != (F77_DIM_SIZE (nss) - 1)) ++ if (i != (F77_DIM_COUNT (nss) - 1)) + fprintf_filtered (stream, ", "); + +- if ((*elts == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1))) ++ if ((*elts == print_max - 1) && (i != (F77_DIM_COUNT (nss) - 1))) + fprintf_filtered (stream, "..."); + } + } +@@ -372,6 +381,9 @@ f_val_print (struct type *type, const gd + CORE_ADDR addr; + int index; + ++ if (f_type_object_valid_to_stream (type, stream) != NULL) ++ return 0; ++ + CHECK_TYPEDEF (type); + switch (TYPE_CODE (type)) + { +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/findvar.c gdb-6.8cvs20080219/gdb/findvar.c +--- gdb-6.8cvs20080219-fortranless/gdb/findvar.c 2008-01-02 00:03:54.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/findvar.c 2008-02-22 16:50:29.000000000 +0100 +@@ -34,6 +34,7 @@ + #include "regcache.h" + #include "user-regs.h" + #include "block.h" ++#include "dwarf2block.h" + + /* Basic byte-swapping routines. GDB has needed these for a long time... + All extract a target-format integer at ADDR which is LEN bytes long. */ +@@ -370,24 +371,8 @@ symbol_read_needs_frame (struct symbol * + struct value * + read_var_value (struct symbol *var, struct frame_info *frame) + { +- struct value *v; + struct type *type = SYMBOL_TYPE (var); + CORE_ADDR addr; +- int len; +- +- if (SYMBOL_CLASS (var) == LOC_COMPUTED +- || SYMBOL_CLASS (var) == LOC_COMPUTED_ARG +- || SYMBOL_CLASS (var) == LOC_REGISTER +- || SYMBOL_CLASS (var) == LOC_REGPARM) +- /* These cases do not use V. */ +- v = NULL; +- else +- { +- v = allocate_value (type); +- VALUE_LVAL (v) = lval_memory; /* The most likely possibility. */ +- } +- +- len = TYPE_LENGTH (type); + + /* FIXME drow/2003-09-06: this call to the selected frame should be + pushed upwards to the callers. */ +@@ -397,31 +382,39 @@ read_var_value (struct symbol *var, stru + switch (SYMBOL_CLASS (var)) + { + case LOC_CONST: +- /* Put the constant back in target format. */ +- store_signed_integer (value_contents_raw (v), len, +- (LONGEST) SYMBOL_VALUE (var)); +- VALUE_LVAL (v) = not_lval; +- return v; ++ { ++ /* Put the constant back in target format. */ ++ struct value *v = allocate_value (type); ++ VALUE_LVAL (v) = not_lval; ++ store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type), ++ (LONGEST) SYMBOL_VALUE (var)); ++ return v; ++ } + + case LOC_LABEL: +- /* Put the constant back in target format. */ +- if (overlay_debugging) +- { +- CORE_ADDR addr +- = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), +- SYMBOL_BFD_SECTION (var)); +- store_typed_address (value_contents_raw (v), type, addr); +- } +- else +- store_typed_address (value_contents_raw (v), type, +- SYMBOL_VALUE_ADDRESS (var)); +- VALUE_LVAL (v) = not_lval; +- return v; ++ { ++ /* Put the constant back in target format. */ ++ struct value *v = allocate_value (type); ++ VALUE_LVAL (v) = not_lval; ++ if (overlay_debugging) ++ { ++ CORE_ADDR addr ++ = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), ++ SYMBOL_BFD_SECTION (var)); ++ store_typed_address (value_contents_raw (v), type, addr); ++ } ++ else ++ store_typed_address (value_contents_raw (v), type, ++ SYMBOL_VALUE_ADDRESS (var)); ++ return v; ++ } + + case LOC_CONST_BYTES: + { +- memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); ++ struct value *v = allocate_value (type); + VALUE_LVAL (v) = not_lval; ++ memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), ++ TYPE_LENGTH (type)); + return v; + } + +@@ -503,12 +496,23 @@ addresses have not been bound by the dyn + break; + + case LOC_BLOCK: +- if (overlay_debugging) +- VALUE_ADDRESS (v) = symbol_overlayed_address +- (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_BFD_SECTION (var)); +- else +- VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var)); +- return v; ++ { ++ CORE_ADDR addr; ++ struct value *v; ++ ++ if (overlay_debugging) ++ addr = symbol_overlayed_address ++ (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_BFD_SECTION (var)); ++ else ++ addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var)); ++ /* ADDR is set here for ALLOCATE_VALUE's CHECK_TYPEDEF for ++ DW_OP_push_object_address. */ ++ object_address_set (addr); ++ v = allocate_value (type); ++ VALUE_ADDRESS (v) = addr; ++ VALUE_LVAL (v) = lval_memory; ++ return v; ++ } + + case LOC_REGISTER: + case LOC_REGPARM: +@@ -532,7 +536,6 @@ addresses have not been bound by the dyn + error (_("Value of register variable not available.")); + + addr = value_as_address (regval); +- VALUE_LVAL (v) = lval_memory; + } + else + { +@@ -572,18 +575,33 @@ addresses have not been bound by the dyn + break; + + case LOC_OPTIMIZED_OUT: +- VALUE_LVAL (v) = not_lval; +- set_value_optimized_out (v, 1); +- return v; ++ { ++ struct value *v = allocate_value (type); ++ ++ VALUE_LVAL (v) = not_lval; ++ set_value_optimized_out (v, 1); ++ return v; ++ } + + default: + error (_("Cannot look up value of a botched symbol.")); + break; + } + +- VALUE_ADDRESS (v) = addr; +- set_value_lazy (v, 1); +- return v; ++ { ++ struct value *v; ++ ++ /* ADDR is set here for ALLOCATE_VALUE's CHECK_TYPEDEF for ++ DW_OP_push_object_address. */ ++ object_address_set (addr); ++ v = allocate_value (type); ++ VALUE_ADDRESS (v) = addr; ++ VALUE_LVAL (v) = lval_memory; ++ ++ set_value_lazy (v, 1); ++ ++ return v; ++ } + } + + /* Install default attributes for register values. */ +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/gdbtypes.c gdb-6.8cvs20080219/gdb/gdbtypes.c +--- gdb-6.8cvs20080219-fortranless/gdb/gdbtypes.c 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/gdbtypes.c 2008-02-22 16:58:30.000000000 +0100 +@@ -38,6 +38,7 @@ + #include "cp-abi.h" + #include "gdb_assert.h" + #include "hashtab.h" ++#include "dwarf2block.h" + + /* These variables point to the objects + representing the predefined C data types. */ +@@ -682,16 +683,21 @@ allocate_stub_method (struct type *type) + RESULT_TYPE, or creating a new type, inheriting the objfile from + INDEX_TYPE. + +- Indices will be of type INDEX_TYPE, and will range from LOW_BOUND +- to HIGH_BOUND, inclusive. ++ Indices will be of type INDEX_TYPE. NFIELDS should be 2 for standard ++ arrays, 3 for a custom TYPE_BYTE_STRIDE. Use CREATE_RANGE_TYPE for common ++ constant LOW_BOUND/HIGH_BOUND ranges. ++ ++ You must set TYPE_FLAG_UNSIGNED yourself as being done in CREATE_RANGE_TYPE. + + FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make + sure it is TYPE_CODE_UNDEF before we bash it into a range type? */ + + struct type * +-create_range_type (struct type *result_type, struct type *index_type, +- int low_bound, int high_bound) ++create_range_type_nfields (struct type *result_type, struct type *index_type, ++ int nfields) + { ++ int fieldno; ++ + if (result_type == NULL) + { + result_type = alloc_type (TYPE_OBJFILE (index_type)); +@@ -702,17 +708,33 @@ create_range_type (struct type *result_t + TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB; + else + TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type)); +- TYPE_NFIELDS (result_type) = 2; ++ TYPE_NFIELDS (result_type) = nfields; + TYPE_FIELDS (result_type) = (struct field *) +- TYPE_ALLOC (result_type, 2 * sizeof (struct field)); +- memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field)); +- TYPE_FIELD_BITPOS (result_type, 0) = low_bound; +- TYPE_FIELD_BITPOS (result_type, 1) = high_bound; ++ TYPE_ALLOC (result_type, ++ TYPE_NFIELDS (result_type) * sizeof (struct field)); ++ memset (TYPE_FIELDS (result_type), 0, ++ TYPE_NFIELDS (result_type) * sizeof (struct field)); ++ ++ return (result_type); ++} ++ ++/* Simplified CREATE_RANGE_TYPE_NFIELDS for constant ranges from LOW_BOUND to ++ HIGH_BOUND, inclusive. TYPE_BYTE_STRIDE is always set to zero (default ++ native target type length). */ ++ ++struct type * ++create_range_type (struct type *result_type, struct type *index_type, ++ int low_bound, int high_bound) ++{ ++ result_type = create_range_type_nfields (result_type, index_type, 2); ++ ++ TYPE_LOW_BOUND_RAW (result_type) = low_bound; ++ TYPE_HIGH_BOUND_RAW (result_type) = high_bound; + + if (low_bound >= 0) + TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED; + +- return (result_type); ++ return result_type; + } + + /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type +@@ -800,25 +822,23 @@ create_array_type (struct type *result_t + struct type *element_type, + struct type *range_type) + { +- LONGEST low_bound, high_bound; +- + if (result_type == NULL) + { + result_type = alloc_type (TYPE_OBJFILE (range_type)); + } + TYPE_CODE (result_type) = TYPE_CODE_ARRAY; + TYPE_TARGET_TYPE (result_type) = element_type; +- if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) +- low_bound = high_bound = 0; + CHECK_TYPEDEF (element_type); +- /* Be careful when setting the array length. Ada arrays can be +- empty arrays with the high_bound being smaller than the low_bound. +- In such cases, the array length should be zero. */ +- if (high_bound < low_bound) ++ /* Dynamically sized arrays cannot be computed now as we may have forward ++ DWARF references here. */ ++ if ((TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, 0) ++ & TYPE_BOUND_IS_DWARF_BLOCK_MASK) != 0 ++ && (TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, 1) ++ & TYPE_BOUND_IS_DWARF_BLOCK_MASK) != 0) + TYPE_LENGTH (result_type) = 0; + else +- TYPE_LENGTH (result_type) = +- TYPE_LENGTH (element_type) * (high_bound - low_bound + 1); ++ TYPE_LENGTH (result_type) = TYPE_LENGTH (element_type) ++ * TYPE_COUNT_BOUND (range_type); + TYPE_NFIELDS (result_type) = 1; + TYPE_FIELDS (result_type) = + (struct field *) TYPE_ALLOC (result_type, sizeof (struct field)); +@@ -1377,6 +1397,116 @@ stub_noname_complaint (void) + complaint (&symfile_complaints, _("stub type has NULL name")); + } + ++CORE_ADDR range_type_any_field_internal (struct type *range_type, int fieldno) ++{ ++ if ((TYPE_BOUND_IS_DWARF_BLOCK_VAR (range_type, fieldno) ++ & TYPE_BOUND_IS_DWARF_BLOCK_MASK) != 0) ++ return dwarf_block_exec (TYPE_FIELD_DWARF_BLOCK (range_type, fieldno)); ++ else ++ return TYPE_FIELD_BITPOS (range_type, (fieldno)); ++} ++ ++int ++range_type_high_bound_internal (struct type *range_type) ++{ ++ int raw_value = range_type_any_field_internal (range_type, 1); ++ ++ if ((TYPE_HIGH_BOUND_IS_COUNT_VAR (range_type) ++ & TYPE_HIGH_BOUND_IS_COUNT_MASK) == 0) ++ { ++ /* DW_AT_upper_bound value. */ ++ return raw_value; ++ } ++ else ++ { ++ /* DW_AT_count value. */ ++ return TYPE_LOW_BOUND (range_type) + raw_value - 1; ++ } ++} ++ ++int ++range_type_count_bound_internal (struct type *range_type) ++{ ++ int raw_value = range_type_any_field_internal (range_type, 1); ++ if ((TYPE_HIGH_BOUND_IS_COUNT_VAR (range_type) ++ & TYPE_HIGH_BOUND_IS_COUNT_MASK) != 0) ++ { ++ /* DW_AT_count value. */ ++ return raw_value; ++ } ++ else ++ { ++ /* DW_AT_upper_bound value. */ ++ /* Be careful when getting the array length. Ada arrays can be ++ empty arrays with the high_bound being smaller than the low_bound. ++ In such cases, the array length should be zero. */ ++ if (raw_value < TYPE_LOW_BOUND (range_type)) ++ return 0; ++ return 1 + raw_value - TYPE_LOW_BOUND (range_type); ++ } ++} ++ ++CORE_ADDR range_type_byte_stride_internal (struct type *range_type) ++{ ++ if (TYPE_NFIELDS (range_type) >= 3) ++ return range_type_any_field_internal (range_type, 2); ++ else ++ { ++ /* The caller will need to call something like ++ `TYPE_LENGTH (check_typedef (element_type)) ++ * TYPE_COUNT_BOUND (range_type) '. */ ++ return 0; ++ } ++} ++ ++/* Calculate the memory length of array TYPE. ++ ++ TARGET_TYPE should be set to `check_typedef (TYPE_TARGET_TYPE (type))' as ++ a performance hint. Feel free to pass NULL. Set FULL_SPAN to return the ++ size incl. the possibly incomplete last element - it may differ from the ++ cleared FULL_SPAN return value for larger TYPE_BYTE_STRIDE values. */ ++ ++static CORE_ADDR ++type_length_get (struct type *type, struct type *target_type, int full_span) ++{ ++ struct type *range_type; ++ int count; ++ CORE_ADDR byte_stride = 0; /* `= 0' for a false GCC warning. */ ++ CORE_ADDR element_size; ++ ++ if (TYPE_CODE (type) != TYPE_CODE_ARRAY) ++ return TYPE_LENGTH (type); ++ ++ /* Avoid executing TYPE_COUNT_BOUND for invalid (unallocated/unassociated) ++ Fortran arrays. The allocated data will never be used so they can be ++ zero-length. */ ++ if (!LA_VALUE_ADDRESS_GET (type, NULL)) ++ return 0; ++ ++ range_type = TYPE_INDEX_TYPE (type); ++ count = TYPE_COUNT_BOUND (range_type); ++ if (count < 0) ++ warning (_("Object count %d < 0"), count); ++ if (count <= 0) ++ return 0; ++ if (full_span || count > 1) ++ { ++ byte_stride = TYPE_BYTE_STRIDE (range_type); ++ if (byte_stride == 0) ++ { ++ if (target_type == NULL) ++ target_type = check_typedef (TYPE_TARGET_TYPE (type)); ++ byte_stride = type_length_get (target_type, NULL, 1); ++ } ++ } ++ if (full_span) ++ return count * byte_stride; ++ if (target_type == NULL) ++ target_type = check_typedef (TYPE_TARGET_TYPE (type)); ++ element_size = type_length_get (target_type, NULL, 1); ++ return (count - 1) * byte_stride + element_size; ++} ++ + /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. + + If this is a stubbed struct (i.e. declared as struct foo *), see if +@@ -1520,19 +1650,8 @@ check_typedef (struct type *type) + == TYPE_CODE_RANGE)) + { + /* Now recompute the length of the array type, based on its +- number of elements and the target type's length. +- Watch out for Ada null Ada arrays where the high bound +- is smaller than the low bound. */ +- const int low_bound = TYPE_FIELD_BITPOS (range_type, 0); +- const int high_bound = TYPE_FIELD_BITPOS (range_type, 1); +- int nb_elements; +- +- if (high_bound < low_bound) +- nb_elements = 0; +- else +- nb_elements = high_bound - low_bound + 1; +- +- TYPE_LENGTH (type) = nb_elements * TYPE_LENGTH (target_type); ++ number of elements and the target type's length. */ ++ TYPE_LENGTH (type) = type_length_get (type, target_type, 0); + TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; + } + else if (TYPE_CODE (type) == TYPE_CODE_RANGE) +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/gdbtypes.h gdb-6.8cvs20080219/gdb/gdbtypes.h +--- gdb-6.8cvs20080219-fortranless/gdb/gdbtypes.h 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/gdbtypes.h 2008-02-22 16:59:22.000000000 +0100 +@@ -417,6 +417,9 @@ struct main_type + + CORE_ADDR physaddr; + char *physname; ++ ++ /* For dynamically-sized arrays. Passed to DWARF_BLOCK_EXEC. */ ++ struct dwarf_block *dwarf_block; + } + loc; + +@@ -427,7 +430,11 @@ struct main_type + + /* This flag is zero for non-static fields, 1 for fields whose location + is specified by the label loc.physname, and 2 for fields whose location +- is specified by loc.physaddr. */ ++ is specified by loc.physaddr. ++ For range bounds bit 0 cleared is for loc.bitpos and bit 0 set is for ++ loc.dwarf_block (TYPE_BOUND_IS_DWARF_BLOCK_MASK). ++ For range bounds bit 1 cleared is for DW_AT_upper_bound and bit 1 set is ++ for DW_AT_count (TYPE_HIGH_BOUND_IS_COUNT_MASK). */ + + unsigned int static_kind : 2; + +@@ -481,6 +488,10 @@ struct main_type + targets and the second is for little endian targets. */ + + const struct floatformat **floatformat; ++ ++ /* FORTRAN_ARRAY is for TYPE_CODE_ARRAY. */ ++ ++ struct fortran_array_type *fortran_array; + } type_specific; + }; + +@@ -766,9 +777,9 @@ extern void allocate_cplus_struct_type ( + #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type + #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type + #define TYPE_CHAIN(thistype) (thistype)->chain +-/* Note that if thistype is a TYPEDEF type, you have to call check_typedef. +- But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, +- so you only have to call check_typedef once. Since allocate_value ++/* Note that if thistype is a TYPEDEF or ARRAY type, you have to call ++ check_typedef. But check_typedef does set the TYPE_LENGTH of the TYPEDEF ++ type, so you only have to call check_typedef once. Since allocate_value + calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ + #define TYPE_LENGTH(thistype) (thistype)->length + #define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile +@@ -782,8 +793,25 @@ extern void allocate_cplus_struct_type ( + #define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations + + #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0) +-#define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0) +-#define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1) ++#define TYPE_LOW_BOUND_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 0) ++#define TYPE_HIGH_BOUND_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 1) ++/* `TYPE_NFIELDS (range_type) >= 3' check is required before accessing it: */ ++#define TYPE_BYTE_STRIDE_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 2) ++#define TYPE_LOW_BOUND(range_type) \ ++ ((int) range_type_any_field_internal ((range_type), 0)) ++#define TYPE_HIGH_BOUND(range_type) \ ++ range_type_high_bound_internal ((range_type)) ++#define TYPE_COUNT_BOUND(range_type) \ ++ range_type_count_bound_internal ((range_type)) ++#define TYPE_BYTE_STRIDE(type) \ ++ range_type_byte_stride_internal ((type)) ++ ++#define TYPE_BOUND_IS_DWARF_BLOCK_MASK 1 ++#define TYPE_BOUND_IS_DWARF_BLOCK_VAR(range_type, fieldno) \ ++ TYPE_FIELD_STATIC_KIND (range_type, fieldno) ++#define TYPE_HIGH_BOUND_IS_COUNT_MASK 2 ++#define TYPE_HIGH_BOUND_IS_COUNT_VAR(range_type) \ ++ TYPE_FIELD_STATIC_KIND (range_type, 1) + + /* Moto-specific stuff for FORTRAN arrays */ + +@@ -792,11 +820,12 @@ extern void allocate_cplus_struct_type ( + #define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \ + TYPE_MAIN_TYPE(thistype)->lower_bound_type + +-#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ +- (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1)) +- + #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ +- (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0)) ++ (TYPE_LOW_BOUND(TYPE_INDEX_TYPE(arraytype))) ++#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ ++ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE(arraytype))) ++#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype) \ ++ (TYPE_BYTE_STRIDE(TYPE_INDEX_TYPE(arraytype))) + + /* C++ */ + +@@ -812,6 +841,7 @@ extern void allocate_cplus_struct_type ( + #define TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific + #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff + #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat ++#define TYPE_FORTRAN_ARRAY(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.fortran_array + #define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type + #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses + #define TYPE_BASECLASS_NAME(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].name +@@ -826,6 +856,7 @@ extern void allocate_cplus_struct_type ( + #define FIELD_TYPE(thisfld) ((thisfld).type) + #define FIELD_NAME(thisfld) ((thisfld).name) + #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) ++#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) + #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial) + #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) + #define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind) +@@ -839,6 +870,7 @@ extern void allocate_cplus_struct_type ( + #define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n)) + #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n)) + #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n)) ++#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK(TYPE_FIELD(thistype,n)) + #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) + #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n)) + #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0) +@@ -1251,12 +1283,25 @@ extern struct type *make_function_type ( + + extern struct type *lookup_function_type (struct type *); + ++extern struct type *create_range_type_nfields (struct type *result_type, ++ struct type *index_type, ++ int nfields); ++ + extern struct type *create_range_type (struct type *, struct type *, int, + int); + + extern struct type *create_array_type (struct type *, struct type *, + struct type *); + ++extern CORE_ADDR range_type_any_field_internal (struct type *range_type, ++ int fieldno); ++ ++extern int range_type_high_bound_internal (struct type *range_type); ++ ++extern int range_type_count_bound_internal (struct type *range_type); ++ ++extern CORE_ADDR range_type_byte_stride_internal (struct type *range_type); ++ + extern struct type *create_string_type (struct type *, struct type *); + + extern struct type *create_set_type (struct type *, struct type *); +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/jv-lang.c gdb-6.8cvs20080219/gdb/jv-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/jv-lang.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/jv-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -1083,6 +1083,7 @@ const struct language_defn java_language + c_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/language.c gdb-6.8cvs20080219/gdb/language.c +--- gdb-6.8cvs20080219-fortranless/gdb/language.c 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/language.c 2008-02-22 16:47:53.000000000 +0100 +@@ -1087,6 +1087,15 @@ default_print_array_index (struct value + fprintf_filtered (stream, "] = "); + } + ++/* No *ADDRESS_RETURN change is needed as we do not support DW_AT_data_location ++ * for general types. */ ++ ++int ++default_value_address_get (struct type *type, CORE_ADDR *address_return) ++{ ++ return 1; ++} ++ + /* Define the language that is no language. */ + + static int +@@ -1205,6 +1214,7 @@ const struct language_defn unknown_langu + unknown_language_arch_info, /* la_language_arch_info. */ + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +@@ -1241,6 +1251,7 @@ const struct language_defn auto_language + unknown_language_arch_info, /* la_language_arch_info. */ + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +@@ -1276,6 +1287,7 @@ const struct language_defn local_languag + unknown_language_arch_info, /* la_language_arch_info. */ + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/language.h gdb-6.8cvs20080219/gdb/language.h +--- gdb-6.8cvs20080219-fortranless/gdb/language.h 2008-02-14 23:03:57.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/language.h 2008-02-22 16:47:53.000000000 +0100 +@@ -268,6 +268,13 @@ struct language_defn + reference at the language level. */ + int (*la_pass_by_reference) (struct type *type); + ++ /* Return the data address (DW_AT_data_location) of TYPE into ++ *ADDRESS_RETURN. Return non-zero if the variable/data is valid. ++ You should set *ADDRESS_RETURN as VALUE_ADDRESS (VAL) as if no ++ DW_AT_data_location is present for TYPE *ADDRESS_RETURN is left ++ unchanged. ADDRESS_RETURN may be NULL. */ ++ int (*la_value_address_get) (struct type *type, CORE_ADDR *address_return); ++ + /* Add fields above this point, so the magic number is always last. */ + /* Magic number for compat checking */ + +@@ -363,6 +370,9 @@ extern enum language set_language (enum + #define LA_PRINT_ARRAY_INDEX(index_value, stream, format, pretty) \ + (current_language->la_print_array_index(index_value, stream, format, pretty)) + ++#define LA_VALUE_ADDRESS_GET(type, address_return) \ ++ (current_language->la_value_address_get(type, address_return)) ++ + /* Test a character to decide whether it can be printed in literal form + or needs to be printed in another representation. For example, + in C the literal form of the character with octal value 141 is 'a' +@@ -470,4 +480,7 @@ int language_pass_by_reference (struct t + independent of this. */ + int default_pass_by_reference (struct type *type); + ++extern int default_value_address_get (struct type *type, ++ CORE_ADDR *address_return); ++ + #endif /* defined (LANGUAGE_H) */ +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/m2-lang.c gdb-6.8cvs20080219/gdb/m2-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/m2-lang.c 2008-02-14 23:03:58.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/m2-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -388,6 +388,7 @@ const struct language_defn m2_language_d + m2_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/objc-lang.c gdb-6.8cvs20080219/gdb/objc-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/objc-lang.c 2008-02-14 23:03:59.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/objc-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -522,6 +522,7 @@ const struct language_defn objc_language + c_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/p-lang.c gdb-6.8cvs20080219/gdb/p-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/p-lang.c 2008-02-14 23:03:59.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/p-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -427,6 +427,7 @@ const struct language_defn pascal_langua + pascal_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/printcmd.c gdb-6.8cvs20080219/gdb/printcmd.c +--- gdb-6.8cvs20080219-fortranless/gdb/printcmd.c 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/printcmd.c 2008-02-22 16:49:35.000000000 +0100 +@@ -888,6 +888,11 @@ print_command_1 (char *exp, int inspect, + else + val = access_value_history (0); + ++ /* Do not try to OBJECT_ADDRESS_SET here anything. We are interested in the ++ source variable base addresses as found by READ_VAR_VALUE. The value here ++ can be already a calculated expression address inappropriate for ++ DW_OP_push_object_address. */ ++ + if (voidprint || (val && value_type (val) && + TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) + { +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/scm-lang.c gdb-6.8cvs20080219/gdb/scm-lang.c +--- gdb-6.8cvs20080219-fortranless/gdb/scm-lang.c 2008-02-14 23:04:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/scm-lang.c 2008-02-22 16:47:53.000000000 +0100 +@@ -266,6 +266,7 @@ const struct language_defn scm_language_ + c_language_arch_info, + default_print_array_index, + default_pass_by_reference, ++ default_value_address_get, /* Retrieve the real data value */ + LANG_MAGIC + }; + +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/testsuite/gdb.fortran/dynamic.exp gdb-6.8cvs20080219/gdb/testsuite/gdb.fortran/dynamic.exp +--- gdb-6.8cvs20080219-fortranless/gdb/testsuite/gdb.fortran/dynamic.exp 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/testsuite/gdb.fortran/dynamic.exp 2008-02-22 16:59:42.000000000 +0100 +@@ -0,0 +1,145 @@ ++# 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 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 was written by Jan Kratochvil . ++ ++# This file is part of the gdb testsuite. It contains tests for dynamically ++# allocated Fortran arrays. ++# It depends on the GCC dynamic Fortran arrays DWARF support: ++# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244 ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set testfile "dynamic" ++set srcfile ${testfile}.f90 ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "varx-init"] ++gdb_continue_to_breakpoint "varx-init" ++gdb_test "p varx" "\\$\[0-9\]* = " ++gdb_test "ptype varx" "type = " ++gdb_test "p varx(1,5,17)" "Unable to access the object because the array is not allocated\\." ++gdb_test "p varx(1,5,17)=1" "Unable to access the object because the array is not allocated\\." ++gdb_test "ptype varx(1,5,17)" "Unable to access the object because the array is not allocated\\." ++ ++gdb_breakpoint [gdb_get_line_number "varx-allocated"] ++gdb_continue_to_breakpoint "varx-allocated" ++# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) ++gdb_test "ptype varx" "type = real\\*4 \\(6,5:15,17:28\\)" ++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. ++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" ++ ++gdb_breakpoint [gdb_get_line_number "varx-filled"] ++gdb_continue_to_breakpoint "varx-filled" ++gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6" ++gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7" ++gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8" ++gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9" ++# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. ++gdb_test "p varv" "\\$\[0-9\]* = (|.*Unable to access the object because the array is not associated.)" ++gdb_test "ptype varv" "type = (|.*Unable to access the object because the array is not associated.)" ++ ++gdb_breakpoint [gdb_get_line_number "varv-associated"] ++gdb_continue_to_breakpoint "varv-associated" ++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" ++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" ++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. ++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" ++gdb_test "ptype varx" "type = real\\*4 \\(6,5:15,17:28\\)" ++# Intel Fortran Compiler 10.1.008 uses the pointer type. ++gdb_test "ptype varv" "type = (PTR TO -> \\( )?real\\*4 \\(6,5:15,17:28\\)\\)?" ++ ++gdb_breakpoint [gdb_get_line_number "varv-filled"] ++gdb_continue_to_breakpoint "varv-filled" ++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" ++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" ++ ++gdb_breakpoint [gdb_get_line_number "varv-deassociated"] ++gdb_continue_to_breakpoint "varv-deassociated" ++# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. ++gdb_test "p varv" "\\$\[0-9\]* = (|.*Unable to access the object because the array is not associated.)" ++gdb_test "ptype varv" "type = (|.*Unable to access the object because the array is not associated.)" ++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." ++gdb_test "p varv(1,5,17)" "Unable to access the object because the array is not associated\\." ++gdb_test "ptype varv(1,5,17)" "Unable to access the object because the array is not associated\\." ++ ++gdb_breakpoint [gdb_get_line_number "varx-deallocated"] ++gdb_continue_to_breakpoint "varx-deallocated" ++gdb_test "p varx" "\\$\[0-9\]* = " ++gdb_test "ptype varx" "type = " ++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." ++gdb_test "p varx(1,5,17)" "Unable to access the object because the array is not allocated\\." ++gdb_test "ptype varx(1,5,17)" "Unable to access the object because the array is not allocated\\." ++ ++gdb_breakpoint [gdb_get_line_number "vary-passed"] ++gdb_continue_to_breakpoint "vary-passed" ++# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...) ++gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)" ++ ++gdb_breakpoint [gdb_get_line_number "vary-filled"] ++gdb_continue_to_breakpoint "vary-filled" ++gdb_test "ptype vary" "type = real\\*4 \\(10,10\\)" ++gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8" ++gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9" ++gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10" ++# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...) ++gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)" ++ ++gdb_breakpoint [gdb_get_line_number "varw-almostfilled"] ++gdb_continue_to_breakpoint "varw-almostfilled" ++gdb_test "ptype varw" "type = real\\*4 \\(5,4,3\\)" ++gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1" ++# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...) ++gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" ++# "up" works with GCC but other Fortran compilers may copy the values into the ++# outer function only on the exit of the inner function. ++gdb_test "finish" ".*call bar \\(y, x\\)" ++gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3" ++gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6" ++gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5" ++gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1" ++ ++gdb_breakpoint [gdb_get_line_number "varz-almostfilled"] ++gdb_continue_to_breakpoint "varz-almostfilled" ++# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not. ++gdb_test "ptype varz" "type = (PTR TO -> \\( )?real\\*4 \\(\\*\\)\\)?" ++# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7) ++# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7. ++gdb_test "ptype vart" "type = (PTR TO -> \\( )?real\\*4 \\(2:11,7:\\*\\)\\)?" ++gdb_test "p varz(3)" "\\$\[0-9\]* = 4" ++# maps to foo::vary(1,1) ++gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8" ++# maps to foo::vary(2,2) ++gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" ++# maps to foo::vary(1,3) ++gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/testsuite/gdb.fortran/dynamic.f90 gdb-6.8cvs20080219/gdb/testsuite/gdb.fortran/dynamic.f90 +--- gdb-6.8cvs20080219-fortranless/gdb/testsuite/gdb.fortran/dynamic.f90 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/testsuite/gdb.fortran/dynamic.f90 2008-02-22 16:59:42.000000000 +0100 +@@ -0,0 +1,97 @@ ++! 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 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. ++! ++! Ihis file is the Fortran source file for dynamic.exp. ++! Original file written by Jakub Jelinek . ++! Modified for the GDB testcase by Jan Kratochvil . ++ ++subroutine baz ++ real, target, allocatable :: varx (:, :, :) ++ real, pointer :: varv (:, :, :) ++ real, target :: varu (1, 2, 3) ++ logical :: l ++ allocate (varx (1:6, 5:15, 17:28)) ! varx-init ++ l = allocated (varx) ++ varx(:, :, :) = 6 ! varx-allocated ++ varx(1, 5, 17) = 7 ++ varx(2, 6, 18) = 8 ++ varx(6, 15, 28) = 9 ++ varv => varx ! varx-filled ++ l = associated (varv) ++ varv(3, 7, 19) = 10 ! varv-associated ++ varv => null () ! varv-filled ++ l = associated (varv) ++ deallocate (varx) ! varv-deassociated ++ l = allocated (varx) ++ varu(:, :, :) = 10 ! varx-deallocated ++ allocate (varv (1:6, 5:15, 17:28)) ++ l = associated (varv) ++ varv(:, :, :) = 6 ++ varv(1, 5, 17) = 7 ++ varv(2, 6, 18) = 8 ++ varv(6, 15, 28) = 9 ++ deallocate (varv) ++ l = associated (varv) ++ varv => varu ++ varv(1, 1, 1) = 6 ++ varv(1, 2, 3) = 7 ++ l = associated (varv) ++end subroutine baz ++subroutine foo (vary, varw) ++ real :: vary (:, :) ++ real :: varw (:, :, :) ++ vary(:, :) = 4 ! vary-passed ++ vary(1, 1) = 8 ++ vary(2, 2) = 9 ++ vary(1, 3) = 10 ++ varw(:, :, :) = 5 ! vary-filled ++ varw(1, 1, 1) = 6 ++ varw(2, 2, 2) = 7 ! varw-almostfilled ++end subroutine foo ++subroutine bar (varz, vart) ++ real :: varz (*) ++ real :: vart (2:11, 7:*) ++ varz(1:3) = 4 ++ varz(2) = 5 ! varz-almostfilled ++end subroutine bar ++program test ++ interface ++ subroutine foo (vary, varw) ++ real :: vary (:, :) ++ real :: varw (:, :, :) ++ end subroutine ++ end interface ++ interface ++ subroutine bar (varz, vart) ++ real :: varz (*) ++ real :: vart (2:11, 7:*) ++ end subroutine ++ end interface ++ real :: x (10, 10), y (5), z(8, 8, 8) ++ x(:,:) = 1 ++ y(:) = 2 ++ z(:,:,:) = 3 ++ call baz ++ call foo (x, z(2:6, 4:7, 6:8)) ++ call bar (y, x) ++ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort ++ if (x (1, 3) .ne. 10) call abort ++ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort ++ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort ++ call foo (transpose (x), z) ++ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort ++ if (x (3, 1) .ne. 10) call abort ++end +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/typeprint.c gdb-6.8cvs20080219/gdb/typeprint.c +--- gdb-6.8cvs20080219-fortranless/gdb/typeprint.c 2008-02-14 23:04:00.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/typeprint.c 2008-02-22 16:49:35.000000000 +0100 +@@ -33,6 +33,7 @@ + #include "cp-abi.h" + #include "typeprint.h" + #include "gdb_string.h" ++#include "dwarf2block.h" + #include + + /* For real-type printing in whatis_exp() */ +@@ -130,6 +131,7 @@ whatis_exp (char *exp, int show) + val = access_value_history (0); + + type = value_type (val); ++ object_address_set (VALUE_ADDRESS (val)); + + if (objectprint) + { +diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile gdb-6.8cvs20080219-fortranless/gdb/valops.c gdb-6.8cvs20080219/gdb/valops.c +--- gdb-6.8cvs20080219-fortranless/gdb/valops.c 2008-02-22 08:19:37.000000000 +0100 ++++ gdb-6.8cvs20080219/gdb/valops.c 2008-02-22 16:47:53.000000000 +0100 +@@ -571,12 +571,21 @@ value_at_lazy (struct type *type, CORE_A + int + value_fetch_lazy (struct value *val) + { +- CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val); +- int length = TYPE_LENGTH (value_enclosing_type (val)); ++ CORE_ADDR addr; ++ int length; + +- struct type *type = value_type (val); +- if (length) +- read_memory (addr, value_contents_all_raw (val), length); ++ addr = VALUE_ADDRESS (val); ++ if (LA_VALUE_ADDRESS_GET (value_type (val), &addr)) ++ { ++ struct type *type = value_enclosing_type (val); ++ int length = TYPE_LENGTH (check_typedef (type)); ++ ++ if (length) ++ { ++ addr += value_offset (val); ++ read_memory (addr, value_contents_all_raw (val), length); ++ } ++ } + + set_value_lazy (val, 0); + return 0; +@@ -880,12 +889,17 @@ struct value * + value_coerce_array (struct value *arg1) + { + struct type *type = check_typedef (value_type (arg1)); ++ CORE_ADDR address; + + if (VALUE_LVAL (arg1) != lval_memory) + error (_("Attempt to take address of value not located in memory.")); + ++ address = VALUE_ADDRESS (arg1); ++ if (!LA_VALUE_ADDRESS_GET (type, &address)) ++ error (_("Attempt to take address of non-valid value.")); ++ + return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), +- (VALUE_ADDRESS (arg1) + value_offset (arg1))); ++ address + value_offset (arg1)); + } + + /* Given a value which is a function, return a value which is a pointer diff --git a/gdb-6.8-watchpoint-inaccessible-memory.patch b/gdb-6.8-watchpoint-inaccessible-memory.patch new file mode 100644 index 0000000..be3e1bb --- /dev/null +++ b/gdb-6.8-watchpoint-inaccessible-memory.patch @@ -0,0 +1,477 @@ +http://sourceware.org/ml/gdb-patches/2008-02/msg00472.html + +2008-02-28 Daniel Jacobowitz + + * 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 + + * 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, _("")); ++ 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 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 diff --git a/gdb.spec b/gdb.spec index f9d676a..687b02c 100644 --- a/gdb.spec +++ b/gdb.spec @@ -8,14 +8,14 @@ Name: gdb%{?_with_debug:-debug} # Set version to contents of gdb/version.in. # 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). -Version: 6.7.1 +Version: 6.7.50.20080227 # The release always contains a leading reserved number, start it at 1. -Release: 16%{?dist} +Release: 1%{?dist} License: GPL 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) 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. 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 # correct symbol is found. 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. 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. 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 # VSYSCALL and PIE -Patch122: gdb-6.3-test-pie-20050107.patch Patch124: gdb-6.3-pie-20050110.patch # 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 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. Patch147: gdb-6.3-warnings-20050317.patch @@ -162,9 +151,6 @@ Patch157: gdb-6.3-security-errata-20050610.patch # IA64 sigtramp prev register 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 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 # 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). 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) 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). 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). 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). Patch247: gdb-6.6-bz235197-fork-detach-info.patch # New testcase for gcore of 32bit inferiors on 64bit hosts. 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". 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'). 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. # 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. @@ -362,12 +336,15 @@ Patch298: gdb-6.6-threads-static-test.patch # Fix false `(no debugging symbols found)' on `-readnever' runs. 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 on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64. 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: flex bison sharutils expat-devel Requires: readline @@ -378,7 +355,7 @@ BuildRequires: rpm-devel # BuildRequires are set here only for the complete testsuite run. %if 0%{?_with_testsuite:1} # 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 %ifarch %{ix86} x86_64 ia64 ppc alpha 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. -%patch232 -p1 +#%patch232 -p1 %patch0 -p1 %patch1 -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 %patch105 -p1 %patch106 -p1 -%patch108 -p1 %patch111 -p1 %patch112 -p1 -%patch113 -p1 %patch117 -p1 %patch118 -p1 %patch119 -p1 %patch120 -p1 -%patch122 -p1 %patch124 -p1 %patch125 -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 %patch259 -p1 %patch142 -p1 -%patch145 -p1 %patch147 -p1 %patch148 -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 %patch157 -p1 %patch158 -p1 -%patch159 -p1 %patch160 -p1 %patch161 -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 %patch234 -p1 %patch235 -p1 -%patch236 -p1 %patch240 -p1 %patch241 -p1 %patch245 -p1 -%patch246 -p1 %patch247 -p1 %patch249 -p1 -%patch251 -p1 %patch254 -p1 %patch256 -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 %patch276 -p1 %patch277 -p1 -%patch278 -p1 %patch280 -p1 %patch282 -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 %patch298 -p1 %patch301 -p1 -%patch303 -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. cat > gdb/version.in << _FOO -Red Hat Linux (%{version}-%{release}rh) +Fedora (%{version}-%{release}) _FOO # Remove the info and other generated files added by the FSF release # process. +rm -f libdecnumber/gstdint.h rm -f bfd/doc/*.info rm -f bfd/doc/*.info-* rm -f gdb/doc/*.info @@ -591,6 +564,7 @@ enable_build_warnings="$enable_build_warnings,-Werror" --disable-sim \ --disable-rpath \ --with-system-readline \ + --with-expat \ %ifarch ia64 --with-libunwind \ %else @@ -763,6 +737,14 @@ fi %{_mandir}/*/gdbserver.1* %changelog +* Mon Mar 3 2008 Jan Kratochvil - 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 - 6.7.1-16 - Run the full testsuite also in the `-fPIE -pie' mode. diff --git a/sources b/sources index e459049..c9e1525 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -30a6bf36eded4ae5a152d7d71b86dc14 gdb-6.7.1.tar.bz2 +79c01091740eda9b2ecf4981b603c477 gdb-6.7.50.20080227.tar.bz2