From a679650f372dfeb7358266ab7cc56e1f7df489eb Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Tue, 11 Aug 1992 05:29:41 +0000 Subject: [PATCH] * Makefile.in (VERSION): Bump to 4.6.3. * dwarfread.c (scan_partial_symbols): Skip over DIE's within function scopes when building partial symbol tables. * objfiles.c (open_existing_mapped_file): Make it clear in warning message that out of date mapped files are ignored. * symtab.c (lookup_symtab_1, lookup_symbol): Print compilation unit source file name in error message. --- gdb/ChangeLog | 10 +++++++++ gdb/Makefile.in | 16 +++++++++---- gdb/dwarfread.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- gdb/objfiles.c | 3 ++- 4 files changed, 88 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9b49a9c..33710ee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Mon Aug 10 22:27:19 1992 Fred Fish (fnf@cygnus.com) + + * Makefile.in (VERSION): Bump to 4.6.3. + * dwarfread.c (scan_partial_symbols): Skip over DIE's within + function scopes when building partial symbol tables. + * objfiles.c (open_existing_mapped_file): Make it clear in + warning message that out of date mapped files are ignored. + * symtab.c (lookup_symtab_1, lookup_symbol): Print compilation + unit source file name in error message. + Sat Aug 8 23:12:22 1992 Fred Fish (fnf@cygnus.com) * dwarfread.c (struct dieinfo): Add has_at_byte_size. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 071b04d..39241dd 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -126,7 +126,7 @@ RL_LIB = ./../readline${subdir}/libreadline.a # All the includes used for CFLAGS and for lint. # -I. for config files. # -I${srcdir} possibly for regex.h also. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(INCLUDE_DIR) -I$(READLINE_DIR) +INCLUDE_CFLAGS = -I. -I${srcdir} -I$(INCLUDE_DIR) # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS # from the config/ directory. @@ -162,7 +162,7 @@ CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${MMALLOC_LIB} ${LIBIBERTY} \ ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES} ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES} -VERSION = 4.6.1 +VERSION = 4.6.3 DIST=gdb LINT=/usr/5bin/lint @@ -188,7 +188,7 @@ SFILES_MAINDIR = \ remote.c source.c stack.c symmisc.c symtab.c symfile.c \ utils.c valarith.c valops.c valprint.c values.c c-exp.y m2-exp.y \ ${DEMANGLER}.c mem-break.c target.c inftarg.c \ - dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c \ + dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c stabsread.c \ ieee-float.c language.c parse.c buildsym.c objfiles.c \ minsyms.c mipsread.c maint.c @@ -277,7 +277,8 @@ OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \ copying.o $(DEPFILES) ${DEMANGLER}.o mem-break.o target.o \ inftarg.o ieee-float.o putenv.o parse.o language.o $(YYOBJ) \ buildsym.o objfiles.o minsyms.o maint.o demangle.o \ - dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o + dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o \ + stabsread.o RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES) @@ -644,6 +645,10 @@ m2-exp.tab.c: $(srcdir)/m2-exp.y < y.tab.c > m2-exp.tab.c -rm y.tab.c + +main.o: ${srcdir}/main.c + ${CC} -c ${INTERNAL_CFLAGS} -I${READLINE_DIR} $< + # The symbol-file readers have dependencies on BFD header files. dbxread.o: ${srcdir}/dbxread.c ${CC} -c ${INTERNAL_CFLAGS} -I$(BFD_DIR) ${srcdir}/dbxread.c @@ -660,6 +665,9 @@ elfread.o: ${srcdir}/elfread.c dwarfread.o: ${srcdir}/dwarfread.c ${CC} -c ${INTERNAL_CFLAGS} -I$(BFD_DIR) ${srcdir}/dwarfread.c +stabsread.o: ${srcdir}/stabsread.c + ${CC} -c ${INTERNAL_CFLAGS} -I$(BFD_DIR) ${srcdir}/stabsread.c + xcoffread.o: ${srcdir}/xcoffread.c ${CC} -c ${INTERNAL_CFLAGS} -I$(BFD_DIR) ${srcdir}/xcoffread.c diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 82ee416..c16c21a 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -2382,15 +2382,50 @@ DESCRIPTION Process the DIE's within a single compilation unit, looking for interesting DIE's that contribute to the partial symbol table entry - for this compilation unit. Since we cannot follow any sibling - chains without reading the complete DIE info for every DIE, - it is probably faster to just sequentially check each one to - see if it is one of the types we are interested in, and if so, - then extract all the attributes info and generate a partial - symbol table entry. + for this compilation unit. NOTES + There are some DIE's that may appear both at file scope and within + the scope of a function. We are only interested in the ones at file + scope, and the only way to tell them apart is to keep track of the + scope. For example, consider the test case: + + static int i; + main () { int j; } + + for which the relevant DWARF segment has the structure: + + 0x51: + 0x23 global subrtn sibling 0x9b + name main + fund_type FT_integer + low_pc 0x800004cc + high_pc 0x800004d4 + + 0x74: + 0x23 local var sibling 0x97 + name j + fund_type FT_integer + location OP_BASEREG 0xe + OP_CONST 0xfffffffc + OP_ADD + 0x97: + 0x4 + + 0x9b: + 0x1d local var sibling 0xb8 + name i + fund_type FT_integer + location OP_ADDR 0x800025dc + + 0xb8: + 0x4 + + We want to include the symbol 'i' in the partial symbol table, but + not the symbol 'j'. In essence, we want to skip all the dies within + the scope of a TAG_global_subroutine DIE. + Don't attempt to add anonymous structures or unions since they have no name. Anonymous enumerations however are processed, because we want to extract their member names (the check for a tag name is @@ -2408,6 +2443,7 @@ scan_partial_symbols (thisdie, enddie, objfile) struct objfile *objfile; { char *nextdie; + char *temp; struct dieinfo di; while (thisdie < enddie) @@ -2426,6 +2462,28 @@ scan_partial_symbols (thisdie, enddie, objfile) { case TAG_global_subroutine: case TAG_subroutine: + completedieinfo (&di, objfile); + if (di.at_name && (di.has_at_low_pc || di.at_location)) + { + add_partial_symbol (&di, objfile); + /* If there is a sibling attribute, adjust the nextdie + pointer to skip the entire scope of the subroutine. + Apply some sanity checking to make sure we don't + overrun or underrun the range of remaining DIE's */ + if (di.at_sibling != 0) + { + temp = dbbase + di.at_sibling - dbroff; + if ((temp < thisdie) || (temp >= enddie)) + { + dwarfwarn ("reference to DIE (0x%x) outside compilation unit", di.at_sibling); + } + else + { + nextdie = temp; + } + } + } + break; case TAG_global_variable: case TAG_local_variable: completedieinfo (&di, objfile); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 4dae610..278aa44 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -435,7 +435,8 @@ open_existing_mapped_file (symsfilename, mtime, mapped) { if (!mapped) { - warning ("mapped symbol file `%s' is out of date", symsfilename); + warning ("mapped symbol file `%s' is out of date, ignored it", + symsfilename); } } else if ((fd = open (symsfilename, O_RDWR)) < 0) -- 2.7.4