This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Defer adding cu to read_in_chain until successfully read in
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Wed, 7 Mar 2012 12:09:58 -0800 (PST)
- Subject: [patch] Defer adding cu to read_in_chain until successfully read in
Hi.
I don't have a testcase that shows a problem, but this patch feels
self-evidently cleaner.
I will check it in in a few days if there are no objections.
2012-03-07 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.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.619
diff -u -p -r1.619 dwarf2read.c
--- dwarf2read.c 6 Mar 2012 23:41:50 -0000 1.619
+++ dwarf2read.c 7 Mar 2012 19:52:13 -0000
@@ -3679,10 +3679,6 @@ load_partial_comp_unit (struct dwarf2_pe
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
{
@@ -3715,6 +3711,10 @@ load_partial_comp_unit (struct dwarf2_pe
/* 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;
}
}
@@ -4693,10 +4693,6 @@ load_full_comp_unit (struct dwarf2_per_c
/* 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
{
@@ -4723,6 +4719,10 @@ load_full_comp_unit (struct dwarf2_per_c
/* 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;
}
}
@@ -14426,6 +14426,7 @@ read_signatured_type (struct signatured_
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;
}