diff --git a/gdb-6.3-dtorfix-20050121.patch b/gdb-6.3-dtorfix-20050121.patch new file mode 100644 index 0000000..55cd23e --- /dev/null +++ b/gdb-6.3-dtorfix-20050121.patch @@ -0,0 +1,52 @@ +2005-01-21 Jeff Johnston + + * linespec.c (collect_methods): Don't do special processing for + destructors as this will be handled in find_methods. + (find_methods): Fix ctor check to also check for dtor. + +2007-10-14 Jan Kratochvil + + Port to GDB-6.7. + +Index: gdb-6.7/gdb/linespec.c +=================================================================== +--- gdb-6.7.orig/gdb/linespec.c 2007-10-13 05:26:33.000000000 +0200 ++++ gdb-6.7/gdb/linespec.c 2007-10-14 23:31:03.000000000 +0200 +@@ -398,12 +398,14 @@ add_matching_methods (int method_counter + + /* Check for special case of looking for member that + doesn't have a mangled name provided. This will happen +- when we have in-charge and not-in-charge constructors. ++ when we have in-charge and not-in-charge ctors/dtors. + Since we don't have a mangled name to work with, if we +- look for the symbol, we can only find the class itself. ++ look for the symbol, we can at best find the class itself. + We can find the information we need in the minimal symbol + table which has the full member name information we need. */ +- if (strlen (phys_name) <= strlen (class_name)) ++ if (strlen (phys_name) <= strlen (class_name) ++ || (strlen (phys_name) == strlen (class_name) + 1 ++ && phys_name[0] == '~')) + return add_minsym_members (class_name, phys_name, msym_arr); + + /* Destructor is handled by caller, don't add it to +@@ -1731,6 +1733,11 @@ collect_methods (char *copy, struct type + { + int i1 = 0; /* Counter for the symbol array. */ + ++#if 0 ++ /* Ignore this special method for getting destructors because ++ find_methods is more robust and can handle multiple ++ destructors which is the case when gcc generates a not-in-charge ++ vs an in-charge destructor. */ + if (destructor_name_p (copy, t)) + { + /* Destructors are a special case. */ +@@ -1749,6 +1756,7 @@ collect_methods (char *copy, struct type + } + } + else ++#endif + i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr, msym_arr); + + return i1; diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch index 1b32fbe..66deccd 100644 --- a/gdb-6.3-large-core-20051206.patch +++ b/gdb-6.3-large-core-20051206.patch @@ -66,8 +66,8 @@ Index: gdb-6.7/gdb/target.c static int return_zero (void); -@@ -283,7 +283,7 @@ target_mourn_inferior (void) - observer_notify_mourn_inferior (¤t_target); +@@ -275,7 +275,7 @@ target_load (char *arg, int from_tty) + (*current_target.to_load) (arg, from_tty); } -static int diff --git a/gdb-6.3-linespec-20041213.patch b/gdb-6.3-linespec-20041213.patch new file mode 100644 index 0000000..99624f2 --- /dev/null +++ b/gdb-6.3-linespec-20041213.patch @@ -0,0 +1,475 @@ +[base] + +2007-09-21 Jan Kratochvil + + * linespec.c (add_minsym_members): Support also the `$allocate' and + `$delete' variants. + +2007-10-05 Jan Kratochvil + + * linespec.c (add_minsym_members): Support also the `$allocate' and + `$delete' variants. + (decode_variable): Renamed to ... + (decode_variable_1) ... here, its parameter NOT_FOUND_PTR and its + exception throwing was moved to ... + (decode_variable_not_found): ... a new function here. + (decode_variable): New function. + +2007-10-31 Jan Kratochvil + + Port to GDB-6.7. + +[ Remove decode_variable* for GDB-6.8+ as no longer needed. ] + +Index: gdb-6.7/gdb/linespec.c +=================================================================== +--- gdb-6.7.orig/gdb/linespec.c 2007-08-23 20:08:35.000000000 +0200 ++++ gdb-6.7/gdb/linespec.c 2007-10-13 05:26:33.000000000 +0200 +@@ -36,6 +36,7 @@ + #include "linespec.h" + #include "exceptions.h" + #include "language.h" ++#include "gdb_assert.h" + + /* We share this one with symtab.c, but it is not exported widely. */ + +@@ -75,7 +76,8 @@ static struct symtabs_and_lines find_met + + static int collect_methods (char *copy, struct type *t, + struct symbol *sym_class, +- struct symbol **sym_arr); ++ struct symbol **sym_arr, ++ struct minimal_symbol **msym_arr); + + static NORETURN void cplusplus_error (const char *name, + const char *fmt, ...) +@@ -84,11 +86,13 @@ static NORETURN void cplusplus_error (co + static int total_number_of_methods (struct type *type); + + static int find_methods (struct type *, char *, +- enum language, struct symbol **); ++ enum language, struct symbol **, ++ struct minimal_symbol **); + + static int add_matching_methods (int method_counter, struct type *t, + enum language language, +- struct symbol **sym_arr); ++ struct symbol **sym_arr, ++ struct minimal_symbol **msym_arr); + + static int add_constructors (int method_counter, struct type *t, + enum language language, +@@ -104,6 +108,9 @@ static int is_objc_method_format (const + static struct symtabs_and_lines decode_line_2 (struct symbol *[], + int, int, char ***); + ++static struct symtabs_and_lines decode_line_3 (struct minimal_symbol *[], ++ int, int, char ***); ++ + static struct symtab *symtab_from_filename (char **argptr, + char *p, int is_quote_enclosed, + int *not_found_ptr); +@@ -194,13 +201,18 @@ total_number_of_methods (struct type *ty + /* Recursive helper function for decode_line_1. + Look for methods named NAME in type T. + Return number of matches. +- Put matches in SYM_ARR, which should have been allocated with ++ Put symbol matches in SYM_ARR, which should have been allocated with + a size of total_number_of_methods (T) * sizeof (struct symbol *). ++ In a special case where we are looking for constructors, we may ++ have to return minimal symbols in the array: MSYM_ARR. This occurs ++ when the compiler does not generate mangled names for the constructor's ++ debug info because there are multiple versions of the constructor ++ (in-charge vs not-in-charge). + Note that this function is g++ specific. */ + + static int + find_methods (struct type *t, char *name, enum language language, +- struct symbol **sym_arr) ++ struct symbol **sym_arr, struct minimal_symbol **msym_arr) + { + int i1 = 0; + int ibase; +@@ -243,7 +255,7 @@ find_methods (struct type *t, char *name + if (strcmp_iw (name, method_name) == 0) + /* Find all the overloaded methods with that name. */ + i1 += add_matching_methods (method_counter, t, language, +- sym_arr + i1); ++ sym_arr + i1, msym_arr); + else if (strncmp (class_name, name, name_len) == 0 + && (class_name[name_len] == '\0' + || class_name[name_len] == '<')) +@@ -266,21 +278,100 @@ find_methods (struct type *t, char *name + if (i1 == 0) + for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++) + i1 += find_methods (TYPE_BASECLASS (t, ibase), name, +- language, sym_arr + i1); ++ language, sym_arr + i1, msym_arr); + + return i1; + } + ++static int ++add_minsym_members (const char *class_name, ++ const char *member_name, ++ struct minimal_symbol **msym_arr) ++{ ++ char *completion_name; ++ char **list; ++ int i; ++ int comp_len; ++ int counter = 0; ++ ++ /* To find the member, we first cheat and use symbol completion. ++ This will give us a list of all the member names including ++ the function signature. */ ++ completion_name = xmalloc (strlen (class_name) + ++ strlen (member_name) + 9); ++ completion_name[0] = '\''; ++ strcpy (completion_name+1, class_name); ++ /* FIXME: make this the language class separator. */ ++ strcat (completion_name, "::"); ++ strcat (completion_name, member_name); ++ strcat (completion_name, "("); ++ list = make_symbol_completion_list (completion_name, ++ completion_name+1); ++ ++ /* Now that we have the list, we generate an array of their ++ corresponding minimal symbols. */ ++ counter = 0; ++ while (list && list[counter] != NULL) ++ { ++ msym_arr[counter] = lookup_minimal_symbol (list[counter], NULL, NULL); ++ ++counter; ++ } ++ ++ xfree (list); ++ ++ /* In the case of constructors, there may be in-charge vs not-in-charge ++ constructors. Check for names with $base which indicates not-in-charge ++ constructors. */ ++ comp_len = strlen (completion_name); ++ strcpy (completion_name + comp_len - 1, "$base("); ++ list = make_symbol_completion_list (completion_name, ++ completion_name+1); ++ ++ /* Again we have a list. Add their minimal symbols to the array. */ ++ i = 0; ++ while (list && list[i] != NULL) ++ { ++ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL); ++ ++counter; ++ } ++ xfree (list); ++ ++ /* Target also the allocating/deleting variants. */ ++ if (member_name[0] == '~') ++ strcpy (completion_name + comp_len - 1, "$delete("); ++ else ++ strcpy (completion_name + comp_len - 1, "$allocate("); ++ list = make_symbol_completion_list (completion_name, ++ completion_name+1); ++ ++ /* Again we have a list. Add their minimal symbols to the array. */ ++ i = 0; ++ while (list && list[i] != NULL) ++ { ++ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL); ++ ++counter; ++ } ++ xfree (list); ++ ++ xfree (completion_name); ++ ++ return counter; ++} ++ + /* Add the symbols associated to methods of the class whose type is T + and whose name matches the method indexed by METHOD_COUNTER in the + array SYM_ARR. Return the number of methods added. */ + + static int + add_matching_methods (int method_counter, struct type *t, +- enum language language, struct symbol **sym_arr) ++ enum language language, struct symbol **sym_arr, ++ struct minimal_symbol **msym_arr) + { + int field_counter; + int i1 = 0; ++ int cons_index = 0; ++ char *class_name = type_name_no_tag (t); ++ char **list = NULL; + + for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1; + field_counter >= 0; +@@ -305,6 +396,16 @@ add_matching_methods (int method_counter + else + phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter); + ++ /* Check for special case of looking for member that ++ doesn't have a mangled name provided. This will happen ++ when we have in-charge and not-in-charge constructors. ++ Since we don't have a mangled name to work with, if we ++ look for the symbol, we can only find the class itself. ++ We can find the information we need in the minimal symbol ++ table which has the full member name information we need. */ ++ if (strlen (phys_name) <= strlen (class_name)) ++ return add_minsym_members (class_name, phys_name, msym_arr); ++ + /* Destructor is handled by caller, don't add it to + the list. */ + if (is_destructor_name (phys_name) != 0) +@@ -330,6 +431,9 @@ add_matching_methods (int method_counter + } + } + ++ if (list) ++ xfree (list); ++ + return i1; + } + +@@ -610,6 +714,146 @@ decode_line_2 (struct symbol *sym_arr[], + discard_cleanups (old_chain); + return return_values; + } ++ ++/* Given a list of NELTS minimal symbols in MSYM_ARR, return a list of lines to ++ operate on (ask user if necessary). ++ If CANONICAL is non-NULL return a corresponding array of mangled names ++ as canonical line specs there. */ ++ ++static struct symtabs_and_lines ++decode_line_3 (struct minimal_symbol *msym_arr[], ++ int nelts, int funfirstline, ++ char ***canonical) ++{ ++ struct symtabs_and_lines values, return_values; ++ char *args, *arg1; ++ int i; ++ char *prompt; ++ char *symname; ++ struct cleanup *old_chain; ++ char **canonical_arr = (char **) NULL; ++ ++ values.sals = (struct symtab_and_line *) ++ alloca (nelts * sizeof (struct symtab_and_line)); ++ return_values.sals = (struct symtab_and_line *) ++ xmalloc (nelts * sizeof (struct symtab_and_line)); ++ old_chain = make_cleanup (xfree, return_values.sals); ++ ++ if (canonical) ++ { ++ canonical_arr = (char **) xmalloc (nelts * sizeof (char *)); ++ make_cleanup (xfree, canonical_arr); ++ memset (canonical_arr, 0, nelts * sizeof (char *)); ++ *canonical = canonical_arr; ++ } ++ ++ i = 0; ++ printf_unfiltered ("[0] cancel\n[1] all\n"); ++ while (i < nelts) ++ { ++ init_sal (&return_values.sals[i]); /* Initialize to zeroes. */ ++ init_sal (&values.sals[i]); ++ if (msym_arr[i]) ++ { ++ struct symtabs_and_lines msal = minsym_found (funfirstline, ++ msym_arr[i]); ++ memcpy (&values.sals[i], &msal.sals[0], ++ sizeof (struct symtab_and_line)); ++ if (values.sals[i].symtab) ++ printf_unfiltered ("[%d] %s at %s:%d\n", ++ (i + 2), ++ SYMBOL_PRINT_NAME (msym_arr[i]), ++ values.sals[i].symtab->filename, ++ values.sals[i].line); ++ else ++ printf_unfiltered ("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n", ++ (i + 2), ++ SYMBOL_PRINT_NAME (msym_arr[i]), ++ values.sals[i].line); ++ ++ } ++ else ++ printf_unfiltered ("?HERE\n"); ++ i++; ++ } ++ ++ prompt = getenv ("PS2"); ++ if (prompt == NULL) ++ { ++ prompt = "> "; ++ } ++ args = command_line_input (prompt, 0, "overload-choice"); ++ ++ if (args == 0 || *args == 0) ++ error_no_arg ("one or more choice numbers"); ++ ++ i = 0; ++ while (*args) ++ { ++ int num; ++ ++ arg1 = args; ++ while (*arg1 >= '0' && *arg1 <= '9') ++ arg1++; ++ if (*arg1 && *arg1 != ' ' && *arg1 != '\t') ++ error ("Arguments must be choice numbers."); ++ ++ num = atoi (args); ++ ++ if (num == 0) ++ error ("canceled"); ++ else if (num == 1) ++ { ++ if (canonical_arr) ++ { ++ for (i = 0; i < nelts; i++) ++ { ++ if (canonical_arr[i] == NULL) ++ { ++ symname = DEPRECATED_SYMBOL_NAME (msym_arr[i]); ++ canonical_arr[i] = savestring (symname, strlen (symname)); ++ } ++ } ++ } ++ memcpy (return_values.sals, values.sals, ++ (nelts * sizeof (struct symtab_and_line))); ++ return_values.nelts = nelts; ++ discard_cleanups (old_chain); ++ return return_values; ++ } ++ ++ if (num >= nelts + 2) ++ { ++ printf_unfiltered ("No choice number %d.\n", num); ++ } ++ else ++ { ++ num -= 2; ++ if (values.sals[num].pc) ++ { ++ if (canonical_arr) ++ { ++ symname = DEPRECATED_SYMBOL_NAME (msym_arr[num]); ++ make_cleanup (xfree, symname); ++ canonical_arr[i] = savestring (symname, strlen (symname)); ++ } ++ return_values.sals[i++] = values.sals[num]; ++ values.sals[num].pc = 0; ++ } ++ else ++ { ++ printf_unfiltered ("duplicate request for %d ignored.\n", num); ++ } ++ } ++ ++ args = arg1; ++ while (*args == ' ' || *args == '\t') ++ args++; ++ } ++ return_values.nelts = i; ++ discard_cleanups (old_chain); ++ return return_values; ++} + + /* The parser of linespec itself. */ + +@@ -1414,35 +1658,46 @@ find_method (int funfirstline, char ***c + struct symbol **sym_arr = alloca (total_number_of_methods (t) + * sizeof (struct symbol *)); + ++ struct minimal_symbol **msym_arr = alloca (total_number_of_methods (t) ++ * sizeof (struct minimal_symbol *)); ++ ++ msym_arr[0] = NULL; ++ + /* Find all methods with a matching name, and put them in + sym_arr. */ + +- i1 = collect_methods (copy, t, sym_class, sym_arr); ++ i1 = collect_methods (copy, t, sym_class, sym_arr, msym_arr); + + if (i1 == 1) + { + /* There is exactly one field with that name. */ +- sym = sym_arr[0]; +- +- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) +- { +- values.sals = (struct symtab_and_line *) +- xmalloc (sizeof (struct symtab_and_line)); +- values.nelts = 1; +- values.sals[0] = find_function_start_sal (sym, +- funfirstline); +- } ++ if (msym_arr[0] != NULL) ++ return minsym_found (funfirstline, msym_arr[0]); + else + { +- values.sals = NULL; +- values.nelts = 0; ++ sym = sym_arr[0]; ++ ++ if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ++ { ++ values.sals = (struct symtab_and_line *) ++ xmalloc (sizeof (struct symtab_and_line)); ++ values.nelts = 1; ++ values.sals[0] = find_function_start_sal (sym, ++ funfirstline); ++ } ++ else ++ { ++ values.nelts = 0; ++ } ++ return values; + } +- return values; + } + if (i1 > 0) + { + /* There is more than one field with that name + (overloaded). Ask the user which one to use. */ ++ if (msym_arr[0] != NULL) ++ return decode_line_3 (msym_arr, i1, funfirstline, canonical); + return decode_line_2 (sym_arr, i1, funfirstline, canonical); + } + else +@@ -1469,11 +1722,12 @@ find_method (int funfirstline, char ***c + } + + /* Find all methods named COPY in the class whose type is T, and put +- them in SYM_ARR. Return the number of methods found. */ ++ them in SYM_ARR or MSYM_ARR. Return the number of methods found. */ + + static int + collect_methods (char *copy, struct type *t, +- struct symbol *sym_class, struct symbol **sym_arr) ++ struct symbol *sym_class, struct symbol **sym_arr, ++ struct minimal_symbol **msym_arr) + { + int i1 = 0; /* Counter for the symbol array. */ + +@@ -1495,7 +1749,7 @@ collect_methods (char *copy, struct type + } + } + else +- i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr); ++ i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr, msym_arr); + + return i1; + } +--- gdb-6.8/gdb/Makefile.in.orig 2008-08-27 12:59:59.000000000 +0200 ++++ gdb-6.8/gdb/Makefile.in 2008-08-27 13:00:19.000000000 +0200 +@@ -2341,7 +2341,8 @@ libunwind-frame.o: libunwind-frame.c $(d + linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ + $(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \ + $(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \ +- $(objc_lang_h) $(linespec_h) $(exceptions_h) $(language_h) ++ $(objc_lang_h) $(linespec_h) $(exceptions_h) $(language_h) \ ++ $(gdb_assert_h) + linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \ + $(infcall_h) $(gdb_assert_h) $(gdb_string_h) $(linux_fork_h) \ + $(linux_nat_h) $(gdb_wait_h) $(gdb_dirent_h) diff --git a/gdb-6.3-nonthreaded-wp-20050117.patch b/gdb-6.3-nonthreaded-wp-20050117.patch index 8ec23fb..6f49864 100644 --- a/gdb-6.3-nonthreaded-wp-20050117.patch +++ b/gdb-6.3-nonthreaded-wp-20050117.patch @@ -17,131 +17,12 @@ Port to GDB-6.8pre. -Index: gdb-6.8cvs20080219/gdb/doc/observer.texi -=================================================================== ---- 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 - -+@deftypefun void mourn_inferior (struct target_ops *@var{target}) -+@value{GDBN} has just detached from an inferior. -+@end deftypefun -+ - @deftypefun void solib_unloaded (struct so_list *@var{solib}) - The shared library specified by @var{solib} has been unloaded. - @end deftypefun -Index: gdb-6.8cvs20080219/gdb/linux-nat.c -=================================================================== ---- 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; - -- for (lp = lwp_list; lp; lp = lpnext) -+ if (lwp_list != NULL) - { -- lpnext = lp->next; -+ for (lp = lwp_list; lp; lp = lpnext) -+ { -+ lpnext = lp->next; -+ if ((*callback) (lp, data)) -+ return lp; -+ } -+ } -+ else -+ { -+ /* We are calling iterate_over_lwps for a non-threaded program. -+ Initialize the lwp list to the inferior's ptid. */ -+ gdb_assert (!is_lwp (inferior_ptid)); -+ -+ inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), -+ GET_PID (inferior_ptid)); -+ lp = add_lwp (inferior_ptid); - if ((*callback) (lp, data)) -- return lp; -+ return lp; - } - - return NULL; -@@ -3319,6 +3335,18 @@ linux_nat_get_siginfo (ptid_t ptid) - return &lp->siginfo; - } - -+/* Observer function for a mourn inferior event. This is needed -+ because if iterate_over_lwps is called for a non-threaded program -+ to handle watchpoints, the lwp list gets initialized but there is -+ no corresponding clean-up when the inferior is detached. In -+ a threaded program, the observer is simply redundant as the -+ same clean-up gets done in linux_nat_mourn_inferior. */ -+static void -+linux_nat_mourn_inferior_observer (struct target_ops *objfile) -+{ -+ init_lwp_list (); -+} -+ - void - _initialize_linux_nat (void) - { -@@ -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.")); - -+ observer_attach_mourn_inferior (linux_nat_mourn_inferior_observer); -+ - /* Save the original signal mask. */ - sigprocmask (SIG_SETMASK, NULL, &normal_mask); - -Index: gdb-6.8cvs20080219/gdb/target.c -=================================================================== ---- 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" - #include "target-descriptions.h" -+#include "observer.h" - - static void target_info (char *, int); - -@@ -275,6 +276,13 @@ target_load (char *arg, int from_tty) - (*current_target.to_load) (arg, from_tty); - } - -+void -+target_mourn_inferior (void) -+{ -+ (*current_target.to_mourn_inferior) (); -+ observer_notify_mourn_inferior (¤t_target); -+} -+ - static int - nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct target_ops *t) -Index: gdb-6.8cvs20080219/gdb/target.h -=================================================================== ---- 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. */ - --#define target_mourn_inferior() \ -- (*current_target.to_mourn_inferior) () -+extern void target_mourn_inferior (void); - - /* Does target have enough data to do a run or attach command? */ - +2008-08-25 Jan Kratochvil + + Remove the fix as causing an assertion failure for + gdb.base/checkpoint.exp and it is no longer needed for + gdb.base/follow-child.exp . + Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -236,16 +117,3 @@ Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp + 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-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch new file mode 100644 index 0000000..df46859 --- /dev/null +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -0,0 +1,263 @@ +Index: gdb/testsuite/ChangeLog +2005-01-21 Jeff Johnston + + * gdb.cp/constructortest.exp: New test. + * gdb.cp/constructortest.cc: Ditto. + * gdb.cp/templates.exp: Change break of dtor to be fully quoted. + +2007-09-22 Jan Kratochvil + + * gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the + `$delete' destructor variant. + +2007-09-25 Jan Kratochvil + + * gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting + the whole GDB. + +2007-10-05 Jan Kratochvil + + * gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs + by PIE. + * gdb.cp/constructortest.exp: Handle the change of settings breakpoints + always at all the ctor/dtor variants. + +[ Removed the `gdb.cp/templates.exp' patch. ] +[ Updated the patch for "(X location") of GDB-6.8+. ] + +--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005 ++++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005 +@@ -0,0 +1,99 @@ ++/* 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. */ ++ ++class A ++{ ++ public: ++ A(); ++ ~A(); ++ int k; ++ private: ++ int x; ++}; ++ ++class B: public A ++{ ++ public: ++ B(); ++ private: ++ int y; ++}; ++ ++/* C and D are for the $delete destructor. */ ++ ++class C ++{ ++ public: ++ C(); ++ virtual ~C(); ++ private: ++ int x; ++}; ++ ++class D: public C ++{ ++ public: ++ D(); ++ private: ++ int y; ++}; ++ ++int main(int argc, char *argv[]) ++{ ++ A* a = new A; ++ B* b = new B; ++ D* d = new D; ++ delete a; ++ delete b; ++ delete d; ++ return 0; ++} ++ ++A::A() /* Constructor A */ ++{ ++ x = 1; /* First line A */ ++ k = 4; /* Second line A */ ++} ++ ++A::~A() /* Destructor A */ ++{ ++ x = 3; /* First line ~A */ ++ k = 6; /* Second line ~A */ ++} ++ ++B::B() ++{ ++ y = 2; /* First line B */ ++ k = 5; ++} ++ ++C::C() /* Constructor C */ ++{ ++ x = 1; /* First line C */ ++} ++ ++C::~C() /* Destructor C */ ++{ ++ x = 3; /* First line ~C */ ++} ++ ++D::D() ++{ ++ y = 2; /* First line D */ ++} +--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005 ++++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005 +@@ -0,0 +1,131 @@ ++# This testcase is part of GDB, the GNU debugger. ++ ++# Copyright 2005, 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. ++ ++# Check that GDB can break at multiple forms of constructors. ++ ++if $tracelevel { ++ strace $tracelevel ++} ++ ++set prms_id 0 ++set bug_id 0 ++ ++set testfile "constructortest" ++set srcfile ${testfile}.cc ++set binfile ${objdir}/${subdir}/${testfile} ++# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC ++# breakpoints. ++if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++# ++# Run to `main' where we begin our tests. ++# ++ ++if ![runto_main] then { ++ gdb_suppress_tests ++} ++ ++# Break on the various forms of the A::A constructor ++gdb_test "break A\:\:A" "Breakpoint 2 at .* \\(2 locations\\)" "breaking on A::A" ++ ++# Verify that we break for the A constructor two times ++# Once for new A and once for new B ++gdb_continue_to_breakpoint "First line A" ++gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A" ++gdb_continue_to_breakpoint "First line A" ++gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A" ++ ++# Now do the same for destructors ++gdb_test "break 'A::~A()'" "" ++ ++# Verify that we break for the A destructor two times ++# Once for delete a and once for delete b ++gdb_continue_to_breakpoint "First line ~A" ++gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A" ++gdb_continue_to_breakpoint "First line ~A" ++gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A" ++ ++ ++# Verify that we can break by line number in a constructor and find ++# both occurrences ++runto_main ++gdb_test "break 'A::A()'" "" "break in constructor A 2" ++gdb_continue_to_breakpoint "First line A" ++set second_line [gdb_get_line_number "Second line A"] ++gdb_test "break $second_line" "Breakpoint .*, line $second_line. \\(2 locations\\)" "break by line in constructor" ++gdb_continue_to_breakpoint "Second line A" ++gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line" ++gdb_continue_to_breakpoint "Second line A" ++gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line" ++ ++# Verify that we can break by line number in a destructor and find ++# both occurrences ++gdb_test "break 'A::~A()'" "" "break in constructor ~A 2" ++gdb_continue_to_breakpoint "First line ~A" ++set second_line_dtor [gdb_get_line_number "Second line ~A"] ++gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor. \\(2 locations\\)" "break by line in destructor" ++gdb_continue_to_breakpoint "Second line ~A" ++gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line" ++# FIXME: Analyse this case better. ++gdb_continue_to_breakpoint "Second line ~A" ++gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2" ++gdb_continue_to_breakpoint "Second line ~A" ++gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line" ++ ++ ++# Test now the $delete destructors. ++ ++gdb_load ${binfile} ++runto_main ++ ++# Break on the various forms of the C::~C destructor ++gdb_test "break C\:\:~C" "Breakpoint .* \\(3 locations\\)" "breaking on C::~C" ++gdb_continue_to_breakpoint "First line ~C" ++ ++# Verify that we can break by line number in a destructor and find ++# the $delete occurence ++ ++gdb_load ${binfile} ++delete_breakpoints ++ ++set first_line_dtor [gdb_get_line_number "First line ~C"] ++gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor. \\(3 locations\\)" "break by line in destructor" ++ ++# Run to `main' where we begin our tests. ++# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET. ++# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS. ++ ++if ![gdb_breakpoint main] { ++ gdb_suppress_tests ++} ++gdb_run_cmd ++set test "running to main" ++gdb_test_multiple "" $test { ++ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++gdb_continue_to_breakpoint "First line ~C" diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch new file mode 100644 index 0000000..ecaa473 --- /dev/null +++ b/gdb-6.3-test-pie-20050107.patch @@ -0,0 +1,2116 @@ +--- gdb-6.8/gdb/testsuite/configure.ac.orig 2007-10-25 22:30:26.000000000 +0200 ++++ gdb-6.8/gdb/testsuite/configure.ac 2008-08-26 18:02:17.000000000 +0200 +@@ -116,5 +116,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.modula2/Makefile \ +- gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ ++ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ + gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) +--- gdb-6.8/gdb/testsuite/configure.orig 2007-12-29 15:01:30.000000000 +0100 ++++ gdb-6.8/gdb/testsuite/configure 2008-08-26 18:02:02.000000000 +0200 +@@ -3104,7 +3104,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.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/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.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/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 +@@ -3671,6 +3671,7 @@ do + "gdb.objc/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;; + "gdb.opt/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; + "gdb.pascal/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.pascal/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.5/gdb/testsuite/gdb.pie/attach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/attach.c 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/attach2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/attach2.c 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/break.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/break.c 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/break1.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/break1.c 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/coremaker.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/coremaker.c 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/attach.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/attach.exp 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/break.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/break.exp 2006-07-07 01:13:23.000000000 -0300 +@@ -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 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.* ++\[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 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\] ++\[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.5/gdb/testsuite/gdb.pie/corefile.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/corefile.exp 2006-07-07 01:13:23.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.pie/Makefile.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.pie/Makefile.in 2006-07-07 01:13:23.000000000 -0300 +@@ -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-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch new file mode 100644 index 0000000..b77512f --- /dev/null +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -0,0 +1,248 @@ +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. + +[ With recent upstream GDB (6.8) reduced only to the testcase. ] + +Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c 2006-07-12 01:54:29.000000000 -0300 +@@ -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.5/gdb/testsuite/gdb.threads/watchthreads2.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp 2006-07-12 01:54:29.000000000 -0300 +@@ -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 ++} diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch new file mode 100644 index 0000000..aa514c2 --- /dev/null +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -0,0 +1,86 @@ +diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp +--- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp 1969-12-31 19:00:00.000000000 -0500 ++++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp 2007-07-31 13:04:12.000000000 -0400 +@@ -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 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. */ ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set prms_id 0 ++set bug_id 0 ++ ++# are we on a target board ++if [is_remote target] then { ++ return 0 ++} ++ ++# Start the program running and then wait for a bit, to be sure ++# that it can be attached to. ++ ++gdb_exit ++gdb_start ++gdb_load sleep ++ ++set gdb_pid [exp_pid -i [board_info host fileid]] ++set test "identified the child GDB" ++if {$gdb_pid != "" && $gdb_pid > 0} { ++ pass $test ++ verbose -log "Child GDB PID $gdb_pid" ++} else { ++ fail $test ++} ++ ++set testpid [eval exec sleep 10 &] ++exec sleep 2 ++ ++set test "attach" ++gdb_test_multiple "attach $testpid" "$test" { ++ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" { ++ pass "$test" ++ } ++ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" { ++ # Response expected on Cygwin ++ pass "$test" ++ } ++} ++ ++# Some time to let GDB spawn its testing child. ++exec sleep 2 ++ ++set found none ++foreach procpid [glob -directory /proc -type d {[0-9]*}] { ++ if {[catch {open $procpid/status} statusfi]} { ++ continue ++ } ++ set status [read $statusfi] ++ close $statusfi ++ if {1 ++ && [regexp -line {^Name:\tgdb$} $status] ++ && [regexp -line {^PPid:\t1$} $status] ++ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} { ++ set found $procpid ++ verbose -log "Found linux_test_for_tracefork zombie PID $procpid" ++ } ++} ++set test "linux_test_for_tracefork leaves no zombie" ++if {$found eq {none}} { ++ pass $test ++} else { ++ fail $test ++} diff --git a/gdb-6.6-step-thread-exit.patch b/gdb-6.6-step-thread-exit.patch index 5e765c6..7943daa 100644 --- a/gdb-6.6-step-thread-exit.patch +++ b/gdb-6.6-step-thread-exit.patch @@ -1,11 +1,7 @@ -Index: ./gdb/linux-nat.c -=================================================================== -RCS file: /cvs/src/src/gdb/linux-nat.c,v -retrieving revision 1.64 -diff -u -p -r1.64 linux-nat.c ---- ./gdb/linux-nat.c 16 Jun 2007 17:16:25 -0000 1.64 -+++ ./gdb/linux-nat.c 18 Jun 2007 12:53:41 -0000 -@@ -1109,15 +1109,17 @@ resume_set_callback (struct lwp_info *lp +diff -up -rup gdb-6.8-clean/gdb/linux-nat.c gdb-6.8-new/gdb/linux-nat.c +--- gdb-6.8-clean/gdb/linux-nat.c 2008-08-26 00:04:08.000000000 +0200 ++++ gdb-6.8-new/gdb/linux-nat.c 2008-08-26 00:04:50.000000000 +0200 +@@ -1083,15 +1083,17 @@ resume_set_callback (struct lwp_info *lp } static void @@ -25,7 +21,7 @@ diff -u -p -r1.64 linux-nat.c target_pid_to_str (ptid), signo ? strsignal (signo) : "0", target_pid_to_str (inferior_ptid)); -@@ -2077,6 +2082,9 @@ retry: +@@ -2076,6 +2078,9 @@ retry: /* Check if the thread has exited. */ if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1) { @@ -35,7 +31,7 @@ diff -u -p -r1.64 linux-nat.c /* If this is the main thread, we must stop all threads and verify if they are still alive. This is because in the nptl thread model, there is no signal issued for exiting LWPs -@@ -2095,6 +2103,10 @@ retry: +@@ -2096,6 +2101,10 @@ retry: fprintf_unfiltered (gdb_stdlog, "LLW: %s exited.\n", target_pid_to_str (lp->ptid)); @@ -46,7 +42,7 @@ diff -u -p -r1.64 linux-nat.c exit_lwp (lp); -@@ -2105,8 +2117,29 @@ retry: +@@ -2104,8 +2113,29 @@ retry: ignored. */ if (num_lwps > 0) { diff --git a/gdb-6.8-ctors-dtors-unique.patch b/gdb-6.8-ctors-dtors-unique.patch new file mode 100644 index 0000000..21e8729 --- /dev/null +++ b/gdb-6.8-ctors-dtors-unique.patch @@ -0,0 +1,73 @@ +--- ./gdb/linespec.c 2008-08-27 00:27:33.000000000 +0200 ++++ ./gdb/linespec.c 2008-08-27 00:53:16.000000000 +0200 +@@ -284,6 +284,15 @@ find_methods (struct type *t, char *name + } + + static int ++add_minsym_members_compar (const void *ap, const void *bp) ++{ ++ const char *a = *(const char **) ap; ++ const char *b = *(const char **) bp; ++ ++ return strcmp (a, b); ++} ++ ++static int + add_minsym_members (const char *class_name, + const char *member_name, + struct minimal_symbol **msym_arr) +@@ -293,6 +302,7 @@ add_minsym_members (const char *class_na + int i; + int comp_len; + int counter = 0; ++ int src_i, dst_i; + + /* To find the member, we first cheat and use symbol completion. + This will give us a list of all the member names including +@@ -307,6 +317,28 @@ add_minsym_members (const char *class_na + strcat (completion_name, "("); + list = make_symbol_completion_list (completion_name, + completion_name+1); ++ if (list == NULL || list[0] == NULL) ++ { ++ xfree (completion_name); ++ return 0; ++ } ++ ++ /* Make the list entries unique - Multi-PC breakpoints are already resolved ++ by GDB-6.8+. */ ++ counter = 0; ++ while (list && list[counter] != NULL) ++ counter++; ++ qsort (list, counter, sizeof (*list), add_minsym_members_compar); ++ src_i = dst_i = 0; ++ while (src_i + 1 < counter) ++ { ++ if (strcmp (list[src_i], list[src_i + 1]) != 0) ++ list[dst_i++] = list[src_i]; ++ src_i++; ++ } ++ list[dst_i++] = list[src_i++]; ++ gdb_assert (list[src_i] == NULL); ++ list[dst_i] = 0; + + /* Now that we have the list, we generate an array of their + corresponding minimal symbols. */ +@@ -319,6 +351,8 @@ add_minsym_members (const char *class_na + + xfree (list); + ++#if 0 /* Multi-PC breakpoints are already resolved by GDB-6.8+. */ ++ + /* In the case of constructors, there may be in-charge vs not-in-charge + constructors. Check for names with $base which indicates not-in-charge + constructors. */ +@@ -353,6 +387,8 @@ add_minsym_members (const char *class_na + } + xfree (list); + ++#endif /* Multi-PC breakpoints are already resolved by GDB-6.8+. */ ++ + xfree (completion_name); + + return counter; diff --git a/gdb-6.8-fortran-module-ignore.patch b/gdb-6.8-fortran-module-ignore.patch new file mode 100644 index 0000000..81e1fc4 --- /dev/null +++ b/gdb-6.8-fortran-module-ignore.patch @@ -0,0 +1,14 @@ +--- ./gdb/dwarf2read.c 24 Aug 2008 16:39:56 -0000 1.277 ++++ ./gdb/dwarf2read.c 26 Aug 2008 18:51:28 -0000 +@@ -2761,7 +2769,10 @@ process_die (struct die_info *die, struc + Fortran case, so we'll have to replace this gdb_assert if + Fortran compilers start generating that info. */ + processing_has_namespace_info = 1; +- gdb_assert (die->child == NULL); ++ if (cu->language != language_fortran && die->child == NULL) ++ complaint (&symfile_complaints, ++ _("%s at offset %d has unexpected children"), ++ dwarf_tag_name (die->tag), die->offset); + break; + default: + new_symbol (die, NULL, cu); diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch new file mode 100644 index 0000000..b09bc36 --- /dev/null +++ b/gdb-6.8-fortran-tag-constant.patch @@ -0,0 +1,74 @@ +--- ./gdb/dwarf2read.c 21 Aug 2008 18:57:34 -0000 1.276 ++++ ./gdb/dwarf2read.c 26 Aug 2008 17:54:37 -0000 +@@ -1798,6 +1798,7 @@ scan_partial_symbols (struct partial_die + } + break; + case DW_TAG_variable: ++ case DW_TAG_constant: + case DW_TAG_typedef: + case DW_TAG_union_type: + if (!pdi->is_declaration) +@@ -1983,6 +1984,7 @@ add_partial_symbol (struct partial_die_i + } + break; + case DW_TAG_variable: ++ case DW_TAG_constant: + if (pdi->is_external) + { + /* Global Variable. +@@ -3590,7 +3593,8 @@ dwarf2_add_field (struct field_info *fip + fip->non_public_fields = 1; + } + } +- else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable) ++ else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable ++ || die->tag == DW_TAG_constant) + { + /* C++ static member. */ + +@@ -4069,7 +4073,8 @@ read_structure_type (struct die_info *di + while (child_die && child_die->tag) + { + if (child_die->tag == DW_TAG_member +- || child_die->tag == DW_TAG_variable) ++ || child_die->tag == DW_TAG_variable ++ || child_die->tag == DW_TAG_constant) + { + /* NOTE: carlton/2002-11-05: A C++ static data member + should be a DW_TAG_member that is a declaration, but +@@ -4188,6 +4193,7 @@ process_structure_scope (struct die_info + { + if (child_die->tag == DW_TAG_member + || child_die->tag == DW_TAG_variable ++ || child_die->tag == DW_TAG_constant + || child_die->tag == DW_TAG_inheritance) + { + /* Do nothing. */ +@@ -5565,6 +5571,7 @@ load_partial_dies (bfd *abfd, gdb_byte * + && abbrev->tag != DW_TAG_enumerator + && abbrev->tag != DW_TAG_subprogram + && abbrev->tag != DW_TAG_variable ++ && abbrev->tag != DW_TAG_constant + && abbrev->tag != DW_TAG_namespace + && abbrev->tag != DW_TAG_member) + { +@@ -5672,6 +5679,7 @@ load_partial_dies (bfd *abfd, gdb_byte * + if (load_all + || abbrev->tag == DW_TAG_subprogram + || abbrev->tag == DW_TAG_variable ++ || abbrev->tag == DW_TAG_constant + || abbrev->tag == DW_TAG_namespace + || part_die->is_declaration) + { +@@ -7579,6 +7579,11 @@ new_symbol (struct die_info *die, struct + /* Do not add the symbol to any lists. It will be found via + BLOCK_FUNCTION from the blockvector. */ + break; ++ case DW_TAG_constant: ++ SYMBOL_TYPE (sym) = make_cv_type (1, ++ TYPE_VOLATILE (SYMBOL_TYPE (sym)), ++ SYMBOL_TYPE (sym), NULL); ++ /* PASSTHRU */ + case DW_TAG_variable: + /* Compilation with minimal debug info may result in variables + with missing type entries. Change the misleading `void' type diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch new file mode 100644 index 0000000..70d794d --- /dev/null +++ b/gdb-6.8-quit-never-aborts.patch @@ -0,0 +1,64 @@ +We may abort the process of detaching threads with multiple SIGINTs - which are +being sent during a testcase terminating its child GDB. + +Some of the threads may not be properly PTRACE_DETACHed which hurts if they +should have been detached with SIGSTOP (as they are accidentally left running +on the debugger termination). + +--- ./gdb/defs.h 26 Jun 2008 15:51:28 -0000 1.227 ++++ ./gdb/defs.h 10 Jul 2008 10:37:32 -0000 +@@ -141,6 +141,7 @@ extern char *gdb_sysroot; + extern char *debug_file_directory; + + extern int quit_flag; ++extern int quit_flag_cleanup; + extern int immediate_quit; + extern int sevenbit_strings; + +@@ -159,7 +159,7 @@ extern void quit (void); + #define QUIT_FIXME "ignoring redefinition of QUIT" + #else + #define QUIT { \ +- if (quit_flag) quit (); \ ++ if (quit_flag && !quit_flag_cleanup) quit (); \ + if (deprecated_interactive_hook) deprecated_interactive_hook (); \ + } + #endif +--- ./gdb/event-top.c 9 Jul 2008 22:16:14 -0000 1.61 ++++ ./gdb/event-top.c 10 Jul 2008 10:37:33 -0000 +@@ -941,7 +941,7 @@ async_request_quit (gdb_client_data arg) + is no reason to call quit again here, unless immediate_quit is + set.*/ + +- if (quit_flag || immediate_quit) ++ if ((quit_flag || immediate_quit) && !quit_flag_cleanup) + quit (); + } + +--- ./gdb/top.c 9 Jul 2008 22:30:46 -0000 1.145 ++++ ./gdb/top.c 10 Jul 2008 10:37:37 -0000 +@@ -1263,7 +1263,9 @@ quit_force (char *args, int from_tty) + qt.args = args; + qt.from_tty = from_tty; + +- /* We want to handle any quit errors and exit regardless. */ ++ /* We want to handle any quit errors and exit regardless but we should never ++ get user-interrupted to properly detach the inferior. */ ++ quit_flag_cleanup = 1; + catch_errors (quit_target, &qt, + "Quitting: ", RETURN_MASK_ALL); + +--- ./gdb/utils.c 10 Jun 2008 09:29:15 -0000 1.189 ++++ ./gdb/utils.c 10 Jul 2008 10:37:38 -0000 +@@ -120,6 +120,11 @@ int job_control; + + int quit_flag; + ++/* Nonzero means we are already processing the quitting cleanups and we should ++ no longer get aborted. */ ++ ++int quit_flag_cleanup; ++ + /* Nonzero means quit immediately if Control-C is typed now, rather + than waiting until QUIT is executed. Be careful in setting this; + code which executes with immediate_quit set has to be very careful diff --git a/gdb.spec b/gdb.spec index 1b02c2a..5de1f46 100644 --- a/gdb.spec +++ b/gdb.spec @@ -13,7 +13,7 @@ Version: 6.8 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 21%{?_with_upstream:.upstream}%{?dist} +Release: 22%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ Group: Development/Debuggers @@ -86,6 +86,9 @@ 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 +# Fix to display base constructors from list and breakpoint commands +Patch116: gdb-6.3-linespec-20041213.patch + # Continue removing breakpoints even when failure occurs. Patch117: gdb-6.3-removebp-20041130.patch @@ -97,6 +100,7 @@ Patch118: gdb-6.3-gstack-20050411.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 @@ -105,6 +109,10 @@ Patch125: gdb-6.3-test-self-20050110.patch # Fix for non-threaded watchpoints. Patch128: gdb-6.3-nonthreaded-wp-20050117.patch +# Fix to support multiple destructors just like multiple constructors +Patch133: gdb-6.3-test-dtorfix-20050121.patch +Patch134: gdb-6.3-dtorfix-20050121.patch + # Fix to support executable moving Patch136: gdb-6.3-test-movedir-20050125.patch @@ -124,6 +132,9 @@ 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 +# Test 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 @@ -285,6 +296,9 @@ Patch263: gdb-6.3-attach-see-vdso-test.patch Patch265: gdb-6.6-bz247354-leader-exit-fix.patch Patch266: gdb-6.6-bz247354-leader-exit-test.patch +# Test leftover zombie process (BZ 243845). +Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch + # New locating of the matching binaries from the pure core file (build-id). Patch274: gdb-6.6-buildid-locate.patch @@ -388,6 +402,18 @@ Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch # Fix register assignments with no GDB stack frames (BZ 436037). Patch330: gdb-6.8-bz436037-reg-no-longer-active.patch +# Make the GDB quit processing non-abortable to cleanup everything properly. +Patch331: gdb-6.8-quit-never-aborts.patch + +# Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs. +Patch332: gdb-6.8-fortran-tag-constant.patch + +# Fix crash on DW_TAG_module for Fortran in recent Fedora/RH GCCs. +Patch333: gdb-6.8-fortran-module-ignore.patch + +# bare names of constructors and destructors should be unique for GDB-6.8+. +Patch334: gdb-6.8-ctors-dtors-unique.patch + BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext BuildRequires: flex bison sharutils expat-devel Requires: readline @@ -476,17 +502,22 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch106 -p1 %patch111 -p1 %patch112 -p1 +%patch116 -p1 %patch117 -p1 %patch118 -p1 %patch120 -p1 +%patch122 -p1 %patch125 -p1 %patch128 -p1 +%patch133 -p1 +%patch134 -p1 %patch136 -p1 %patch139 -p1 %patch140 -p1 %patch141 -p1 %patch259 -p1 %patch142 -p1 +%patch145 -p1 %patch147 -p1 %patch148 -p1 %patch150 -p1 @@ -541,6 +572,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch263 -p1 %patch265 -p1 %patch266 -p1 +%patch271 -p1 %patch274 -p1 %patch275 -p1 %patch277 -p1 @@ -577,6 +609,10 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch328 -p1 %patch329 -p1 %patch330 -p1 +%patch331 -p1 +%patch332 -p1 +%patch333 -p1 +%patch334 -p1 %patch124 -p1 find -name "*.orig" | xargs rm -f @@ -843,6 +879,18 @@ fi %endif %changelog +* Wed Aug 27 2008 Jan Kratochvil - 6.8-22 +- Remove `gdb-6.3-nonthreaded-wp-20050117.patch' as obsoleted + regressing now. +- Make the GDB quit processing non-abortable to cleanup everything properly. +- Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs. +- Fix crash on DW_TAG_module for Fortran in recent Fedora/RH GCCs. +- Readd resolving of bare names of constructors and destructors. +- Include various vendor testcases: + - Leftover zombie process (BZ 243845). + - Multithreaded watchpoints (`gdb.threads/watchthreads2.exp'). + - PIE testcases (`gdb.pie/*'). + - C++ contructors/destructors (`gdb.cp/constructortest.exp'). + * Sat Aug 23 2008 Jan Kratochvil - 6.8-21 - Fix MI debuginfo print on reloaded exec, found by Denys Vlasenko (BZ 459414). - Extend the Fortran dynamic variables patch also for dynamic Fortran strings.