1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/tools/llvm-dwarfdump/X86/find.test
Pavel Labath c8fe2424ea DWARFAcceleratorTable: fix equal_range iterators
Summary:
Both (Apple and DWARF5) implementations of the iterators had bugs which
resulted in crashes if one attempted to iterate through the accelerator
tables all the way.

For the Apple tables, the issue was that we did not clear the DataOffset
field when we reached the end, which made our iterator compare unequal
to the "end" iterator. For the Dwarf5 tables, the problem was that we
incremented the CurrentIndex pointer and then used the incremented
(possibly invalid) pointer to check whether we have reached the end of
the index list.

The reason these bugs went undetected is because their only user
(dwarfdump) only ever searched for the first match. Besides allowing us
to test this fix, changing llvm-dwarfdump --find to display all matches
seems like a good improvement (it makes the behavior consistent with the
--name option), so I change llvm-dwarfdump to do that.

The existing tests would be sufficient to test this fix with the new
llvm-dwarfdump behavior, but I add a special test that demonstrates that
the tool indeed displays multiple results. The find.test test needed to
be tweaked a bit as the tool now does not print the ".debug_info
contents" header (also consistent with how --name works).

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: mgrang, llvm-commits

Differential Revision: https://reviews.llvm.org/D47543

llvm-svn: 333635
2018-05-31 08:47:00 +00:00

41 lines
1.3 KiB
Plaintext

RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
RUN: | llvm-dwarfdump -find=not_there_at_all - | \
RUN: FileCheck %s --check-prefix=EMPTY --allow-empty
EMPTY: {{^$}}
RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
RUN: | llvm-dwarfdump -find=main - | FileCheck %s
CHECK: : DW_TAG_subprogram
CHECK-NOT: {{:}}
CHECK: DW_AT_name ("main")
CHECK-NOT: {{:}}
RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/libfat-test.a \
RUN: -find=x86_64h_var -find=i386_var \
RUN: | FileCheck %s --check-prefix=MULTI
MULTI: libfat-test.a(i386)
MULTI-NOT: {{: DW}}
MULTI: : DW_TAG_variable
MULTI-NOT: {{: DW}}
MULTI: DW_AT_name ("i386_var")
MULTI: libfat-test.a(x86_64h)
MULTI-NOT: {{: DW}}
MULTI: : DW_TAG_variable
MULTI-NOT: {{: DW}}
MULTI: DW_AT_name ("x86_64h_var")
MULTI-NOT: {{: DW}}
RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
RUN: | llvm-dwarfdump -find=int - | FileCheck %s --check-prefix=TYPES
TYPES: : DW_TAG_base_type
TYPES-NOT: {{:}}
TYPES: DW_AT_name ("int")
TYPES-NOT: {{:}}
RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/odr-anon-namespace/1.o \
RUN: -find="(anonymous namespace)" \
RUN: | FileCheck %s --check-prefix=NAMESPACE
NAMESPACE-NOT: {{: DW}}
NAMESPACE: 0x0000005b: DW_TAG_namespace
NAMESPACE-NOT: {{: DW}}