diff --git a/gdb.changes b/gdb.changes index 24af19b..b780760 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 24 11:33:32 CEST 2007 - schwab@suse.de + +- Fix internal error [#309928]. + ------------------------------------------------------------------- Thu Jul 26 12:41:05 CEST 2007 - schwab@suse.de diff --git a/gdb.spec b/gdb.spec index e0d00b2..6c13d93 100644 --- a/gdb.spec +++ b/gdb.spec @@ -18,13 +18,13 @@ BuildRequires: libunwind-devel %ifnarch ppc64 s390x BuildRequires: gcc-ada %endif -URL: http://www.gnu.org/software/gdb/ +Url: http://www.gnu.org/software/gdb/ License: GPL v2 or later Group: Development/Tools/Debuggers -Autoreqprov: on +AutoReqProv: on PreReq: %{install_info_prereq} Version: 6.6.50.20070726 -Release: 1 +Release: 24 Summary: The GNU Debugger Source: gdb-%{version}-cvs.tar.bz2 Patch1: gdb-misc.patch @@ -35,6 +35,7 @@ Patch5: gstack.patch Patch6: sect-index-text.diff Patch7: pie-relocate.diff Patch8: mst-solib-trampoline.diff +Patch9: macro-table.diff Patch10: ppc-long-double.diff Patch12: find-pc-sect-line.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -73,6 +74,7 @@ Authors: %patch6 %patch7 %patch8 +%patch9 -p1 %patch10 %patch12 @@ -86,7 +88,7 @@ CFLAGS="$RPM_OPT_FLAGS" \ --without-libunwind \ %endif --with-separate-debug-dir=%{_prefix}/lib/debug \ - --enable-64-bit-bfd --disable-werror --disable-tui \ + --enable-64-bit-bfd --disable-werror \ --build=%{_target_cpu}-suse-linux make %{?jobs:-j%jobs} make info @@ -96,7 +98,9 @@ make -k check || : %install make install-gdb install-info-gdb DESTDIR="$RPM_BUILD_ROOT" +rm -f $RPM_BUILD_ROOT%{_bindir}/gdbtui rm -f $RPM_BUILD_ROOT%{_bindir}/run +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/gdbtui.1 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/run.1 %clean @@ -128,8 +132,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/gdbserver %{_mandir}/man1/gdbserver.1.gz %endif - %changelog +* Mon Sep 24 2007 - schwab@suse.de +- Fix internal error [#309928]. * Thu Jul 26 2007 - schwab@suse.de - Update to head of trunk. * Fri Jul 13 2007 - schwab@suse.de diff --git a/macro-table.diff b/macro-table.diff new file mode 100644 index 0000000..a952840 --- /dev/null +++ b/macro-table.diff @@ -0,0 +1,136 @@ +2007-09-21 Jim Blandy + + * macrotab.h (new_macro_table): Document that removing information + from an obstack/bcache-managed macro table leaks memory. + * macrotab.c (macro_free, macro_bcache_free): Instead of asserting + that data is never freed in obstack/bcache-managed macro tables, + just leak the storage. + (macro_undef): If we're undefining a macro at exactly the same + source location that we defined it, simply remove the definition + altogether. + +diff -r 77afe7ffac2f gdb/macrotab.c +--- a/gdb/macrotab.c Fri Sep 21 14:38:59 2007 -0700 ++++ b/gdb/macrotab.c Fri Sep 21 17:32:52 2007 -0700 +@@ -87,8 +87,14 @@ static void + static void + macro_free (void *object, struct macro_table *t) + { +- gdb_assert (! t->obstack); +- xfree (object); ++ if (t->obstack) ++ /* There are cases where we need to remove entries from a macro ++ table, even when reading debugging information. This should be ++ rare, and there's no easy way to free arbitrary data from an ++ obstack, so we just leak it. */ ++ ; ++ else ++ xfree (object); + } + + +@@ -120,12 +126,18 @@ macro_bcache_str (struct macro_table *t, + + + /* Free a possibly bcached object OBJ. That is, if the macro table T +- has a bcache, it's an error; otherwise, xfree OBJ. */ ++ has a bcache, do nothing; otherwise, xfree OBJ. */ + static void + macro_bcache_free (struct macro_table *t, void *obj) + { +- gdb_assert (! t->bcache); +- xfree (obj); ++ if (t->bcache) ++ /* There are cases where we need to remove entries from a macro ++ table, even when reading debugging information. This should be ++ rare, and there's no easy way to free data from a bcache, so we ++ just leak it. */ ++ ; ++ else ++ xfree (obj); + } + + +@@ -781,25 +793,39 @@ macro_undef (struct macro_source_file *s + + if (n) + { +- /* This function is the only place a macro's end-of-scope +- location gets set to anything other than "end of the +- compilation unit" (i.e., end_file is zero). So if this macro +- already has its end-of-scope set, then we're probably seeing +- a second #undefinition for the same #definition. */ + struct macro_key *key = (struct macro_key *) n->key; + +- if (key->end_file) ++ /* If we're removing a definition at exactly the same point that ++ we defined it, then just delete the entry altogether. GCC ++ 4.1.2 will generate DWARF that says to do this if you pass it ++ arguments like '-DFOO -UFOO -DFOO=2'. */ ++ if (source == key->start_file ++ && line == key->start_line) ++ splay_tree_remove (source->table->definitions, n->key); ++ ++ else + { +- complaint (&symfile_complaints, +- _("macro '%s' is #undefined twice, at %s:%d and %s:%d"), name, +- source->filename, line, key->end_file->filename, +- key->end_line); ++ /* This function is the only place a macro's end-of-scope ++ location gets set to anything other than "end of the ++ compilation unit" (i.e., end_file is zero). So if this ++ macro already has its end-of-scope set, then we're ++ probably seeing a second #undefinition for the same ++ #definition. */ ++ if (key->end_file) ++ { ++ complaint (&symfile_complaints, ++ _("macro '%s' is #undefined twice," ++ " at %s:%d and %s:%d"), ++ name, ++ source->filename, line, ++ key->end_file->filename, key->end_line); ++ } ++ ++ /* Whether or not we've seen a prior #undefinition, wipe out ++ the old ending point, and make this the ending point. */ ++ key->end_file = source; ++ key->end_line = line; + } +- +- /* Whatever the case, wipe out the old ending point, and +- make this the ending point. */ +- key->end_file = source; +- key->end_line = line; + } + else + { +diff -r 77afe7ffac2f gdb/macrotab.h +--- a/gdb/macrotab.h Fri Sep 21 14:38:59 2007 -0700 ++++ b/gdb/macrotab.h Fri Sep 21 17:32:52 2007 -0700 +@@ -152,15 +152,15 @@ struct macro_source_file + amongst compilation units in an executable file; if BCACHE is zero, + don't cache these things. + +- Note that, if either OBSTACK or BCACHE are non-zero, then you +- should only ever add information the macro table --- you should +- never remove things from it. You'll get an error if you try. At +- the moment, since we only provide obstacks and bcaches for macro +- tables for symtabs, this restriction makes a nice sanity check. +- Obstacks and bcaches are pretty much grow-only structures anyway. +- However, if we find that it's occasionally useful to delete things +- even from the symtab's tables, and the storage leak isn't a +- problem, this restriction could be lifted. */ ++ Note that, if either OBSTACK or BCACHE are non-zero, then removing ++ information from the table may leak memory. Neither obstacks nor ++ bcaches really allow you to remove information, so although we can ++ update the data structure to record the change, we can't free the ++ old data. At the moment, since we only provide obstacks and ++ bcaches for macro tables for symtabs, this isn't a problem; only ++ odd debugging information makes a definition and then deletes it at ++ the same source location (although 'gcc -DFOO -UFOO -DFOO=2' does ++ do that in GCC 4.1.2.). */ + struct macro_table *new_macro_table (struct obstack *obstack, + struct bcache *bcache); +