diff options
| author | KyleMiles <krm504@nyu.edu> | 2023-07-25 20:01:15 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2023-07-25 20:01:15 -0400 |
| commit | 3cf3924281802ce606757e4a707534bad6b1ccbb (patch) | |
| tree | a28ccb72f621c1d4df46b8b95b3c3e167aa6f276 /rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | |
| parent | 5978a0ede2c071b547b692033f561641edc4ac37 (diff) | |
DWARF Import : Allow for duplicate type definitions; log_error when overwriting one type with another; add progress tracking; resolves #4514
Diffstat (limited to 'rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs index 2403c879..f82174aa 100644 --- a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs +++ b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs @@ -146,10 +146,27 @@ impl DebugInfoBuilder { } pub fn add_type(&mut self, type_uid: TypeUID, name: CString, t: Ref<Type>, commit: bool) { - assert!(self - .types - .insert(type_uid, DebugType { name, t, commit }) - .is_none()); + if let Some(DebugType { + name: existing_name, + t: existing_type, + commit: _, + }) = self.types.insert( + type_uid, + DebugType { + name: name.clone(), + t: t.clone(), + commit, + }, + ) { + if existing_type != t { + error!("DWARF info contains duplicate type definition. Overwriting type `{}` (named `{:?}`) with `{}` (named `{:?}`)", + existing_type, + existing_name, + t, + name + ); + } + } } // TODO : Non-copy? |
