jankratochvil updated this revision to Diff 206905. jankratochvil marked 2 inline comments as done.
Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63540/new/ https://reviews.llvm.org/D63540 Files: lldb/lit/SymbolFile/Inputs/sizeless-symbol.s lldb/lit/SymbolFile/sizeless-symbol.test lldb/source/Symbol/Symtab.cpp Index: lldb/source/Symbol/Symtab.cpp =================================================================== --- lldb/source/Symbol/Symtab.cpp +++ lldb/source/Symbol/Symtab.cpp @@ -896,8 +896,12 @@ for (size_t i = 0; i < num_entries; i++) { FileRangeToIndexMap::Entry *entry = m_file_addr_to_index.GetMutableEntryAtIndex(i); - if (entry->GetByteSize() == 0) { - addr_t curr_base_addr = entry->GetRangeBase(); + if (entry->GetByteSize() > 0) + continue; + addr_t curr_base_addr = entry->GetRangeBase(); + // Symbols with non-zero size will show after zero-sized symbols on the + // same address. So do not set size of a non-last zero-sized symbol. + if (i == num_entries - 1 || m_file_addr_to_index.GetMutableEntryAtIndex(i + 1)->GetRangeBase() != curr_base_addr) { const RangeVector<addr_t, addr_t>::Entry *containing_section = section_ranges.FindEntryThatContains(curr_base_addr); Index: lldb/lit/SymbolFile/sizeless-symbol.test =================================================================== --- /dev/null +++ lldb/lit/SymbolFile/sizeless-symbol.test @@ -0,0 +1,14 @@ +# Some targets do not have the .size directive. +# RUN: %clang -target x86_64-unknown-unknown-elf %S/Inputs/sizeless-symbol.s -c -o %t.o +# RUN: %lldb %t.o -s %s -o quit | FileCheck %s + +image lookup --address 1 +# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful +image lookup --address 2 +# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful + 1 +image dump symtab +# CHECK:Index UserID DSX Type File Address/Value Load Address Size Flags Name +# CHECK-NEXT:------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ---------------------------------- +# CHECK-NEXT:[ 0] 1 Code 0x0000000000000003 0x0000000000000000 0x00000000 sizeend +# CHECK-NEXT:[ 1] 2 Code 0x0000000000000001 0x0000000000000002 0x00000000 sizeful +# CHECK-NEXT:[ 2] 3 Code 0x0000000000000001 0x0000000000000000 0x00000000 sizeless Index: lldb/lit/SymbolFile/Inputs/sizeless-symbol.s =================================================================== --- /dev/null +++ lldb/lit/SymbolFile/Inputs/sizeless-symbol.s @@ -0,0 +1,8 @@ + .text + .byte 0 +sizeless: +sizeful: + .byte 0 + .byte 0 +sizeend: + .size sizeful, sizeend - sizeful
Index: lldb/source/Symbol/Symtab.cpp =================================================================== --- lldb/source/Symbol/Symtab.cpp +++ lldb/source/Symbol/Symtab.cpp @@ -896,8 +896,12 @@ for (size_t i = 0; i < num_entries; i++) { FileRangeToIndexMap::Entry *entry = m_file_addr_to_index.GetMutableEntryAtIndex(i); - if (entry->GetByteSize() == 0) { - addr_t curr_base_addr = entry->GetRangeBase(); + if (entry->GetByteSize() > 0) + continue; + addr_t curr_base_addr = entry->GetRangeBase(); + // Symbols with non-zero size will show after zero-sized symbols on the + // same address. So do not set size of a non-last zero-sized symbol. + if (i == num_entries - 1 || m_file_addr_to_index.GetMutableEntryAtIndex(i + 1)->GetRangeBase() != curr_base_addr) { const RangeVector<addr_t, addr_t>::Entry *containing_section = section_ranges.FindEntryThatContains(curr_base_addr); Index: lldb/lit/SymbolFile/sizeless-symbol.test =================================================================== --- /dev/null +++ lldb/lit/SymbolFile/sizeless-symbol.test @@ -0,0 +1,14 @@ +# Some targets do not have the .size directive. +# RUN: %clang -target x86_64-unknown-unknown-elf %S/Inputs/sizeless-symbol.s -c -o %t.o +# RUN: %lldb %t.o -s %s -o quit | FileCheck %s + +image lookup --address 1 +# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful +image lookup --address 2 +# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful + 1 +image dump symtab +# CHECK:Index UserID DSX Type File Address/Value Load Address Size Flags Name +# CHECK-NEXT:------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ---------------------------------- +# CHECK-NEXT:[ 0] 1 Code 0x0000000000000003 0x0000000000000000 0x00000000 sizeend +# CHECK-NEXT:[ 1] 2 Code 0x0000000000000001 0x0000000000000002 0x00000000 sizeful +# CHECK-NEXT:[ 2] 3 Code 0x0000000000000001 0x0000000000000000 0x00000000 sizeless Index: lldb/lit/SymbolFile/Inputs/sizeless-symbol.s =================================================================== --- /dev/null +++ lldb/lit/SymbolFile/Inputs/sizeless-symbol.s @@ -0,0 +1,8 @@ + .text + .byte 0 +sizeless: +sizeful: + .byte 0 + .byte 0 +sizeend: + .size sizeful, sizeend - sizeful
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits