dwarf-reader: Fix reader::initialize to clear per corpus data

Message ID 87frt6telw.fsf@redhat.com
State New
Headers
Series dwarf-reader: Fix reader::initialize to clear per corpus data |

Commit Message

Dodji Seketeli June 21, 2024, 5 p.m. UTC
  Hello,

After cleaning up the re-initialization sequence of the the CTF reader,
Claudiu Ianculescu suggested that I look into the DWARF reader's
initialization sequence as well.  Lo and behold, the
dwarf::reader::read_debug_info_into_corpus calls
reader::clear_per_corpus_data while reader::initialize does not.

This patch moves the call to reader::clear_per_corpus_data into
reader::initialize.  It makes the code consistent with what we are now
doing in the CTF reader.

	* src/abg-dwarf-reader.cc (reader::initialize):  Call
	clear_per_corpus_data.
	(reader::read_debug_info_into_corpus): Remove the call to
	clear_per_corpus_data from here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-dwarf-reader.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 3e021a06..a9799437 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -2083,6 +2083,7 @@  public:
     type_section_die_parent_map_.clear();
     var_decls_to_add_.clear();
     clear_per_translation_unit_data();
+    clear_per_corpus_data();
     options().load_in_linux_kernel_mode = linux_kernel_mode;
     options().load_all_types = load_all_types;
 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
@@ -2217,8 +2218,6 @@  public:
   corpus_sptr
   read_debug_info_into_corpus()
   {
-    clear_per_corpus_data();
-
     // First set some mundane properties of the corpus gathered from
     // ELF.
     corpus::origin origin = corpus()->get_origin();