llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) <details> <summary>Changes</summary> The original code resulted in a misfire in the symtab vs. debug info deduplication code, which caused us to return the same function twice when searching via a regex (for functions whose entry point is also not the lowest address). --- Full diff: https://github.com/llvm/llvm-project/pull/124938.diff 2 Files Affected: - (modified) lldb/source/Core/Module.cpp (+2-3) - (modified) lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s (+16-4) ``````````diff diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 9601c834d9b8fe..33668c5d20dde4 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -919,9 +919,8 @@ void Module::FindFunctions(const RegularExpression ®ex, const SymbolContext &sc = sc_list[i]; if (sc.block) continue; - file_addr_to_index[sc.function->GetAddressRange() - .GetBaseAddress() - .GetFileAddress()] = i; + file_addr_to_index[sc.function->GetAddress().GetFileAddress()] = + i; } FileAddrToIndexMap::const_iterator end = file_addr_to_index.end(); diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s b/lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s index 93ea9f33e762df..197ab9aa14910e 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s @@ -6,17 +6,29 @@ # The function bar has been placed "in the middle" of foo, and the function # entry point is deliberately not its lowest address. -# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t -# RUN: %lldb %t -o "image lookup -v -n foo" -o "expr -- &foo" -o exit | FileCheck %s +# RUN: split-file %s %t +# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %t/input.s -o %t/input.o +# RUN: %lldb %t/input.o -s %t/commands -o exit | FileCheck %s -# CHECK-LABEL: image lookup +#--- commands + +image lookup -v -n foo +# CHECK-LABEL: image lookup -v -n foo +# CHECK: 1 match found in {{.*}} +# CHECK: Summary: input.o`foo +# CHECK: Function: id = {{.*}}, name = "foo", ranges = [0x0000000000000000-0x000000000000000e)[0x0000000000000014-0x000000000000001c) + +image lookup -v --regex -n '^foo$' +# CHECK-LABEL: image lookup -v --regex -n '^foo$' # CHECK: 1 match found in {{.*}} -# CHECK: Summary: {{.*}}`foo +# CHECK: Summary: input.o`foo # CHECK: Function: id = {{.*}}, name = "foo", ranges = [0x0000000000000000-0x000000000000000e)[0x0000000000000014-0x000000000000001c) +expr -- &foo # CHECK-LABEL: expr -- &foo # CHECK: (void (*)()) $0 = 0x0000000000000007 +#--- input.s .text foo.__part.1: `````````` </details> https://github.com/llvm/llvm-project/pull/124938 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits