[Lldb-commits] [PATCH] D87036: [lldb] Make symbol list output from `image dump symtab` not depend on internal ordering of DenseMap
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 3 01:28:08 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b354d204d09: [lldb] Make symbol list output from `image dump symtab` not depend on internal… (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87036/new/
https://reviews.llvm.org/D87036
Files:
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/test/Shell/SymbolFile/Breakpad/symtab.test
Index: lldb/test/Shell/SymbolFile/Breakpad/symtab.test
===================================================================
--- lldb/test/Shell/SymbolFile/Breakpad/symtab.test
+++ lldb/test/Shell/SymbolFile/Breakpad/symtab.test
@@ -6,10 +6,10 @@
# CHECK: Symtab, file = {{.*}}symtab.out, num_symbols = 5:
# CHECK: Index UserID DSX Type File Address/Value Load Address Size Flags Name
# CHECK: [ 0] 0 SX Code 0x0000000000400000 0x00000000000000b0 0x00000000 ___lldb_unnamed_symbol{{[0-9]*}}$$symtab.out
-# CHECK: [ 1] 0 X Code 0x00000000004000c0 0x0000000000000010 0x00000000 f2
-# CHECK: [ 2] 0 X Code 0x00000000004000d0 0x0000000000000022 0x00000000 _start
-# CHECK: [ 3] 0 X Code 0x00000000004000a0 0x000000000000000d 0x00000000 func_only
-# CHECK: [ 4] 0 X Code 0x00000000004000b0 0x000000000000000c 0x00000000 f1_func
+# CHECK: [ 1] 0 X Code 0x00000000004000b0 0x000000000000000c 0x00000000 f1_func
+# CHECK: [ 2] 0 X Code 0x00000000004000a0 0x000000000000000d 0x00000000 func_only
+# CHECK: [ 3] 0 X Code 0x00000000004000c0 0x0000000000000010 0x00000000 f2
+# CHECK: [ 4] 0 X Code 0x00000000004000d0 0x0000000000000022 0x00000000 _start
# CHECK-LABEL: (lldb) image lookup -a 0x4000b0 -v
# CHECK: Address: symtab.out[0x00000000004000b0] (symtab.out.PT_LOAD[0]..text2 + 0)
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -326,7 +326,8 @@
}
const SectionList &list = *module.GetSectionList();
- llvm::DenseMap<addr_t, Symbol> symbols;
+ llvm::DenseSet<addr_t> found_symbol_addresses;
+ std::vector<Symbol> symbols;
auto add_symbol = [&](addr_t address, llvm::Optional<addr_t> size,
llvm::StringRef name) {
address += base;
@@ -338,8 +339,12 @@
name, address);
return;
}
- symbols.try_emplace(
- address, /*symID*/ 0, Mangled(name), eSymbolTypeCode,
+ // Keep track of what addresses were already added so far and only add
+ // the symbol with the first address.
+ if (!found_symbol_addresses.insert(address).second)
+ return;
+ symbols.emplace_back(
+ /*symID*/ 0, Mangled(name), eSymbolTypeCode,
/*is_global*/ true, /*is_debug*/ false,
/*is_trampoline*/ false, /*is_artificial*/ false,
AddressRange(section_sp, address - section_sp->GetFileAddress(),
@@ -359,8 +364,8 @@
LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
}
- for (auto &KV : symbols)
- symtab.AddSymbol(std::move(KV.second));
+ for (Symbol &symbol : symbols)
+ symtab.AddSymbol(std::move(symbol));
symtab.CalculateSymbolSizes();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87036.289655.patch
Type: text/x-patch
Size: 3202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200903/aeba28f6/attachment-0001.bin>
More information about the lldb-commits
mailing list