]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 19 Dec 2011 22:20:07 +0000 (22:20 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 19 Dec 2011 22:20:07 +0000 (22:20 +0000)
* symfile.c (reread_symbols): Move free_objfile_separate_debug,
preserve_values, sym_finish and clear_objfile_data calls before BFD
close.  Move free_objfile_separate_debug as the very first call.  New
comment on the ordering.

gdb/testsuite/
* gdb.base/reread.exp: If srcfile2 fails to build retry it with
-DNO_SECTIONS.
* gdb.base/reread2.c <!NO_SECTIONS>: New sections block.

gdb/ChangeLog
gdb/symfile.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/reread.exp
gdb/testsuite/gdb.base/reread2.c

index 16748d1f9e9d7ca0203da4c8610d6d7af783ed12..7c8d38f0caa702ec3e59108d7890a99a01dc2430 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * symfile.c (reread_symbols): Move free_objfile_separate_debug,
+       preserve_values, sym_finish and clear_objfile_data calls before BFD
+       close.  Move free_objfile_separate_debug as the very first call.  New
+       comment on the ordering.
+
 2011-12-19  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * s390-tdep.c (s390_push_dummy_call): Set addressing mode bit
index 72080acdf8dcbb53bd7f63d18bcfc072347063c8..e9c290c4da864132b678efe09fcbd3ae40bc3a8c 100644 (file)
@@ -2446,6 +2446,29 @@ reread_symbols (void)
              exec_file_attach (bfd_get_filename (objfile->obfd), 0);
            }
 
+         /* Keep the calls order approx. the same as in free_objfile.  */
+
+         /* Free the separate debug objfiles.  It will be
+            automatically recreated by sym_read.  */
+         free_objfile_separate_debug (objfile);
+
+         /* Remove any references to this objfile in the global
+            value lists.  */
+         preserve_values (objfile);
+
+         /* Nuke all the state that we will re-read.  Much of the following
+            code which sets things to NULL really is necessary to tell
+            other parts of GDB that there is nothing currently there.
+
+            Try to keep the freeing order compatible with free_objfile.  */
+
+         if (objfile->sf != NULL)
+           {
+             (*objfile->sf->sym_finish) (objfile);
+           }
+
+         clear_objfile_data (objfile);
+
          /* Clean up any state BFD has sitting around.  We don't need
             to close the descriptor but BFD lacks a way of closing the
             BFD without closing the descriptor.  */
@@ -2471,27 +2494,6 @@ reread_symbols (void)
          memcpy (offsets, objfile->section_offsets,
                  SIZEOF_N_SECTION_OFFSETS (num_offsets));
 
-         /* Remove any references to this objfile in the global
-            value lists.  */
-         preserve_values (objfile);
-
-         /* Nuke all the state that we will re-read.  Much of the following
-            code which sets things to NULL really is necessary to tell
-            other parts of GDB that there is nothing currently there.
-
-            Try to keep the freeing order compatible with free_objfile.  */
-
-         if (objfile->sf != NULL)
-           {
-             (*objfile->sf->sym_finish) (objfile);
-           }
-
-         clear_objfile_data (objfile);
-
-         /* Free the separate debug objfiles.  It will be
-            automatically recreated by sym_read.  */
-          free_objfile_separate_debug (objfile);
-
          /* FIXME: Do we have to free a whole linked list, or is this
             enough?  */
          if (objfile->global_psymbols.list)
index bca2d34f3419f5e0805fd84eea5d094b18f1dc8b..e815b07dbb2cd681481510561b477531ccc2cdd7 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/reread.exp: If srcfile2 fails to build retry it with
+       -DNO_SECTIONS.
+       * gdb.base/reread2.c <!NO_SECTIONS>: New sections block.
+
 2011-12-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.cp/ptype-cv-cp.exp (ptype v_volatile_const_my_int): Make
index 291de546e81f416f5d0012dc17054c9ac0437478..dca25f89b5e8a4754915ef43ff424590d719bee9 100644 (file)
@@ -38,7 +38,8 @@ set testfile2 "reread2"
 set srcfile2 ${testfile2}.c
 set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings}] != ""
+      && [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings additional_flags=-DNO_SECTIONS}] != ""} {
     untested reread.exp
     return -1
 }
index 181616c7aca90b2a1e393f3a9b803be41de84e5c..f45f29e3c0e12d28aa8154c1602e3160d427c3b8 100644 (file)
@@ -15,3 +15,14 @@ int main()
   foo();
   return 0;
 }
+
+/* Ensure the new file will have more sections.  It may exploit code not
+   updating its SECTION_COUNT on reread_symbols.  */
+
+#ifndef NO_SECTIONS
+# define VAR0(n) __attribute__ ((section ("sect" #n))) int var##n;
+# define VAR1(n) VAR0 (n ## 0) VAR0(n ## 1) VAR0(n ## 2) VAR0(n ## 3)
+# define VAR2(n) VAR1 (n ## 0) VAR1(n ## 1) VAR1(n ## 2) VAR1(n ## 3)
+# define VAR3(n) VAR2 (n ## 0) VAR2(n ## 1) VAR2(n ## 2) VAR2(n ## 3)
+VAR3 (0)
+#endif