- 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').
This commit is contained in:
Jan Kratochvil 2008-08-27 11:07:47 +00:00
parent 4f698ded6f
commit e3c8b47c74
14 changed files with 3529 additions and 152 deletions

View File

@ -0,0 +1,52 @@
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* 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 <jan.kratochvil@redhat.com>
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;

View File

@ -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 (&current_target);
@@ -275,7 +275,7 @@ target_load (char *arg, int from_tty)
(*current_target.to_load) (arg, from_tty);
}
-static int

View File

@ -0,0 +1,475 @@
[base]
2007-09-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* 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 <jan.kratochvil@redhat.com>
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)

View File

@ -17,130 +17,11 @@
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
2008-08-25 Jan Kratochvil <jan.kratochvil@redhat.com>
+@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 <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
@@ -751,11 +752,26 @@ iterate_over_lwps (int (*callback) (stru
{
struct lwp_info *lp, *lpnext;
- 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 (&current_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? */
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
===================================================================
@ -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) \

View File

@ -0,0 +1,263 @@
Index: gdb/testsuite/ChangeLog
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* 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 <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the
`$delete' destructor variant.
2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting
the whole GDB.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* 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"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,248 @@
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>
* config/i386/nm-linux.h: Change dr register routines to
accept a ptid_t first argument. Change all calling macros
to default the inferior_ptid for the first argument.
(i386_linux_insert_watchpoint): New prototype.
(i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto.
(i386_linux_remove_hw_breakpoint): Ditto.
(target_insert_watchpoint, target_remove_watchpoint): Undef and
override.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto.
* config/i386/nm-linux64.h: Ditto except add amd64 versions of
the watchpoint/hw-breakpoint insert/remove routines.
* i386-nat.c: Include "inferior.h" to define inferior_ptid.
* i386-linux-nat.c: Change all dr get/set routines to accept
ptid_t as first argument and to use this argument to determine
the tid for PTRACE.
(i386_linux_set_debug_regs_for_thread): New function.
(i386_linux_sync_debug_registers_callback): Ditto.
(i386_linux_sync_debug_registers_across_threads): Ditto.
(i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto.
(i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto.
(i386_linux_new_thread): Ditto.
(_initialize_i386_linux_nat): Ditto.
* amd64-linux-nat.c: Change all dr get/set routines to accept
ptid_t as first argument and to use this argument to determine
the tid for PTRACE.
(amd64_linux_set_debug_regs_for_thread): New function.
(amd64_linux_sync_debug_registers_callback): Ditto.
(amd64_linux_sync_debug_registers_across_threads): Ditto.
(amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto.
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
(amd64_linux_new_thread): Ditto.
(_initialize_amd64_linux_nat): Register linux new thread observer.
* testsuite/gdb.threads/watchthreads2.c: New test case.
* testsuite/gdb.threads/watchthreads2.exp: Ditto.
[ 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 <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+void *thread_function(void *arg); /* Pointer to function executed by each thread */
+
+#define NUM 5
+
+unsigned int args[NUM+1];
+
+int main() {
+ int res;
+ pthread_t threads[NUM];
+ void *thread_result;
+ long i;
+
+ for (i = 0; i < NUM; i++)
+ {
+ args[i] = 1; /* Init value. */
+ res = pthread_create(&threads[i],
+ NULL,
+ thread_function,
+ (void *) i);
+ }
+
+ args[i] = 1;
+ thread_function ((void *) i);
+
+ exit(EXIT_SUCCESS);
+}
+
+void *thread_function(void *arg) {
+ int my_number = (long) arg;
+ int *myp = (int *) &args[my_number];
+
+ /* Don't run forever. Run just short of it :) */
+ while (*myp > 0)
+ {
+ (*myp) ++; usleep (1); /* Loop increment. */
+ }
+
+ pthread_exit(NULL);
+}
+
Index: gdb-6.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
+}

View File

@ -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
+}

View File

@ -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)
{

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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 <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 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.