drgn/libdrgn
Omar Sandoval e537999173 libdrgn: dwarf_info: remove ambiguous incomplete type check
When we encounter an incomplete struct, union, class, or enum type, we
try to find the complete definition by name. We also try to detect
whether the name is ambiguous, i.e., whether there are multiple distinct
types with that name. This is based on the DWARF index's deduplication
by filename: if the index contains more than one DIE matching the (name,
tag), then the type name was defined in more than one file, and
therefore it is ambiguous.

However, this breaks if the exact same definition came from different
paths. For example, a Linux kernel module built out-of-tree may use
different paths than the original kernel build. Other scenarios
involving the compilation directory could also affect this.

Furthermore, this check won't be feasible with an upcoming rework of the
DWARF index.

Let's drop the check and return the first match regardless of other
matches. Hopefully it doesn't matter too much in practice. If the wrong
type is returned, it can be worked around by casting to the correct type
looked up by filename.

Closes #186.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
2023-08-16 14:15:03 -07:00
..
build-aux libdrgn: don't cache ORC sections in struct drgn_elf_file 2023-06-22 15:27:39 -07:00
examples libdrgn: examples: load_debug_info: pass struct drgn_program address to --{pre,post}-exec 2023-08-04 12:49:48 -07:00
include libdrgn: replace copies of elfutils headers with generated files 2022-11-01 15:41:53 -07:00
m4 libdrgn: define auto to __auto_type via autoconf 2023-08-16 10:32:39 -07:00
python libdrgn: revamp generic vector API 2023-08-16 14:13:38 -07:00
.gitignore libdrgn: use memswitch for linux_kernel_object_find 2022-02-08 02:03:11 -08:00
arch_aarch64_defs.py Add StackFrame.sp 2022-11-22 18:47:16 -08:00
arch_aarch64.c libdrgn: platform: replace demangle_return_address() with demangle_cfi_registers() 2022-12-02 13:52:06 -08:00
arch_arm.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
arch_i386.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
arch_ppc64_defs.py Add StackFrame.sp 2022-11-22 18:47:16 -08:00
arch_ppc64.c libdrgn: ppc64: fix stack unwinding since Linux v5.11 and before v4.20 2023-01-04 13:42:28 -08:00
arch_riscv.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
arch_s390x_defs.py libdrgn: add s390x unwinding support 2022-12-19 13:48:44 -08:00
arch_s390x.c libdrgn: use new include-what-you-use exported declarations and fix warnings 2023-05-24 00:25:25 -07:00
arch_x86_64_defs.py Add StackFrame.sp 2022-11-22 18:47:16 -08:00
arch_x86_64.c libdrgn: orc_info: handle ORC changes in Linux 6.3 and 6.4 2023-06-22 15:27:39 -07:00
array.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
binary_buffer.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
binary_buffer.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
binary_search_tree.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
bitops.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
cfi.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
cfi.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
cityhash.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
cleanup.h libdrgn: add _cleanup_free_ scope guard, no_cleanup_ptr(), and return_ptr() 2023-08-02 12:26:50 -07:00
configure.ac libdrgn: define auto to __auto_type via autoconf 2023-08-16 10:32:39 -07:00
debug_info.c libdrgn: dwarf_info: fail hard instead of rolling back on error during DWARF indexing 2023-08-16 14:15:03 -07:00
debug_info.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
Doxyfile libdrgn: add read(2) and pread(2) wrappers that don't return short reads 2022-08-26 12:43:20 -07:00
drgn_program_parse_vmcoreinfo.inc.strswitch Add some missing copyright/license notices 2022-11-01 17:14:02 -07:00
drgn.h.in libdrgn: support value objects with >64-bit integer types 2023-08-02 14:21:46 -07:00
dwarf_constants.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
dwarf_constants.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
dwarf_info.c libdrgn: dwarf_info: remove ambiguous incomplete type check 2023-08-16 14:15:03 -07:00
dwarf_info.h libdrgn: dwarf_info: make drgn_dwarf_index_state::max_threads an int 2023-08-16 14:15:03 -07:00
elf_file.c libdrgn: dwarf_info: read CU DIE with libdw in DWARF index 2023-07-19 10:10:08 -07:00
elf_file.h libdrgn: dwarf_info: read CU DIE with libdw in DWARF index 2023-07-19 10:10:08 -07:00
error.c libdrgn: add simple logging framework 2023-07-18 12:47:34 -07:00
error.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
generics.h libdrgn: add macros for defining types conditionally 2023-08-16 14:13:54 -07:00
hash_table.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
hash_table.h libdrgn: get rid of compatible type requirement for {min,max}_iconst() 2023-08-16 14:12:11 -07:00
helpers.h drgn.helpers.linux.sched: add cpu_curr() helper 2023-06-29 15:58:52 -07:00
io.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
io.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
kdump.c libdrgn: add stub s390 and s390x architectures with relocation implementation 2022-12-19 13:48:44 -08:00
language_c.c libdrgn: revamp generic vector API 2023-08-16 14:13:38 -07:00
language.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
language.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
lazy_object.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
lazy_object.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
lexer.c libdrgn: revamp generic vector API 2023-08-16 14:13:38 -07:00
lexer.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
linux_kernel_helpers.c drgn.helpers.linux.sched: add cpu_curr() helper 2023-06-29 15:58:52 -07:00
linux_kernel_object_find.inc.strswitch libdrgn: linux_kernel: add object finder for jiffies 2023-02-22 11:15:37 -08:00
linux_kernel.c libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
linux_kernel.h libdrgn: detect flattened vmcores and raise error 2023-08-16 09:41:26 -07:00
log.c libdrgn: add simple logging framework 2023-07-18 12:47:34 -07:00
log.h libdrgn: add simple logging framework 2023-07-18 12:47:34 -07:00
Makefile.am libdrgn: add macros for defining types conditionally 2023-08-16 14:13:54 -07:00
memory_reader.c libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
memory_reader.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
minmax.h libdrgn: get rid of compatible type requirement for {min,max}_iconst() 2023-08-16 14:12:11 -07:00
nstring.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
object_index.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
object_index.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
object.c libdrgn: support value objects with >64-bit integer types 2023-08-02 14:21:46 -07:00
object.h libdrgn: support value objects with >64-bit integer types 2023-08-02 14:21:46 -07:00
orc_info.c libdrgn: orc_info: use .orc_header to detect version 2023-06-28 11:10:18 -07:00
orc_info.h libdrgn: orc_info: handle ORC changes in Linux 6.3 and 6.4 2023-06-22 15:27:39 -07:00
orc.h libdrgn: orc_info: handle ORC changes in Linux 6.3 and 6.4 2023-06-22 15:27:39 -07:00
path.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
path.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
platform.c libdrgn: add stub s390 and s390x architectures with relocation implementation 2022-12-19 13:48:44 -08:00
platform.h libdrgn: platform: expand on page table iterator documentation 2023-02-21 17:42:22 -08:00
pp.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
program.c libdrgn: revamp generic vector API 2023-08-16 14:13:38 -07:00
program.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
register_state.c libdrgn: use new include-what-you-use exported declarations and fix warnings 2023-05-24 00:25:25 -07:00
register_state.h libdrgn: use new include-what-you-use exported declarations and fix warnings 2023-05-24 00:25:25 -07:00
serialize.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
serialize.h libdrgn: support value objects with >64-bit integer types 2023-08-02 14:21:46 -07:00
splay_tree.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
stack_trace.c libdrgn: add _cleanup_free_ scope guard, no_cleanup_ptr(), and return_ptr() 2023-08-02 12:26:50 -07:00
stack_trace.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
string_builder.c libdrgn: use new include-what-you-use exported declarations and fix warnings 2023-05-24 00:25:25 -07:00
string_builder.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
symbol.c Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
symbol.h Relicense drgn from GPLv3+ to LGPLv2.1+ 2022-11-01 17:05:16 -07:00
type.c libdrgn: revamp generic vector API 2023-08-16 14:13:38 -07:00
type.h libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}* 2023-08-02 14:54:59 -07:00
util.h libdrgn: document implementation-defined behavior in add_to_possibly_null_pointer() 2022-12-19 12:07:40 -08:00
vector.h libdrgn: vector: support using a smaller type for size/capacity 2023-08-16 14:14:59 -07:00