Compare commits
21 Commits
Author | SHA1 | Date |
---|---|---|
Fedora Release Engineering | 0e31857596 | |
Bill Nottingham | 2eb561a536 | |
Jan Kratochvil | 57131d56c8 | |
Jan Kratochvil | 54a47620e2 | |
Jan Kratochvil | 52934b27c9 | |
Jan Kratochvil | 1a96385283 | |
Jan Kratochvil | 5a86319fb1 | |
Jan Kratochvil | 0768c25abe | |
Jan Kratochvil | bae7d1e4d4 | |
Jan Kratochvil | 62495bef8a | |
Jan Kratochvil | 0fc889748f | |
Jan Kratochvil | 3f974e0437 | |
Jan Kratochvil | d03bbcd3a1 | |
Jan Kratochvil | 2357a47db9 | |
Jan Kratochvil | bb22d30837 | |
Jan Kratochvil | cae3ac6551 | |
Jan Kratochvil | 296cce914d | |
Tom Callaway | 31a2eafa99 | |
Tom Callaway | 7115f0bab7 | |
Jan Kratochvil | 193a9401d2 | |
Jesse Keating | 36df512154 |
21
Makefile
21
Makefile
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: gdb
|
||||
# $Id: Makefile,v 1.2 2007/05/30 14:38:39 kasal Exp $
|
||||
NAME := gdb
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attempt a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
|
@ -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;
|
|
@ -0,0 +1,477 @@
|
|||
[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;
|
||||
}
|
||||
Index: gdb-6.7/gdb/Makefile.in
|
||||
===================================================================
|
||||
--- gdb-6.7.orig/gdb/Makefile.in 2007-10-13 05:09:50.000000000 +0200
|
||||
+++ gdb-6.7/gdb/Makefile.in 2007-10-13 05:15:13.000000000 +0200
|
||||
@@ -2233,7 +2233,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)
|
|
@ -1,38 +0,0 @@
|
|||
2004-12-16 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* linux-thread-db.c (clear_lwpip_callback): Removed.
|
||||
(thread_db_resume): Do not iterate and call
|
||||
clear_lwp_callback.
|
||||
|
||||
--- gdb-6.3/gdb/linux-thread-db.c.fix Thu Dec 16 16:32:13 2004
|
||||
+++ gdb-6.3/gdb/linux-thread-db.c Thu Dec 16 16:32:30 2004
|
||||
@@ -822,19 +822,6 @@ thread_db_detach (char *args, int from_t
|
||||
target_beneath->to_detach (args, from_tty);
|
||||
}
|
||||
|
||||
-static int
|
||||
-clear_lwpid_callback (struct thread_info *thread, void *dummy)
|
||||
-{
|
||||
- /* If we know that our thread implementation is 1-to-1, we could save
|
||||
- a certain amount of information; it's not clear how much, so we
|
||||
- are always conservative. */
|
||||
-
|
||||
- thread->private->th_valid = 0;
|
||||
- thread->private->ti_valid = 0;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static void
|
||||
thread_db_resume (ptid_t ptid, int step, enum target_signal signo)
|
||||
{
|
||||
@@ -845,9 +832,6 @@ thread_db_resume (ptid_t ptid, int step,
|
||||
else if (is_thread (ptid))
|
||||
ptid = lwp_from_thread (ptid);
|
||||
|
||||
- /* Clear cached data which may not be valid after the resume. */
|
||||
- iterate_over_threads (clear_lwpid_callback, NULL);
|
||||
-
|
||||
target_beneath->to_resume (ptid, step, signo);
|
||||
|
||||
do_cleanups (old_chain);
|
|
@ -1,91 +1,6 @@
|
|||
--- /dev/null 2007-10-25 16:04:06.860116064 -0400
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.base/gcore-shmid0.c 2007-10-27 14:49:59.000000000 -0400
|
||||
@@ -0,0 +1,82 @@
|
||||
+/* Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 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. */
|
||||
+
|
||||
+/*
|
||||
+ * Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||
+ */
|
||||
+
|
||||
+#include <sys/ipc.h>
|
||||
+#include <sys/shm.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+/* We need a backtrace through the stack. */
|
||||
+
|
||||
+static void
|
||||
+initialized (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ int sid;
|
||||
+ unsigned int *addr = (void *) -1L;
|
||||
+ int try;
|
||||
+
|
||||
+ /* The generated SID will cycle with an increment of 32768, try until it
|
||||
+ * wraps to 0. */
|
||||
+
|
||||
+ for (try = 0; addr == (void *) -1L; try++)
|
||||
+ {
|
||||
+ assert (try < 0x10000);
|
||||
+
|
||||
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
|
||||
+ if (sid == -1)
|
||||
+ {
|
||||
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* Use SID only if it is 0, retry it otherwise. */
|
||||
+
|
||||
+ if (sid == 0)
|
||||
+ {
|
||||
+ addr = shmat (sid, NULL, SHM_RND);
|
||||
+ if (addr == (void *) -1L)
|
||||
+ {
|
||||
+ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid,
|
||||
+ errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+ if (shmctl (sid, IPC_RMID, NULL) != 0)
|
||||
+ {
|
||||
+ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ initialized ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null 2007-10-25 16:04:06.860116064 -0400
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.base/gcore-shmid0.exp 2007-10-27 14:50:40.000000000 -0400
|
||||
@@ -0,0 +1,116 @@
|
||||
--- /dev/null 2008-05-02 23:36:22.370004160 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/gcore-shmid0.exp 2008-05-03 22:36:56.000000000 +0200
|
||||
@@ -0,0 +1,120 @@
|
||||
+# Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -107,13 +22,6 @@
|
|||
+
|
||||
+# Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+set testfile "gcore-shmid0"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
|
@ -150,12 +58,23 @@
|
|||
+}
|
||||
+
|
||||
+if { ! [ runto_main ] } then {
|
||||
+ untested gcore-buffer-overflow.exp
|
||||
+ untested gcore-shmid0.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "initialized"
|
||||
+gdb_continue_to_breakpoint "initialized"
|
||||
+gdb_breakpoint "unresolved"
|
||||
+
|
||||
+set test "Continue to initialized."
|
||||
+gdb_test_multiple "continue" $test {
|
||||
+ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore-shmid0.test]
|
||||
+
|
||||
|
@ -202,3 +121,101 @@
|
|||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
--- /dev/null 2008-05-02 23:36:22.370004160 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/gcore-shmid0.c 2008-05-03 22:39:10.000000000 +0200
|
||||
@@ -0,0 +1,95 @@
|
||||
+/* Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 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. */
|
||||
+
|
||||
+/*
|
||||
+ * Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||
+ */
|
||||
+
|
||||
+#include <sys/ipc.h>
|
||||
+#include <sys/shm.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+/* We need a backtrace through the stack. */
|
||||
+
|
||||
+static void
|
||||
+initialized (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+unresolved (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ int sid;
|
||||
+ unsigned int *addr = (void *) -1L;
|
||||
+ int try;
|
||||
+
|
||||
+ /* The generated SID will cycle with an increment of 32768, try until it
|
||||
+ * wraps to 0. */
|
||||
+
|
||||
+ for (try = 0; addr == (void *) -1L; try++)
|
||||
+ {
|
||||
+ /* At least kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
|
||||
+ shmget(2). */
|
||||
+ if (try > 0x10000)
|
||||
+ {
|
||||
+ printf ("Problem no longer reproducible on this kernel (try %d)\n",
|
||||
+ try);
|
||||
+ unresolved ();
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
|
||||
+ if (sid == -1)
|
||||
+ {
|
||||
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* Use SID only if it is 0, retry it otherwise. */
|
||||
+
|
||||
+ if (sid == 0)
|
||||
+ {
|
||||
+ addr = shmat (sid, NULL, SHM_RND);
|
||||
+ if (addr == (void *) -1L)
|
||||
+ {
|
||||
+ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid,
|
||||
+ errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+ if (shmctl (sid, IPC_RMID, NULL) != 0)
|
||||
+ {
|
||||
+ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ initialized ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
|
|
@ -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 <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 (¤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 <jan.kratochvil@redhat.com>
|
||||
|
||||
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) \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
@ -0,0 +1,250 @@
|
|||
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. ]
|
||||
|
||||
FIXME: The testcase does not expects multiple watchpoints hits per one stop.
|
||||
|
||||
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
|
||||
+}
|
|
@ -196,6 +196,18 @@ Index: gdb-6.8cvs20080219/gdb/target.c
|
|||
|
||||
return addr;
|
||||
}
|
||||
--- ./gdb/elfread.c 2008-08-03 11:02:10.000000000 +0200
|
||||
+++ ./gdb/elfread.c 2008-08-03 11:01:21.000000000 +0200
|
||||
@@ -318,7 +318,8 @@ elf_symtab_read (struct objfile *objfile
|
||||
/* Bfd symbols are section relative. */
|
||||
symaddr = sym->value + sym->section->vma;
|
||||
/* Relocate all non-absolute symbols by the section offset. */
|
||||
- if (sym->section != &bfd_abs_section)
|
||||
+ if (sym->section != &bfd_abs_section
|
||||
+ && (sym->section->flags & SEC_THREAD_LOCAL) == 0)
|
||||
{
|
||||
symaddr += offset;
|
||||
}
|
||||
Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196439
|
||||
|
||||
|
||||
2006-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-stripped.exp: New file, Handle corrupted
|
||||
or missing location list information.
|
||||
* gdb.dwarf2/dw2-stripped.c: New file, Handle corrupted
|
||||
or missing location list information.
|
||||
|
||||
|
||||
Index: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
|
||||
===================================================================
|
||||
RCS file: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
|
||||
diff -N gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
|
||||
--- /dev/null 1 Jan 1970 00:00:00 -0000
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 26 Aug 2006 11:47:26 -0000
|
||||
@@ -0,0 +1,42 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 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. */
|
||||
+
|
||||
+
|
||||
+/* The function `func1' traced into must have debug info on offset > 0;
|
||||
+ (DW_UNSND (attr)). This is the reason of `func0' existence. */
|
||||
+
|
||||
+void
|
||||
+func0(int a, int b)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+/* `func1' being traced into must have some arguments to dump. */
|
||||
+
|
||||
+void
|
||||
+func1(int a, int b)
|
||||
+{
|
||||
+ func0 (a,b);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ func1 (1, 2);
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
|
||||
===================================================================
|
||||
RCS file: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
|
||||
diff -N gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
|
||||
--- /dev/null 1 Jan 1970 00:00:00 -0000
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 26 Aug 2006 11:47:27 -0000
|
||||
@@ -0,0 +1,79 @@
|
||||
+# Copyright 2006 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.
|
||||
+
|
||||
+# Minimal DWARF-2 unit test
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-stripped"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}.x
|
||||
+
|
||||
+remote_exec build "rm -f ${binfile}"
|
||||
+
|
||||
+# get the value of gcc_compiled
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# This test can only be run on gcc as we use additional_flags=FIXME
|
||||
+if {$gcc_compiled == 0} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+remote_exec build "objcopy -R .debug_loc ${binfile}"
|
||||
+set strip_output [remote_exec build "objdump -h ${binfile}"]
|
||||
+
|
||||
+set test "stripping test file preservation"
|
||||
+if [ regexp ".debug_info " $strip_output] {
|
||||
+ pass "$test (.debug_info preserved)"
|
||||
+} else {
|
||||
+ fail "$test (.debug_info got also stripped)"
|
||||
+}
|
||||
+
|
||||
+set test "stripping test file functionality"
|
||||
+if [ regexp ".debug_loc " $strip_output] {
|
||||
+ fail "$test (.debug_loc still present)"
|
||||
+} else {
|
||||
+ pass "$test (.debug_loc stripped)"
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# For C programs, "start" should stop in main().
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ ".*main \\(\\) at .*" \
|
||||
+ "start"
|
||||
+gdb_test "step" \
|
||||
+ "func.* \\(.*\\) at .*" \
|
||||
+ "step"
|
|
@ -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
|
||||
+}
|
|
@ -0,0 +1,111 @@
|
|||
diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-lib.c gdb-6.5/gdb/testsuite/gdb.base/datalib-lib.c
|
||||
--- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-lib.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.base/datalib-lib.c 2008-05-29 13:51:50.000000000 -0400
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 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 */
|
||||
+
|
||||
+int var;
|
||||
diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-main.c gdb-6.5/gdb/testsuite/gdb.base/datalib-main.c
|
||||
--- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-main.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.base/datalib-main.c 2008-05-29 13:51:39.000000000 -0400
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 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 */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib.exp gdb-6.5/gdb/testsuite/gdb.base/datalib.exp
|
||||
--- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib.exp 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.base/datalib.exp 2008-05-29 14:58:33.000000000 -0400
|
||||
@@ -0,0 +1,51 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 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.
|
||||
+
|
||||
+set testfile datalib
|
||||
+set srcfilemain ${testfile}-main.c
|
||||
+set srcfilelib ${testfile}-lib.c
|
||||
+set libfile ${objdir}/${subdir}/${testfile}-lib.so
|
||||
+set binfile ${objdir}/${subdir}/${testfile}-main
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We must use a separate library as the main executable is compiled to the
|
||||
+# address 0 by default and it would get fixed up already at the end of
|
||||
+# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing
|
||||
+# on ia64. The library must be NOSTDLIB as otherwise some stub code would
|
||||
+# create the `.text' section there. Also DEBUG option is useful as some of
|
||||
+# the crashes occur in dwarf2read.c.
|
||||
+
|
||||
+# FAIL case:
|
||||
+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
|
||||
+# A problem internal to GDB has been detected,
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcfilemain}.*" \
|
||||
+ "start"
|
|
@ -1,80 +0,0 @@
|
|||
2007-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
|
||||
X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
|
||||
check for its aligned size between the last segment and still before
|
||||
the section header end. Added variables check to cover also the
|
||||
section header string table.
|
||||
|
||||
--- ./bfd/elfcode.h 14 Aug 2007 08:04:47 -0000 1.86
|
||||
+++ ./bfd/elfcode.h 23 Sep 2007 14:24:39 -0000
|
||||
@@ -1628,6 +1628,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
|
||||
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
|
||||
Elf_External_Phdr *x_phdrs;
|
||||
Elf_Internal_Phdr *i_phdrs, *last_phdr;
|
||||
+ Elf_External_Shdr *x_shdr_shstrtab;
|
||||
+ Elf_Internal_Shdr *i_shdr_shstrtab;
|
||||
bfd *nbfd;
|
||||
struct bfd_in_memory *bim;
|
||||
int contents_size;
|
||||
@@ -1746,19 +1748,49 @@ NAME(_bfd_elf,bfd_from_remote_memory)
|
||||
|
||||
/* Trim the last segment so we don't bother with zeros in the last page
|
||||
that are off the end of the file. However, if the extra bit in that
|
||||
- page includes the section headers, keep them. */
|
||||
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
|
||||
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
|
||||
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
|
||||
- {
|
||||
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
|
||||
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
|
||||
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
|
||||
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
|
||||
- }
|
||||
- else
|
||||
+ page includes the section headers os the section header string table,
|
||||
+ keep them. */
|
||||
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
|
||||
contents_size = last_phdr->p_offset + last_phdr->p_filesz;
|
||||
|
||||
+ if ((bfd_vma) contents_size < i_ehdr.e_shoff
|
||||
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
|
||||
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
|
||||
+
|
||||
+ /* Section header string table is usually before the section headers
|
||||
+ so this check is here has usually no effect. */
|
||||
+ if (i_ehdr.e_shstrndx < i_ehdr.e_shnum)
|
||||
+ {
|
||||
+ x_shdr_shstrtab = bfd_malloc (sizeof *x_shdr_shstrtab
|
||||
+ + sizeof *i_shdr_shstrtab);
|
||||
+ if (x_shdr_shstrtab == NULL)
|
||||
+ {
|
||||
+ free (x_phdrs);
|
||||
+ bfd_set_error (bfd_error_no_memory);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff
|
||||
+ + i_ehdr.e_shstrndx * sizeof *x_shdr_shstrtab,
|
||||
+ (bfd_byte *) x_shdr_shstrtab,
|
||||
+ sizeof *x_shdr_shstrtab);
|
||||
+ if (err)
|
||||
+ {
|
||||
+ free (x_shdr_shstrtab);
|
||||
+ free (x_phdrs);
|
||||
+ bfd_set_error (bfd_error_system_call);
|
||||
+ errno = err;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ i_shdr_shstrtab = (Elf_Internal_Shdr *) &x_shdr_shstrtab[1];
|
||||
+ elf_swap_shdr_in (templ, x_shdr_shstrtab, i_shdr_shstrtab);
|
||||
+
|
||||
+ if ((bfd_vma) contents_size < i_shdr_shstrtab->sh_offset
|
||||
+ + i_shdr_shstrtab->sh_size)
|
||||
+ contents_size = i_shdr_shstrtab->sh_offset + i_shdr_shstrtab->sh_size;
|
||||
+
|
||||
+ free (x_shdr_shstrtab);
|
||||
+ }
|
||||
+
|
||||
/* Now we know the size of the whole image we want read in. */
|
||||
contents = bfd_zmalloc (contents_size);
|
||||
if (contents == NULL)
|
|
@ -32,11 +32,20 @@
|
|||
|
||||
Fix -I for non-standard rpm includes in `$(includedir)/rpm'.
|
||||
|
||||
Index: gdb-6.7.50.20080227/gdb/Makefile.in
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/Makefile.in 2008-03-10 00:48:52.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/Makefile.in 2008-03-10 00:48:53.000000000 +0100
|
||||
@@ -340,7 +340,7 @@
|
||||
2008-04-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Disable the warnings for the testsuite not expecting them.
|
||||
|
||||
2008-08-21 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Disable MI non-compliant message on the missing debuginfo printed on
|
||||
reloaded exec file.
|
||||
Fix found by Denys Vlasenko <dvlasenk@redhat.com>.
|
||||
Fixes Red Hat Bug 459414.
|
||||
|
||||
--- ./gdb/Makefile.in 2008-08-21 00:29:46.000000000 +0200
|
||||
+++ ./gdb/Makefile.in 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -340,7 +340,7 @@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
|
||||
# your system doesn't have fcntl.h in /usr/include (which is where it
|
||||
# should be according to Posix).
|
||||
DEFS = @DEFS@
|
||||
|
@ -92,10 +101,8 @@ Index: gdb-6.7.50.20080227/gdb/Makefile.in
|
|||
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-interp.c
|
||||
tui-io.o: $(srcdir)/tui/tui-io.c $(defs_h) $(target_h) \
|
||||
$(event_loop_h) $(event_top_h) $(command_h) $(top_h) $(tui_h) \
|
||||
Index: gdb-6.7.50.20080227/gdb/corelow.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/corelow.c 2008-02-09 14:45:33.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/corelow.c 2008-03-10 00:49:19.000000000 +0100
|
||||
--- ./gdb/corelow.c 2008-02-09 14:45:33.000000000 +0100
|
||||
+++ ./gdb/corelow.c 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -45,6 +45,10 @@
|
||||
#include "exceptions.h"
|
||||
#include "solib.h"
|
||||
|
@ -192,11 +199,9 @@ Index: gdb-6.7.50.20080227/gdb/corelow.c
|
|||
+ NULL, NULL, NULL,
|
||||
+ &setlist, &showlist);
|
||||
}
|
||||
Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/doc/gdb.texinfo 2008-03-10 00:48:52.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/doc/gdb.texinfo 2008-03-10 00:49:42.000000000 +0100
|
||||
@@ -12208,6 +12208,27 @@ information files.
|
||||
--- ./gdb/doc/gdb.texinfo 2008-08-21 00:29:46.000000000 +0200
|
||||
+++ ./gdb/doc/gdb.texinfo 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -12195,6 +12195,27 @@ information files.
|
||||
|
||||
@end table
|
||||
|
||||
|
@ -224,10 +229,8 @@ Index: gdb-6.7.50.20080227/gdb/doc/gdb.texinfo
|
|||
@cindex @code{.gnu_debuglink} sections
|
||||
@cindex debug link sections
|
||||
A debug link is a special section of the executable file named
|
||||
Index: gdb-6.7.50.20080227/gdb/event-top.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/event-top.c 2008-01-01 23:53:09.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/event-top.c 2008-03-10 00:48:53.000000000 +0100
|
||||
--- ./gdb/event-top.c 2008-01-01 23:53:09.000000000 +0100
|
||||
+++ ./gdb/event-top.c 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <signal.h>
|
||||
#include "exceptions.h"
|
||||
|
@ -254,53 +257,48 @@ Index: gdb-6.7.50.20080227/gdb/event-top.c
|
|||
/* Each interpreter has its own rules on displaying the command
|
||||
prompt. */
|
||||
if (!current_interp_display_prompt_p ())
|
||||
Index: gdb-6.7.50.20080227/gdb/solib-svr4.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/solib-svr4.c 2008-03-10 00:48:51.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/solib-svr4.c 2008-03-10 00:48:53.000000000 +0100
|
||||
@@ -967,9 +967,34 @@ svr4_current_sos (void)
|
||||
free_so (new);
|
||||
else
|
||||
{
|
||||
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
- strcpy (new->so_original_name, new->so_name);
|
||||
+ struct build_id *build_id;
|
||||
--- ./gdb/solib-svr4.c 2008-08-21 00:29:46.000000000 +0200
|
||||
+++ ./gdb/solib-svr4.c 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -764,9 +764,33 @@ svr4_current_sos (void)
|
||||
safe_strerror (errcode));
|
||||
else
|
||||
{
|
||||
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
- strcpy (new->so_original_name, new->so_name);
|
||||
+ struct build_id *build_id;
|
||||
+
|
||||
+ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
+ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
+ /* May get overwritten below. */
|
||||
+ strcpy (new->so_name, new->so_original_name);
|
||||
+ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
+ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
+ /* May get overwritten below. */
|
||||
+ strcpy (new->so_name, new->so_original_name);
|
||||
+
|
||||
+ build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
|
||||
+ if (build_id != NULL)
|
||||
+ build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
|
||||
+ if (build_id != NULL)
|
||||
+ {
|
||||
+ char *name, *build_id_filename;
|
||||
+
|
||||
+ /* Missing the build-id matching separate debug info file
|
||||
+ would be handled while SO_NAME gets loaded. */
|
||||
+ name = build_id_to_filename (build_id, &build_id_filename, 0);
|
||||
+ if (name != NULL)
|
||||
+ {
|
||||
+ char *name, *build_id_filename;
|
||||
+
|
||||
+ /* Missing the build-id matching separate debug info file
|
||||
+ would be handled while SO_NAME gets loaded. */
|
||||
+ name = build_id_to_filename (build_id, &build_id_filename, 0);
|
||||
+ if (name != NULL)
|
||||
+ {
|
||||
+ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
+ xfree (name);
|
||||
+ }
|
||||
+ else
|
||||
+ debug_print_missing (new->so_name, build_id_filename);
|
||||
+
|
||||
+ xfree (build_id_filename);
|
||||
+ xfree (build_id);
|
||||
+ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
|
||||
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
+ xfree (name);
|
||||
+ }
|
||||
+ else
|
||||
+ debug_print_missing (new->so_name, build_id_filename);
|
||||
+
|
||||
if (debug_solib)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
Index: gdb-6.7.50.20080227/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/symfile.c 2008-03-10 00:48:51.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/symfile.c 2008-03-10 00:49:33.000000000 +0100
|
||||
@@ -54,6 +54,9 @@
|
||||
+ xfree (build_id_filename);
|
||||
+ xfree (build_id);
|
||||
+ }
|
||||
}
|
||||
xfree (buffer);
|
||||
|
||||
--- ./gdb/symfile.c 2008-08-21 00:29:46.000000000 +0200
|
||||
+++ ./gdb/symfile.c 2008-08-21 00:29:18.000000000 +0200
|
||||
@@ -53,6 +53,9 @@
|
||||
#include "varobj.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "solib.h"
|
||||
|
@ -310,7 +308,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
@@ -62,6 +65,7 @@
|
||||
@@ -61,6 +64,7 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -318,7 +316,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
|
||||
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
|
||||
@@ -1235,16 +1239,65 @@ symbol_file_clear (int from_tty)
|
||||
@@ -1226,16 +1230,65 @@ symbol_file_clear (int from_tty)
|
||||
printf_unfiltered (_("No symbol file now.\n"));
|
||||
}
|
||||
|
||||
|
@ -386,7 +384,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
{
|
||||
struct build_id *retval;
|
||||
|
||||
@@ -1260,6 +1313,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
@@ -1251,6 +1304,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -735,7 +733,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
|
||||
|
||||
static int
|
||||
@@ -1274,7 +1669,7 @@ build_id_verify (const char *filename, s
|
||||
@@ -1265,7 +1660,7 @@ build_id_verify (const char *filename, s
|
||||
if (abfd == NULL)
|
||||
return 0;
|
||||
|
||||
|
@ -744,7 +742,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
if (found == NULL)
|
||||
warning (_("File \"%s\" has no build-id, file skipped"), filename);
|
||||
@@ -1290,8 +1685,9 @@ build_id_verify (const char *filename, s
|
||||
@@ -1281,8 +1676,9 @@ build_id_verify (const char *filename, s
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -756,7 +754,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
{
|
||||
char *link, *s, *retval = NULL;
|
||||
gdb_byte *data = build_id->data;
|
||||
@@ -1299,7 +1695,9 @@ build_id_to_debug_filename (struct build
|
||||
@@ -1290,7 +1686,9 @@ build_id_to_debug_filename (struct build
|
||||
|
||||
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
|
||||
link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
|
||||
|
@ -767,7 +765,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
|
||||
if (size > 0)
|
||||
{
|
||||
@@ -1310,12 +1708,14 @@ build_id_to_debug_filename (struct build
|
||||
@@ -1301,12 +1699,14 @@ build_id_to_debug_filename (struct build
|
||||
*s++ = '/';
|
||||
while (size-- > 0)
|
||||
s += sprintf (s, "%02x", (unsigned) *data++);
|
||||
|
@ -784,7 +782,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
if (retval != NULL && !build_id_verify (retval, build_id))
|
||||
{
|
||||
@@ -1323,9 +1723,433 @@ build_id_to_debug_filename (struct build
|
||||
@@ -1314,9 +1714,446 @@ build_id_to_debug_filename (struct build
|
||||
retval = NULL;
|
||||
}
|
||||
|
||||
|
@ -1001,11 +999,14 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+{
|
||||
+ char **array, **array_iter;
|
||||
+ struct missing_rpm *list_iter;
|
||||
+ struct cleanup *cleanups;
|
||||
+
|
||||
+ if (missing_rpm_list_entries == 0)
|
||||
+ return;
|
||||
+
|
||||
+ array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
|
||||
+ cleanups = make_cleanup (xfree, array);
|
||||
+
|
||||
+ array_iter = array;
|
||||
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
||||
+ list_iter = list_iter->next)
|
||||
|
@ -1017,16 +1018,16 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+ qsort (array, missing_rpm_list_entries, sizeof (*array),
|
||||
+ (int (*) (const void *, const void *)) missing_rpm_list_compar);
|
||||
+
|
||||
+ printf (_("Missing separate debuginfos, use: %s"), "debuginfo-install");
|
||||
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||
+ "debuginfo-install");
|
||||
+ for (array_iter = array; array_iter < array + missing_rpm_list_entries;
|
||||
+ array_iter++)
|
||||
+ {
|
||||
+ putchar (' ');
|
||||
+ fputs (*array_iter, stdout);
|
||||
+ putchar_unfiltered (' ');
|
||||
+ puts_unfiltered (*array_iter);
|
||||
+ }
|
||||
+ putchar ('\n');
|
||||
+ putchar_unfiltered ('\n');
|
||||
+
|
||||
+ xfree (array);
|
||||
+ while (missing_rpm_list != NULL)
|
||||
+ {
|
||||
+ list_iter = missing_rpm_list;
|
||||
|
@ -1034,6 +1035,8 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+ xfree (list_iter);
|
||||
+ }
|
||||
+ missing_rpm_list_entries = 0;
|
||||
+
|
||||
+ do_cleanups (cleanups);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
|
@ -1110,8 +1113,8 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+ const struct missing_filepair *elem2)
|
||||
+{
|
||||
+ return strcmp (elem1->binary, elem2->binary) == 0
|
||||
+ && ((elem1->debug == NULL && elem2->debug == NULL)
|
||||
+ || strcmp (elem1->debug, elem2->debug) == 0);
|
||||
+ && ((elem1->debug == NULL) == (elem2->debug == NULL))
|
||||
+ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
|
@ -1144,6 +1147,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+{
|
||||
+ size_t binary_len0 = strlen (binary) + 1;
|
||||
+ size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
|
||||
+ struct missing_filepair missing_filepair_find;
|
||||
+ struct missing_filepair *missing_filepair;
|
||||
+ struct missing_filepair **slot;
|
||||
+
|
||||
|
@ -1159,6 +1163,27 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+ missing_filepair_xcalloc, NULL);
|
||||
+ }
|
||||
+
|
||||
+ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with
|
||||
+ obstack_free in the case of a (rare) match. The problem is ALLOC_F for
|
||||
+ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance
|
||||
+ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly
|
||||
+ not to free only MISSING_FILEPAIR but also some such structures (allocated
|
||||
+ during the htab_find_slot call). */
|
||||
+
|
||||
+ missing_filepair_find.binary = (char *) binary;
|
||||
+ missing_filepair_find.debug = (char *) debug;
|
||||
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
|
||||
+ &missing_filepair_find,
|
||||
+ INSERT);
|
||||
+
|
||||
+ /* While it may be still printed duplicitely with the missing debuginfo file
|
||||
+ * it is due to once printing about the binary file build-id link and once
|
||||
+ * about the .debug file build-id link as both the build-id symlinks are
|
||||
+ * located in the debuginfo package. */
|
||||
+
|
||||
+ if (*slot != NULL)
|
||||
+ return;
|
||||
+
|
||||
+ missing_filepair = obstack_alloc (&missing_filepair_obstack,
|
||||
+ sizeof (*missing_filepair) - 1
|
||||
+ + binary_len0 + debug_len0);
|
||||
|
@ -1172,20 +1197,6 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+ else
|
||||
+ missing_filepair->debug = NULL;
|
||||
+
|
||||
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
|
||||
+ missing_filepair,
|
||||
+ INSERT);
|
||||
+
|
||||
+ /* While it may be still printed duplicitely with the missing debuginfo file
|
||||
+ * it is due to once printing about the binary file build-id link and once
|
||||
+ * about the .debug file build-id link as both the build-id symlinks are
|
||||
+ * located in the debuginfo package. */
|
||||
+
|
||||
+ if (*slot != NULL)
|
||||
+ {
|
||||
+ obstack_free (&missing_filepair_obstack, missing_filepair);
|
||||
+ return;
|
||||
+ }
|
||||
+ *slot = missing_filepair;
|
||||
+
|
||||
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
||||
|
@ -1218,7 +1229,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
static char *
|
||||
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
|
||||
{
|
||||
@@ -1411,32 +2235,36 @@ static char *
|
||||
@@ -1402,32 +2231,36 @@ static char *
|
||||
find_separate_debug_file (struct objfile *objfile)
|
||||
{
|
||||
asection *sect;
|
||||
|
@ -1264,7 +1275,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
}
|
||||
|
||||
basename = get_debug_link_info (objfile, &crc32);
|
||||
@@ -1444,7 +2272,7 @@ find_separate_debug_file (struct objfile
|
||||
@@ -1435,7 +2268,7 @@ find_separate_debug_file (struct objfile
|
||||
if (basename == NULL)
|
||||
/* There's no separate debug info, hence there's no way we could
|
||||
load it => no warning. */
|
||||
|
@ -1273,7 +1284,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
dir = xstrdup (objfile->name);
|
||||
|
||||
@@ -1460,23 +2288,19 @@ find_separate_debug_file (struct objfile
|
||||
@@ -1451,23 +2284,19 @@ find_separate_debug_file (struct objfile
|
||||
gdb_assert (i >= 0 && IS_DIR_SEPARATOR (dir[i]));
|
||||
dir[i+1] = '\0';
|
||||
|
||||
|
@ -1304,7 +1315,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
|
||||
strcpy (debugfile, dir);
|
||||
@@ -1485,11 +2309,7 @@ find_separate_debug_file (struct objfile
|
||||
@@ -1476,11 +2305,7 @@ find_separate_debug_file (struct objfile
|
||||
strcat (debugfile, basename);
|
||||
|
||||
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
||||
|
@ -1317,7 +1328,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
/* Then try in the global debugfile directory. */
|
||||
strcpy (debugfile, debug_file_directory);
|
||||
@@ -1498,11 +2318,7 @@ find_separate_debug_file (struct objfile
|
||||
@@ -1489,11 +2314,7 @@ find_separate_debug_file (struct objfile
|
||||
strcat (debugfile, basename);
|
||||
|
||||
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
||||
|
@ -1330,7 +1341,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
|
||||
/* If the file is in the sysroot, try using its base path in the
|
||||
global debugfile directory. */
|
||||
@@ -1517,20 +2333,18 @@ find_separate_debug_file (struct objfile
|
||||
@@ -1508,20 +2329,18 @@ find_separate_debug_file (struct objfile
|
||||
strcat (debugfile, basename);
|
||||
|
||||
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
||||
|
@ -1359,7 +1370,7 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
}
|
||||
|
||||
|
||||
@@ -4220,4 +5034,16 @@ the global debug-file directory prepende
|
||||
@@ -4208,4 +5027,16 @@ the global debug-file directory prepende
|
||||
NULL,
|
||||
show_debug_file_directory,
|
||||
&setlist, &showlist);
|
||||
|
@ -1376,10 +1387,8 @@ Index: gdb-6.7.50.20080227/gdb/symfile.c
|
|||
+
|
||||
+ observer_attach_executable_changed (debug_print_executable_changed);
|
||||
}
|
||||
Index: gdb-6.7.50.20080227/gdb/symfile.h
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/symfile.h 2008-02-03 23:13:29.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/symfile.h 2008-03-10 00:48:53.000000000 +0100
|
||||
--- ./gdb/symfile.h 2008-02-03 23:13:29.000000000 +0100
|
||||
+++ ./gdb/symfile.h 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -358,6 +358,14 @@ extern int symfile_map_offsets_to_segmen
|
||||
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
|
||||
void free_symfile_segment_data (struct symfile_segment_data *data);
|
||||
|
@ -1395,10 +1404,27 @@ Index: gdb-6.7.50.20080227/gdb/symfile.h
|
|||
/* From dwarf2read.c */
|
||||
|
||||
extern int dwarf2_has_info (struct objfile *);
|
||||
Index: gdb-6.7.50.20080227/gdb/tui/tui-interp.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/tui/tui-interp.c 2008-01-01 23:53:22.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227/gdb/tui/tui-interp.c 2008-03-10 00:48:53.000000000 +0100
|
||||
--- ./gdb/testsuite/lib/gdb.exp 2008-08-21 00:29:46.000000000 +0200
|
||||
+++ ./gdb/testsuite/lib/gdb.exp 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -1199,6 +1199,16 @@ proc default_gdb_start { } {
|
||||
warning "Couldn't set the width to 0."
|
||||
}
|
||||
}
|
||||
+ # Turn off the missing RPMs warnings as the testsuite does not expect it.
|
||||
+ send_gdb "set build-id-verbose 0\n"
|
||||
+ gdb_expect 10 {
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ verbose "Disabled the missing debug infos warnings." 2
|
||||
+ }
|
||||
+ timeout {
|
||||
+ warning "Could not disable the missing debug infos warnings.."
|
||||
+ }
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- ./gdb/tui/tui-interp.c 2008-01-01 23:53:22.000000000 +0100
|
||||
+++ ./gdb/tui/tui-interp.c 2008-08-21 00:28:43.000000000 +0200
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "tui/tui.h"
|
||||
#include "tui/tui-io.h"
|
||||
|
|
|
@ -23,6 +23,11 @@ http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html
|
|||
* gdb.threads/watchpoint-fork-forkoff.c (forkoff): New delay after the
|
||||
parent/child messages to fix a race.
|
||||
|
||||
2008-05-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* s390-nat.c (s390_fix_watch_points): Fix its compilation failure
|
||||
- rename it to S390_FIX_WATCH_POINTS_LIST.
|
||||
|
||||
Index: gdb-6.7.50.20080227/gdb/amd64-linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-6.7.50.20080227.orig/gdb/amd64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
|
||||
|
@ -565,7 +570,7 @@ Index: gdb-6.7.50.20080227/gdb/s390-nat.c
|
|||
|
||||
static void
|
||||
-s390_fix_watch_points (ptid_t ptid)
|
||||
+s390_fix_watch_points (int tid, struct watch_area *area_list)
|
||||
+s390_fix_watch_points_list (int tid, struct watch_area *area_list)
|
||||
{
|
||||
- int tid;
|
||||
-
|
||||
|
@ -637,6 +642,17 @@ Index: gdb-6.7.50.20080227/gdb/s390-nat.c
|
|||
for (parea = &watch_base; *parea; parea = &(*parea)->next)
|
||||
if ((*parea)->lo_addr == addr
|
||||
&& (*parea)->hi_addr == addr + len - 1)
|
||||
@@ -378,8 +378,10 @@ s390_remove_watchpoint (CORE_ADDR addr,
|
||||
|
||||
if (!*parea)
|
||||
{
|
||||
+#if 0 /* Red Hat fork/threads watchpoints changes may trigger it. */
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
"Attempt to remove nonexistent watchpoint.\n");
|
||||
+#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -375,6 +392,15 @@ s390_remove_watchpoint (CORE_ADDR addr,
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -112,11 +112,3 @@ Index: gdb-6.7/gdb/symfile.c
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1174,7 +1196,6 @@ symbol_file_add_from_bfd (bfd *abfd, int
|
||||
mainline, flags);
|
||||
}
|
||||
|
||||
-
|
||||
/* Process a symbol file, as either the main file or as a dynamically
|
||||
loaded file. See symbol_file_add_with_addrs_or_offsets's comments
|
||||
for details. */
|
||||
|
|
|
@ -1,436 +0,0 @@
|
|||
2008-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Support attaching to stopped processes/threads and/or with pending
|
||||
signals. This ChangeLog entry is OBSOLETE:
|
||||
* linux-nat.c (STRINGIFY, STRINGIFY_ARG): New macros.
|
||||
(kill_lwp): New declaration.
|
||||
(linux_ptrace_post_attach, pid_is_stopped): New function.
|
||||
(linux_child_follow_fork): New comment about WAS_STOPPED.
|
||||
(lin_lwp_attach_lwp): Variable PID removed. Part replaced by a call to
|
||||
LINUX_PTRACE_POST_ATTACH.
|
||||
(linux_nat_attach): Likewise.
|
||||
(linux_nat_detach): Optionally stop the detached process.
|
||||
(linux_nat_resume): Clear WAS_STOPPED if appropriate.
|
||||
* NEWS: Document the new behaviour.
|
||||
|
||||
2007-06-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.texinfo (Attach): Document the ATTACH and DETACH commands for
|
||||
stopped processes. Document the messages on the seen pending signals.
|
||||
|
||||
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.8pre.
|
||||
|
||||
Index: gdb-6.8cvs20080219/gdb/NEWS
|
||||
===================================================================
|
||||
--- gdb-6.8cvs20080219.orig/gdb/NEWS 2008-02-24 19:35:37.000000000 +0100
|
||||
+++ gdb-6.8cvs20080219/gdb/NEWS 2008-02-24 19:36:26.000000000 +0100
|
||||
@@ -412,6 +412,9 @@ Renesas M32C/M16C m32c-elf
|
||||
|
||||
Morpho Technologies ms1 ms1-elf
|
||||
|
||||
+* On GNU/Linux, stopped processes may get attached to now. Signals being
|
||||
+delivered at the time of the attach command no longer get lost.
|
||||
+
|
||||
* New commands
|
||||
|
||||
init-if-undefined Initialize a convenience variable, but
|
||||
Index: gdb-6.8cvs20080219/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c 2008-02-24 19:36:26.000000000 +0100
|
||||
+++ gdb-6.8cvs20080219/gdb/linux-nat.c 2008-02-24 19:45:01.000000000 +0100
|
||||
@@ -89,6 +89,15 @@
|
||||
#define PTRACE_GETSIGINFO 0x4202
|
||||
#endif
|
||||
|
||||
+#define STRINGIFY_ARG(x) #x
|
||||
+#define STRINGIFY(x) STRINGIFY_ARG (x)
|
||||
+
|
||||
+static int linux_ptrace_post_attach (ptid_t ptid, int *cloned_return);
|
||||
+static int kill_lwp (int lwpid, int signo);
|
||||
+
|
||||
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
|
||||
+static pid_t pid_was_stopped;
|
||||
+
|
||||
/* The single-threaded native GNU/Linux target_ops. We save a pointer for
|
||||
the use of the multi-threaded target. */
|
||||
static struct target_ops *linux_ops;
|
||||
@@ -539,6 +548,11 @@ linux_child_follow_fork (struct target_o
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
|
||||
+ In this point of code it cannot be 1 as we would not get FORK
|
||||
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
|
||||
+ We would have to first TARGET_STOP and WAITPID it as with running
|
||||
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
|
||||
target_detach (NULL, 0);
|
||||
}
|
||||
|
||||
@@ -942,9 +956,8 @@ lin_lwp_attach_lwp (ptid_t ptid)
|
||||
to happen. */
|
||||
if (GET_LWP (ptid) != GET_PID (ptid) && lp == NULL)
|
||||
{
|
||||
- pid_t pid;
|
||||
int status;
|
||||
- int cloned = 0;
|
||||
+ int cloned;
|
||||
|
||||
if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
|
||||
{
|
||||
@@ -958,37 +971,20 @@ lin_lwp_attach_lwp (ptid_t ptid)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (debug_linux_nat)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
|
||||
- target_pid_to_str (ptid));
|
||||
-
|
||||
- pid = my_waitpid (GET_LWP (ptid), &status, 0);
|
||||
- if (pid == -1 && errno == ECHILD)
|
||||
- {
|
||||
- /* Try again with __WCLONE to check cloned processes. */
|
||||
- pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
|
||||
- cloned = 1;
|
||||
+ status = linux_ptrace_post_attach (ptid, &cloned);
|
||||
+ if (status != 0)
|
||||
+ {
|
||||
+ error (_("Thread %s exited: %s"), target_pid_to_str (ptid),
|
||||
+ status_to_str (status));
|
||||
}
|
||||
|
||||
- gdb_assert (pid == GET_LWP (ptid)
|
||||
- && WIFSTOPPED (status) && WSTOPSIG (status));
|
||||
-
|
||||
- if (lp == NULL)
|
||||
- lp = add_lwp (ptid);
|
||||
+ /* ADD_LWP with TID only already after the WAITPID. */
|
||||
+ lp = add_lwp (ptid);
|
||||
lp->cloned = cloned;
|
||||
|
||||
- target_post_attach (pid);
|
||||
+ target_post_attach (GET_LWP (ptid));
|
||||
|
||||
lp->stopped = 1;
|
||||
-
|
||||
- if (debug_linux_nat)
|
||||
- {
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLAL: waitpid %s received %s\n",
|
||||
- target_pid_to_str (ptid),
|
||||
- status_to_str (status));
|
||||
- }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -998,44 +994,202 @@ lin_lwp_attach_lwp (ptid_t ptid)
|
||||
threads. Note that this won't have already been done since
|
||||
the main thread will have, we assume, been stopped by an
|
||||
attach from a different layer. */
|
||||
- if (lp == NULL)
|
||||
- lp = add_lwp (ptid);
|
||||
lp->stopped = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Detect `T (stopped)' in `/proc/PID/status'.
|
||||
+ Other states including `T (tracing stop)' are reported as false. */
|
||||
+
|
||||
+static int
|
||||
+pid_is_stopped (pid_t pid)
|
||||
+{
|
||||
+ FILE *status_file;
|
||||
+ char buf[100];
|
||||
+ int retval = 0;
|
||||
+
|
||||
+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
|
||||
+ status_file = fopen (buf, "r");
|
||||
+ if (status_file != NULL)
|
||||
+ {
|
||||
+ int have_state = 0;
|
||||
+
|
||||
+ while (fgets (buf, sizeof (buf), status_file))
|
||||
+ {
|
||||
+ if (strncmp (buf, "State:", 6) == 0)
|
||||
+ {
|
||||
+ have_state = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (have_state && strstr (buf, "T (stopped)") != NULL)
|
||||
+ retval = 1;
|
||||
+ fclose (status_file);
|
||||
+ }
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* Handle the processing after PTRACE_ATTACH, the first WAITPID -> SIGSTOP.
|
||||
+ Returns STATUS if the thread has exited, 0 otherwise.
|
||||
+ Sets PID_WAS_STOPPED if the process was originally stopped.
|
||||
+ Sets LP->CLONED if the given LWP is not the thread leader.
|
||||
+
|
||||
+ Scenario for a standard unstopped inferior:
|
||||
+ * `S (sleeping)' or `R (running)' or similiar states.
|
||||
+ * PTRACE_ATTACH is called.
|
||||
+ * `S (sleeping)' (or similiar) for some while.
|
||||
+ * `T (tracing stop)'.
|
||||
+ * WAITPID succeeds here returning SIGSTOP (signalled by PTRACE_ATTACH).
|
||||
+
|
||||
+ Scenario for a formerly stopped inferior:
|
||||
+ * `T (stopped)'.
|
||||
+ * PTRACE_ATTACH is called.
|
||||
+ * `T (stopped)' would stay indefinitely
|
||||
+ Note since this moment the `TracerPid' field gets filled
|
||||
+ (by PTRACE_ATTACH), it is no longer just the common `T (stopped)' state.
|
||||
+ * If no one did WAITPID since sending SIGSTOP our WAITPID would return
|
||||
+ SIGSTOP. The state still would not turn to `T (tracing stop)'.
|
||||
+ * Usually its original parent (before PTRACE_ATTACH was applied) already
|
||||
+ did WAITPID. The original parent already received our SIGSTOP
|
||||
+ sinalled by our PTRACE_ATTACH.
|
||||
+ In this case our own WAITPID would hang. Therefore...
|
||||
+ * ... we do artificial: tkill (SIGCONT);
|
||||
+ `PTRACE_CONT, SIGSTOP' does not work in 100% cases as sometimes SIGSTOP
|
||||
+ gets remembered by kernel during the first PTRACE_CONT later and we get
|
||||
+ spurious SIGSTOP event. Expecting the signal may get delivered to
|
||||
+ a different task of the thread group.
|
||||
+ `kill_lwp (SIGSTOP)' has no effect in this moment (it is already stopped).
|
||||
+ * WAITPID returns the artifical SIGCONT.
|
||||
+ (The possibly pending SIGSTOP gets vanished by specifically SIGCONT.)
|
||||
+ * State turns `T (tracing stop)'.
|
||||
+ In this moment everything is almost fine but we need a workaround as final
|
||||
+ `PTRACE_DETACH, SIGSTOP' would leave the process unstopped otherwise:
|
||||
+ * tkill (SIGSTOP);
|
||||
+ * `PTRACE_CONT, 0'
|
||||
+ * WAITPID returns the artifical SIGSTOP.
|
||||
+
|
||||
+ With the pending (unwaited for) SIGSTOP the artifical signal effects are:
|
||||
+ kill (SIGSTOP)
|
||||
+ PTRACE_ATTACH
|
||||
+ /-tkill (SIGCONT), WAITPID: SIGCONT, WAITPID: hang !
|
||||
+ //-tkill (SIGCONT), WAITPID: SIGCONT, PTRACE_CONT (SIG_0), WAITPID: wait (OK)
|
||||
+ \\-tkill (SIGALRM), WAITPID: SIGSTOP, WAITPID: hang !
|
||||
+ \-tkill (SIGALRM), WAITPID: SIGSTOP, PTRACE_CONT (SIG_0), WAITPID: SIGALRM !
|
||||
+ Therefore we signal artifical SIGCONT and stop waiting after its reception.
|
||||
+
|
||||
+ For the detection whether the process was formerly stopped we need to
|
||||
+ read `/proc/PID/status'. `PTRACE_CONT, SIGSTOP' returns ESRCH
|
||||
+ for `S (sleeping)' and succeeds for `T (stopped)' but it unfortunately
|
||||
+ succeeds even for `T (tracing stop)'. Depending on PTRACE_CONT, SIGSTOP
|
||||
+ success value for formerly stopped processes would mean a race condition
|
||||
+ as we would get false stopped processes detection if we get too slow.
|
||||
+
|
||||
+ `waitid (..., WSTOPPED)' hangs the same way as WAITPID.
|
||||
+
|
||||
+ Signals get queued for WAITPID. PTRACE_ATTACH (or TKILL) enqueues SIGSTOP
|
||||
+ there but WAITPID may return an already pending signal.
|
||||
+ Redeliver it by PTRACE_CONT, SIGxxx as otherwise it would get lost.
|
||||
+ Similiar processing is being done in this file by WAIT_LWP. */
|
||||
+
|
||||
+static int
|
||||
+linux_ptrace_post_attach (ptid_t ptid, int *cloned_return)
|
||||
+{
|
||||
+ unsigned long sig;
|
||||
+ int this_thread_was_stopped;
|
||||
+ int cloned = 0;
|
||||
+
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
|
||||
+ target_pid_to_str (ptid));
|
||||
+
|
||||
+ /* This code should not be run for the threads being attached after the first
|
||||
+ thread (process) as we would get later spurious SIGCONT otherwise. */
|
||||
+
|
||||
+ this_thread_was_stopped = pid_is_stopped (GET_LWP (ptid));
|
||||
+ if (this_thread_was_stopped)
|
||||
+ {
|
||||
+ pid_was_stopped = GET_PID (ptid);
|
||||
+ if (kill_lwp (GET_LWP (ptid), SIGCONT) != 0)
|
||||
+ perror_with_name (("kill_lwp (SIGCONT)"));
|
||||
+ }
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ pid_t pid;
|
||||
+ int status;
|
||||
+
|
||||
+ pid = my_waitpid (GET_LWP (ptid), &status, 0);
|
||||
+ if (pid == -1 && errno == ECHILD)
|
||||
+ {
|
||||
+ /* Try again with __WCLONE to check cloned processes. */
|
||||
+ pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
|
||||
+ cloned = 1;
|
||||
+ }
|
||||
+
|
||||
+ gdb_assert (pid == GET_LWP (ptid));
|
||||
+
|
||||
+ if (debug_linux_nat)
|
||||
+ {
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LLAL: waitpid %s received %s\n",
|
||||
+ target_pid_to_str (ptid),
|
||||
+ status_to_str (status));
|
||||
+ }
|
||||
+
|
||||
+ /* Check if the thread has exited. */
|
||||
+ if (WIFEXITED (status) || WIFSIGNALED (status))
|
||||
+ return status;
|
||||
+ gdb_assert (WIFSTOPPED (status));
|
||||
+ sig = WSTOPSIG (status);
|
||||
+ gdb_assert (sig != 0);
|
||||
+ if (sig == SIGSTOP)
|
||||
+ break;
|
||||
+
|
||||
+ /* As the second signal for stopped processes we send SIGSTOP. */
|
||||
+ if (this_thread_was_stopped && sig == SIGCONT)
|
||||
+ sig = SIGSTOP;
|
||||
+
|
||||
+ printf_unfiltered (_("Redelivering pending %s.\n"),
|
||||
+ target_signal_to_string (target_signal_from_host (sig)));
|
||||
+ if (sig == SIGSTOP)
|
||||
+ {
|
||||
+ if (kill_lwp (GET_LWP (ptid), sig) != 0)
|
||||
+ perror_with_name (("kill_lwp"));
|
||||
+ /* We now must resume the inferior to get SIGSTOP delivered. */
|
||||
+ sig = 0;
|
||||
+ }
|
||||
+ if (ptrace (PTRACE_CONT, GET_LWP (ptid), NULL, (void *) sig) != 0)
|
||||
+ perror_with_name (("ptrace"));
|
||||
+ }
|
||||
+ *cloned_return = cloned;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
linux_nat_attach (char *args, int from_tty)
|
||||
{
|
||||
struct lwp_info *lp;
|
||||
- pid_t pid;
|
||||
int status;
|
||||
- int cloned = 0;
|
||||
+ int cloned;
|
||||
|
||||
/* FIXME: We should probably accept a list of process id's, and
|
||||
attach all of them. */
|
||||
linux_ops->to_attach (args, from_tty);
|
||||
|
||||
- /* Make sure the initial process is stopped. The user-level threads
|
||||
- layer might want to poke around in the inferior, and that won't
|
||||
- work if things haven't stabilized yet. */
|
||||
- pid = my_waitpid (GET_PID (inferior_ptid), &status, 0);
|
||||
- if (pid == -1 && errno == ECHILD)
|
||||
- {
|
||||
- warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid));
|
||||
-
|
||||
- /* Try again with __WCLONE to check cloned processes. */
|
||||
- pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
|
||||
- cloned = 1;
|
||||
- }
|
||||
-
|
||||
- gdb_assert (pid == GET_PID (inferior_ptid)
|
||||
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
|
||||
-
|
||||
/* Add the initial process as the first LWP to the list. */
|
||||
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
|
||||
+
|
||||
+ status = linux_ptrace_post_attach (inferior_ptid, &cloned);
|
||||
+ if (status != 0)
|
||||
+ error (_("Program %s exited: %s\n"), target_pid_to_str (inferior_ptid),
|
||||
+ status_to_str (status));
|
||||
+ if (cloned)
|
||||
+ warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid));
|
||||
+
|
||||
+ /* ADD_LWP with TID only already after the WAITPID. */
|
||||
lp = add_lwp (inferior_ptid);
|
||||
lp->cloned = cloned;
|
||||
|
||||
@@ -1046,8 +1200,8 @@ linux_nat_attach (char *args, int from_t
|
||||
lp->resumed = 1;
|
||||
if (debug_linux_nat)
|
||||
{
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
|
||||
+ fprintf_unfiltered (gdb_stdlog, "LLA: waitpid %d, faking SIGSTOP\n",
|
||||
+ GET_PID (inferior_ptid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1092,6 +1246,9 @@ detach_callback (struct lwp_info *lp, vo
|
||||
overall process id just yet. */
|
||||
if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
|
||||
{
|
||||
+ /* None of these threads should be stopped for PID_WAS_STOPPED. Only the
|
||||
+ last thread (process) will be stopped by LINUX_NAT_DETACH. */
|
||||
+
|
||||
errno = 0;
|
||||
if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
|
||||
WSTOPSIG (lp->status)) < 0)
|
||||
@@ -1120,6 +1277,9 @@ linux_nat_detach (char *args, int from_t
|
||||
|
||||
trap_ptid = null_ptid;
|
||||
|
||||
+ if (pid_was_stopped == GET_PID (lwp_list->ptid))
|
||||
+ args = STRINGIFY (SIGSTOP);
|
||||
+
|
||||
/* Destroy LWP info; it's no longer valid. */
|
||||
init_lwp_list ();
|
||||
|
||||
@@ -1255,6 +1415,14 @@ linux_nat_resume (ptid_t ptid, int step_
|
||||
resume_callback. */
|
||||
lp->stopped = 0;
|
||||
|
||||
+ /* At this point, we are going to resume the inferior and if we
|
||||
+ have attached to a stopped process, we no longer should leave
|
||||
+ it as stopped if the user detaches. PTID variable has PID set to LWP
|
||||
+ while we need to check the real PID here. */
|
||||
+
|
||||
+ if (!step && lp && pid_was_stopped == GET_PID (lp->ptid))
|
||||
+ pid_was_stopped = 0;
|
||||
+
|
||||
if (resume_all)
|
||||
iterate_over_lwps (resume_callback, NULL);
|
||||
|
||||
Index: gdb-6.8cvs20080219/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-6.8cvs20080219.orig/gdb/doc/gdb.texinfo 2008-02-24 19:36:24.000000000 +0100
|
||||
+++ gdb-6.8cvs20080219/gdb/doc/gdb.texinfo 2008-02-24 19:36:26.000000000 +0100
|
||||
@@ -2176,16 +2176,29 @@ can step and continue; you can modify st
|
||||
process continue running, you may use the @code{continue} command after
|
||||
attaching @value{GDBN} to the process.
|
||||
|
||||
+For a process already being stopped before the @code{attach} command executed
|
||||
+you get the informational message below. Other signals may be occasionally
|
||||
+shown if they were being delivered right the time the @code{attach} command
|
||||
+executed. Such process is left still stopped after the @code{detach} command
|
||||
+as long as you have not used the @code{continue} command (or similiar one)
|
||||
+during your debugging session.
|
||||
+
|
||||
+@smallexample
|
||||
+Attaching to program: /bin/sleep, process 16289
|
||||
+Redelivering pending Stopped (signal).
|
||||
+@end smallexample
|
||||
+
|
||||
@table @code
|
||||
@kindex detach
|
||||
@item detach
|
||||
When you have finished debugging the attached process, you can use the
|
||||
-@code{detach} command to release it from @value{GDBN} control. Detaching
|
||||
-the process continues its execution. After the @code{detach} command,
|
||||
-that process and @value{GDBN} become completely independent once more, and you
|
||||
-are ready to @code{attach} another process or start one with @code{run}.
|
||||
-@code{detach} does not repeat if you press @key{RET} again after
|
||||
-executing the command.
|
||||
+@code{detach} command to release it from @value{GDBN} control. Detaching the
|
||||
+process continues its execution unless it was already stopped before the
|
||||
+attachment and a @code{continue} type command has not been executed. After the
|
||||
+@code{detach} command, that process and @value{GDBN} become completely
|
||||
+independent once more, and you are ready to @code{attach} another process or
|
||||
+start one with @code{run}. @code{detach} does not repeat if you press
|
||||
+@key{RET} again after executing the command.
|
||||
@end table
|
||||
|
||||
If you exit @value{GDBN} while you have an attached process, you detach
|
|
@ -88,3 +88,55 @@
|
|||
|
||||
set timeout $oldtimeout
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
2008-04-21 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* ada-lang.c (get_selections): Variable PROMPT made non-const and
|
||||
initialized with a trailing space now. Use PROMPT_ARG of
|
||||
COMMAND_LINE_INPUT instead of printing it ourselves.
|
||||
|
||||
--- ./gdb/ada-lang.c 6 Apr 2008 08:56:36 -0000 1.137
|
||||
+++ ./gdb/ada-lang.c 21 Apr 2008 13:33:42 -0000
|
||||
@@ -3424,18 +3424,15 @@ get_selections (int *choices, int n_choi
|
||||
int is_all_choice, char *annotation_suffix)
|
||||
{
|
||||
char *args;
|
||||
- const char *prompt;
|
||||
+ char *prompt;
|
||||
int n_chosen;
|
||||
int first_choice = is_all_choice ? 2 : 1;
|
||||
|
||||
prompt = getenv ("PS2");
|
||||
if (prompt == NULL)
|
||||
- prompt = ">";
|
||||
+ prompt = "> ";
|
||||
|
||||
- printf_unfiltered (("%s "), prompt);
|
||||
- gdb_flush (gdb_stdout);
|
||||
-
|
||||
- args = command_line_input ((char *) NULL, 0, annotation_suffix);
|
||||
+ args = command_line_input (prompt, 0, annotation_suffix);
|
||||
|
||||
if (args == NULL)
|
||||
error_no_arg (_("one or more choice numbers"));
|
||||
|
||||
|
||||
|
||||
Found on RHEL-5.s390x.
|
||||
|
||||
--- sources/gdb/testsuite/gdb.base/dump.exp-orig 2008-08-28 11:44:40.000000000 +0200
|
||||
+++ sources/gdb/testsuite/gdb.base/dump.exp 2008-08-28 11:44:49.000000000 +0200
|
||||
@@ -493,8 +493,10 @@ if ![string compare $is64bitonly "no"] t
|
||||
gdb_test "print zero_all ()" "" ""
|
||||
|
||||
# restore with expressions
|
||||
+ # Address may fit in int32 but its negative result would be 0xffffxxxx for
|
||||
+ # 64-bit LONGEST addresses.
|
||||
test_restore_saved_value \
|
||||
- "intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
|
||||
+ "intarr3.srec (long)${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
|
||||
"array partial with expressions" 4 "intarray2\[3\]"
|
||||
|
||||
gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
|
||||
|
|
|
@ -0,0 +1,482 @@
|
|||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/linux-nat.c gdb-6.8/gdb/linux-nat.c
|
||||
--- gdb-6.8-base/gdb/linux-nat.c 2008-08-27 18:09:35.000000000 +0200
|
||||
+++ gdb-6.8/gdb/linux-nat.c 2008-08-27 18:48:40.000000000 +0200
|
||||
@@ -117,6 +117,9 @@
|
||||
static struct target_ops *linux_ops;
|
||||
static struct target_ops linux_ops_saved;
|
||||
|
||||
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
|
||||
+static pid_t pid_was_stopped;
|
||||
+
|
||||
/* The method to call, if any, when a new thread is attached. */
|
||||
static void (*linux_nat_new_thread) (ptid_t);
|
||||
|
||||
@@ -531,6 +534,11 @@ linux_child_follow_fork (struct target_o
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
|
||||
+ In this point of code it cannot be 1 as we would not get FORK
|
||||
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
|
||||
+ We would have to first TARGET_STOP and WAITPID it as with running
|
||||
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
|
||||
target_detach (NULL, 0);
|
||||
}
|
||||
|
||||
@@ -936,6 +944,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
|
||||
if (debug_linux_nat)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LNPAW: Attaching to a stopped process\n");
|
||||
+ pid_was_stopped = GET_PID (ptid);
|
||||
|
||||
/* The process is definitely stopped. It is in a job control
|
||||
stop, unless the kernel predates the TASK_STOPPED /
|
||||
@@ -1128,6 +1137,9 @@ get_pending_status (struct lwp_info *lp,
|
||||
else
|
||||
*status = lp->status;
|
||||
|
||||
+ if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
|
||||
+ *status = W_STOPCODE (SIGSTOP);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1207,6 +1219,8 @@ linux_nat_detach (char *args, int from_t
|
||||
|
||||
trap_ptid = null_ptid;
|
||||
|
||||
+ pid_was_stopped = 0;
|
||||
+
|
||||
/* Destroy LWP info; it's no longer valid. */
|
||||
init_lwp_list ();
|
||||
|
||||
@@ -1340,6 +1354,14 @@ linux_nat_resume (ptid_t ptid, int step,
|
||||
resume_callback. */
|
||||
lp->stopped = 0;
|
||||
|
||||
+ /* At this point, we are going to resume the inferior and if we
|
||||
+ have attached to a stopped process, we no longer should leave
|
||||
+ it as stopped if the user detaches. PTID variable has PID set to LWP
|
||||
+ while we need to check the real PID here. */
|
||||
+
|
||||
+ if (!step && lp && pid_was_stopped == GET_PID (lp->ptid))
|
||||
+ pid_was_stopped = 0;
|
||||
+
|
||||
if (resume_all)
|
||||
iterate_over_lwps (resume_callback, NULL);
|
||||
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attach-into-signal.c gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.c
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attach-into-signal.c 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.c 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,19 +1,20 @@
|
||||
/* This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
- Copyright 2008 Free Software Foundation, Inc.
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
- the Free Software Foundation; either version 3 of the License, or
|
||||
+ 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, see <http://www.gnu.org/licenses/>. */
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
@@ -40,8 +41,10 @@ static void *func (void *arg)
|
||||
|
||||
raise (SIGALRM);
|
||||
|
||||
- /* We must not get past this point, either in a free standing or debugged
|
||||
- state. */
|
||||
+ /* This should be NOTREACHED but sometimes it is reached - Bug 427860.
|
||||
+ We never get here without ptrace(2). It may also be a kernel bug. */
|
||||
+ for (;;)
|
||||
+ pause ();
|
||||
|
||||
abort ();
|
||||
/* NOTREACHED */
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attach-into-signal.exp gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.exp
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attach-into-signal.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.exp 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,27 +1,29 @@
|
||||
-# Copyright 2008
|
||||
-# Free Software Foundation, Inc.
|
||||
+# Copyright 2007
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
-# the Free Software Foundation; either version 3 of the License, or
|
||||
+# 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, see <http://www.gnu.org/licenses/>.
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This test was created by modifying attach-stopped.exp.
|
||||
# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
|
||||
-# This test only works on Linux
|
||||
-if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
- continue
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
}
|
||||
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
set testfile "attach-into-signal"
|
||||
set srcfile ${testfile}.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
@@ -60,6 +62,10 @@ proc corefunc { threadtype } {
|
||||
set attempt 1
|
||||
set passes 1
|
||||
while { $passes < 3 && $attempt <= $attempts } {
|
||||
+
|
||||
+ # Start with clean gdb
|
||||
+ gdb_exit
|
||||
+
|
||||
set stoppedtry 0
|
||||
while { $stoppedtry < 10 } {
|
||||
if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
@@ -83,10 +89,30 @@ proc corefunc { threadtype } {
|
||||
break
|
||||
}
|
||||
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ gdb_test "set debug lin-lwp 1" "" ""
|
||||
+
|
||||
+ set test "$threadtype: set file (pass $passes), before attach1 to stopped process"
|
||||
+ if {[gdb_test_multiple "file $binfile" $test {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." ""
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ }
|
||||
+ }] != 0 } {
|
||||
+ break
|
||||
+ }
|
||||
+
|
||||
# Main test:
|
||||
set test "$threadtype: attach (pass $passes), pending signal catch"
|
||||
if {[gdb_test_multiple "attach $testpid" $test {
|
||||
- -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Redelivering pending Alarm clock..*$gdb_prompt $" {
|
||||
# nonthreaded:
|
||||
pass $test
|
||||
verbose -log "$test succeeded on the attempt # $attempt of $attempts"
|
||||
@@ -97,7 +123,7 @@ proc corefunc { threadtype } {
|
||||
# We just lack the luck, we should try it again.
|
||||
set attempt [expr $attempt + 1]
|
||||
}
|
||||
- -re "Attaching to process $testpid.*Received Alarm clock.*$gdb_prompt $" {
|
||||
+ -re "Attaching to process $testpid.*Redelivering pending Alarm clock..*$gdb_prompt $" {
|
||||
# threaded:
|
||||
pass $test
|
||||
verbose -log "$test succeeded on the attempt # $attempt of $attempts"
|
||||
@@ -111,8 +137,6 @@ proc corefunc { threadtype } {
|
||||
}] != 0 } {
|
||||
break
|
||||
}
|
||||
-
|
||||
- gdb_test "detach" "Detaching from.*" ""
|
||||
}
|
||||
if {$passes < 3} {
|
||||
if {$attempt > $attempts} {
|
||||
@@ -138,20 +162,12 @@ proc corefunc { threadtype } {
|
||||
remote_exec build "kill -9 ${testpid}"
|
||||
}
|
||||
|
||||
-# Start with clean gdb
|
||||
-gdb_exit
|
||||
-
|
||||
# build the test case first without threads
|
||||
#
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||||
}
|
||||
|
||||
-gdb_start
|
||||
-gdb_reinitialize_dir $srcdir/$subdir
|
||||
-gdb_load ${binfile}
|
||||
-gdb_test "set debug lin-lwp 1" "" ""
|
||||
-
|
||||
corefunc nonthreaded
|
||||
|
||||
# build the test case also with threads
|
||||
@@ -160,9 +176,4 @@ if { [gdb_compile_pthreads "${srcdir}/$
|
||||
gdb_suppress_entire_file "Testcase threaded compile failed, so all tests in this file will automatically fail."
|
||||
}
|
||||
|
||||
-gdb_start
|
||||
-gdb_reinitialize_dir $srcdir/$subdir
|
||||
-gdb_load ${binfile}
|
||||
-gdb_test "set debug lin-lwp 1" "" ""
|
||||
-
|
||||
corefunc threaded
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attach-stopped.c gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.c
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attach-stopped.c 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.c 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,19 +1,20 @@
|
||||
/* This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
- Copyright 2008 Free Software Foundation, Inc.
|
||||
+ 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 3 of the License, or
|
||||
+ 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, see <http://www.gnu.org/licenses/>. */
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This program is intended to be started outside of gdb, then
|
||||
manually stopped via a signal. */
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attach-stopped.exp gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attach-stopped.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.exp 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,26 +1,33 @@
|
||||
-# Copyright 2008
|
||||
-# Free Software Foundation, Inc.
|
||||
+# Copyright 2005-2007
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
-# the Free Software Foundation; either version 3 of the License, or
|
||||
+# 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, see <http://www.gnu.org/licenses/>.
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This test was created by modifying attach.exp.
|
||||
# This file was created by Jeff Johnston <jjohnstn@redhat.com>.
|
||||
# This file was updated by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
# This test only works on Linux
|
||||
-if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
- continue
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
}
|
||||
|
||||
set testfile "attach-stopped"
|
||||
@@ -63,7 +70,65 @@ proc corefunc { threadtype } {
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
- # Verify that we can attach to the stopped process.
|
||||
+ # 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.
|
||||
+
|
||||
+ set test "$threadtype: set file, before attach1 to stopped process"
|
||||
+ gdb_test_multiple "file $binfile" "$test" {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
|
||||
+ "$test (re-read)"
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1 to stopped, after setting file"
|
||||
+ gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
|
||||
+ if {[string equal $threadtype threaded]} {
|
||||
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
|
||||
+ } else {
|
||||
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
|
||||
+ }
|
||||
+
|
||||
+ # Exit and detach the process.
|
||||
+
|
||||
+ gdb_exit
|
||||
+
|
||||
+ # Avoid some race:
|
||||
+ sleep 2
|
||||
+
|
||||
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
+ set line2 "NOTFOUND"
|
||||
+ } else {
|
||||
+ gets $fileid line1;
|
||||
+ gets $fileid line2;
|
||||
+ close $fileid;
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1, exit leaves process stopped"
|
||||
+ if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+
|
||||
+ # At this point, the process should still be stopped
|
||||
+
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # Verify that we can attach to the process just by giving the
|
||||
+ # process ID.
|
||||
|
||||
set test "$threadtype: attach2 to stopped, after setting file"
|
||||
gdb_test_multiple "attach $testpid" "$test" {
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attachstop-mt.c gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.c
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attachstop-mt.c 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.c 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,19 +1,20 @@
|
||||
/* This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
- Copyright 2008 Free Software Foundation, Inc.
|
||||
+ 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 3 of the License, or
|
||||
+ 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, see <http://www.gnu.org/licenses/>. */
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This program is intended to be started outside of gdb, then
|
||||
manually stopped via a signal. */
|
||||
diff -up -u -X /home/jkratoch2/.diffi.list -rup gdb-6.8-base/gdb/testsuite/gdb.threads/attachstop-mt.exp gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.exp
|
||||
--- gdb-6.8-base/gdb/testsuite/gdb.threads/attachstop-mt.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.exp 2008-08-27 18:13:41.000000000 +0200
|
||||
@@ -1,26 +1,33 @@
|
||||
-# Copyright 2008
|
||||
-# Free Software Foundation, Inc.
|
||||
+# Copyright 2006
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
-# the Free Software Foundation; either version 3 of the License, or
|
||||
+# 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, see <http://www.gnu.org/licenses/>.
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This test was created by modifying gdb.threads/attachstop.
|
||||
# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
# Regression for: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197584
|
||||
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
# This test only works on Linux
|
||||
-if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
- continue
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
}
|
||||
|
||||
set testfile "attachstop-mt"
|
||||
@@ -169,12 +176,23 @@ gdb_test "bt" ".*sleep.*(func|main).*" "
|
||||
# Exit and detach the process.
|
||||
gdb_exit
|
||||
|
||||
-# Stop the program
|
||||
-remote_exec build "kill -s STOP ${testpid}"
|
||||
-
|
||||
# No race
|
||||
sleep 2
|
||||
|
||||
+set fileid3 [open $status2 r];
|
||||
+gets $fileid3 line1;
|
||||
+gets $fileid3 line2;
|
||||
+close $fileid3;
|
||||
+
|
||||
+set test "attach3, exit leaves process stopped"
|
||||
+if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+# At this point, the process should still be stopped
|
||||
+
|
||||
# Continue the test as we would hit another expected bug regarding
|
||||
# Program received signal SIGSTOP, Stopped (signal).
|
||||
# across NPTL threads.
|
|
@ -1,38 +1,487 @@
|
|||
2008-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/attach-into-signal.c, gdb.threads/attach-into-signal.exp,
|
||||
gdb.threads/attach-stopped.c, gdb.threads/attach-stopped.exp: New files.
|
||||
|
||||
2008-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Bugreport by Petr Muller.
|
||||
* gdb.threads/attach-stopped.exp: Fix the `Second sleep' breakpoint,
|
||||
add there a comment.
|
||||
|
||||
Formerly gdb-6.3-bz202705-attach-stop-20051011-race-fix-test.patch:
|
||||
gdb.threads/attachstop-mt.exp, gdb.threads/attachstop-mt.c
|
||||
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-into-signal.c gdb-6.5/gdb/testsuite/gdb.threads/attach-into-signal.c
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-into-signal.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attach-into-signal.c 2008-01-09 15:26:30.000000000 +0100
|
||||
@@ -0,0 +1,70 @@
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/NEWS gdb-6.8/gdb/NEWS
|
||||
--- gdb-6.8-orig/gdb/NEWS 2008-03-27 19:14:10.000000000 +0100
|
||||
+++ gdb-6.8/gdb/NEWS 2008-08-27 17:45:03.000000000 +0200
|
||||
@@ -1,6 +1,12 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
+*** Changes since GDB 6.8
|
||||
+
|
||||
+* On GNU/Linux, GDB can now attach to stopped processes. Several race
|
||||
+conditions handling signals delivered during attach or thread creation
|
||||
+have also been fixed.
|
||||
+
|
||||
*** Changes in GDB 6.8
|
||||
|
||||
* New native configurations
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/infcmd.c gdb-6.8/gdb/infcmd.c
|
||||
--- gdb-6.8-orig/gdb/infcmd.c 2008-01-31 14:37:21.000000000 +0100
|
||||
+++ gdb-6.8/gdb/infcmd.c 2008-08-27 17:45:31.000000000 +0200
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "observer.h"
|
||||
#include "target-descriptions.h"
|
||||
#include "user-regs.h"
|
||||
+#include "gdbthread.h"
|
||||
|
||||
/* Functions exported for general use, in inferior.h: */
|
||||
|
||||
@@ -1974,6 +1975,7 @@ detach_command (char *args, int from_tty
|
||||
dont_repeat (); /* Not for the faint of heart. */
|
||||
target_detach (args, from_tty);
|
||||
no_shared_libraries (NULL, from_tty);
|
||||
+ init_thread_list ();
|
||||
if (deprecated_detach_hook)
|
||||
deprecated_detach_hook ();
|
||||
}
|
||||
@@ -1992,6 +1994,7 @@ disconnect_command (char *args, int from
|
||||
dont_repeat (); /* Not for the faint of heart */
|
||||
target_disconnect (args, from_tty);
|
||||
no_shared_libraries (NULL, from_tty);
|
||||
+ init_thread_list ();
|
||||
if (deprecated_detach_hook)
|
||||
deprecated_detach_hook ();
|
||||
}
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/infrun.c gdb-6.8/gdb/infrun.c
|
||||
--- gdb-6.8-orig/gdb/infrun.c 2008-01-29 23:47:19.000000000 +0100
|
||||
+++ gdb-6.8/gdb/infrun.c 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -1966,13 +1966,15 @@ handle_inferior_event (struct execution_
|
||||
|
||||
/* This originates from attach_command(). We need to overwrite
|
||||
the stop_signal here, because some kernels don't ignore a
|
||||
- SIGSTOP in a subsequent ptrace(PTRACE_SONT,SOGSTOP) call.
|
||||
- See more comments in inferior.h. */
|
||||
- if (stop_soon == STOP_QUIETLY_NO_SIGSTOP)
|
||||
+ SIGSTOP in a subsequent ptrace(PTRACE_CONT,SIGSTOP) call.
|
||||
+ See more comments in inferior.h. On the other hand, if we
|
||||
+ get a non-SIGSTOP, report it to the user - assume the backend
|
||||
+ will handle the SIGSTOP if it should show up later. */
|
||||
+ if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
|
||||
+ && stop_signal == TARGET_SIGNAL_STOP)
|
||||
{
|
||||
stop_stepping (ecs);
|
||||
- if (stop_signal == TARGET_SIGNAL_STOP)
|
||||
- stop_signal = TARGET_SIGNAL_0;
|
||||
+ stop_signal = TARGET_SIGNAL_0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2043,7 +2045,7 @@ process_event_stop_test:
|
||||
target_terminal_ours_for_output ();
|
||||
print_stop_reason (SIGNAL_RECEIVED, stop_signal);
|
||||
}
|
||||
- if (signal_stop[stop_signal])
|
||||
+ if (signal_stop_state (stop_signal))
|
||||
{
|
||||
stop_stepping (ecs);
|
||||
return;
|
||||
@@ -3306,7 +3308,9 @@ hook_stop_stub (void *cmd)
|
||||
int
|
||||
signal_stop_state (int signo)
|
||||
{
|
||||
- return signal_stop[signo];
|
||||
+ /* Always stop on signals if we're just gaining control of the
|
||||
+ program. */
|
||||
+ return signal_stop[signo] || stop_soon != NO_STOP_QUIETLY;
|
||||
}
|
||||
|
||||
int
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/linux-nat.c gdb-6.8/gdb/linux-nat.c
|
||||
--- gdb-6.8-orig/gdb/linux-nat.c 2008-01-29 23:47:20.000000000 +0100
|
||||
+++ gdb-6.8/gdb/linux-nat.c 2008-08-27 18:00:22.000000000 +0200
|
||||
@@ -47,6 +47,30 @@
|
||||
#include "gdb_stat.h" /* for struct stat */
|
||||
#include <fcntl.h> /* for O_RDONLY */
|
||||
|
||||
+/* Note on this file's use of signals:
|
||||
+
|
||||
+ We stop threads by sending a SIGSTOP. The use of SIGSTOP instead
|
||||
+ of another signal is not entirely significant; we just need for a
|
||||
+ signal to be delivered, so that we can intercept it. SIGSTOP's
|
||||
+ advantage is that it can not be blocked. A disadvantage is that it
|
||||
+ is not a real-time signal, so it can only be queued once; we do not
|
||||
+ keep track of other sources of SIGSTOP.
|
||||
+
|
||||
+ Two other signals that can't be blocked are SIGCONT and SIGKILL.
|
||||
+ But we can't use them, because they have special behavior when the
|
||||
+ signal is generated - not when it is delivered. SIGCONT resumes
|
||||
+ the entire thread group and SIGKILL kills the entire thread group.
|
||||
+
|
||||
+ A delivered SIGSTOP would stop the entire thread group, not just the
|
||||
+ thread we tkill'd. But we never let the SIGSTOP deliver; we always
|
||||
+ intercept and cancel it (by PTRACE_CONT without passing SIGSTOP).
|
||||
+
|
||||
+ We could use a real-time signal instead. This would solve those
|
||||
+ problems; we could use PTRACE_GETSIGINFO to locate the specific
|
||||
+ stop signals sent by GDB. But we would still have to have some
|
||||
+ support for SIGSTOP, since PTRACE_ATTACH generates it, and there
|
||||
+ are races with trying to find a signal that is not blocked. */
|
||||
+
|
||||
#ifndef O_LARGEFILE
|
||||
#define O_LARGEFILE 0
|
||||
#endif
|
||||
@@ -624,6 +648,7 @@ static sigset_t blocked_mask;
|
||||
static int stop_wait_callback (struct lwp_info *lp, void *data);
|
||||
static int linux_nat_thread_alive (ptid_t ptid);
|
||||
static char *linux_child_pid_to_exec_file (int pid);
|
||||
+static int kill_lwp (int lwpid, int signo);
|
||||
|
||||
/* Convert wait status STATUS to a string. Used for printing debug
|
||||
messages only. */
|
||||
@@ -865,10 +890,103 @@ exit_lwp (struct lwp_info *lp)
|
||||
delete_lwp (lp->ptid);
|
||||
}
|
||||
|
||||
-/* Attach to the LWP specified by PID. If VERBOSE is non-zero, print
|
||||
- a message telling the user that a new LWP has been added to the
|
||||
- process. Return 0 if successful or -1 if the new LWP could not
|
||||
- be attached. */
|
||||
+/* Detect `T (stopped)' in `/proc/PID/status'.
|
||||
+ Other states including `T (tracing stop)' are reported as false. */
|
||||
+
|
||||
+static int
|
||||
+pid_is_stopped (pid_t pid)
|
||||
+{
|
||||
+ FILE *status_file;
|
||||
+ char buf[100];
|
||||
+ int retval = 0;
|
||||
+
|
||||
+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
|
||||
+ status_file = fopen (buf, "r");
|
||||
+ if (status_file != NULL)
|
||||
+ {
|
||||
+ int have_state = 0;
|
||||
+
|
||||
+ while (fgets (buf, sizeof (buf), status_file))
|
||||
+ {
|
||||
+ if (strncmp (buf, "State:", 6) == 0)
|
||||
+ {
|
||||
+ have_state = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (have_state && strstr (buf, "T (stopped)") != NULL)
|
||||
+ retval = 1;
|
||||
+ fclose (status_file);
|
||||
+ }
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* Wait for the LWP specified by LP, which we have just attached to.
|
||||
+ Returns a wait status for that LWP, to cache. */
|
||||
+
|
||||
+static int
|
||||
+linux_nat_post_attach_wait (ptid_t ptid, int first, int *cloned,
|
||||
+ int *signalled)
|
||||
+{
|
||||
+ pid_t new_pid, pid = GET_LWP (ptid);
|
||||
+ int status;
|
||||
+
|
||||
+ if (pid_is_stopped (pid))
|
||||
+ {
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LNPAW: Attaching to a stopped process\n");
|
||||
+
|
||||
+ /* The process is definitely stopped. It is in a job control
|
||||
+ stop, unless the kernel predates the TASK_STOPPED /
|
||||
+ TASK_TRACED distinction, in which case it might be in a
|
||||
+ ptrace stop. Make sure it is in a ptrace stop; from there we
|
||||
+ can kill it, signal it, et cetera.
|
||||
+
|
||||
+ First make sure there is a pending SIGSTOP. Since we are
|
||||
+ already attached, the process can not transition from stopped
|
||||
+ to running without a PTRACE_CONT; so we know this signal will
|
||||
+ go into the queue. The SIGSTOP generated by PTRACE_ATTACH is
|
||||
+ probably already in the queue (unless this kernel is old
|
||||
+ enough to use TASK_STOPPED for ptrace stops); but since SIGSTOP
|
||||
+ is not an RT signal, it can only be queued once. */
|
||||
+ kill_lwp (pid, SIGSTOP);
|
||||
+
|
||||
+ /* Finally, resume the stopped process. This will deliver the SIGSTOP
|
||||
+ (or a higher priority signal, just like normal PTRACE_ATTACH). */
|
||||
+ ptrace (PTRACE_CONT, pid, 0, 0);
|
||||
+ }
|
||||
+
|
||||
+ /* Make sure the initial process is stopped. The user-level threads
|
||||
+ layer might want to poke around in the inferior, and that won't
|
||||
+ work if things haven't stabilized yet. */
|
||||
+ new_pid = my_waitpid (pid, &status, 0);
|
||||
+ if (new_pid == -1 && errno == ECHILD)
|
||||
+ {
|
||||
+ if (first)
|
||||
+ warning (_("%s is a cloned process"), target_pid_to_str (ptid));
|
||||
+
|
||||
+ /* Try again with __WCLONE to check cloned processes. */
|
||||
+ new_pid = my_waitpid (pid, &status, __WCLONE);
|
||||
+ *cloned = 1;
|
||||
+ }
|
||||
+
|
||||
+ gdb_assert (pid == new_pid && WIFSTOPPED (status));
|
||||
+
|
||||
+ if (WSTOPSIG (status) != SIGSTOP)
|
||||
+ {
|
||||
+ *signalled = 1;
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LNPAW: Received %s after attaching\n",
|
||||
+ status_to_str (status));
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+/* Attach to the LWP specified by PID. Return 0 if successful or -1
|
||||
+ if the new LWP could not be attached. */
|
||||
|
||||
int
|
||||
lin_lwp_attach_lwp (ptid_t ptid)
|
||||
@@ -895,9 +1013,7 @@ lin_lwp_attach_lwp (ptid_t ptid)
|
||||
to happen. */
|
||||
if (GET_LWP (ptid) != GET_PID (ptid) && lp == NULL)
|
||||
{
|
||||
- pid_t pid;
|
||||
- int status;
|
||||
- int cloned = 0;
|
||||
+ int status, cloned = 0, signalled = 0;
|
||||
|
||||
if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
|
||||
{
|
||||
@@ -916,24 +1032,18 @@ lin_lwp_attach_lwp (ptid_t ptid)
|
||||
"LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
|
||||
target_pid_to_str (ptid));
|
||||
|
||||
- pid = my_waitpid (GET_LWP (ptid), &status, 0);
|
||||
- if (pid == -1 && errno == ECHILD)
|
||||
+ status = linux_nat_post_attach_wait (ptid, 0, &cloned, &signalled);
|
||||
+ lp = add_lwp (ptid);
|
||||
+ lp->stopped = 1;
|
||||
+ lp->cloned = cloned;
|
||||
+ lp->signalled = signalled;
|
||||
+ if (WSTOPSIG (status) != SIGSTOP)
|
||||
{
|
||||
- /* Try again with __WCLONE to check cloned processes. */
|
||||
- pid = my_waitpid (GET_LWP (ptid), &status, __WCLONE);
|
||||
- cloned = 1;
|
||||
+ lp->resumed = 1;
|
||||
+ lp->status = status;
|
||||
}
|
||||
|
||||
- gdb_assert (pid == GET_LWP (ptid)
|
||||
- && WIFSTOPPED (status) && WSTOPSIG (status));
|
||||
-
|
||||
- if (lp == NULL)
|
||||
- lp = add_lwp (ptid);
|
||||
- lp->cloned = cloned;
|
||||
-
|
||||
- target_post_attach (pid);
|
||||
-
|
||||
- lp->stopped = 1;
|
||||
+ target_post_attach (GET_LWP (lp->ptid));
|
||||
|
||||
if (debug_linux_nat)
|
||||
{
|
||||
@@ -963,45 +1073,62 @@ static void
|
||||
linux_nat_attach (char *args, int from_tty)
|
||||
{
|
||||
struct lwp_info *lp;
|
||||
- pid_t pid;
|
||||
int status;
|
||||
- int cloned = 0;
|
||||
|
||||
/* FIXME: We should probably accept a list of process id's, and
|
||||
attach all of them. */
|
||||
linux_ops->to_attach (args, from_tty);
|
||||
|
||||
- /* Make sure the initial process is stopped. The user-level threads
|
||||
- layer might want to poke around in the inferior, and that won't
|
||||
- work if things haven't stabilized yet. */
|
||||
- pid = my_waitpid (GET_PID (inferior_ptid), &status, 0);
|
||||
- if (pid == -1 && errno == ECHILD)
|
||||
- {
|
||||
- warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid));
|
||||
-
|
||||
- /* Try again with __WCLONE to check cloned processes. */
|
||||
- pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
|
||||
- cloned = 1;
|
||||
- }
|
||||
-
|
||||
- gdb_assert (pid == GET_PID (inferior_ptid)
|
||||
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
|
||||
-
|
||||
/* Add the initial process as the first LWP to the list. */
|
||||
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
|
||||
lp = add_lwp (inferior_ptid);
|
||||
- lp->cloned = cloned;
|
||||
|
||||
+ status = linux_nat_post_attach_wait (lp->ptid, 1, &lp->cloned,
|
||||
+ &lp->signalled);
|
||||
lp->stopped = 1;
|
||||
|
||||
- /* Fake the SIGSTOP that core GDB expects. */
|
||||
- lp->status = W_STOPCODE (SIGSTOP);
|
||||
+ /* Save the wait status to report later. */
|
||||
lp->resumed = 1;
|
||||
if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LNA: waitpid %ld, saving status %s\n",
|
||||
+ (long) GET_PID (lp->ptid), status_to_str (status));
|
||||
+
|
||||
+ lp->status = status;
|
||||
+ if (debug_linux_nat)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
|
||||
+ "LLA: waitpid %ld, faking SIGSTOP\n",
|
||||
+ (long) GET_PID (lp->ptid));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Get pending status of LP. */
|
||||
+static int
|
||||
+get_pending_status (struct lwp_info *lp, int *status)
|
||||
+{
|
||||
+ struct target_waitstatus last;
|
||||
+ ptid_t last_ptid;
|
||||
+
|
||||
+ get_last_target_status (&last_ptid, &last);
|
||||
+
|
||||
+ /* If this lwp is the ptid that GDB is processing an event from, the
|
||||
+ signal will be in stop_signal. Otherwise, in all-stop + sync
|
||||
+ mode, we may cache pending events in lp->status while trying to
|
||||
+ stop all threads (see stop_wait_callback). In async mode, the
|
||||
+ events are always cached in waitpid_queue. */
|
||||
+
|
||||
+ *status = 0;
|
||||
+ if (GET_LWP (lp->ptid) == GET_LWP (last_ptid))
|
||||
+ {
|
||||
+ if (stop_signal != TARGET_SIGNAL_0
|
||||
+ && signal_pass_state (stop_signal))
|
||||
+ *status = W_STOPCODE (target_signal_to_host (stop_signal));
|
||||
}
|
||||
+ else
|
||||
+ *status = lp->status;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1014,40 +1141,30 @@ detach_callback (struct lwp_info *lp, vo
|
||||
strsignal (WSTOPSIG (lp->status)),
|
||||
target_pid_to_str (lp->ptid));
|
||||
|
||||
- while (lp->signalled && lp->stopped)
|
||||
+ /* If there is a pending SIGSTOP, get rid of it. */
|
||||
+ if (lp->signalled)
|
||||
{
|
||||
- errno = 0;
|
||||
- if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
|
||||
- WSTOPSIG (lp->status)) < 0)
|
||||
- error (_("Can't continue %s: %s"), target_pid_to_str (lp->ptid),
|
||||
- safe_strerror (errno));
|
||||
-
|
||||
if (debug_linux_nat)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
- "DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
|
||||
- target_pid_to_str (lp->ptid),
|
||||
- status_to_str (lp->status));
|
||||
+ "DC: Sending SIGCONT to %s\n",
|
||||
+ target_pid_to_str (lp->ptid));
|
||||
|
||||
- lp->stopped = 0;
|
||||
+ kill_lwp (GET_LWP (lp->ptid), SIGCONT);
|
||||
lp->signalled = 0;
|
||||
- lp->status = 0;
|
||||
- /* FIXME drow/2003-08-26: There was a call to stop_wait_callback
|
||||
- here. But since lp->signalled was cleared above,
|
||||
- stop_wait_callback didn't do anything; the process was left
|
||||
- running. Shouldn't we be waiting for it to stop?
|
||||
- I've removed the call, since stop_wait_callback now does do
|
||||
- something when called with lp->signalled == 0. */
|
||||
-
|
||||
- gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
|
||||
}
|
||||
|
||||
/* We don't actually detach from the LWP that has an id equal to the
|
||||
overall process id just yet. */
|
||||
if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
|
||||
{
|
||||
+ int status = 0;
|
||||
+
|
||||
+ /* Pass on any pending signal for this LWP. */
|
||||
+ get_pending_status (lp, &status);
|
||||
+
|
||||
errno = 0;
|
||||
if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
|
||||
- WSTOPSIG (lp->status)) < 0)
|
||||
+ WSTOPSIG (status)) < 0)
|
||||
error (_("Can't detach %s: %s"), target_pid_to_str (lp->ptid),
|
||||
safe_strerror (errno));
|
||||
|
||||
@@ -1066,11 +1183,28 @@ detach_callback (struct lwp_info *lp, vo
|
||||
static void
|
||||
linux_nat_detach (char *args, int from_tty)
|
||||
{
|
||||
+ int status;
|
||||
+
|
||||
iterate_over_lwps (detach_callback, NULL);
|
||||
|
||||
/* Only the initial process should be left right now. */
|
||||
gdb_assert (num_lwps == 1);
|
||||
|
||||
+ /* Pass on any pending signal for the last LWP. */
|
||||
+ if ((args == NULL || *args == '\0')
|
||||
+ && get_pending_status (lwp_list, &status) != -1
|
||||
+ && WIFSTOPPED (status))
|
||||
+ {
|
||||
+ /* Put the signal number in ARGS so that inf_ptrace_detach will
|
||||
+ pass it along with PTRACE_DETACH. */
|
||||
+ args = alloca (8);
|
||||
+ sprintf (args, "%d", (int) WSTOPSIG (status));
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "LND: Sending signal %s to %s\n",
|
||||
+ args,
|
||||
+ target_pid_to_str (lwp_list->ptid));
|
||||
+ }
|
||||
+
|
||||
trap_ptid = null_ptid;
|
||||
|
||||
/* Destroy LWP info; it's no longer valid. */
|
||||
@@ -2490,7 +2624,9 @@ linux_nat_pid_to_str (ptid_t ptid)
|
||||
{
|
||||
static char buf[64];
|
||||
|
||||
- if (lwp_list && lwp_list->next && is_lwp (ptid))
|
||||
+ if (is_lwp (ptid)
|
||||
+ && ((lwp_list && lwp_list->next)
|
||||
+ || GET_PID (ptid) != GET_LWP (ptid)))
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "LWP %ld", GET_LWP (ptid));
|
||||
return buf;
|
||||
@@ -3424,4 +3560,3 @@ lin_thread_get_thread_signals (sigset_t
|
||||
/* ... except during a sigsuspend. */
|
||||
sigdelset (&suspend_mask, cancel);
|
||||
}
|
||||
-
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-into-signal.c gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.c
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-into-signal.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.c 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,67 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <signal.h>
|
||||
+#include <unistd.h>
|
||||
|
@ -59,10 +508,8 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+
|
||||
+ raise (SIGALRM);
|
||||
+
|
||||
+ /* This should be NOTREACHED but sometimes it is reached - Bug 427860.
|
||||
+ We never get here without ptrace(2). It may also be a kernel bug. */
|
||||
+ for (;;)
|
||||
+ pause ();
|
||||
+ /* We must not get past this point, either in a free standing or debugged
|
||||
+ state. */
|
||||
+
|
||||
+ abort ();
|
||||
+ /* NOTREACHED */
|
||||
|
@ -86,36 +533,34 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-into-signal.exp gdb-6.5/gdb/testsuite/gdb.threads/attach-into-signal.exp
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-into-signal.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attach-into-signal.exp 2008-01-09 15:26:30.000000000 +0100
|
||||
@@ -0,0 +1,179 @@
|
||||
+# Copyright 2007
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-into-signal.exp gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.exp
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-into-signal.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-into-signal.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,168 @@
|
||||
+# Copyright 2008
|
||||
+# Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This test was created by modifying attach-stopped.exp.
|
||||
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+# This test only works on Linux
|
||||
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+set testfile "attach-into-signal"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
|
@ -154,10 +599,6 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ set attempt 1
|
||||
+ set passes 1
|
||||
+ while { $passes < 3 && $attempt <= $attempts } {
|
||||
+
|
||||
+ # Start with clean gdb
|
||||
+ gdb_exit
|
||||
+
|
||||
+ set stoppedtry 0
|
||||
+ while { $stoppedtry < 10 } {
|
||||
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
|
@ -181,30 +622,10 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ break
|
||||
+ }
|
||||
+
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ gdb_test "set debug lin-lwp 1" "" ""
|
||||
+
|
||||
+ set test "$threadtype: set file (pass $passes), before attach1 to stopped process"
|
||||
+ if {[gdb_test_multiple "file $binfile" $test {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." ""
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ # No PASS message as we may be looping in multiple attempts.
|
||||
+ }
|
||||
+ }] != 0 } {
|
||||
+ break
|
||||
+ }
|
||||
+
|
||||
+ # Main test:
|
||||
+ set test "$threadtype: attach (pass $passes), pending signal catch"
|
||||
+ if {[gdb_test_multiple "attach $testpid" $test {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Redelivering pending Alarm clock..*$gdb_prompt $" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
|
||||
+ # nonthreaded:
|
||||
+ pass $test
|
||||
+ verbose -log "$test succeeded on the attempt # $attempt of $attempts"
|
||||
|
@ -215,7 +636,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ # We just lack the luck, we should try it again.
|
||||
+ set attempt [expr $attempt + 1]
|
||||
+ }
|
||||
+ -re "Attaching to process $testpid.*Redelivering pending Alarm clock..*$gdb_prompt $" {
|
||||
+ -re "Attaching to process $testpid.*Received Alarm clock.*$gdb_prompt $" {
|
||||
+ # threaded:
|
||||
+ pass $test
|
||||
+ verbose -log "$test succeeded on the attempt # $attempt of $attempts"
|
||||
|
@ -229,6 +650,8 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ }] != 0 } {
|
||||
+ break
|
||||
+ }
|
||||
+
|
||||
+ gdb_test "detach" "Detaching from.*" ""
|
||||
+ }
|
||||
+ if {$passes < 3} {
|
||||
+ if {$attempt > $attempts} {
|
||||
|
@ -254,12 +677,20 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ remote_exec build "kill -9 ${testpid}"
|
||||
+}
|
||||
+
|
||||
+# Start with clean gdb
|
||||
+gdb_exit
|
||||
+
|
||||
+# build the test case first without threads
|
||||
+#
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+gdb_test "set debug lin-lwp 1" "" ""
|
||||
+
|
||||
+corefunc nonthreaded
|
||||
+
|
||||
+# build the test case also with threads
|
||||
|
@ -268,28 +699,32 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ gdb_suppress_entire_file "Testcase threaded compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+gdb_test "set debug lin-lwp 1" "" ""
|
||||
+
|
||||
+corefunc threaded
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-stopped.c gdb-6.5/gdb/testsuite/gdb.threads/attach-stopped.c
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-stopped.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attach-stopped.c 2008-01-09 15:26:30.000000000 +0100
|
||||
@@ -0,0 +1,51 @@
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-stopped.c gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.c
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-stopped.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.c 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005-2007 Free Software Foundation, Inc.
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This program is intended to be started outside of gdb, then
|
||||
+ manually stopped via a signal. */
|
||||
|
@ -324,40 +759,33 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-stopped.exp gdb-6.5/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attach-stopped.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attach-stopped.exp 2008-01-09 15:26:30.000000000 +0100
|
||||
@@ -0,0 +1,222 @@
|
||||
+# Copyright 2005-2007
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-stopped.exp gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attach-stopped.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attach-stopped.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,157 @@
|
||||
+# Copyright 2008
|
||||
+# Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This test was created by modifying attach.exp.
|
||||
+# This file was created by Jeff Johnston <jjohnstn@redhat.com>.
|
||||
+# This file was updated by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+# This test only works on Linux
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "attach-stopped"
|
||||
|
@ -400,65 +828,7 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # 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.
|
||||
+
|
||||
+ set test "$threadtype: set file, before attach1 to stopped process"
|
||||
+ gdb_test_multiple "file $binfile" "$test" {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
|
||||
+ "$test (re-read)"
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1 to stopped, after setting file"
|
||||
+ gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
|
||||
+ if {[string equal $threadtype threaded]} {
|
||||
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
|
||||
+ } else {
|
||||
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
|
||||
+ }
|
||||
+
|
||||
+ # Exit and detach the process.
|
||||
+
|
||||
+ gdb_exit
|
||||
+
|
||||
+ # Avoid some race:
|
||||
+ sleep 2
|
||||
+
|
||||
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
+ set line2 "NOTFOUND"
|
||||
+ } else {
|
||||
+ gets $fileid line1;
|
||||
+ gets $fileid line2;
|
||||
+ close $fileid;
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1, exit leaves process stopped"
|
||||
+ if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+
|
||||
+ # At this point, the process should still be stopped
|
||||
+
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # Verify that we can attach to the process just by giving the
|
||||
+ # process ID.
|
||||
+ # Verify that we can attach to the stopped process.
|
||||
+
|
||||
+ set test "$threadtype: attach2 to stopped, after setting file"
|
||||
+ gdb_test_multiple "attach $testpid" "$test" {
|
||||
|
@ -550,27 +920,26 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+corefunc threaded
|
||||
+
|
||||
+return 0
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attachstop-mt.c gdb-6.5/gdb/testsuite/gdb.threads/attachstop-mt.c
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attachstop-mt.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attachstop-mt.c 2008-01-09 15:26:29.000000000 +0100
|
||||
@@ -0,0 +1,56 @@
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attachstop-mt.c gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.c
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attachstop-mt.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.c 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,55 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005 Free Software Foundation, Inc.
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This program is intended to be started outside of gdb, then
|
||||
+ manually stopped via a signal. */
|
||||
|
@ -610,40 +979,33 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attachstop-mt.exp gdb-6.5/gdb/testsuite/gdb.threads/attachstop-mt.exp
|
||||
--- gdb-6.5-unpatched/gdb/testsuite/gdb.threads/attachstop-mt.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.threads/attachstop-mt.exp 2008-01-09 18:13:49.000000000 +0100
|
||||
@@ -0,0 +1,278 @@
|
||||
+# Copyright 2006
|
||||
diff -up -ruNp gdb-6.8-orig/gdb/testsuite/gdb.threads/attachstop-mt.exp gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.exp
|
||||
--- gdb-6.8-orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.threads/attachstop-mt.exp 2008-08-27 17:44:23.000000000 +0200
|
||||
@@ -0,0 +1,260 @@
|
||||
+# Copyright 2008
|
||||
+# Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This test was created by modifying gdb.threads/attachstop.
|
||||
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+# Regression for: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197584
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+# This test only works on Linux
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "attachstop-mt"
|
||||
|
@ -792,23 +1154,12 @@ diff -u -X /home/short/.diffi.list -ruNp gdb-6.5-unpatched/gdb/testsuite/gdb.thr
|
|||
+# Exit and detach the process.
|
||||
+gdb_exit
|
||||
+
|
||||
+# Stop the program
|
||||
+remote_exec build "kill -s STOP ${testpid}"
|
||||
+
|
||||
+# No race
|
||||
+sleep 2
|
||||
+
|
||||
+set fileid3 [open $status2 r];
|
||||
+gets $fileid3 line1;
|
||||
+gets $fileid3 line2;
|
||||
+close $fileid3;
|
||||
+
|
||||
+set test "attach3, exit leaves process stopped"
|
||||
+if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+# At this point, the process should still be stopped
|
||||
+
|
||||
+# Continue the test as we would hit another expected bug regarding
|
||||
+# Program received signal SIGSTOP, Stopped (signal).
|
||||
+# across NPTL threads.
|
|
@ -0,0 +1,18 @@
|
|||
A part of:
|
||||
http://sourceware.org/ml/gdb-cvs/2008-06/msg00160.html
|
||||
|
||||
It was crashing the RH testcase `gdb.threads/watchthreads2.exp'.
|
||||
|
||||
diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/breakpoint.c gdb-6.8-patched/gdb/breakpoint.c
|
||||
--- gdb-6.8/gdb/breakpoint.c 2008-08-28 11:56:56.000000000 +0200
|
||||
+++ gdb-6.8-patched/gdb/breakpoint.c 2008-08-28 11:53:43.000000000 +0200
|
||||
@@ -3173,6 +3173,9 @@ bpstat_what (bpstat bs)
|
||||
/* I suspect this can happen if it was a momentary breakpoint
|
||||
which has since been deleted. */
|
||||
continue;
|
||||
+ if (bs->breakpoint_at->owner == NULL)
|
||||
+ bs_class = bp_nostop;
|
||||
+ else
|
||||
switch (bs->breakpoint_at->owner->type)
|
||||
{
|
||||
case bp_none:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,545 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2008-10/msg00019.html
|
||||
|
||||
gdb/
|
||||
2008-10-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Replace TYPE_ARRAY_{UPPER,LOWER}_BOUND_TYPE by a bit if {un,}defined.
|
||||
* c-typeprint.c (c_type_print_varspec_suffix), m2-typeprint.c
|
||||
(m2_array), p-typeprint.c (pascal_type_print_varspec_prefix),
|
||||
valops.c (value_cast), varobj.c (c_number_of_children): Replace
|
||||
TYPE_ARRAY_UPPER_BOUND_TYPE compared to BOUND_CANNOT_BE_DETERMINED by
|
||||
TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
|
||||
* parse.c (follow_types): Use TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
|
||||
* f-valprint.c (f77_get_dynamic_upperbound): Replace with ...
|
||||
(f77_get_upperbound): ... this function handling now only
|
||||
TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
|
||||
(f77_get_dynamic_lowerbound): Replace with ...
|
||||
(f77_get_lowerbound): ... this function handling now only
|
||||
TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED.
|
||||
(f77_get_dynamic_length_of_aggregate, f77_create_arrayprint_offset_tbl):
|
||||
Update their callers.
|
||||
* eval.c (evaluate_subexp_standard): Update their callers.
|
||||
* f-lang.h (f77_get_dynamic_upperbound, f77_get_upperbound)
|
||||
(f77_get_dynamic_lowerbound, f77_get_lowerbound): Update their
|
||||
prototypes.
|
||||
(BOUND_FETCH_OK, BOUND_FETCH_ERROR): Remove.
|
||||
* f-typeprint.c (f_type_print_varspec_suffix, f_type_print_base): Remove
|
||||
the lower_bound_was_default variable. Update the
|
||||
f77_get_dynamic_upperbound, f77_get_upperbound and
|
||||
TYPE_ARRAY_UPPER_BOUND_TYPE calls.
|
||||
* gdbtypes.c (print_bound_type): Remove the function.
|
||||
(recursive_dump_type): Remove its calls printing UPPER_BOUND_TYPE and
|
||||
LOWER_BOUND_TYPE.
|
||||
* gdbtypes.h (enum array_bound_type): Remove.
|
||||
(struct main_type): Remove the fields upper_bound_type and
|
||||
lower_bound_type. Comment the new overload of the field artificial.
|
||||
(TYPE_ARRAY_UPPER_BOUND_TYPE): Replace by ...
|
||||
(TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED): ... this macro.
|
||||
(TYPE_ARRAY_LOWER_BOUND_TYPE): Replace by ...
|
||||
(TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): ... this macro.
|
||||
|
||||
gdb/testsuite/
|
||||
2008-10-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/maint.exp (maint print type): Remove printing
|
||||
UPPER_BOUND_TYPE and LOWER_BOUND_TYPE.
|
||||
|
||||
[ Ported to gdb-6.8fedora. ]
|
||||
|
||||
--- ./gdb/c-typeprint.c 2008-01-01 23:53:09.000000000 +0100
|
||||
+++ ./gdb/c-typeprint.c 2008-10-29 10:55:07.000000000 +0100
|
||||
@@ -542,7 +542,7 @@ c_type_print_varspec_suffix (struct type
|
||||
|
||||
fprintf_filtered (stream, "[");
|
||||
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
|
||||
- && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
|
||||
+ && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
fprintf_filtered (stream, "%d",
|
||||
(TYPE_LENGTH (type)
|
||||
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
|
||||
--- ./gdb/eval.c 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/eval.c 2008-10-29 10:55:07.000000000 +0100
|
||||
@@ -1674,13 +1674,8 @@ evaluate_subexp_standard (struct type *e
|
||||
/* Internal type of array is arranged right to left */
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
- retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain dynamic upper bound"));
|
||||
-
|
||||
- retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain dynamic lower bound"));
|
||||
+ upper = f77_get_upperbound (tmp_type);
|
||||
+ lower = f77_get_lowerbound (tmp_type);
|
||||
|
||||
array_size_array[nargs - i - 1] = upper - lower + 1;
|
||||
|
||||
--- ./gdb/f-lang.h 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/f-lang.h 2008-10-29 10:55:07.000000000 +0100
|
||||
@@ -83,9 +83,6 @@ extern SAVED_F77_COMMON_PTR find_common_
|
||||
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
|
||||
#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */
|
||||
|
||||
-#define BOUND_FETCH_OK 1
|
||||
-#define BOUND_FETCH_ERROR -999
|
||||
-
|
||||
/* When reasonable array bounds cannot be fetched, such as when
|
||||
you ask to 'mt print symbols' and there is no stack frame and
|
||||
therefore no way of knowing the bounds of stack-based arrays,
|
||||
@@ -97,9 +94,9 @@ extern SAVED_F77_COMMON_PTR find_common_
|
||||
extern char *real_main_name; /* Name of main function */
|
||||
extern int real_main_c_value; /* C_value field of main function */
|
||||
|
||||
-extern int f77_get_dynamic_upperbound (struct type *, int *);
|
||||
+extern int f77_get_upperbound (struct type *);
|
||||
|
||||
-extern int f77_get_dynamic_lowerbound (struct type *, int *);
|
||||
+extern int f77_get_lowerbound (struct type *);
|
||||
|
||||
extern void f77_get_dynamic_array_length (struct type *);
|
||||
|
||||
--- ./gdb/f-typeprint.c 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/f-typeprint.c 2008-10-29 10:55:07.000000000 +0100
|
||||
@@ -150,7 +150,6 @@ f_type_print_varspec_suffix (struct type
|
||||
int show, int passed_a_ptr, int demangled_args)
|
||||
{
|
||||
int upper_bound, lower_bound;
|
||||
- int lower_bound_was_default = 0;
|
||||
static int arrayprint_recurse_level = 0;
|
||||
int retcode;
|
||||
|
||||
@@ -173,35 +172,19 @@ f_type_print_varspec_suffix (struct type
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
|
||||
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
|
||||
|
||||
- retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
|
||||
-
|
||||
- lower_bound_was_default = 0;
|
||||
-
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- fprintf_filtered (stream, "???");
|
||||
- else if (lower_bound == 1) /* The default */
|
||||
- lower_bound_was_default = 1;
|
||||
- else
|
||||
- fprintf_filtered (stream, "%d", lower_bound);
|
||||
-
|
||||
- if (lower_bound_was_default)
|
||||
- lower_bound_was_default = 0;
|
||||
- else
|
||||
- fprintf_filtered (stream, ":");
|
||||
+ lower_bound = f77_get_lowerbound (type);
|
||||
+ if (lower_bound != 1) /* Not the default. */
|
||||
+ fprintf_filtered (stream, "%d:", lower_bound);
|
||||
|
||||
/* Make sure that, if we have an assumed size array, we
|
||||
print out a warning and print the upperbound as '*' */
|
||||
|
||||
- if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
|
||||
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
fprintf_filtered (stream, "*");
|
||||
else
|
||||
{
|
||||
- retcode = f77_get_dynamic_upperbound (type, &upper_bound);
|
||||
-
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- fprintf_filtered (stream, "???");
|
||||
- else
|
||||
- fprintf_filtered (stream, "%d", upper_bound);
|
||||
+ upper_bound = f77_get_upperbound (type);
|
||||
+ fprintf_filtered (stream, "%d", upper_bound);
|
||||
}
|
||||
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
|
||||
@@ -351,16 +334,12 @@ f_type_print_base (struct type *type, st
|
||||
case TYPE_CODE_STRING:
|
||||
/* Strings may have dynamic upperbounds (lengths) like arrays. */
|
||||
|
||||
- if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
|
||||
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
fprintfi_filtered (level, stream, "character*(*)");
|
||||
else
|
||||
{
|
||||
- retcode = f77_get_dynamic_upperbound (type, &upper_bound);
|
||||
-
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- fprintf_filtered (stream, "character*???");
|
||||
- else
|
||||
- fprintf_filtered (stream, "character*%d", upper_bound);
|
||||
+ upper_bound = f77_get_upperbound (type);
|
||||
+ fprintf_filtered (stream, "character*%d", upper_bound);
|
||||
}
|
||||
break;
|
||||
|
||||
--- ./gdb/f-valprint.c 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/f-valprint.c 2008-10-29 20:48:30.000000000 +0100
|
||||
@@ -61,130 +61,28 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM
|
||||
#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
|
||||
|
||||
int
|
||||
-f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
|
||||
+f77_get_lowerbound (struct type *type)
|
||||
{
|
||||
- struct frame_info *frame;
|
||||
- CORE_ADDR current_frame_addr;
|
||||
- CORE_ADDR ptr_to_lower_bound;
|
||||
-
|
||||
- switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type))
|
||||
- {
|
||||
- case BOUND_BY_VALUE_ON_STACK:
|
||||
- frame = deprecated_safe_get_selected_frame ();
|
||||
- current_frame_addr = get_frame_base (frame);
|
||||
- if (current_frame_addr > 0)
|
||||
- {
|
||||
- *lower_bound =
|
||||
- read_memory_integer (current_frame_addr +
|
||||
- TYPE_ARRAY_LOWER_BOUND_VALUE (type),
|
||||
- 4);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- *lower_bound = DEFAULT_LOWER_BOUND;
|
||||
- return BOUND_FETCH_ERROR;
|
||||
- }
|
||||
- break;
|
||||
-
|
||||
- case BOUND_SIMPLE:
|
||||
- *lower_bound = TYPE_ARRAY_LOWER_BOUND_VALUE (type);
|
||||
- break;
|
||||
-
|
||||
- case BOUND_CANNOT_BE_DETERMINED:
|
||||
- error (_("Lower bound may not be '*' in F77"));
|
||||
- break;
|
||||
-
|
||||
- case BOUND_BY_REF_ON_STACK:
|
||||
- frame = deprecated_safe_get_selected_frame ();
|
||||
- current_frame_addr = get_frame_base (frame);
|
||||
- if (current_frame_addr > 0)
|
||||
- {
|
||||
- ptr_to_lower_bound =
|
||||
- read_memory_typed_address (current_frame_addr +
|
||||
- TYPE_ARRAY_LOWER_BOUND_VALUE (type),
|
||||
- builtin_type_void_data_ptr);
|
||||
- *lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- *lower_bound = DEFAULT_LOWER_BOUND;
|
||||
- return BOUND_FETCH_ERROR;
|
||||
- }
|
||||
- break;
|
||||
+ if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
|
||||
+ error (_("Lower bound may not be '*' in F77"));
|
||||
|
||||
- case BOUND_BY_REF_IN_REG:
|
||||
- case BOUND_BY_VALUE_IN_REG:
|
||||
- default:
|
||||
- error (_("??? unhandled dynamic array bound type ???"));
|
||||
- break;
|
||||
- }
|
||||
- return BOUND_FETCH_OK;
|
||||
+ return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
|
||||
}
|
||||
|
||||
int
|
||||
-f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
|
||||
+f77_get_upperbound (struct type *type)
|
||||
{
|
||||
- struct frame_info *frame;
|
||||
- CORE_ADDR current_frame_addr = 0;
|
||||
- CORE_ADDR ptr_to_upper_bound;
|
||||
-
|
||||
- switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type))
|
||||
- {
|
||||
- case BOUND_BY_VALUE_ON_STACK:
|
||||
- frame = deprecated_safe_get_selected_frame ();
|
||||
- current_frame_addr = get_frame_base (frame);
|
||||
- if (current_frame_addr > 0)
|
||||
- {
|
||||
- *upper_bound =
|
||||
- read_memory_integer (current_frame_addr +
|
||||
- TYPE_ARRAY_UPPER_BOUND_VALUE (type),
|
||||
- 4);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- *upper_bound = DEFAULT_UPPER_BOUND;
|
||||
- return BOUND_FETCH_ERROR;
|
||||
- }
|
||||
- break;
|
||||
-
|
||||
- case BOUND_SIMPLE:
|
||||
- *upper_bound = TYPE_ARRAY_UPPER_BOUND_VALUE (type);
|
||||
- break;
|
||||
-
|
||||
- case BOUND_CANNOT_BE_DETERMINED:
|
||||
- /* we have an assumed size array on our hands. Assume that
|
||||
- upper_bound == lower_bound so that we show at least
|
||||
- 1 element.If the user wants to see more elements, let
|
||||
- him manually ask for 'em and we'll subscript the
|
||||
- array and show him */
|
||||
- f77_get_dynamic_lowerbound (type, upper_bound);
|
||||
- break;
|
||||
-
|
||||
- case BOUND_BY_REF_ON_STACK:
|
||||
- frame = deprecated_safe_get_selected_frame ();
|
||||
- current_frame_addr = get_frame_base (frame);
|
||||
- if (current_frame_addr > 0)
|
||||
- {
|
||||
- ptr_to_upper_bound =
|
||||
- read_memory_typed_address (current_frame_addr +
|
||||
- TYPE_ARRAY_UPPER_BOUND_VALUE (type),
|
||||
- builtin_type_void_data_ptr);
|
||||
- *upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- *upper_bound = DEFAULT_UPPER_BOUND;
|
||||
- return BOUND_FETCH_ERROR;
|
||||
- }
|
||||
- break;
|
||||
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
+ {
|
||||
+ /* We have an assumed size array on our hands. Assume that
|
||||
+ upper_bound == lower_bound so that we show at least 1 element.
|
||||
+ If the user wants to see more elements, let him manually ask for 'em
|
||||
+ and we'll subscript the array and show him. */
|
||||
|
||||
- case BOUND_BY_REF_IN_REG:
|
||||
- case BOUND_BY_VALUE_IN_REG:
|
||||
- default:
|
||||
- error (_("??? unhandled dynamic array bound type ???"));
|
||||
- break;
|
||||
+ return f77_get_lowerbound (type);
|
||||
}
|
||||
- return BOUND_FETCH_OK;
|
||||
+
|
||||
+ return TYPE_ARRAY_UPPER_BOUND_VALUE (type);
|
||||
}
|
||||
|
||||
/* Obtain F77 adjustable array dimensions */
|
||||
@@ -210,13 +108,8 @@ f77_get_dynamic_length_of_aggregate (str
|
||||
f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type));
|
||||
|
||||
/* Recursion ends here, start setting up lengths. */
|
||||
- retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain valid array lower bound"));
|
||||
-
|
||||
- retcode = f77_get_dynamic_upperbound (type, &upper_bound);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain valid array upper bound"));
|
||||
+ lower_bound = f77_get_lowerbound (type);
|
||||
+ upper_bound = f77_get_upperbound (type);
|
||||
|
||||
/* Patch in a valid length value. */
|
||||
|
||||
@@ -239,16 +132,8 @@ f77_create_arrayprint_offset_tbl (struct
|
||||
|
||||
while ((TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY))
|
||||
{
|
||||
- if (TYPE_ARRAY_UPPER_BOUND_TYPE (tmp_type) == BOUND_CANNOT_BE_DETERMINED)
|
||||
- fprintf_filtered (stream, "<assumed size array> ");
|
||||
-
|
||||
- retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain dynamic upper bound"));
|
||||
-
|
||||
- retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
|
||||
- if (retcode == BOUND_FETCH_ERROR)
|
||||
- error (_("Cannot obtain dynamic lower bound"));
|
||||
+ upper = f77_get_upperbound (tmp_type);
|
||||
+ lower = f77_get_lowerbound (tmp_type);
|
||||
|
||||
F77_DIM_SIZE (ndimen) = upper - lower + 1;
|
||||
|
||||
--- ./gdb/gdbtypes.c 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.c 2008-10-29 10:55:07.000000000 +0100
|
||||
@@ -2529,35 +2529,6 @@ print_cplus_stuff (struct type *type, in
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-print_bound_type (int bt)
|
||||
-{
|
||||
- switch (bt)
|
||||
- {
|
||||
- case BOUND_CANNOT_BE_DETERMINED:
|
||||
- printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
|
||||
- break;
|
||||
- case BOUND_BY_REF_ON_STACK:
|
||||
- printf_filtered ("(BOUND_BY_REF_ON_STACK)");
|
||||
- break;
|
||||
- case BOUND_BY_VALUE_ON_STACK:
|
||||
- printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
|
||||
- break;
|
||||
- case BOUND_BY_REF_IN_REG:
|
||||
- printf_filtered ("(BOUND_BY_REF_IN_REG)");
|
||||
- break;
|
||||
- case BOUND_BY_VALUE_IN_REG:
|
||||
- printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
|
||||
- break;
|
||||
- case BOUND_SIMPLE:
|
||||
- printf_filtered ("(BOUND_SIMPLE)");
|
||||
- break;
|
||||
- default:
|
||||
- printf_filtered (_("(unknown bound type)"));
|
||||
- break;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static struct obstack dont_print_type_obstack;
|
||||
|
||||
void
|
||||
@@ -2692,14 +2663,6 @@ recursive_dump_type (struct type *type,
|
||||
}
|
||||
puts_filtered ("\n");
|
||||
printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
|
||||
- printfi_filtered (spaces, "upper_bound_type 0x%x ",
|
||||
- TYPE_ARRAY_UPPER_BOUND_TYPE (type));
|
||||
- print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type));
|
||||
- puts_filtered ("\n");
|
||||
- printfi_filtered (spaces, "lower_bound_type 0x%x ",
|
||||
- TYPE_ARRAY_LOWER_BOUND_TYPE (type));
|
||||
- print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type));
|
||||
- puts_filtered ("\n");
|
||||
printfi_filtered (spaces, "objfile ");
|
||||
gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
|
||||
printf_filtered ("\n");
|
||||
@@ -2942,10 +2942,6 @@ copy_type_recursive (struct objfile *obj
|
||||
|
||||
/* Copy the common fields of types. */
|
||||
TYPE_CODE (new_type) = TYPE_CODE (type);
|
||||
- TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) =
|
||||
- TYPE_ARRAY_UPPER_BOUND_TYPE (type);
|
||||
- TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) =
|
||||
- TYPE_ARRAY_LOWER_BOUND_TYPE (type);
|
||||
if (TYPE_NAME (type))
|
||||
TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
|
||||
if (TYPE_TAG_NAME (type))
|
||||
--- ./gdb/gdbtypes.h 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.h 2008-10-29 10:56:05.000000000 +0100
|
||||
@@ -310,17 +310,6 @@ enum type_code
|
||||
#define TYPE_FLAG_NOTTEXT (1 << 17)
|
||||
#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
|
||||
|
||||
-/* Array bound type. */
|
||||
-enum array_bound_type
|
||||
-{
|
||||
- BOUND_SIMPLE = 0,
|
||||
- BOUND_BY_VALUE_IN_REG,
|
||||
- BOUND_BY_REF_IN_REG,
|
||||
- BOUND_BY_VALUE_ON_STACK,
|
||||
- BOUND_BY_REF_ON_STACK,
|
||||
- BOUND_CANNOT_BE_DETERMINED
|
||||
-};
|
||||
-
|
||||
/* This structure is space-critical.
|
||||
Its layout has been tweaked to reduce the space used. */
|
||||
|
||||
@@ -330,12 +319,6 @@ struct main_type
|
||||
|
||||
ENUM_BITFIELD(type_code) code : 8;
|
||||
|
||||
- /* Array bounds. These fields appear at this location because
|
||||
- they pack nicely here. */
|
||||
-
|
||||
- ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
|
||||
- ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
|
||||
-
|
||||
/* Name of this type, or NULL if none.
|
||||
|
||||
This is used for printing only, except by poorly designed C++ code.
|
||||
@@ -437,7 +420,8 @@ struct main_type
|
||||
|
||||
/* For a function or member type, this is 1 if the argument is marked
|
||||
artificial. Artificial arguments should not be shown to the
|
||||
- user. */
|
||||
+ user. For TYPE_CODE_RANGE it is set if the specific bound is not
|
||||
+ defined. */
|
||||
unsigned int artificial : 1;
|
||||
|
||||
/* This flag is zero for non-static fields, 1 for fields whose location
|
||||
@@ -802,10 +786,10 @@ extern void allocate_cplus_struct_type (
|
||||
|
||||
/* Moto-specific stuff for FORTRAN arrays */
|
||||
|
||||
-#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) \
|
||||
- TYPE_MAIN_TYPE(thistype)->upper_bound_type
|
||||
-#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \
|
||||
- TYPE_MAIN_TYPE(thistype)->lower_bound_type
|
||||
+#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
|
||||
+ (TYPE_FIELD_ARTIFICIAL((TYPE_FIELD_TYPE((arraytype),0)),1))
|
||||
+#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
|
||||
+ (TYPE_FIELD_ARTIFICIAL((TYPE_FIELD_TYPE((arraytype),0)),0))
|
||||
|
||||
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
|
||||
(TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1))
|
||||
--- ./gdb/m2-typeprint.c 2008-01-01 23:53:11.000000000 +0100
|
||||
+++ ./gdb/m2-typeprint.c 2008-10-29 10:55:12.000000000 +0100
|
||||
@@ -202,7 +202,7 @@ static void m2_array (struct type *type,
|
||||
{
|
||||
fprintf_filtered (stream, "ARRAY [");
|
||||
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
|
||||
- && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
|
||||
+ && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
{
|
||||
if (TYPE_INDEX_TYPE (type) != 0)
|
||||
{
|
||||
--- ./gdb/p-typeprint.c 2008-01-01 23:53:12.000000000 +0100
|
||||
+++ ./gdb/p-typeprint.c 2008-10-29 10:55:12.000000000 +0100
|
||||
@@ -251,7 +251,7 @@ pascal_type_print_varspec_prefix (struct
|
||||
fprintf_filtered (stream, "(");
|
||||
fprintf_filtered (stream, "array ");
|
||||
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
|
||||
- && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
|
||||
+ && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
fprintf_filtered (stream, "[%d..%d] ",
|
||||
TYPE_ARRAY_LOWER_BOUND_VALUE (type),
|
||||
TYPE_ARRAY_UPPER_BOUND_VALUE (type)
|
||||
--- ./gdb/parse.c 2008-10-29 10:47:18.000000000 +0100
|
||||
+++ ./gdb/parse.c 2008-10-29 10:55:12.000000000 +0100
|
||||
@@ -1175,8 +1175,7 @@ follow_types (struct type *follow_type)
|
||||
create_array_type ((struct type *) NULL,
|
||||
follow_type, range_type);
|
||||
if (array_size < 0)
|
||||
- TYPE_ARRAY_UPPER_BOUND_TYPE (follow_type)
|
||||
- = BOUND_CANNOT_BE_DETERMINED;
|
||||
+ TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (follow_type) = 1;
|
||||
break;
|
||||
case tp_function:
|
||||
/* FIXME-type-allocation: need a way to free this type when we are
|
||||
--- ./gdb/testsuite/gdb.base/maint.exp 2008-01-28 19:06:59.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/maint.exp 2008-10-29 20:50:33.000000000 +0100
|
||||
@@ -404,7 +404,7 @@ gdb_expect {
|
||||
|
||||
send_gdb "maint print type argc\n"
|
||||
gdb_expect {
|
||||
- -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
|
||||
+ -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
|
||||
{ pass "maint print type" }
|
||||
-re ".*$gdb_prompt $" { fail "maint print type" }
|
||||
timeout { fail "(timeout) maint print type" }
|
||||
--- ./gdb/valops.c 2008-10-29 10:50:23.000000000 +0100
|
||||
+++ ./gdb/valops.c 2008-10-29 10:55:12.000000000 +0100
|
||||
@@ -291,8 +291,7 @@ value_cast (struct type *type, struct va
|
||||
{
|
||||
struct type *element_type = TYPE_TARGET_TYPE (type);
|
||||
unsigned element_length = TYPE_LENGTH (check_typedef (element_type));
|
||||
- if (element_length > 0
|
||||
- && TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
|
||||
+ if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
{
|
||||
struct type *range_type = TYPE_INDEX_TYPE (type);
|
||||
int val_length = TYPE_LENGTH (type2);
|
||||
--- ./gdb/varobj.c 2008-10-29 10:47:21.000000000 +0100
|
||||
+++ ./gdb/varobj.c 2008-10-29 10:55:12.000000000 +0100
|
||||
@@ -1988,7 +1988,7 @@ c_number_of_children (struct varobj *var
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
|
||||
- && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
|
||||
+ && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
|
||||
else
|
||||
/* If we don't know how many elements there are, don't display
|
|
@ -0,0 +1,579 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2008-10/msg00099.html
|
||||
|
||||
2008-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Convert static_kind into loc_kind enum.
|
||||
* gdbtypes.h (enum field_loc_kind): New.
|
||||
(union field_location): New field dwarf_block.
|
||||
(struct field): Rename static_kind as loc_kind.
|
||||
(FIELD_STATIC_KIND): Rename to ...
|
||||
(FIELD_LOC_KIND): ... here.
|
||||
(TYPE_FIELD_STATIC_KIND): Rename to ...
|
||||
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
|
||||
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
|
||||
(TYPE_FIELD_STATIC): Remove.
|
||||
(TYPE_FIELD_BITPOS): Reformat.
|
||||
(SET_FIELD_BITPOS): New.
|
||||
(FIELD_PHYSADDR): Rename to ...
|
||||
(FIELD_STATIC_PHYSADDR): ... here.
|
||||
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
|
||||
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
|
||||
(FIELD_PHYSNAME): Rename to ...
|
||||
(FIELD_STATIC_PHYSNAME): ... here.
|
||||
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
|
||||
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
|
||||
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
|
||||
(field_is_static): New declaration.
|
||||
* gdbtypes.c (field_is_static): New function.
|
||||
(copy_type_recursive): Update throughout.
|
||||
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
|
||||
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
|
||||
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
|
||||
|
||||
[ Ported to gdb-6.8fedora. ]
|
||||
|
||||
--- ./gdb/amd64-tdep.c 2008-10-29 10:47:21.000000000 +0100
|
||||
+++ ./gdb/amd64-tdep.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -317,7 +317,7 @@ amd64_classify_aggregate (struct type *t
|
||||
enum amd64_reg_class subclass[2];
|
||||
|
||||
/* Ignore static fields. */
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
continue;
|
||||
|
||||
gdb_assert (pos == 0 || pos == 1);
|
||||
--- ./gdb/c-typeprint.c 2008-10-29 10:55:07.000000000 +0100
|
||||
+++ ./gdb/c-typeprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -872,14 +872,12 @@ c_type_print_base (struct type *type, st
|
||||
}
|
||||
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
- {
|
||||
- fprintf_filtered (stream, "static ");
|
||||
- }
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
+ fprintf_filtered (stream, "static ");
|
||||
c_print_type (TYPE_FIELD_TYPE (type, i),
|
||||
TYPE_FIELD_NAME (type, i),
|
||||
stream, show - 1, level + 4);
|
||||
- if (!TYPE_FIELD_STATIC (type, i)
|
||||
+ if (!field_is_static (&TYPE_FIELD (type, i))
|
||||
&& TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
/* It is a bitfield. This code does not attempt
|
||||
--- ./gdb/coffread.c 2008-01-16 12:21:42.000000000 +0100
|
||||
+++ ./gdb/coffread.c 2008-10-29 20:58:56.000000000 +0100
|
||||
@@ -1946,9 +1946,8 @@ coff_read_struct_type (int index, int le
|
||||
strlen (name),
|
||||
¤t_objfile->objfile_obstack);
|
||||
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
|
||||
- FIELD_BITPOS (list->field) = 8 * ms->c_value;
|
||||
+ SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
|
||||
FIELD_BITSIZE (list->field) = 0;
|
||||
- FIELD_STATIC_KIND (list->field) = 0;
|
||||
nfields++;
|
||||
break;
|
||||
|
||||
@@ -1965,9 +1964,8 @@ coff_read_struct_type (int index, int le
|
||||
strlen (name),
|
||||
¤t_objfile->objfile_obstack);
|
||||
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
|
||||
- FIELD_BITPOS (list->field) = ms->c_value;
|
||||
+ SET_FIELD_BITPOS (list->field, ms->c_value);
|
||||
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
|
||||
- FIELD_STATIC_KIND (list->field) = 0;
|
||||
nfields++;
|
||||
break;
|
||||
|
||||
@@ -2083,11 +2081,10 @@ coff_read_enum_type (int index, int leng
|
||||
struct symbol *xsym = syms->symbol[j];
|
||||
SYMBOL_TYPE (xsym) = type;
|
||||
TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
|
||||
- TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
|
||||
+ SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
|
||||
if (SYMBOL_VALUE (xsym) < 0)
|
||||
unsigned_enum = 0;
|
||||
TYPE_FIELD_BITSIZE (type, n) = 0;
|
||||
- TYPE_FIELD_STATIC_KIND (type, n) = 0;
|
||||
}
|
||||
if (syms == osyms)
|
||||
break;
|
||||
--- ./gdb/cp-valprint.c 2008-01-01 23:53:09.000000000 +0100
|
||||
+++ ./gdb/cp-valprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -192,7 +192,8 @@ cp_print_value_fields (struct type *type
|
||||
for (i = n_baseclasses; i < len; i++)
|
||||
{
|
||||
/* If requested, skip printing of static fields. */
|
||||
- if (!static_field_print && TYPE_FIELD_STATIC (type, i))
|
||||
+ if (!static_field_print
|
||||
+ && field_is_static (&TYPE_FIELD (type, i)))
|
||||
continue;
|
||||
|
||||
if (fields_seen)
|
||||
@@ -225,7 +226,7 @@ cp_print_value_fields (struct type *type
|
||||
fputs_filtered ("\"( ptr \"", stream);
|
||||
else
|
||||
fputs_filtered ("\"( nodef \"", stream);
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
current_language->la_language,
|
||||
@@ -240,7 +241,7 @@ cp_print_value_fields (struct type *type
|
||||
{
|
||||
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
|
||||
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
current_language->la_language,
|
||||
@@ -252,7 +253,8 @@ cp_print_value_fields (struct type *type
|
||||
annotate_field_value ();
|
||||
}
|
||||
|
||||
- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
|
||||
+ if (!field_is_static (&TYPE_FIELD (type, i))
|
||||
+ && TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
struct value *v;
|
||||
|
||||
@@ -277,7 +279,7 @@ cp_print_value_fields (struct type *type
|
||||
{
|
||||
fputs_filtered ("<optimized out or zero length>", stream);
|
||||
}
|
||||
- else if (TYPE_FIELD_STATIC (type, i))
|
||||
+ else if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
{
|
||||
struct value *v = value_static_field (type, i);
|
||||
if (v == NULL)
|
||||
--- ./gdb/dwarf2read.c 2008-10-29 10:50:56.000000000 +0100
|
||||
+++ ./gdb/dwarf2read.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -3492,7 +3492,7 @@ dwarf2_add_field (struct field_info *fip
|
||||
/* Get type of field. */
|
||||
fp->type = die_type (die, cu);
|
||||
|
||||
- FIELD_STATIC_KIND (*fp) = 0;
|
||||
+ SET_FIELD_BITPOS (*fp, 0);
|
||||
|
||||
/* Get bit size of field (zero if none). */
|
||||
attr = dwarf2_attr (die, DW_AT_bit_size, cu);
|
||||
@@ -3521,10 +3521,8 @@ dwarf2_add_field (struct field_info *fip
|
||||
else
|
||||
byte_offset = decode_locdesc (DW_BLOCK (attr), cu);
|
||||
|
||||
- FIELD_BITPOS (*fp) = byte_offset * bits_per_byte;
|
||||
+ SET_FIELD_BITPOS (*fp, byte_offset * bits_per_byte);
|
||||
}
|
||||
- else
|
||||
- FIELD_BITPOS (*fp) = 0;
|
||||
attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
|
||||
if (attr)
|
||||
{
|
||||
@@ -3617,10 +3615,9 @@ dwarf2_add_field (struct field_info *fip
|
||||
/* C++ base class field. */
|
||||
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
|
||||
if (attr)
|
||||
- FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), cu)
|
||||
- * bits_per_byte);
|
||||
+ SET_FIELD_BITPOS (*fp, decode_locdesc (DW_BLOCK (attr), cu)
|
||||
+ * bits_per_byte);
|
||||
FIELD_BITSIZE (*fp) = 0;
|
||||
- FIELD_STATIC_KIND (*fp) = 0;
|
||||
FIELD_TYPE (*fp) = die_type (die, cu);
|
||||
FIELD_NAME (*fp) = type_name_no_tag (fp->type);
|
||||
fip->nbaseclasses++;
|
||||
@@ -4379,9 +4376,8 @@ process_enumeration_scope (struct die_in
|
||||
|
||||
FIELD_NAME (fields[num_fields]) = DEPRECATED_SYMBOL_NAME (sym);
|
||||
FIELD_TYPE (fields[num_fields]) = NULL;
|
||||
- FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym);
|
||||
+ SET_FIELD_BITPOS (fields[num_fields], SYMBOL_VALUE (sym));
|
||||
FIELD_BITSIZE (fields[num_fields]) = 0;
|
||||
- FIELD_STATIC_KIND (fields[num_fields]) = 0;
|
||||
|
||||
num_fields++;
|
||||
}
|
||||
--- ./gdb/eval.c 2008-10-29 10:55:07.000000000 +0100
|
||||
+++ ./gdb/eval.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -288,7 +288,8 @@ evaluate_struct_tuple (struct value *str
|
||||
fieldno++;
|
||||
/* Skip static fields. */
|
||||
while (fieldno < TYPE_NFIELDS (struct_type)
|
||||
- && TYPE_FIELD_STATIC_KIND (struct_type, fieldno))
|
||||
+ && field_is_static (&TYPE_FIELD (struct_type,
|
||||
+ fieldno)))
|
||||
fieldno++;
|
||||
subfieldno = fieldno;
|
||||
if (fieldno >= TYPE_NFIELDS (struct_type))
|
||||
--- ./gdb/gdbtypes.c 2008-10-29 10:55:07.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -2407,6 +2407,20 @@ print_arg_types (struct field *args, int
|
||||
}
|
||||
}
|
||||
|
||||
+int
|
||||
+field_is_static (struct field *f)
|
||||
+{
|
||||
+ /* "static" fields are the fields whose location is not relative
|
||||
+ to the address of the enclosing struct. It would be nice to
|
||||
+ have a dedicated flag that would be set for static fields when
|
||||
+ the type is being created. But in practice, checking the field
|
||||
+ loc_kind should give us an accurate answer (at least as long as
|
||||
+ we assume that DWARF block locations are not going to be used
|
||||
+ for static fields). FIXME? */
|
||||
+ return (FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSNAME
|
||||
+ || FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSADDR);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
dump_fn_fieldlists (struct type *type, int spaces)
|
||||
{
|
||||
@@ -2939,18 +2953,25 @@ copy_type_recursive (struct objfile *obj
|
||||
if (TYPE_FIELD_NAME (type, i))
|
||||
TYPE_FIELD_NAME (new_type, i) =
|
||||
xstrdup (TYPE_FIELD_NAME (type, i));
|
||||
- if (TYPE_FIELD_STATIC_HAS_ADDR (type, i))
|
||||
- SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
|
||||
- TYPE_FIELD_STATIC_PHYSADDR (type, i));
|
||||
- else if (TYPE_FIELD_STATIC (type, i))
|
||||
- SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
|
||||
- xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
|
||||
- i)));
|
||||
- else
|
||||
+ switch (TYPE_FIELD_LOC_KIND (type, i))
|
||||
{
|
||||
- TYPE_FIELD_BITPOS (new_type, i) =
|
||||
- TYPE_FIELD_BITPOS (type, i);
|
||||
- TYPE_FIELD_STATIC_KIND (new_type, i) = 0;
|
||||
+ case FIELD_LOC_KIND_BITPOS:
|
||||
+ SET_FIELD_BITPOS (TYPE_FIELD (new_type, i),
|
||||
+ TYPE_FIELD_BITPOS (type, i));
|
||||
+ break;
|
||||
+ case FIELD_LOC_KIND_PHYSADDR:
|
||||
+ SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
|
||||
+ TYPE_FIELD_STATIC_PHYSADDR (type, i));
|
||||
+ break;
|
||||
+ case FIELD_LOC_KIND_PHYSNAME:
|
||||
+ SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
|
||||
+ xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
|
||||
+ i)));
|
||||
+ break;
|
||||
+ default:
|
||||
+ internal_error (__FILE__, __LINE__,
|
||||
+ _("Unexpected type field location kind: %d"),
|
||||
+ TYPE_FIELD_LOC_KIND (type, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
--- ./gdb/gdbtypes.h 2008-10-29 10:56:05.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.h 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -310,6 +310,16 @@ enum type_code
|
||||
#define TYPE_FLAG_NOTTEXT (1 << 17)
|
||||
#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
|
||||
|
||||
+/* Determine which field of the union main_type.fields[x].loc is used. */
|
||||
+
|
||||
+enum field_loc_kind
|
||||
+ {
|
||||
+ FIELD_LOC_KIND_BITPOS, /* bitpos */
|
||||
+ FIELD_LOC_KIND_PHYSADDR, /* physaddr */
|
||||
+ FIELD_LOC_KIND_PHYSNAME, /* physname */
|
||||
+ FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
|
||||
+ };
|
||||
+
|
||||
/* This structure is space-critical.
|
||||
Its layout has been tweaked to reduce the space used. */
|
||||
|
||||
@@ -415,6 +425,12 @@ struct main_type
|
||||
|
||||
CORE_ADDR physaddr;
|
||||
char *physname;
|
||||
+
|
||||
+ /* The field location can be computed by evaluating the following DWARF
|
||||
+ block. This can be used in Fortran variable-length arrays, for
|
||||
+ instance. */
|
||||
+
|
||||
+ struct dwarf2_locexpr_baton *dwarf_block;
|
||||
}
|
||||
loc;
|
||||
|
||||
@@ -424,11 +440,8 @@ struct main_type
|
||||
defined. */
|
||||
unsigned int artificial : 1;
|
||||
|
||||
- /* This flag is zero for non-static fields, 1 for fields whose location
|
||||
- is specified by the label loc.physname, and 2 for fields whose location
|
||||
- is specified by loc.physaddr. */
|
||||
-
|
||||
- unsigned int static_kind : 2;
|
||||
+ /* Discriminant for union field_location. */
|
||||
+ ENUM_BITFIELD(field_loc_kind) loc_kind : 2;
|
||||
|
||||
/* Size of this field, in bits, or zero if not packed.
|
||||
For an unpacked field, the field's type's length
|
||||
@@ -824,20 +837,34 @@ extern void allocate_cplus_struct_type (
|
||||
|
||||
#define FIELD_TYPE(thisfld) ((thisfld).type)
|
||||
#define FIELD_NAME(thisfld) ((thisfld).name)
|
||||
+#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
||||
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
|
||||
+#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
|
||||
+#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
+#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
|
||||
+#define SET_FIELD_BITPOS(thisfld, bitpos) \
|
||||
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
|
||||
+ FIELD_BITPOS (thisfld) = (bitpos))
|
||||
+#define SET_FIELD_PHYSNAME(thisfld, name) \
|
||||
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
|
||||
+ FIELD_STATIC_PHYSNAME (thisfld) = (name))
|
||||
+#define SET_FIELD_PHYSADDR(thisfld, addr) \
|
||||
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
|
||||
+ FIELD_STATIC_PHYSADDR (thisfld) = (addr))
|
||||
+#define SET_FIELD_DWARF_BLOCK(thisfld, addr) \
|
||||
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_DWARF_BLOCK, \
|
||||
+ FIELD_DWARF_BLOCK (thisfld) = (addr))
|
||||
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
|
||||
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
|
||||
-#define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind)
|
||||
-#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname)
|
||||
-#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
-#define SET_FIELD_PHYSNAME(thisfld, name) \
|
||||
- ((thisfld).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name))
|
||||
-#define SET_FIELD_PHYSADDR(thisfld, name) \
|
||||
- ((thisfld).static_kind = 2, FIELD_PHYSADDR(thisfld) = (name))
|
||||
+
|
||||
#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n]
|
||||
#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
|
||||
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
|
||||
-#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
|
||||
+#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
|
||||
+#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
|
||||
+#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
|
||||
+#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
|
||||
+#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
|
||||
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
|
||||
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
|
||||
@@ -873,12 +900,6 @@ extern void allocate_cplus_struct_type (
|
||||
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
|
||||
|
||||
-#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0)
|
||||
-#define TYPE_FIELD_STATIC_KIND(thistype, n) TYPE_MAIN_TYPE (thistype)->fields[n].static_kind
|
||||
-#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind == 2)
|
||||
-#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n))
|
||||
-#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n))
|
||||
-
|
||||
#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
|
||||
#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
|
||||
#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
|
||||
@@ -1331,6 +1352,8 @@ extern int rank_one_type (struct type *,
|
||||
|
||||
extern void recursive_dump_type (struct type *, int);
|
||||
|
||||
+extern int field_is_static (struct field *);
|
||||
+
|
||||
/* printcmd.c */
|
||||
|
||||
extern void print_scalar_formatted (const void *, struct type *, int, int,
|
||||
--- ./gdb/jv-typeprint.c 2008-01-01 23:53:11.000000000 +0100
|
||||
+++ ./gdb/jv-typeprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -185,7 +185,7 @@ java_type_print_base (struct type *type,
|
||||
fprintf_filtered (stream, "public ");
|
||||
}
|
||||
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fprintf_filtered (stream, "static ");
|
||||
|
||||
java_print_type (TYPE_FIELD_TYPE (type, i),
|
||||
--- ./gdb/jv-valprint.c 2008-01-01 23:53:11.000000000 +0100
|
||||
+++ ./gdb/jv-valprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -302,7 +302,7 @@ java_print_value_fields (struct type *ty
|
||||
for (i = n_baseclasses; i < len; i++)
|
||||
{
|
||||
/* If requested, skip printing of static fields. */
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
{
|
||||
char *name = TYPE_FIELD_NAME (type, i);
|
||||
if (!static_field_print)
|
||||
@@ -340,7 +340,7 @@ java_print_value_fields (struct type *ty
|
||||
fputs_filtered ("\"( ptr \"", stream);
|
||||
else
|
||||
fputs_filtered ("\"( nodef \"", stream);
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
language_cplus,
|
||||
@@ -355,7 +355,7 @@ java_print_value_fields (struct type *ty
|
||||
{
|
||||
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
|
||||
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
language_cplus,
|
||||
@@ -365,7 +365,8 @@ java_print_value_fields (struct type *ty
|
||||
annotate_field_value ();
|
||||
}
|
||||
|
||||
- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
|
||||
+ if (!field_is_static (&TYPE_FIELD (type, i))
|
||||
+ && TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
struct value *v;
|
||||
|
||||
@@ -389,7 +390,7 @@ java_print_value_fields (struct type *ty
|
||||
{
|
||||
fputs_filtered ("<optimized out or zero length>", stream);
|
||||
}
|
||||
- else if (TYPE_FIELD_STATIC (type, i))
|
||||
+ else if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
{
|
||||
struct value *v = value_static_field (type, i);
|
||||
if (v == NULL)
|
||||
--- ./gdb/mdebugread.c 2008-01-01 23:53:12.000000000 +0100
|
||||
+++ ./gdb/mdebugread.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -1053,11 +1053,10 @@ parse_symbol (SYMR *sh, union aux_ext *a
|
||||
if (tsym.st != stMember)
|
||||
break;
|
||||
|
||||
- FIELD_BITPOS (*f) = tsym.value;
|
||||
+ SET_FIELD_BITPOS (*f, tsym.value);
|
||||
FIELD_TYPE (*f) = t;
|
||||
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
|
||||
FIELD_BITSIZE (*f) = 0;
|
||||
- FIELD_STATIC_KIND (*f) = 0;
|
||||
|
||||
enum_sym = ((struct symbol *)
|
||||
obstack_alloc (¤t_objfile->objfile_obstack,
|
||||
@@ -1247,11 +1246,10 @@ parse_symbol (SYMR *sh, union aux_ext *a
|
||||
case stMember: /* member of struct or union */
|
||||
f = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++];
|
||||
FIELD_NAME (*f) = name;
|
||||
- FIELD_BITPOS (*f) = sh->value;
|
||||
+ SET_FIELD_BITPOS (*f, sh->value);
|
||||
bitsize = 0;
|
||||
FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name);
|
||||
FIELD_BITSIZE (*f) = bitsize;
|
||||
- FIELD_STATIC_KIND (*f) = 0;
|
||||
break;
|
||||
|
||||
case stIndirect: /* forward declaration on Irix5 */
|
||||
--- ./gdb/p-typeprint.c 2008-10-29 10:55:12.000000000 +0100
|
||||
+++ ./gdb/p-typeprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -575,14 +575,12 @@ pascal_type_print_base (struct type *typ
|
||||
}
|
||||
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
- {
|
||||
- fprintf_filtered (stream, "static ");
|
||||
- }
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
+ fprintf_filtered (stream, "static ");
|
||||
pascal_print_type (TYPE_FIELD_TYPE (type, i),
|
||||
TYPE_FIELD_NAME (type, i),
|
||||
stream, show - 1, level + 4);
|
||||
- if (!TYPE_FIELD_STATIC (type, i)
|
||||
+ if (!field_is_static (&TYPE_FIELD (type, i))
|
||||
&& TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
/* It is a bitfield. This code does not attempt
|
||||
--- ./gdb/p-valprint.c 2008-01-01 23:53:12.000000000 +0100
|
||||
+++ ./gdb/p-valprint.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -671,7 +671,8 @@ pascal_object_print_value_fields (struct
|
||||
for (i = n_baseclasses; i < len; i++)
|
||||
{
|
||||
/* If requested, skip printing of static fields. */
|
||||
- if (!pascal_static_field_print && TYPE_FIELD_STATIC (type, i))
|
||||
+ if (!pascal_static_field_print
|
||||
+ && field_is_static (&TYPE_FIELD (type, i)))
|
||||
continue;
|
||||
if (fields_seen)
|
||||
fprintf_filtered (stream, ", ");
|
||||
@@ -703,7 +704,7 @@ pascal_object_print_value_fields (struct
|
||||
fputs_filtered ("\"( ptr \"", stream);
|
||||
else
|
||||
fputs_filtered ("\"( nodef \"", stream);
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
language_cplus,
|
||||
@@ -718,7 +719,7 @@ pascal_object_print_value_fields (struct
|
||||
{
|
||||
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
|
||||
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
fputs_filtered ("static ", stream);
|
||||
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
||||
language_cplus,
|
||||
@@ -728,7 +729,8 @@ pascal_object_print_value_fields (struct
|
||||
annotate_field_value ();
|
||||
}
|
||||
|
||||
- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
|
||||
+ if (!field_is_static (&TYPE_FIELD (type, i))
|
||||
+ && TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
struct value *v;
|
||||
|
||||
@@ -752,7 +754,7 @@ pascal_object_print_value_fields (struct
|
||||
{
|
||||
fputs_filtered ("<optimized out or zero length>", stream);
|
||||
}
|
||||
- else if (TYPE_FIELD_STATIC (type, i))
|
||||
+ else if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
{
|
||||
/* struct value *v = value_static_field (type, i); v4.17 specific */
|
||||
struct value *v;
|
||||
--- ./gdb/valops.c 2008-10-29 10:55:12.000000000 +0100
|
||||
+++ ./gdb/valops.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -1269,7 +1269,7 @@ search_struct_field (char *name, struct
|
||||
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
|
||||
{
|
||||
struct value *v;
|
||||
- if (TYPE_FIELD_STATIC (type, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, i)))
|
||||
{
|
||||
v = value_static_field (type, i);
|
||||
if (v == 0)
|
||||
@@ -2382,7 +2382,7 @@ value_struct_elt_for_reference (struct t
|
||||
|
||||
if (t_field_name && strcmp (t_field_name, name) == 0)
|
||||
{
|
||||
- if (TYPE_FIELD_STATIC (t, i))
|
||||
+ if (field_is_static (&TYPE_FIELD (t, i)))
|
||||
{
|
||||
v = value_static_field (t, i);
|
||||
if (v == NULL)
|
||||
--- ./gdb/value.c 2008-10-29 10:47:18.000000000 +0100
|
||||
+++ ./gdb/value.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -1261,7 +1261,7 @@ value_static_field (struct type *type, i
|
||||
{
|
||||
struct value *retval;
|
||||
|
||||
- if (TYPE_FIELD_STATIC_HAS_ADDR (type, fieldno))
|
||||
+ if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
|
||||
{
|
||||
retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
|
||||
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
|
||||
--- ./gdb/varobj.c 2008-10-29 10:55:12.000000000 +0100
|
||||
+++ ./gdb/varobj.c 2008-10-29 20:56:57.000000000 +0100
|
||||
@@ -2050,7 +2050,7 @@ value_struct_element_index (struct value
|
||||
|
||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||
{
|
||||
- if (TYPE_FIELD_STATIC (type, type_index))
|
||||
+ if (field_is_static (&TYPE_FIELD (type, type_index)))
|
||||
result = value_static_field (type, type_index);
|
||||
else
|
||||
result = value_primitive_field (value, 0, type_index, type);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
|||
diff -d -urpN src.0/gdb/valops.c src.1/gdb/valops.c
|
||||
--- src.0/gdb/valops.c 2008-07-27 04:00:03.000000000 +0200
|
||||
+++ src.1/gdb/valops.c 2008-07-31 15:17:42.000000000 +0200
|
||||
@@ -813,10 +813,18 @@ value_assign (struct value *toval, struc
|
||||
struct frame_info *frame;
|
||||
int value_reg;
|
||||
|
||||
- /* Figure out which frame this is in currently. */
|
||||
- frame = frame_find_by_id (VALUE_FRAME_ID (toval));
|
||||
value_reg = VALUE_REGNUM (toval);
|
||||
|
||||
+ /* Figure out which frame this is in currently. */
|
||||
+ frame = frame_find_by_id (VALUE_FRAME_ID (toval));
|
||||
+ /* "set $reg+=1" should work on programs with no debug info,
|
||||
+ but frame_find_by_id returns NULL here (RH bug 436037).
|
||||
+ Use current frame, it represents CPU state in this case.
|
||||
+ If frame_find_by_id is changed to do it internally
|
||||
+ (it is contemplated there), remove this. */
|
||||
+ if (!frame)
|
||||
+ frame = get_current_frame ();
|
||||
+ /* Probably never happens. */
|
||||
if (!frame)
|
||||
error (_("Value being assigned to is no longer active."));
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
Test various forms of threads tracking across exec(2).
|
||||
|
||||
diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
--- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 17:05:19.000000000 -0400
|
||||
+++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 14:43:50.000000000 -0400
|
||||
@@ -18,21 +18,95 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stddef.h>
|
||||
-#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
+#ifdef THREADS
|
||||
+
|
||||
+# include <pthread.h>
|
||||
|
||||
static void *
|
||||
threader (void *arg)
|
||||
{
|
||||
- return NULL;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
-main (void)
|
||||
+main (int argc, char **argv)
|
||||
{
|
||||
+ char *exec_nothreads, *exec_threads, *cmd;
|
||||
+ int phase;
|
||||
+ char phase_s[8];
|
||||
+
|
||||
+ setbuf (stdout, NULL);
|
||||
+
|
||||
+ if (argc != 4)
|
||||
+ {
|
||||
+ fprintf (stderr, "%s <non-threaded> <threaded> <phase>\n", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+#ifdef THREADS
|
||||
+ puts ("THREADS: Y");
|
||||
+#else
|
||||
+ puts ("THREADS: N");
|
||||
+#endif
|
||||
+ exec_nothreads = argv[1];
|
||||
+ printf ("exec_nothreads: %s\n", exec_nothreads);
|
||||
+ exec_threads = argv[2];
|
||||
+ printf ("exec_threads: %s\n", exec_threads);
|
||||
+ phase = atoi (argv[3]);
|
||||
+ printf ("phase: %d\n", phase);
|
||||
+
|
||||
+ /* Phases: threading
|
||||
+ 0: N -> N
|
||||
+ 1: N -> Y
|
||||
+ 2: Y -> Y
|
||||
+ 3: Y -> N
|
||||
+ 4: N -> exit */
|
||||
+
|
||||
+ cmd = NULL;
|
||||
+
|
||||
+#ifndef THREADS
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ cmd = exec_nothreads;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ cmd = exec_threads;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 3:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 4:
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#else /* THREADS */
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 1:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 2:
|
||||
+ cmd = exec_threads;
|
||||
+ {
|
||||
pthread_t t1;
|
||||
int i;
|
||||
|
||||
@@ -40,7 +114,34 @@ main (void)
|
||||
assert (i == 0);
|
||||
i = pthread_join (t1, NULL);
|
||||
assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ cmd = exec_nothreads;
|
||||
+ {
|
||||
+ pthread_t t1;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_join (t1, NULL);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#endif /* THREADS */
|
||||
+
|
||||
+ assert (cmd != NULL);
|
||||
+
|
||||
+ phase++;
|
||||
+ snprintf (phase_s, sizeof phase_s, "%d", phase);
|
||||
|
||||
- execl ("/bin/true", "/bin/true", NULL);
|
||||
- abort ();
|
||||
+ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL);
|
||||
+ assert (0);
|
||||
}
|
||||
diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
--- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 17:05:19.000000000 -0400
|
||||
+++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 14:42:49.000000000 -0400
|
||||
@@ -20,9 +20,14 @@
|
||||
|
||||
set testfile threaded-exec
|
||||
set srcfile ${testfile}.c
|
||||
-set binfile ${objdir}/${subdir}/${testfile}
|
||||
+set binfile_nothreads ${objdir}/${subdir}/${testfile}N
|
||||
+set binfile_threads ${objdir}/${subdir}/${testfile}Y
|
||||
|
||||
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
@@ -30,9 +35,9 @@ gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
|
||||
-gdb_load ${binfile}
|
||||
+gdb_load ${binfile_nothreads}
|
||||
|
||||
-gdb_run_cmd
|
||||
+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0
|
||||
|
||||
gdb_test_multiple {} "Program exited" {
|
||||
-re "\r\nProgram exited normally.\r\n$gdb_prompt $" {
|
|
@ -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;
|
|
@ -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);
|
|
@ -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)
|
||||
{
|
||||
@@ -7404,6 +7412,11 @@ new_symbol (struct die_info *die, struct
|
||||
add_symbol_to_list (sym, cu->list_in_scope);
|
||||
}
|
||||
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
|
|
@ -0,0 +1,18 @@
|
|||
--- ./gdb/dwarf2read.c 4 May 2008 17:27:01 -0000 1.260
|
||||
+++ ./gdb/dwarf2read.c 4 May 2008 18:26:20 -0000
|
||||
@@ -6754,7 +6754,14 @@ dwarf2_attr (struct die_info *die, unsig
|
||||
for (i = 0; i < die->num_attrs; ++i)
|
||||
{
|
||||
if (die->attrs[i].name == name)
|
||||
- return &die->attrs[i];
|
||||
+ {
|
||||
+ /* GCC PR ada/35998 workaround. */
|
||||
+ if (name == DW_AT_byte_size
|
||||
+ && DW_UNSND (&die->attrs[i]) == 0xffffffff)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return &die->attrs[i];
|
||||
+ }
|
||||
if (die->attrs[i].name == DW_AT_specification
|
||||
|| die->attrs[i].name == DW_AT_abstract_origin)
|
||||
spec = &die->attrs[i];
|
|
@ -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;
|
||||
|
||||
@@ -154,7 +155,7 @@ extern void quit (void);
|
||||
needed. */
|
||||
|
||||
#define QUIT { \
|
||||
- if (quit_flag) quit (); \
|
||||
+ if (quit_flag && !quit_flag_cleanup) quit (); \
|
||||
if (deprecated_interactive_hook) deprecated_interactive_hook (); \
|
||||
}
|
||||
|
||||
--- ./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
|
|
@ -0,0 +1,97 @@
|
|||
diff -up gdb-6.8/gdb/sparc64-linux-tdep.c.sparc gdb-6.8/gdb/sparc64-linux-tdep.c
|
||||
--- gdb-6.8/gdb/sparc64-linux-tdep.c.sparc 2008-01-01 16:53:13.000000000 -0600
|
||||
+++ gdb-6.8/gdb/sparc64-linux-tdep.c 2008-05-15 14:08:57.000000000 -0500
|
||||
@@ -174,6 +174,30 @@ sparc64_linux_collect_core_fpregset (con
|
||||
sparc64_collect_fpregset (regcache, regnum, fpregs);
|
||||
}
|
||||
|
||||
+/* Set the program counter for process PTID to PC. */
|
||||
+
|
||||
+static void
|
||||
+sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
||||
+{
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
|
||||
+ ULONGEST state;
|
||||
+
|
||||
+ regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
|
||||
+ regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
|
||||
+
|
||||
+ /* Clear the "in syscall" bit to prevent the kernel from
|
||||
+ messing with the PCs we just installed, if we happen to be
|
||||
+ within an interrupted system call that the kernel wants to
|
||||
+ restart.
|
||||
+
|
||||
+ Note that after we return from the dummy call, the TSTATE et al.
|
||||
+ registers will be automatically restored, and the kernel
|
||||
+ continues to restart the system call at this point. */
|
||||
+ regcache_cooked_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
|
||||
+ state &= ~((ULONGEST)0x20);
|
||||
+ regcache_cooked_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
static void
|
||||
@@ -211,6 +235,8 @@ sparc64_linux_init_abi (struct gdbarch_i
|
||||
|
||||
/* Make sure we can single-step over signal return system calls. */
|
||||
tdep->step_trap = sparc64_linux_step_trap;
|
||||
+
|
||||
+ set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
|
||||
}
|
||||
|
||||
|
||||
diff -up gdb-6.8/gdb/sparc-linux-tdep.c.sparc gdb-6.8/gdb/sparc-linux-tdep.c
|
||||
--- gdb-6.8/gdb/sparc-linux-tdep.c.sparc 2008-01-01 16:53:13.000000000 -0600
|
||||
+++ gdb-6.8/gdb/sparc-linux-tdep.c 2008-05-15 14:08:12.000000000 -0500
|
||||
@@ -211,6 +211,30 @@ sparc32_linux_collect_core_fpregset (con
|
||||
sparc32_collect_fpregset (regcache, regnum, fpregs);
|
||||
}
|
||||
|
||||
+/* Set the program counter for process PTID to PC. */
|
||||
+
|
||||
+static void
|
||||
+sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
||||
+{
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
|
||||
+ ULONGEST psr;
|
||||
+
|
||||
+ regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
|
||||
+ regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
|
||||
+
|
||||
+ /* Clear the "in syscall" bit to prevent the kernel from
|
||||
+ messing with the PCs we just installed, if we happen to be
|
||||
+ within an interrupted system call that the kernel wants to
|
||||
+ restart.
|
||||
+
|
||||
+ Note that after we return from the dummy call, the PSR et al.
|
||||
+ registers will be automatically restored, and the kernel
|
||||
+ continues to restart the system call at this point. */
|
||||
+ regcache_cooked_read_unsigned (regcache, SPARC32_PSR_REGNUM, &psr);
|
||||
+ psr &= ~0x000004000;
|
||||
+ regcache_cooked_write_unsigned (regcache, SPARC32_PSR_REGNUM, psr);
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
static void
|
||||
@@ -238,10 +262,6 @@ sparc32_linux_init_abi (struct gdbarch_i
|
||||
prologue analysis. */
|
||||
tdep->plt_entry_size = 12;
|
||||
|
||||
- /* GNU/Linux doesn't support the 128-bit `long double' from the psABI. */
|
||||
- set_gdbarch_long_double_bit (gdbarch, 64);
|
||||
- set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
|
||||
-
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
svr4_fetch_objfile_link_map);
|
||||
@@ -251,6 +271,8 @@ sparc32_linux_init_abi (struct gdbarch_i
|
||||
|
||||
/* Hook in the DWARF CFI frame unwinder. */
|
||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
||||
+
|
||||
+ set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
@ -0,0 +1,11 @@
|
|||
diff -up gdb-6.8/gdb/sparc-tdep.c.BAD gdb-6.8/gdb/sparc-tdep.c
|
||||
--- gdb-6.8/gdb/sparc-tdep.c.BAD 2008-05-15 16:12:58.000000000 -0500
|
||||
+++ gdb-6.8/gdb/sparc-tdep.c 2008-05-15 16:13:41.000000000 -0500
|
||||
@@ -1122,6 +1122,7 @@ sparc32_store_return_value (struct type
|
||||
if (sparc_floating_p (type))
|
||||
{
|
||||
/* Floating return values. */
|
||||
+ len = (len <= 8) ? len : 8;
|
||||
memcpy (buf, valbuf, len);
|
||||
regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf);
|
||||
if (len > 4)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,78 @@
|
|||
For:
|
||||
http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html
|
||||
http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html
|
||||
|
||||
--- /dev/null 2008-11-04 06:31:10.599601840 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.exp 2008-11-04 06:43:29.000000000 +0100
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile watchpoint-cond
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if { [runto_main] < 0 } {
|
||||
+ untested watchpoint-cond
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i"
|
||||
+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*"
|
||||
--- /dev/null 2008-11-04 06:31:10.599601840 +0100
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.c 2008-11-04 06:42:48.000000000 +0100
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ static int i = 0; /* `static' to start initialized. */
|
||||
+ int j = 2;
|
||||
+
|
||||
+ for (j = 0; j < 30; j++)
|
||||
+ i = 30 - j;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
|
@ -31,9 +31,10 @@ It fixes the regression since GDB-6.7.1rh on x86_64 -m64 -fPIE/-pie:
|
|||
-PASS: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
|
||||
+FAIL: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
|
||||
|
||||
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/NEWS gdb-6.7.50.20080227-dynwatch/gdb/NEWS
|
||||
--- gdb-6.7.50.20080227-orig/gdb/NEWS 2008-03-03 08:42:11.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227-dynwatch/gdb/NEWS 2008-03-03 08:38:18.000000000 +0100
|
||||
Index: gdb-6.8/gdb/NEWS
|
||||
===================================================================
|
||||
--- gdb-6.8.orig/gdb/NEWS 2008-04-19 20:48:13.000000000 +0200
|
||||
+++ gdb-6.8/gdb/NEWS 2008-04-19 20:50:24.000000000 +0200
|
||||
@@ -1,6 +1,9 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
@ -44,9 +45,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/NEWS gdb
|
|||
*** Changes in GDB 6.8
|
||||
|
||||
* New native configurations
|
||||
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoint.c gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.c
|
||||
--- gdb-6.7.50.20080227-orig/gdb/breakpoint.c 2008-03-03 08:42:10.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.c 2008-03-03 08:37:33.000000000 +0100
|
||||
Index: gdb-6.8/gdb/breakpoint.c
|
||||
===================================================================
|
||||
--- gdb-6.8.orig/gdb/breakpoint.c 2008-04-19 20:48:11.000000000 +0200
|
||||
+++ gdb-6.8/gdb/breakpoint.c 2008-04-19 20:51:49.000000000 +0200
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "memattr.h"
|
||||
#include "ada-lang.h"
|
||||
|
@ -177,8 +179,8 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
+ }
|
||||
|
||||
/* Look at each value on the value chain. */
|
||||
- for (; v; v = value_next (v))
|
||||
+ for (v = val_chain; v; v = value_next (v))
|
||||
- for (; v; v = next)
|
||||
+ for (v = val_chain; v; v = next)
|
||||
{
|
||||
/* If it's a memory location, and GDB actually needed
|
||||
its contents to evaluate the expression, then we
|
||||
|
@ -332,7 +334,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
/* We will stop here */
|
||||
return WP_VALUE_CHANGED;
|
||||
}
|
||||
@@ -5780,10 +5844,9 @@ watch_command_1 (char *arg, int accessfl
|
||||
@@ -5723,10 +5787,9 @@ watch_command_1 (char *arg, int accessfl
|
||||
exp_end = arg;
|
||||
exp_valid_block = innermost_block;
|
||||
mark = value_mark ();
|
||||
|
@ -346,7 +348,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
|
||||
tok = arg;
|
||||
while (*tok == ' ' || *tok == '\t')
|
||||
@@ -5872,6 +5935,7 @@ watch_command_1 (char *arg, int accessfl
|
||||
@@ -5815,6 +5878,7 @@ watch_command_1 (char *arg, int accessfl
|
||||
b->exp_valid_block = exp_valid_block;
|
||||
b->exp_string = savestring (exp_start, exp_end - exp_start);
|
||||
b->val = val;
|
||||
|
@ -354,7 +356,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
b->loc->cond = cond;
|
||||
if (cond_start)
|
||||
b->cond_string = savestring (cond_start, cond_end - cond_start);
|
||||
@@ -7755,11 +7819,11 @@ is valid is not currently in scope.\n"),
|
||||
@@ -7698,11 +7762,11 @@ is valid is not currently in scope.\n"),
|
||||
if (bpt->val)
|
||||
value_free (bpt->val);
|
||||
mark = value_mark ();
|
||||
|
@ -371,10 +373,11 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
if (bpt->type == bp_hardware_watchpoint ||
|
||||
bpt->type == bp_read_watchpoint ||
|
||||
bpt->type == bp_access_watchpoint)
|
||||
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoint.h gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.h
|
||||
--- gdb-6.7.50.20080227-orig/gdb/breakpoint.h 2008-03-03 08:42:10.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227-dynwatch/gdb/breakpoint.h 2008-03-03 08:34:20.000000000 +0100
|
||||
@@ -392,8 +392,13 @@ struct breakpoint
|
||||
Index: gdb-6.8/gdb/breakpoint.h
|
||||
===================================================================
|
||||
--- gdb-6.8.orig/gdb/breakpoint.h 2008-04-19 20:47:23.000000000 +0200
|
||||
+++ gdb-6.8/gdb/breakpoint.h 2008-04-19 20:50:24.000000000 +0200
|
||||
@@ -391,8 +391,13 @@ struct breakpoint
|
||||
/* The largest block within which it is valid, or NULL if it is
|
||||
valid anywhere (e.g. consists just of global symbols). */
|
||||
struct block *exp_valid_block;
|
||||
|
@ -389,9 +392,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/breakpoi
|
|||
|
||||
/* Holds the address of the related watchpoint_scope breakpoint
|
||||
when using watchpoints on local variables (might the concept
|
||||
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.c gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.c
|
||||
--- gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.c 2003-03-17 20:51:58.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.c 2008-03-03 08:34:20.000000000 +0100
|
||||
Index: gdb-6.8/gdb/testsuite/gdb.base/watchpoint.c
|
||||
===================================================================
|
||||
--- gdb-6.8.orig/gdb/testsuite/gdb.base/watchpoint.c 2008-04-19 20:47:16.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint.c 2008-04-19 20:50:24.000000000 +0200
|
||||
@@ -39,6 +39,8 @@ struct foo struct1, struct2, *ptr1, *ptr
|
||||
|
||||
int doread = 0;
|
||||
|
@ -424,9 +428,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuit
|
|||
+
|
||||
return 0;
|
||||
}
|
||||
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.exp gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.exp
|
||||
--- gdb-6.7.50.20080227-orig/gdb/testsuite/gdb.base/watchpoint.exp 2008-01-01 23:53:19.000000000 +0100
|
||||
+++ gdb-6.7.50.20080227-dynwatch/gdb/testsuite/gdb.base/watchpoint.exp 2008-03-03 08:34:20.000000000 +0100
|
||||
Index: gdb-6.8/gdb/testsuite/gdb.base/watchpoint.exp
|
||||
===================================================================
|
||||
--- gdb-6.8.orig/gdb/testsuite/gdb.base/watchpoint.exp 2008-04-19 20:47:16.000000000 +0200
|
||||
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint.exp 2008-04-19 20:52:11.000000000 +0200
|
||||
@@ -645,6 +645,30 @@ proc test_watchpoint_and_breakpoint {} {
|
||||
}
|
||||
}
|
||||
|
@ -454,7 +459,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.50.20080227-orig/gdb/testsuit
|
|||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
# Start with a fresh gdb.
|
||||
|
||||
gdb_exit
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
From 30c13da4efe18f43ee34aa4b29bc86e1a53de548 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
|
||||
Date: Thu, 11 Jun 2009 00:23:54 +0200
|
||||
Subject: [PATCH] cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163).
|
||||
|
||||
gdb/
|
||||
* gdbtypes.c (get_discrete_bounds): Remove the VLA-introduced check for
|
||||
TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED and
|
||||
TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.base/arrayidx.c (unbound): New variable.
|
||||
* gdb.base/arrayidx.exp (p unbound.a == &unbound.a[0]): New test.
|
||||
---
|
||||
gdb/gdbtypes.c | 3 ---
|
||||
gdb/testsuite/gdb.base/arrayidx.c | 7 +++++++
|
||||
gdb/testsuite/gdb.base/arrayidx.exp | 10 +++++++++-
|
||||
3 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
|
||||
index 012485c..9899727 100644
|
||||
--- a/gdb/gdbtypes.c
|
||||
+++ b/gdb/gdbtypes.c
|
||||
@@ -769,9 +769,6 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_RANGE:
|
||||
- if (TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (type)
|
||||
- || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (type))
|
||||
- return -1;
|
||||
*lowp = TYPE_LOW_BOUND (type);
|
||||
*highp = TYPE_HIGH_BOUND (type);
|
||||
return 1;
|
||||
diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
|
||||
index 98d4d35..f98a656 100644
|
||||
--- a/gdb/testsuite/gdb.base/arrayidx.c
|
||||
+++ b/gdb/testsuite/gdb.base/arrayidx.c
|
||||
@@ -17,6 +17,13 @@
|
||||
|
||||
int array[] = {1, 2, 3, 4};
|
||||
|
||||
+#ifdef __GNUC__
|
||||
+struct
|
||||
+ {
|
||||
+ int a[0];
|
||||
+ } unbound;
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
|
||||
index 71ce4aa..af0e5f8 100644
|
||||
--- a/gdb/testsuite/gdb.base/arrayidx.exp
|
||||
+++ b/gdb/testsuite/gdb.base/arrayidx.exp
|
||||
@@ -59,4 +59,12 @@ gdb_test "print array" \
|
||||
"\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
|
||||
"Print array with array-indexes on"
|
||||
|
||||
-
|
||||
+set test "p unbound.a == &unbound.a\[0\]"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = 1\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
|
||||
+ unsupported "$test (no GCC)"
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.6.0.6
|
||||
|
269
gdb.spec
269
gdb.spec
|
@ -6,6 +6,9 @@
|
|||
Summary: A GNU source-level debugger for C, C++, Java and other languages
|
||||
Name: gdb%{?_with_debug:-debug}
|
||||
|
||||
# Compatibility with F-10 rpmbuild:
|
||||
%define _default_patch_fuzz 2
|
||||
|
||||
# Set version to contents of gdb/version.in.
|
||||
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
|
||||
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
|
||||
|
@ -13,9 +16,9 @@ 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: 3%{?_with_upstream:.upstream}%{?dist}
|
||||
Release: 24%{?_with_upstream:.upstream}%{?dist}
|
||||
|
||||
License: GPL
|
||||
License: GPLv3+
|
||||
Group: Development/Debuggers
|
||||
Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
|
||||
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
|
@ -86,6 +89,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
|
||||
|
||||
|
@ -93,13 +99,11 @@ Patch117: gdb-6.3-removebp-20041130.patch
|
|||
# --readnever option.
|
||||
Patch118: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
# Fix for caching thread lwps for linux
|
||||
Patch119: gdb-6.3-lwp-cache-20041216.patch
|
||||
|
||||
# Fix to ensure types are visible
|
||||
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
|
||||
|
@ -108,6 +112,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
|
||||
|
||||
|
@ -127,6 +135,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
|
||||
|
||||
|
@ -184,9 +195,6 @@ Patch178: gdb-6.3-catch-debug-registers-error-20060527.patch
|
|||
# ia32el.
|
||||
Patch179: gdb-6.3-ia32el-fix-waitpid-20060615.patch
|
||||
|
||||
# Testcase for corrupted or missing location list information (BZ 196439).
|
||||
Patch187: gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch
|
||||
|
||||
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
Patch188: gdb-6.5-bz203661-emit-relocs.patch
|
||||
|
||||
|
@ -270,11 +278,6 @@ Patch249: gdb-6.6-gcore32-test.patch
|
|||
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
Patch254: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
# Fix attaching to stopped processes (BZ 219118, 233852).
|
||||
# Fix attaching during a pending signal being delivered.
|
||||
Patch256: gdb-6.7-bz233852-attach-signalled-fix.patch
|
||||
Patch275: gdb-6.7-bz233852-attach-signalled-test.patch
|
||||
|
||||
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
Patch258: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
|
@ -288,12 +291,12 @@ 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
|
||||
|
||||
# Fixed the kernel 8KB VDSO loading (producing `no loadable sections found').
|
||||
Patch276: gdb-6.6-bfd-vdso8k.patch
|
||||
|
||||
# Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in').
|
||||
Patch277: gdb-6.6-vdso-i386-on-amd64-warning.patch
|
||||
|
||||
|
@ -338,7 +341,10 @@ Patch301: gdb-6.6-buildid-readnever-silent.patch
|
|||
Patch304: gdb-6.7-kernel-headers-compat.patch
|
||||
|
||||
# Fix/implement the Fortran dynamic arrays support (BZ 377541).
|
||||
Patch305: gdb-6.8-bz377541-fortran-dynamic-arrays.patch
|
||||
# Fix the variable-length-arrays support (BZ 468266, feature BZ 377541).
|
||||
Patch345: gdb-6.8-bz377541-vla-bound-undefined.patch
|
||||
Patch346: gdb-6.8-bz377541-vla-loc-kind.patch
|
||||
Patch305: gdb-6.8-bz377541-vla.patch
|
||||
|
||||
# Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables.
|
||||
Patch306: gdb-6.8-watchpoint-inaccessible-memory.patch
|
||||
|
@ -352,6 +358,49 @@ Patch311: gdb-6.3-focus-cmd-prev-test.patch
|
|||
# Test crash on a sw watchpoint condition getting out of the scope.
|
||||
Patch314: gdb-6.3-watchpoint-cond-gone-test.patch
|
||||
|
||||
# Test various forms of threads tracking across exec() (BZ 442765).
|
||||
Patch315: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
# Enable program counter for processing PTID to PC (sparc/sparc64)
|
||||
Patch316: gdb-6.8-sparc-fix.patch
|
||||
|
||||
# Silence memcpy check which returns false positive (sparc64)
|
||||
Patch317: gdb-6.8-sparc64-silence-memcpy-check.patch
|
||||
|
||||
# Fix memory trashing on binaries from GCC Ada (workaround GCC PR 35998).
|
||||
Patch318: gdb-6.8-gcc35998-ada-memory-trash.patch
|
||||
|
||||
# Test a crash on libraries missing the .text section.
|
||||
Patch320: gdb-6.5-section-num-fixup-test.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
|
||||
|
||||
# Fix attaching to stopped processes and/or pending signals.
|
||||
Patch336: gdb-6.8-attach-signalled-upstream.patch
|
||||
Patch337: gdb-6.8-attach-signalled-detach-stopped.patch
|
||||
|
||||
# Fix occasional crash on a removed watchpoint.
|
||||
Patch338: gdb-6.8-breakpoint-gone.patch
|
||||
|
||||
# Test the watchpoints conditionals works.
|
||||
Patch343: gdb-6.8-watchpoint-conditionals-test.patch
|
||||
|
||||
# Fix dereferencing unbound C arrays (BZ 505163).
|
||||
Patch372: gdb-bz505163-unbound-array-deref.patch
|
||||
|
||||
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
|
||||
BuildRequires: flex bison sharutils expat-devel
|
||||
Requires: readline
|
||||
|
@ -363,15 +412,22 @@ BuildRequires: rpm-devel
|
|||
%if 0%{?_with_testsuite:1}
|
||||
# gcc-objc++ is not covered by the GDB testsuite.
|
||||
BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc fpc
|
||||
# Ensure the devel libraries are installed for both multilib arches.
|
||||
%define multilib_64_archs sparc64 ppc64 s390x x86_64
|
||||
# Copied from gcc-4.1.2-32
|
||||
%ifarch %{ix86} x86_64 ia64 ppc alpha
|
||||
BuildRequires: gcc-gnat
|
||||
%ifarch %{multilib_64_archs} ppc
|
||||
BuildRequires: %{_exec_prefix}/lib64/libgnat-4.3.so %{_exec_prefix}/lib/libgnat-4.3.so
|
||||
%endif
|
||||
%define multilib_64_archs sparc64 ppc64 s390x x86_64
|
||||
%ifarch %{multilib_64_archs} sparc ppc
|
||||
# Ensure glibc{,-devel} is installed for both multilib arches
|
||||
%endif
|
||||
%ifarch %{multilib_64_archs} sparc sparcv9 ppc
|
||||
BuildRequires: /lib/libc.so.6 %{_exec_prefix}/lib/libc.so /lib64/libc.so.6 %{_exec_prefix}/lib64/libc.so
|
||||
BuildRequires: /lib/libgcc_s.so.1 /lib64/libgcc_s.so.1
|
||||
BuildRequires: %{_exec_prefix}/lib/libstdc++.so.6 %{_exec_prefix}/lib64/libstdc++.so.6
|
||||
BuildRequires: %{_exec_prefix}/lib64/libgcj.so.9 %{_exec_prefix}/lib/libgcj.so.9
|
||||
# for gcc-java:
|
||||
BuildRequires: %{_exec_prefix}/lib64/libz.so %{_exec_prefix}/lib/libz.so
|
||||
%endif
|
||||
%endif
|
||||
|
||||
|
@ -379,8 +435,11 @@ BuildRequires: /lib/libgcc_s.so.1 /lib64/libgcc_s.so.1
|
|||
BuildRequires: libunwind-devel >= 0.99-0.1.frysk20070405cvs
|
||||
Requires: libunwind >= 0.99-0.1.frysk20070405cvs
|
||||
%else
|
||||
# Prelink is broken on sparcv9/sparc64
|
||||
%ifnarch sparcv9 sparc64
|
||||
BuildRequires: prelink
|
||||
%endif
|
||||
%endif
|
||||
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
|
@ -430,19 +489,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
|
||||
%patch119 -p1
|
||||
%patch120 -p1
|
||||
%patch124 -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
|
||||
|
@ -462,7 +524,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||
%patch177 -p1
|
||||
%patch178 -p1
|
||||
%patch179 -p1
|
||||
%patch187 -p1
|
||||
%patch188 -p1
|
||||
%patch190 -p1
|
||||
%patch194 -p1
|
||||
|
@ -490,16 +551,14 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||
%patch247 -p1
|
||||
%patch249 -p1
|
||||
%patch254 -p1
|
||||
%patch256 -p1
|
||||
%patch258 -p1
|
||||
%patch260 -p1
|
||||
%patch261 -p1
|
||||
%patch263 -p1
|
||||
%patch265 -p1
|
||||
%patch266 -p1
|
||||
%patch271 -p1
|
||||
%patch274 -p1
|
||||
%patch275 -p1
|
||||
%patch276 -p1
|
||||
%patch277 -p1
|
||||
%patch280 -p1
|
||||
%patch282 -p1
|
||||
|
@ -514,11 +573,29 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||
%patch298 -p1
|
||||
%patch301 -p1
|
||||
%patch304 -p1
|
||||
%patch345 -p1
|
||||
%patch346 -p1
|
||||
%patch305 -p1
|
||||
%patch306 -p1
|
||||
%patch309 -p1
|
||||
%patch311 -p1
|
||||
%patch314 -p1
|
||||
%patch315 -p1
|
||||
%patch316 -p1
|
||||
%patch317 -p1
|
||||
%patch318 -p1
|
||||
%patch320 -p1
|
||||
%patch330 -p1
|
||||
%patch331 -p1
|
||||
%patch332 -p1
|
||||
%patch333 -p1
|
||||
%patch334 -p1
|
||||
%patch336 -p1
|
||||
%patch337 -p1
|
||||
%patch338 -p1
|
||||
%patch343 -p1
|
||||
%patch372 -p1
|
||||
%patch124 -p1
|
||||
|
||||
find -name "*.orig" | xargs rm -f
|
||||
! find -name "*.rej" # Should not happen.
|
||||
|
@ -568,7 +645,7 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
|
|||
--mandir=%{_mandir} \
|
||||
--infodir=%{_infodir} \
|
||||
--enable-gdb-build-warnings=,-Wno-unused \
|
||||
%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64
|
||||
%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparcv9 sparc64
|
||||
--disable-werror \
|
||||
%else
|
||||
%if 0%{?_with_upstream:1}
|
||||
|
@ -590,7 +667,11 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
|
|||
%if 0%{?_with_debug:1}
|
||||
--enable-static --disable-shared --enable-debug \
|
||||
%endif
|
||||
%ifarch sparcv9
|
||||
sparc-%{_vendor}-%{_target_os}%{?_gnu}
|
||||
%else
|
||||
%{_target_platform}
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
make %{?_smp_mflags} info
|
||||
|
@ -609,8 +690,6 @@ echo ====================TESTING=========================
|
|||
cd gdb
|
||||
gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
|
||||
# Need to use a single --ignore option, second use overrides first.
|
||||
# "chng-syms.exp" for possibly avoiding Linux kernel crash - Bug 207002.
|
||||
# "threadcrash.exp" is incompatible on ia64 with old kernels.
|
||||
# No `%{?_smp_mflags}' here as it may race.
|
||||
# WARNING: can't generate a core file - core tests suppressed - check ulimit
|
||||
# "readline-overflow.exp" - Testcase is broken, functionality is OK.
|
||||
|
@ -620,23 +699,31 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
|
|||
ulimit -c unlimited || :
|
||||
|
||||
# Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize.
|
||||
# Simple `check' is not used for $CHECK as different escaping rules apply
|
||||
# for the --ignore list delimiting spaces.
|
||||
# Never use two different bitsizes as it fails on ppc64.
|
||||
echo 'int main (void) { return 0; }' >biarch.c
|
||||
gcc $RPM_OPT_FLAGS -o biarch biarch.c
|
||||
mv -f biarch biarch-native
|
||||
# Do not try -m64 for biarch as GDB cannot handle inferior larger than itself.
|
||||
for BI in -m32 -m31 ""
|
||||
CHECK=""
|
||||
for BI in -m64 -m32 -m31 ""
|
||||
do
|
||||
if gcc 2>/dev/null $RPM_OPT_FLAGS $BI -o biarch biarch.c
|
||||
then
|
||||
break
|
||||
# Do not use size-less options if any of the sizes works.
|
||||
if [ -z "$BI" -a -n "$CHECK" ];then
|
||||
continue
|
||||
fi
|
||||
# Do not use $RPM_OPT_FLAGS as the other non-size options will not be used
|
||||
# in the real run of the testsuite.
|
||||
if ! gcc $BI -o biarch biarch.c
|
||||
then
|
||||
continue
|
||||
fi
|
||||
done
|
||||
CHECK="check`echo " $RPM_OPT_FLAGS "|sed -n 's#^.* \(-m[36][241]\) .*$#//unix/\1#p'`"
|
||||
if ! cmp -s biarch-native biarch
|
||||
then
|
||||
CHECK="$CHECK check//unix/$BI"
|
||||
done
|
||||
# Do not try -m64 inferiors for -m32 GDB as it cannot handle inferiors larger
|
||||
# than itself.
|
||||
# s390 -m31 still uses the standard ELF32 binary format.
|
||||
gcc $RPM_OPT_FLAGS -o biarch biarch.c
|
||||
RPM_SIZE="$(file ./biarch|sed -n 's/^.*: ELF \(32\|64\)-bit .*$/\1/p')"
|
||||
if [ "$RPM_SIZE" != "64" ]
|
||||
then
|
||||
CHECK="$(echo " $CHECK "|sed 's# check//unix/-m64 # #')"
|
||||
fi
|
||||
|
||||
# Disable some problematic testcases.
|
||||
|
@ -644,10 +731,7 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
|
|||
# `check//...' target spawn and too much escaping there would be dense.
|
||||
for test in \
|
||||
gdb.base/readline-overflow.exp \
|
||||
gdb.base/chng-syms.exp \
|
||||
gdb.base/checkpoint.exp \
|
||||
gdb.base/bigcore.exp \
|
||||
gdb.threads/threadcrash.exp \
|
||||
; do
|
||||
mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || :
|
||||
done
|
||||
|
@ -756,11 +840,106 @@ fi
|
|||
|
||||
# don't include the files in include, they are part of binutils
|
||||
|
||||
%ifnarch sparcv9 sparc64
|
||||
%files gdbserver
|
||||
%{_bindir}/gdbserver
|
||||
%{_mandir}/*/gdbserver.1*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sat Jun 13 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-24
|
||||
- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401).
|
||||
- Fix dereferencing unbound C arrays (BZ 505163).
|
||||
|
||||
* Sun Nov 9 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-23
|
||||
- Fix the variable-length-arrays support (BZ 468266, feature BZ 377541).
|
||||
- Fix the watchpoints conditionals.
|
||||
- Fix on PPC spurious SIGTRAPs on active watchpoints.
|
||||
|
||||
* Tue Sep 2 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-22
|
||||
- Fix PIE patch regression for loading binaries from valgrind (BZ 460319).
|
||||
|
||||
* Thu Aug 28 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-21
|
||||
- Fix attaching to stopped processes, based on the upstream version now.
|
||||
- Just kernel-2.6.25 neither upstream nor utrace work with it; 2.6.9 works.
|
||||
- Fix occasional crash on a removed watchpoint.
|
||||
- Fix false testcase FAILs for `gdb.pie/break.exp'.
|
||||
- Fix a false warning (+a testcase FAIL) on s390x watchpoints.
|
||||
- Fix a false FAIL on s390x `gdb.base/dump.exp'.
|
||||
|
||||
* Wed Aug 27 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-20
|
||||
- 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').
|
||||
- Test a crash on libraries missing the .text section.
|
||||
|
||||
* Mon Aug 25 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-19
|
||||
- Extend the Fortran dynamic variables patch also for dynamic Fortran strings.
|
||||
|
||||
* Sat Aug 23 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-18
|
||||
- Fix MI debuginfo print on reloaded exec, found by Denys Vlasenko (BZ 459414).
|
||||
|
||||
* Mon Aug 4 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-17
|
||||
- Fix `errno' printing on nonthreaded non-g3 inferiors (TLS minsym is absolute).
|
||||
|
||||
* Fri Aug 1 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-16
|
||||
- Remove the `original-location' patch as it has testsuite regressions.
|
||||
|
||||
* Fri Aug 1 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-15
|
||||
- Fix register assignments with no GDB stack frames, Denys Vlasenko (BZ 436037).
|
||||
|
||||
* Fri Jul 25 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-14
|
||||
- Backpoint `original-location' for multi-PC breakpoints (for Nemiver).
|
||||
- Include _default_patch_fuzz for builds on F-10.
|
||||
|
||||
* Fri Jul 25 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-13
|
||||
- Fix powerpc recent secure PLTs handling (shared library calls) (BZ 452960).
|
||||
- Fix the testsuite .spec runner to run biarch also on ppc.
|
||||
- Reenable testcases threadcrash.exp, chng-syms.exp, checkpoint.exp (BZ 207002).
|
||||
|
||||
* Thu Jul 24 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-12
|
||||
- Temporarily disable attaching to a stopped process (BZ 453688)
|
||||
- To be reintroduced after a fix of the kernel BZ 454404.
|
||||
|
||||
* Tue Jul 8 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-11
|
||||
- Fix crash due to calling an inferior function right after a watchpoint stop.
|
||||
|
||||
* Sun Jun 1 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-10
|
||||
- Fix crash on a watchpoint update on an inferior stop.
|
||||
- Fix the s390x part of the hardware watchpoints after a fork.
|
||||
|
||||
* Thu May 22 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-9
|
||||
- Fix memory trashing on binaries from GNAT/Ada (workaround GCC PR 35998).
|
||||
|
||||
* Thu May 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 6.8-8
|
||||
- Silence memcpy check which returns false positive (sparc64)
|
||||
|
||||
* Thu May 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 6.8-7
|
||||
- patch from DaveM for sparc/sparc64
|
||||
- touch up spec to enable sparcv9/sparc64
|
||||
|
||||
* Sat May 3 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-6
|
||||
- Fix gdb.base/gcore-shmid0.exp to be unresolved on recent kernels.
|
||||
- Make the testsuite results of dfp-test.exp more stable.
|
||||
|
||||
* Sun Apr 27 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-5
|
||||
- Remove the kernel VDSO workaround (`no loadable ...') (kernel BZ 312011).
|
||||
|
||||
* Wed Apr 23 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-4
|
||||
- Backport fix on various forms of threads tracking across exec() (BZ 442765).
|
||||
- Testsuite: Include more biarch libraries on %%{multilib_64_archs}.
|
||||
- Disable the build-id warnings for the testsuite run as they cause some FAILs.
|
||||
- Fix PIE support for 32bit inferiors on 64bit debugger.
|
||||
- Fix trashing memory on one ada/gnat testcase.
|
||||
- Make the testsuite results on ada more stable.
|
||||
|
||||
* Wed Apr 16 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-3
|
||||
- Fix ia64 compilation errors (Yi Zhan, BZ 442684).
|
||||
- Fix build on non-standard rpm-devel includes (Robert Scheck, BZ 442449).
|
||||
|
|
Loading…
Reference in New Issue