Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 144625 Details for
Bug 109921
gdb is not finding the correct include file for variables
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Preliminary fix.
gdb-6.5-bz109921-DW_AT_decl_file-fix.patch (text/plain), 11.17 KB, created by
Jan Kratochvil
on 2007-01-02 09:22:30 UTC
(
hide
)
Description:
Preliminary fix.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2007-01-02 09:22:30 UTC
Size:
11.17 KB
patch
obsolete
>https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 > > >2007-01-02 Jan Kratochvil <jan.kratochvil@redhat.com> > > * buildsym.c (start_subfile_idx): New renamed `start_subfile' > now supporting the `file_idx' parameter. > (start_subfile): Backward compatible stub for `start_subfile_idx'. > (end_symtab): Copy `file_idx' from `subfile' to `symtab'. > Substitute possibly missing `dirname' from the CU's file dirname. > Clear `subfiles' variable as its data have been deallocated. > * buildsym.h (struct subfile): New field `file_idx'. > (start_subfile_idx): New prototype. > * dwarf2read.c (add_file_name): Ensure subfile has been founded. > (dwarf_decode_lines): Specify the new `file_idx' parameter. > (dwarf2_start_subfile): New `file_idx' parameter. > (new_symbol): Extract `DW_AT_decl_file' DWARF 2 information entry. > * symtab.c (symbol_to_symtab): New function. > (lookup_symbol): Override retrieved `symtab' by symbol_to_symtab (). > (search_symbols): Likewise. > * symtab.h (struct symbol): New field `file_idx'. > (SYMBOL_FILE_IDX): New macro. > (struct symtab): New field `file_idx'. > > >--- ./gdb/buildsym.c 25 Aug 2006 16:32:32 -0000 1.43 >+++ ./gdb/buildsym.c 2 Jan 2007 00:20:18 -0000 >@@ -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_idx (char *name, char *dirname, unsigned file_idx) > { > 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_idx != 0 && file_idx != 0 >+ && subfile->file_idx != file_idx) >+ 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_idx, >+ name, dirname, file_idx); >+ if (subfile->file_idx == 0) >+ subfile->file_idx = file_idx; >+ > return; > } > } >@@ -567,6 +578,7 @@ start_subfile (char *name, char *dirname > current_subfile = subfile; > > /* Save its name and compilation directory name */ >+ subfile->file_idx = file_idx; > 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_idx (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,7 +840,7 @@ 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; > >@@ -921,6 +940,10 @@ end_symtab (CORE_ADDR end_addr, struct o > #endif > PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */ > >+ /* Get the last `subfile' which is the main file compiled. */ >+ for (subfile_main = subfiles; subfile_main && subfile_main->next; >+ subfile_main = subfile_main->next); >+ > /* Now create the symtab objects proper, one for each subfile. */ > /* (The main file is the last one on the chain.) */ > >@@ -959,6 +982,7 @@ end_symtab (CORE_ADDR end_addr, struct o > symtab = allocate_symtab (subfile->name, objfile); > > /* Fill in its components. */ >+ symtab->file_idx = subfile->file_idx; > symtab->blockvector = blockvector; > symtab->macro_table = pending_macros; > if (subfile->line_vector) >@@ -981,6 +1005,16 @@ end_symtab (CORE_ADDR end_addr, struct o > strlen (subfile->dirname) + 1); > strcpy (symtab->dirname, subfile->dirname); > } >+ /* Non-primary subfiles may miss `comp_dir' resultingin 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; >@@ -1030,6 +1062,7 @@ end_symtab (CORE_ADDR end_addr, struct o > nextsub = subfile->next; > xfree ((void *) subfile); > } >+ subfiles = NULL; > > /* Set this for the main source file. */ > if (symtab) >--- ./gdb/buildsym.h 17 Dec 2005 22:33:59 -0000 1.13 >+++ ./gdb/buildsym.h 2 Jan 2007 00:20:18 -0000 >@@ -63,6 +63,7 @@ EXTERN CORE_ADDR last_source_start_addr; > struct subfile > { > struct subfile *next; >+ unsigned file_idx; > char *name; > char *dirname; > struct linetable *line_vector; >@@ -240,6 +241,8 @@ extern void finish_block (struct symbol > > extern void really_free_pendings (void *dummy); > >+extern void start_subfile_idx (char *name, char *dirname, unsigned file_idx); >+ > extern void start_subfile (char *name, char *dirname); > > extern void patch_subfile_names (struct subfile *subfile, char *name); >--- ./gdb/dwarf2read.c 27 Dec 2006 22:38:57 -0000 1.207 >+++ ./gdb/dwarf2read.c 2 Jan 2007 00:20:21 -0000 >@@ -852,7 +852,7 @@ static struct line_header *(dwarf_decode > static void dwarf_decode_lines (struct line_header *, char *, bfd *, > struct dwarf2_cu *, struct partial_symtab *); > >-static void dwarf2_start_subfile (char *, char *, char *); >+static void dwarf2_start_subfile (char *, char *, char *, unsigned); > > static struct symbol *new_symbol (struct die_info *, struct type *, > struct dwarf2_cu *); >@@ -6426,6 +6426,7 @@ add_file_name (struct line_header *lh, > unsigned int length) > { > struct file_entry *fe; >+ char *dir = NULL; > > /* Grow the array if necessary. */ > if (lh->file_names_size == 0) >@@ -6448,6 +6449,10 @@ add_file_name (struct line_header *lh, > 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); > } > > >@@ -6666,7 +6671,7 @@ dwarf_decode_lines (struct line_header * > if (fe->dir_index) > dir = lh->include_dirs[fe->dir_index - 1]; > >- dwarf2_start_subfile (fe->name, dir, comp_dir); >+ dwarf2_start_subfile (fe->name, dir, comp_dir, file); > } > > /* Decode the table. */ >@@ -6666,7 +6666,7 @@ dwarf_decode_lines (struct line_header * > dir = lh->include_dirs[fe->dir_index - 1]; > > if (!decode_for_pst_p) >- dwarf2_start_subfile (fe->name, dir, comp_dir); >+ dwarf2_start_subfile (fe->name, dir, comp_dir, file); > } > break; > case DW_LNS_set_column: >@@ -6887,7 +6892,8 @@ dwarf_decode_lines (struct line_header * > subfile's name. */ > > static void >-dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir) >+dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir, >+ unsigned file_idx) > { > char *fullname; > >@@ -6906,7 +6912,7 @@ dwarf2_start_subfile (char *filename, ch > else > fullname = filename; > >- start_subfile (fullname, comp_dir); >+ start_subfile_idx (fullname, comp_dir, file_idx); > > if (fullname != filename) > xfree (fullname); >@@ -7015,6 +7021,13 @@ new_symbol (struct die_info *die, struct > { > 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_idx' fields. */ >+ SYMBOL_FILE_IDX (sym) = DW_UNSND (attr); >+ } > switch (die->tag) > { > case DW_TAG_label: >--- ./gdb/symtab.c 28 Nov 2006 16:23:32 -0000 1.149 >+++ ./gdb/symtab.c 2 Jan 2007 00:20:23 -0000 >@@ -1048,6 +1048,36 @@ fixup_psymbol_section (struct partial_sy > return psym; > } > >+static struct symtab * >+symbol_to_symtab (struct symbol *symbol) >+{ >+ bfd *abfd; >+ struct objfile *objfile; >+ struct symtab *symtab; >+ asection *sect; >+ >+ if (symbol->file_idx == 0) >+ return NULL; >+ >+ sect = SYMBOL_BFD_SECTION (symbol); >+ if (sect == NULL) >+ return NULL; >+ >+ abfd = SYMBOL_BFD_SECTION (symbol)->owner; >+ >+ ALL_OBJFILES (objfile) >+ if (objfile->obfd == abfd) >+ break; >+ if (objfile == NULL) >+ return NULL; >+ >+ ALL_OBJFILE_SYMTABS (objfile, symtab) >+ if (symtab->file_idx == symbol->file_idx) >+ return symtab; >+ >+ return NULL; >+} >+ > /* Find the definition for a specified symbol name NAME > in domain DOMAIN, visible from lexical block BLOCK. > Returns the struct symbol pointer, or zero if no symbol is found. >@@ -1124,6 +1149,15 @@ lookup_symbol (const char *name, const s > if (needtofreename) > xfree (demangled_name); > >+ /* Override the returned symtab with optional symbol's specific one. */ >+ if (returnval != NULL && symtab != NULL) >+ { >+ struct symtab *symtab_found = symbol_to_symtab (returnval); >+ >+ if (symtab_found != NULL) >+ *symtab = symtab_found; >+ } >+ > return returnval; > } > >@@ -3078,8 +3117,13 @@ search_symbols (char *regexp, domain_enu > b = BLOCKVECTOR_BLOCK (bv, i); > ALL_BLOCK_SYMBOLS (b, iter, sym) > { >+ struct symtab *symtab_found; >+ > QUIT; >- if (file_matches (s->filename, files, nfiles) >+ symtab_found = symbol_to_symtab (sym); >+ if (symtab_found == NULL) >+ symtab_found = s; >+ if (file_matches (symtab_found->filename, files, nfiles) > && ((regexp == NULL > || re_exec (SYMBOL_NATURAL_NAME (sym)) != 0) > && ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF >@@ -3092,7 +3136,7 @@ search_symbols (char *regexp, domain_enu > /* match */ > psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search)); > psr->block = i; >- psr->symtab = s; >+ psr->symtab = symtab_found; > psr->symbol = sym; > psr->msymbol = NULL; > psr->next = NULL; >--- ./gdb/symtab.h 17 Oct 2006 20:17:45 -0000 1.98 >+++ ./gdb/symtab.h 2 Jan 2007 00:20:23 -0000 >@@ -623,6 +623,10 @@ struct symbol > > ENUM_BITFIELD(address_class) aclass : 6; > >+ /* File name it comes from. Value 0 if unused. Use with `line' below. */ >+ >+ unsigned file_idx; >+ > /* 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 +667,7 @@ struct symbol > #define SYMBOL_DOMAIN(symbol) (symbol)->domain > #define SYMBOL_CLASS(symbol) (symbol)->aclass > #define SYMBOL_TYPE(symbol) (symbol)->type >+#define SYMBOL_FILE_IDX(symbol) (symbol)->file_idx > #define SYMBOL_LINE(symbol) (symbol)->line > #define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg > #define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile >@@ -807,6 +812,10 @@ struct symtab > > char *dirname; > >+ /* File index entry from the .debug_line section. 0 if unused. */ >+ >+ unsigned file_idx; >+ > /* This component says how to free the data we point to: > free_contents => do a tree walk and free each object. > free_nothing => do nothing; some other symtab will free
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109921
:
95935
|
95936
|
144625
|
144627