aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-08-12 18:17:48 +0000
committerFred Fish <fnf@specifix.com>1992-08-12 18:17:48 +0000
commit7b5d965008fee110409d054a787a7d825bc44436 (patch)
tree834ee0f20477b37bf8885c14ebea7cb94436aa40 /gdb
parenta00721fc4a008ab916883559397d635e28f1fd1a (diff)
downloadgdb-7b5d965008fee110409d054a787a7d825bc44436.zip
gdb-7b5d965008fee110409d054a787a7d825bc44436.tar.gz
gdb-7b5d965008fee110409d054a787a7d825bc44436.tar.bz2
* buildsym.c (end_symtab): Document that end_symtab can return
NULL under non-error conditions. * dwarfread.c (read_file_scope): Guard against dereferencing NULL returned from end_symtab for empty compilation units.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/buildsym.c9
-rw-r--r--gdb/dwarfread.c27
3 files changed, 30 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 54df4ab..f707ab8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+Wed Aug 12 11:14:58 1992 Fred Fish (fnf@cygnus.com)
+
+ * buildsym.c (end_symtab): Document that end_symtab can return
+ NULL under non-error conditions.
+ * dwarfread.c (read_file_scope): Guard against dereferencing NULL
+ returned from end_symtab for empty compilation units.
+
Tue Aug 11 02:49:39 1992 John Gilmore (gnu at cygnus.com)
* am29k-tdep.c: Lint from DECstation compiler.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index e0f69cd..566a66f 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -549,7 +549,14 @@ start_symtab (name, dirname, start_addr)
(creating struct block's for them), then make the struct symtab
for that file and put it in the list of all such.
- END_ADDR is the address of the end of the file's text. */
+ END_ADDR is the address of the end of the file's text.
+
+ Note that it is possible for end_symtab() to return NULL. In particular,
+ for the DWARF case at least, it will return NULL when it finds a
+ compilation unit that has exactly one DIE, a TAG_compile_unit DIE. This
+ can happen when we link in an object file that was compiled from an empty
+ source file. Returning NULL is probably not the correct thing to do,
+ because then gdb will never know about this empty file (FIXME). */
struct symtab *
end_symtab (end_addr, sort_pending, sort_linevec, objfile)
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index c16c21a..fcca11c 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -1662,19 +1662,22 @@ read_file_scope (dip, thisdie, enddie, objfile)
decode_line_numbers (lnbase);
process_dies (thisdie + dip -> die_length, enddie, objfile);
symtab = end_symtab (dip -> at_high_pc, 0, 0, objfile);
- /* FIXME: The following may need to be expanded for other languages */
- switch (dip -> at_language)
+ if (symtab != NULL)
{
- case LANG_C89:
- case LANG_C:
- symtab -> language = language_c;
- break;
- case LANG_C_PLUS_PLUS:
- symtab -> language = language_cplus;
- break;
- default:
- ;
- }
+ /* FIXME: The following may need to be expanded for other languages */
+ switch (dip -> at_language)
+ {
+ case LANG_C89:
+ case LANG_C:
+ symtab -> language = language_c;
+ break;
+ case LANG_C_PLUS_PLUS:
+ symtab -> language = language_cplus;
+ break;
+ default:
+ ;
+ }
+ }
do_cleanups (back_to);
utypes = NULL;
numutypes = 0;