- Fix crash on parsing duplicite file entries debug info (BZ 426395).

- Fix (#2) readline history for input mode commands like `command' (BZ
    215816).
- Fix documentation on hardware watchpoints wrt multiple threads.
- Rename the patch file for BZ 235197 from its former name BZ 234468.
This commit is contained in:
Jan Kratochvil 2007-12-22 14:38:42 +00:00
parent 337e4aece4
commit 2344090082
8 changed files with 530 additions and 271 deletions

View File

@ -1,351 +1,437 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* buildsym.c (start_subfile_index): Renamed `start_subfile' now
supporting the FILE_INDEX parameter.
(start_subfile): Backward compatible stub for `start_subfile_index'.
(end_symtab): Resolve new SYMBOL.FILE.SYMTAB from SYMBOL.FILE.INDEX.
Substitute possibly missing DIRNAME from the CU's main file DIRNAME.
Clear `subfiles' variable as its data have been deallocated.
* buildsym.h (struct subfile): New field `file_index'.
(start_subfile_index): New prototype.
* dwarf2read.c (add_file_name): Ensure subfile has been founded.
(dwarf_decode_lines): Specify the new FILE_INDEX parameter.
(dwarf2_start_subfile): New FILE_INDEX parameter.
(new_symbol): Extract `DW_AT_decl_file' DWARF 2 information entry.
* symtab.c (lookup_symbol): Override by the new SYMBOL.FILE.SYMTAB.
* buildsym.c (end_symtab): Use preallocated symtab if available.
Fill in SYMBOL_SYMTAB.
* buildsym.h (struct subfile): Add symtab member.
* dwarf2read.c (struct dwarf2_cu): Add line_header.
(struct file_entry): Add symtab.
(free_cu_line_header): New function.
(read_file_scope): Use it. Save line_header in the cu. Process
lines before DIEs.
(add_file_name): Initialize new symtab member.
(dwarf_decode_lines): Create symtabs for included files.
(new_symbol): Set SYMBOL_SYMTAB.
* symtab.c (lookup_symbol): Use SYMBOL_SYMTAB.
(search_symbols): Likewise.
* symtab.h (struct symbol): New fields FILE.INDEX and FILE.SYMTAB.
(SYMBOL_FILE_INDEX, SYMBOL_FILE_SYMTAB): New macros.
* symtab.h (struct symbol): Add symtab member.
(SYMBOL_SYMTAB): Define.
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
Index: gdb-6.6/gdb/buildsym.c
===================================================================
--- gdb-6.6.orig/gdb/buildsym.c 2006-08-25 18:32:32.000000000 +0200
+++ gdb-6.6/gdb/buildsym.c 2007-01-20 13:59:48.000000000 +0100
@@ -540,7 +540,7 @@ make_blockvector (struct objfile *objfil
the directory in which it resides (or NULL if not known). */
void
-start_subfile (char *name, char *dirname)
+start_subfile_index (char *name, char *dirname, unsigned file_index)
{
struct subfile *subfile;
@@ -552,6 +552,17 @@ start_subfile (char *name, char *dirname
if (FILENAME_CMP (subfile->name, name) == 0)
{
current_subfile = subfile;
+
+ if (subfile->file_index != 0 && file_index != 0
+ && subfile->file_index != file_index)
+ complaint (&symfile_complaints, _("Filenames indexing conflict: "
+ "name \"%s\" dir \"%s\" index %u vs. "
+ "name \"%s\" dir \"%s\" index %u"),
+ subfile->name, subfile->dirname, subfile->file_index,
+ name, dirname, file_index);
+ if (subfile->file_index == 0)
+ subfile->file_index = file_index;
+
return;
}
}
@@ -567,6 +578,7 @@ start_subfile (char *name, char *dirname
current_subfile = subfile;
/* Save its name and compilation directory name */
+ subfile->file_index = file_index;
subfile->name = (name == NULL) ? NULL : savestring (name, strlen (name));
subfile->dirname =
(dirname == NULL) ? NULL : savestring (dirname, strlen (dirname));
@@ -622,6 +634,13 @@ start_subfile (char *name, char *dirname
}
}
+/* Backward compatibility. */
+void
+start_subfile (char *name, char *dirname)
+{
+ start_subfile_index (name, dirname, 0);
+}
+
/* For stabs readers, the first N_SO symbol is assumed to be the
source file name, and the subfile struct is initialized using that
assumption. If another N_SO symbol is later seen, immediately
@@ -821,9 +840,12 @@ end_symtab (CORE_ADDR end_addr, struct o
{
struct symtab *symtab = NULL;
struct blockvector *blockvector;
- struct subfile *subfile;
+ struct subfile *subfile, *subfile_main;
struct context_stack *cstk;
struct subfile *nextsub;
+ int subfiles_count;
+ struct symtab **file_index_to_symtab;
+ size_t file_index_to_symtab_size;
/* Finish the lexical context of the last function in the file; pop
the context stack. */
@@ -921,6 +943,18 @@ end_symtab (CORE_ADDR end_addr, struct o
#endif
PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */
+ /* Get the last subfile s SUBFILE_MAIN which is the main file of CU.
+ Count SUBFILES_COUNT.
+ Start with 1 as we do not iterate past the last item. */
+ subfiles_count = 1;
+ for (subfile_main = subfiles; subfile_main && subfile_main->next;
+ subfile_main = subfile_main->next)
+ subfiles_count++;
+
+ file_index_to_symtab_size = sizeof (*file_index_to_symtab) * subfiles_count;
+ file_index_to_symtab = xmalloc (file_index_to_symtab_size);
+ memset ((char *) file_index_to_symtab, 0, file_index_to_symtab_size);
+
/* Now create the symtab objects proper, one for each subfile. */
/* (The main file is the last one on the chain.) */
@@ -981,6 +1015,16 @@ end_symtab (CORE_ADDR end_addr, struct o
strlen (subfile->dirname) + 1);
strcpy (symtab->dirname, subfile->dirname);
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- src/gdb/buildsym.c 2007/01/09 17:58:50 1.45
+++ src/gdb/buildsym.c 2007/01/21 16:49:40 1.46
@@ -959,7 +959,10 @@
}
+ /* Non-primary subfiles may miss COMP_DIR resulting in NULL
+ DIRNAME and so default it from the CU file - SUBFILE_MAIN. */
+ else if (subfile_main->dirname)
+ {
+ /* Reallocate the dirname on the symbol obstack */
+ symtab->dirname = (char *)
+ obstack_alloc (&objfile->objfile_obstack,
+ strlen (subfile_main->dirname) + 1);
+ strcpy (symtab->dirname, subfile_main->dirname);
+ }
else
{
symtab->dirname = NULL;
@@ -1009,6 +1053,13 @@ end_symtab (CORE_ADDR end_addr, struct o
but the main file. */
symtab->primary = 0;
+
+ /* It may be zero for files unlisted in File Table. */
+ if (subfile->file_index)
+ {
+ gdb_assert (subfile->file_index <= subfiles_count);
+ file_index_to_symtab[subfile->file_index - 1] = symtab;
+ }
}
if (subfile->name != NULL)
{
@@ -1037,9 +1088,40 @@ end_symtab (CORE_ADDR end_addr, struct o
/* Now, allocate a symbol table. */
- symtab = allocate_symtab (subfile->name, objfile);
+ if (subfile->symtab == NULL)
+ symtab = allocate_symtab (subfile->name, objfile);
+ else
+ symtab = subfile->symtab;
/* Fill in its components. */
symtab->blockvector = blockvector;
@@ -1048,6 +1051,26 @@
symtab->primary = 1;
}
+ /* Resolve `struct symbol.file.index' into `struct symbol.file.symtab'. */
+ /* Default any symbols without a specified symtab to the primary
+ symtab. */
+ if (blockvector)
+ {
+ int block_i;
+
+ for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
+ {
+ struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
+ struct symbol *sym;
+ struct dict_iterator iter;
+
+ for (sym = dict_iterator_first (BLOCK_DICT
+ (BLOCKVECTOR_BLOCK (blockvector, block_i)), &iter);
+ for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
+ sym != NULL;
+ sym = dict_iterator_next (&iter))
+ {
+ /* Beware the ordering as `sym->file' is a union. */
+ if (SYMBOL_FILE_INDEX (sym)
+ && file_index_to_symtab[SYMBOL_FILE_INDEX (sym) - 1])
+ SYMBOL_FILE_SYMTAB (sym) = file_index_to_symtab
+ [SYMBOL_FILE_INDEX (sym) - 1];
+ else
+ {
+ /* Default to the primary symbol table, never use NULL. */
+ SYMBOL_FILE_SYMTAB (sym) = symtab;
+ }
+ }
+ if (SYMBOL_SYMTAB (sym) == NULL)
+ SYMBOL_SYMTAB (sym) = symtab;
+ }
+ }
+
+ xfree (file_index_to_symtab);
last_source_file = NULL;
current_subfile = NULL;
pending_macros = NULL;
+ subfiles = NULL;
return symtab;
}
Index: gdb-6.6/gdb/buildsym.h
===================================================================
--- gdb-6.6.orig/gdb/buildsym.h 2005-12-17 23:33:59.000000000 +0100
+++ gdb-6.6/gdb/buildsym.h 2007-01-20 13:59:48.000000000 +0100
@@ -63,6 +63,7 @@ EXTERN CORE_ADDR last_source_start_addr;
struct subfile
{
struct subfile *next;
+ unsigned file_index;
char *name;
char *dirname;
struct linetable *line_vector;
@@ -240,6 +241,9 @@ extern void finish_block (struct symbol
RCS file: /cvs/src/src/gdb/buildsym.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- src/gdb/buildsym.h 2007/01/09 17:58:50 1.15
+++ src/gdb/buildsym.h 2007/01/21 16:49:40 1.16
@@ -70,6 +70,7 @@
enum language language;
char *producer;
char *debugformat;
+ struct symtab *symtab;
};
extern void really_free_pendings (void *dummy);
EXTERN struct subfile *subfiles;
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- src/gdb/dwarf2read.c 2007/01/09 17:58:50 1.211
+++ src/gdb/dwarf2read.c 2007/01/21 16:49:40 1.212
@@ -341,6 +341,9 @@
partial symbol tables do not have dependencies. */
htab_t dependencies;
+extern void start_subfile_index (char *name, char *dirname,
+ unsigned file_index);
+ /* Header data from the line table, during full symbol processing. */
+ struct line_header *line_header;
+
extern void start_subfile (char *name, char *dirname);
/* Mark used when releasing cached dies. */
unsigned int mark : 1;
extern void patch_subfile_names (struct subfile *subfile, char *name);
Index: gdb-6.6/gdb/dwarf2read.c
===================================================================
--- gdb-6.6.orig/gdb/dwarf2read.c 2007-01-20 06:43:04.000000000 +0100
+++ gdb-6.6/gdb/dwarf2read.c 2007-01-20 14:00:12.000000000 +0100
@@ -853,7 +853,7 @@ static struct line_header *(dwarf_decode
static void dwarf_decode_lines (struct line_header *, char *, bfd *,
struct dwarf2_cu *, struct partial_symtab *);
@@ -432,6 +435,7 @@
unsigned int mod_time;
unsigned int length;
int included_p; /* Non-zero if referenced by the Line Number Program. */
+ struct symtab *symtab; /* The associated symbol table, if any. */
} *file_names;
-static void dwarf2_start_subfile (char *, char *, char *);
+static void dwarf2_start_subfile (char *, char *, char *, unsigned);
/* The start and end of the statement program following this
@@ -2754,6 +2758,15 @@
}
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
@@ -6428,6 +6428,7 @@ add_file_name (struct line_header *lh,
unsigned int length)
static void
+free_cu_line_header (void *arg)
+{
+ struct dwarf2_cu *cu = arg;
+
+ free_line_header (cu->line_header);
+ cu->line_header = NULL;
+}
+
+static void
read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
{
struct file_entry *fe;
+ char *dir = NULL;
struct objfile *objfile = cu->objfile;
@@ -2823,18 +2836,9 @@
/* Grow the array if necessary. */
if (lh->file_names_size == 0)
@@ -6450,6 +6451,10 @@ add_file_name (struct line_header *lh,
initialize_cu_func_list (cu);
- /* Process all dies in compilation unit. */
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = sibling_die (child_die);
- }
- }
-
- /* Decode line number information if present. */
+ /* Decode line number information if present. We do this before
+ processing child DIEs, so that the line header table is available
+ for DW_AT_decl_file. */
attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
if (attr)
{
@@ -2842,12 +2846,23 @@
line_header = dwarf_decode_line_header (line_offset, abfd, cu);
if (line_header)
{
- make_cleanup ((make_cleanup_ftype *) free_line_header,
- (void *) line_header);
+ cu->line_header = line_header;
+ make_cleanup (free_cu_line_header, cu);
dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
}
}
+ /* Process all dies in compilation unit. */
+ if (die->child != NULL)
+ {
+ child_die = die->child;
+ while (child_die && child_die->tag)
+ {
+ process_die (child_die, cu);
+ child_die = sibling_die (child_die);
+ }
+ }
+
/* Decode macro information, if present. Dwarf 2 macro information
refers to information in the line number info statement program
header, so we can only read it if we've read the header
@@ -6457,6 +6472,7 @@
fe->mod_time = mod_time;
fe->length = length;
fe->included_p = 0;
+
+ if (dir_index)
+ dir = lh->include_dirs[dir_index - 1];
+ dwarf2_start_subfile (name, dir, NULL, lh->num_file_names);
+ fe->symtab = NULL;
}
@@ -6668,7 +6673,7 @@ dwarf_decode_lines (struct line_header *
if (fe->dir_index)
dir = lh->include_dirs[fe->dir_index - 1];
@@ -6644,7 +6660,7 @@
CORE_ADDR baseaddr;
struct objfile *objfile = cu->objfile;
const int decode_for_pst_p = (pst != NULL);
- struct subfile *last_subfile = NULL;
+ struct subfile *last_subfile = NULL, *first_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir);
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
}
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Decode the table. */
@@ -6785,7 +6790,7 @@ dwarf_decode_lines (struct line_header *
if (!decode_for_pst_p)
{
last_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir);
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
}
}
break;
@@ -6889,7 +6894,8 @@ dwarf_decode_lines (struct line_header *
subfile's name. */
@@ -6869,6 +6885,35 @@
dwarf2_create_include_psymtab (include_name, pst, objfile);
}
}
+ else
+ {
+ /* Make sure a symtab is created for every file, even files
+ which contain only variables (i.e. no code with associated
+ line numbers). */
+
+ int i;
+ struct file_entry *fe;
+
+ for (i = 0; i < lh->num_file_names; i++)
+ {
+ char *dir = NULL;
+ fe = &lh->file_names[i];
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+
+ /* Skip the main file; we don't need it, and it must be
+ allocated last, so that it will show up before the
+ non-primary symtabs in the objfile's symtab list. */
+ if (current_subfile == first_subfile)
+ continue;
+
+ if (current_subfile->symtab == NULL)
+ current_subfile->symtab = allocate_symtab (current_subfile->name,
+ cu->objfile);
+ fe->symtab = current_subfile->symtab;
+ }
+ }
}
static void
-dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir)
+dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir,
+ unsigned file_index)
{
char *fullname;
@@ -6908,7 +6914,7 @@ dwarf2_start_subfile (char *filename, ch
else
fullname = filename;
- start_subfile (fullname, comp_dir);
+ start_subfile_index (fullname, comp_dir, file_index);
if (fullname != filename)
xfree (fullname);
@@ -7017,6 +7023,13 @@ new_symbol (struct die_info *die, struct
/* Start a subfile for DWARF. FILENAME is the name of the file and
@@ -7024,6 +7069,23 @@
{
SYMBOL_LINE (sym) = DW_UNSND (attr);
}
+
+ attr = dwarf2_attr (die, DW_AT_decl_file, cu);
+ if (attr)
+ {
+ /* Do not yet search `objfile->symtabs' here as they still do not
+ have filled in their FILE.INDEX fields. */
+ SYMBOL_FILE_INDEX (sym) = DW_UNSND (attr);
+ int file_index = DW_UNSND (attr);
+ if (cu->line_header == NULL
+ || file_index > cu->line_header->num_file_names)
+ complaint (&symfile_complaints,
+ _("file index out of range"));
+ else
+ {
+ struct file_entry *fe;
+ fe = &cu->line_header->file_names[file_index - 1];
+ SYMBOL_SYMTAB (sym) = fe->symtab;
+ }
+ }
+
switch (die->tag)
{
case DW_TAG_label:
Index: gdb-6.6/gdb/symtab.c
===================================================================
--- gdb-6.6.orig/gdb/symtab.c 2007-01-20 13:59:25.000000000 +0100
+++ gdb-6.6/gdb/symtab.c 2007-01-20 13:59:48.000000000 +0100
@@ -1129,6 +1129,10 @@ lookup_symbol (const char *name, const s
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- src/gdb/symtab.c 2007/01/09 22:43:08 1.152
+++ src/gdb/symtab.c 2007/01/21 16:49:40 1.153
@@ -1133,6 +1133,10 @@
if (needtofreename)
xfree (demangled_name);
+ /* Override the returned symtab with optional symbol's specific one. */
+ /* Override the returned symtab with the symbol's specific one. */
+ if (returnval != NULL && symtab != NULL)
+ *symtab = SYMBOL_FILE_SYMTAB (returnval);
+ *symtab = SYMBOL_SYMTAB (returnval);
+
return returnval;
}
@@ -3235,7 +3239,7 @@ search_symbols (char *regexp, domain_enu
@@ -3008,7 +3012,11 @@
QUIT;
/* If it would match (logic taken from loop below)
- load the file and go on to the next one */
+ load the file and go on to the next one. We check the
+ filename here, but that's a bit bogus: we don't know
+ what file it really comes from until we have full
+ symtabs. The symbol might be in a header file included by
+ this psymtab. This only affects Insight. */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0)
@@ -3087,8 +3095,10 @@
b = BLOCKVECTOR_BLOCK (bv, i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
+ struct symtab *real_symtab = SYMBOL_SYMTAB (sym);
QUIT;
- if (file_matches (s->filename, files, nfiles)
+ if (file_matches (SYMBOL_FILE_SYMTAB (sym)->filename, files, nfiles)
+
+ if (file_matches (real_symtab->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
&& ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF
@@ -3248,7 +3252,7 @@ search_symbols (char *regexp, domain_enu
@@ -3101,7 +3111,7 @@
/* match */
psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
- psr->symtab = s;
+ psr->symtab = SYMBOL_FILE_SYMTAB (sym);
+ psr->symtab = real_symtab;
psr->symbol = sym;
psr->msymbol = NULL;
psr->next = NULL;
Index: gdb-6.6/gdb/symtab.h
===================================================================
--- gdb-6.6.orig/gdb/symtab.h 2007-01-20 06:43:00.000000000 +0100
+++ gdb-6.6/gdb/symtab.h 2007-01-20 13:59:48.000000000 +0100
@@ -623,6 +623,18 @@ struct symbol
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- src/gdb/symtab.h 2007/01/09 17:58:59 1.100
+++ src/gdb/symtab.h 2007/01/21 16:49:40 1.101
@@ -609,6 +609,10 @@
ENUM_BITFIELD(address_class) aclass : 6;
struct type *type;
+ /* File name it comes from. Use with `line' below.
+ FILE.INDEX is zero if the symbol's specific file is not known and in such
+ case we later default to the main file of the compilation unit.
+ FILE.SYMTAB gets resolved during end_symtab() and it is never NULL. */
+ /* The symbol table containing this symbol. This is the file
+ associated with LINE. */
+ struct symtab *symtab;
+
+ union
+ {
+ unsigned index;
+ struct symtab *symtab;
+ }
+ file;
+
/* Line number of definition. FIXME: Should we really make the assumption
that nobody will try to debug files longer than 64K lines? What about
machine generated programs? */
@@ -663,6 +675,8 @@ struct symbol
#define SYMBOL_DOMAIN(symbol) (symbol)->domain
/* Domain code. */
ENUM_BITFIELD(domain_enum_tag) domain : 6;
@@ -664,6 +668,7 @@
#define SYMBOL_CLASS(symbol) (symbol)->aclass
#define SYMBOL_TYPE(symbol) (symbol)->type
+#define SYMBOL_FILE_INDEX(symbol) (symbol)->file.index
+#define SYMBOL_FILE_SYMTAB(symbol) (symbol)->file.symtab
#define SYMBOL_LINE(symbol) (symbol)->line
+#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg
#define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile
#define SYMBOL_OPS(symbol) (symbol)->ops
/cvs/src/src/gdb/testsuite/gdb.base/included.c,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.c
+++ src/gdb/testsuite/gdb.base/included.c 2007-12-21 21:10:02.262608000 +0000
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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. */
+
+#include "included.h"
+
+int
+main()
+{
+ return 0;
+}
/cvs/src/src/gdb/testsuite/gdb.base/included.exp,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.exp
+++ src/gdb/testsuite/gdb.base/included.exp 2007-12-21 21:10:02.521938000 +0000
@@ -0,0 +1,46 @@
+# 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.
+
+set testfile "included"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested included.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+
+gdb_test "list main" ".*"
+get_debug_format
+set non_dwarf [expr ! [test_debug_format "DWARF 2"]]
+
+# We should be able to find the source file containing the definition,
+# even though it was an included header.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "list integer" "int integer;"
+
+gdb_test "ptype integer" "type = int"
+
+# We should report that integer comes from the header file.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\nint integer;"
/cvs/src/src/gdb/testsuite/gdb.base/included.h,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.h
+++ src/gdb/testsuite/gdb.base/included.h 2007-12-21 21:10:02.732382000 +0000
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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. */
+
+int integer;

View File

@ -1,12 +1,13 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
It is duplicite to its upstream variant at:
gdb-6.5-bz109921-DW_AT_decl_file-fix.patch
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
gdb.dwarf2/dw2-included.h: New files.
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,26 @@

View File

@ -1,12 +1,15 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/readline.exp: Set $TERM. Test arrow keys in
secondary prompts.
2007-07-01 Nick Roberts <nickrob@snap.net.nz>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/annota3.exp: Test for if construct.
--- ./gdb/testsuite/gdb.base/readline.exp 8 Jun 2003 13:14:05 -0000 1.2
+++ ./gdb/testsuite/gdb.base/readline.exp 3 Jan 2007 21:22:47 -0000
@ -50,3 +53,41 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
# Now repeat the first test with a history file that fills the entire
# history list.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- src/gdb/testsuite/gdb.base/annota3.exp 2007/01/09 17:59:09 1.12
+++ src/gdb/testsuite/gdb.base/annota3.exp 2007/07/01 22:37:52 1.13
@@ -99,7 +99,29 @@
"set annotate 3"
}
-
+#
+# if construct:
+#
+send_gdb "if 1\n"
+gdb_expect {
+ -re "^if 1\r\n\r\n\032\032post-prompt\r\n\r\n\032\032pre-commands\r\n >\r\n\032\032commands\r\n$" {
+ pass "start if construct"
+ }
+ -re ".*\032\032commands\r\n" {
+ fail "start if construct"
+ }
+ timeout { fail "start if construct (timeout)" }
+}
+send_gdb "end\n"
+gdb_expect {
+ -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" {
+ pass "end if construct"
+ }
+ -re ".*$gdb_prompt$" {
+ fail "end if construct"
+ }
+ timeout { fail "end if construct (timeout)" }
+}
#
# info break:
#

View File

@ -1,6 +1,5 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
@ -11,6 +10,13 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
New.
(gdb_readline_wrapper): Rewrite to use asynchronous readline.
2007-07-01 Daniel Jacobowitz <dan@codesourcery.com>
* top.c (gdb_readline_wrapper_line): Call rl_callback_handler_remove.
(struct gdb_readline_wrapper_cleanup): Remove prompt_orig.
(gdb_readline_wrapper_cleanup): Do not reset the prompt.
(gdb_readline_wrapper): Do not save the prompt. Pass our prompt
to display_gdb_prompt.
--- ./gdb/Makefile.in 3 Jan 2007 18:05:43 -0000 1.864
+++ ./gdb/Makefile.in 3 Jan 2007 21:22:46 -0000
@ -163,3 +169,52 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
}
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- src/gdb/top.c 2007/03/29 18:55:01 1.120
+++ src/gdb/top.c 2007/07/01 22:37:52 1.121
@@ -751,12 +751,16 @@
/* Prevent operate-and-get-next from acting too early. */
saved_after_char_processing_hook = after_char_processing_hook;
after_char_processing_hook = NULL;
+
+ /* Prevent parts of the prompt from being redisplayed if annotations
+ are enabled, and readline's state getting out of sync. */
+ if (async_command_editing_p)
+ rl_callback_handler_remove ();
}
struct gdb_readline_wrapper_cleanup
{
void (*handler_orig) (char *);
- char *prompt_orig;
int already_prompted_orig;
};
@@ -766,7 +770,6 @@
struct gdb_readline_wrapper_cleanup *cleanup = arg;
rl_already_prompted = cleanup->already_prompted_orig;
- PROMPT (0) = cleanup->prompt_orig;
gdb_assert (input_handler == gdb_readline_wrapper_line);
input_handler = cleanup->handler_orig;
@@ -790,14 +793,12 @@
cleanup->handler_orig = input_handler;
input_handler = gdb_readline_wrapper_line;
- cleanup->prompt_orig = get_prompt ();
- PROMPT (0) = prompt;
cleanup->already_prompted_orig = rl_already_prompted;
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
/* Display our prompt and prevent double prompt display. */
- display_gdb_prompt (NULL);
+ display_gdb_prompt (prompt);
rl_already_prompted = 1;
if (after_char_processing_hook)

View File

@ -17,6 +17,26 @@
[ Backported for GDB-6.6 (only removed the new file inclusion). ]
http://sources.redhat.com/ml/gdb-patches/2007-07/msg00034.html
2007-07-02 Daniel Jacobowitz <dan@codesourcery.com>
* breakpoint.c (reattach_breakpoints): Do not use remove_breakpoint.
Call insert_bp_location.
[ In `gdb-6.6-upstream.patch'. ]
2007-09-16 Daniel Jacobowitz <dan@codesourcery.com>
Jeff Johnston <jjohnstn@redhat.com>
* gdb.texinfo (Setting Watchpoints): Adjust warning text about
multi-threaded watchpoints.
2007-12-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Setting Watchpoints): New paragraph on the software
watchpoints safety wrt `set scheduler-locking'.
--- ./gdb/i386-nat.c 23 Aug 2007 18:08:34 -0000 1.16
+++ ./gdb/i386-nat.c 14 Oct 2007 15:00:31 -0000
@@ -165,11 +166,22 @@
@ -282,3 +302,53 @@
+gdb_test "continue" \
+ "atchpoint 1: var.*Old value = 1.*New value = 2.*" "watchpoint second hit"
+gdb_test "continue" "Continuing..*Program exited normally." "finish"
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.434
retrieving revision 1.435
diff -u -r1.434 -r1.435
--- src/gdb/doc/gdb.texinfo 2007/09/28 11:09:55 1.434
+++ src/gdb/doc/gdb.texinfo 2007/10/01 00:17:58 1.435
@@ -3346,20 +3346,13 @@
way of doing that would be to set a code breakpoint at the entry to the
@code{main} function and when it breaks, set all the watchpoints.
-@quotation
@cindex watchpoints and threads
@cindex threads and watchpoints
-@emph{Warning:} In multi-thread programs, watchpoints have only limited
-usefulness. With the current watchpoint implementation, @value{GDBN}
-can only watch the value of an expression @emph{in a single thread}. If
-you are confident that the expression can only change due to the current
-thread's activity (and if you are also confident that no other thread
-can become current), then you can use watchpoints as usual. However,
-@value{GDBN} may not notice when a non-current thread's activity changes
-the expression.
+In multi-threaded programs, watchpoints will detect changes to the
+watched expression from every thread.
-@c FIXME: this is almost identical to the previous paragraph.
-@emph{HP-UX Warning:} In multi-thread programs, software watchpoints
+@quotation
+@emph{Warning:} In multi-threaded programs, software watchpoints
have only limited usefulness. If @value{GDBN} creates a software
watchpoint, it can only watch the value of an expression @emph{in a
single thread}. If you are confident that the expression can only
--- gdb-6.5/gdb/doc/gdb.texinfo-orig 2007-12-15 13:25:14.000000000 +0100
+++ gdb-6.5/gdb/doc/gdb.texinfo 2007-12-15 13:45:25.000000000 +0100
@@ -3261,6 +3261,14 @@
software watchpoints as usual. However, @value{GDBN} may not notice
when a non-current thread's activity changes the expression. (Hardware
watchpoints, in contrast, watch an expression in all threads.)
+
+Software watchpoints single-step the current thread to track the changes.
+Other threads are left freely running on @code{continue}; therefore, their
+changes cannot be caught. To get more reliable software watchpoints, please
+use @code{set scheduler-locking on}. The default for Red Hat/Fedora
+@value{GDBN} is @code{set scheduler-locking step}, which makes the software
+watchpoints safe for the @code{step} command, but not for the @code{continue}
+command. @xref{Thread Stops}.
@end quotation
@xref{set remote hardware-watchpoint-limit}.

View File

@ -864,7 +864,7 @@ IBM OzLabs - Linux Technology Centre
- if (!decode_for_pst_p)
- {
- last_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir, file);
- dwarf2_start_subfile (fe->name, dir, comp_dir);
- }
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
@ -876,7 +876,7 @@ IBM OzLabs - Linux Technology Centre
+ if (!decode_for_pst_p)
+ {
+ last_subfile = current_subfile;
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+ }
+ }
}

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.6
# The release always contains a leading reserved number, start it at 1.
Release: 37%{?dist}
Release: 38%{?dist}
License: GPL
Group: Development/Debuggers
@ -330,7 +330,7 @@ Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch246: gdb-6.6-bz237096-watchthreads-testcasefix.patch
# Notify user of a child forked process being detached (BZ 235197).
Patch247: gdb-6.6-bz234468-fork-detach-info.patch
Patch247: gdb-6.6-bz235197-fork-detach-info.patch
# Fix `gcore' command for 32bit PPC inferiors on 64bit PPC hosts (BZ 232015).
Patch248: gdb-6.6-bz232015-gcore-ppc-on-ppc64.patch
@ -710,6 +710,12 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Sat Dec 22 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-38
- Fix crash on parsing duplicite file entries debug info (BZ 426395).
- Fix (#2) readline history for input mode commands like `command' (BZ 215816).
- Fix documentation on hardware watchpoints wrt multiple threads.
- Rename the patch file for BZ 235197 from its former name BZ 234468.
* Mon Dec 10 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-37
- Testsuite fixes for more stable/comparable results.