* dwarf2read.c (load_partial_comp_unit): Defer adding cu to
authorDoug Evans <dje@google.com>
Tue, 13 Mar 2012 17:16:18 +0000 (17:16 +0000)
committerDoug Evans <dje@google.com>
Tue, 13 Mar 2012 17:16:18 +0000 (17:16 +0000)
read_in_chain until we have successfully read it in.
(load_full_comp_unit): Ditto.
(read_signatured_type): Add comment.

gdb/ChangeLog
gdb/dwarf2read.c

index ccb66a194446f127fe5cbd24cea4795dbaf0c6e1..0db4a16ce7c0418d4e9ea207d7b4ccbdf1b6d166 100644 (file)
@@ -1,3 +1,10 @@
+2012-03-13  Doug Evans  <dje@google.com>
+
+       * dwarf2read.c (load_partial_comp_unit): Defer adding cu to
+       read_in_chain until we have successfully read it in.
+       (load_full_comp_unit): Ditto.
+       (read_signatured_type): Add comment.
+
 2012-03-13  Chris January  <chris.january@allinea.com>
 
        * stabsread.c (fix_common_block): Change type of valu argument
index ebe855b0e4d03cdecad02261c2a70455cd1a1169..807d36d3785cb35527741fbcffb6880474ff65fb 100644 (file)
@@ -3686,10 +3686,6 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu)
          do_cleanups (free_cu_cleanup);
          return;
        }
-
-      /* Link this CU into read_in_chain.  */
-      this_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
-      dwarf2_per_objfile->read_in_chain = this_cu;
     }
   else
     {
@@ -3722,6 +3718,10 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu)
       /* We've successfully allocated this compilation unit.  Let our
         caller clean it up when finished with it.  */
       discard_cleanups (free_cu_cleanup);
+
+      /* Link this CU into read_in_chain.  */
+      this_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
+      dwarf2_per_objfile->read_in_chain = this_cu;
     }
 }
 
@@ -4700,10 +4700,6 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
       /* Complete the cu_header.  */
       cu->header.offset = offset;
       cu->header.first_die_offset = info_ptr - beg_of_comp_unit;
-
-      /* Link this CU into read_in_chain.  */
-      per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
-      dwarf2_per_objfile->read_in_chain = per_cu;
     }
   else
     {
@@ -4730,6 +4726,10 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
       /* We've successfully allocated this compilation unit.  Let our
         caller clean it up when finished with it.  */
       discard_cleanups (free_cu_cleanup);
+
+      /* Link this CU into read_in_chain.  */
+      per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
+      dwarf2_per_objfile->read_in_chain = per_cu;
     }
 }
 
@@ -14445,6 +14445,7 @@ read_signatured_type (struct signatured_type *type_sig)
      clean it up when finished with it.         */
   discard_cleanups (free_cu_cleanup);
 
+  /* Link this TU into read_in_chain.  */
   type_sig->per_cu.cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
   dwarf2_per_objfile->read_in_chain = &type_sig->per_cu;
 }