summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-01-22 04:56:31 +0000
committerPavel Labath <pavel@labath.sk>2019-01-22 04:56:31 +0000
commit06bb373559a6014af36b7122b4a7048905a17166 (patch)
tree080c9a571d9a08492c4028b2074e48a3ffa72f07 /lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
parent1efb72f8a404533e604f370e0e4cea4e948ae6e1 (diff)
downloadbcm5719-llvm-06bb373559a6014af36b7122b4a7048905a17166.tar.gz
bcm5719-llvm-06bb373559a6014af36b7122b4a7048905a17166.zip
breakpad: Add FUNC records to the symtab
This patch extends SymbolFileBreakpad::AddSymbols to include the symbols from the FUNC records too. These symbols come from the debug info and have a size associated with them, so they are given preference in case there is a PUBLIC record for the same address. To achieve this, I first pre-process the symbols into a temporary DenseMap, and then insert the uniqued symbols into the module's symtab. Reviewers: clayborg, lemo, zturner Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56590 llvm-svn: 351781
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp67
1 files changed, 56 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
index 0cd92201b40..0dfa6fc3bbe 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
@@ -191,32 +191,77 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
return OS << "INFO CODE_ID " << R.getID().GetAsString();
}
-llvm::Optional<PublicRecord> PublicRecord::parse(llvm::StringRef Line) {
+static bool parsePublicOrFunc(llvm::StringRef Line, bool &Multiple,
+ lldb::addr_t &Address, lldb::addr_t *Size,
+ lldb::addr_t &ParamSize, llvm::StringRef &Name) {
// PUBLIC [m] address param_size name
+ // or
+ // FUNC [m] address size param_size name
+
+ Token Tok = Size ? Token::Func : Token::Public;
+
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
- if (toToken(Str) != Token::Public)
- return llvm::None;
+ if (toToken(Str) != Tok)
+ return false;
std::tie(Str, Line) = getToken(Line);
- bool Multiple = Str == "m";
+ Multiple = Str == "m";
if (Multiple)
std::tie(Str, Line) = getToken(Line);
- lldb::addr_t Address;
if (!to_integer(Str, Address, 16))
- return llvm::None;
+ return false;
+
+ if (Tok == Token::Func) {
+ std::tie(Str, Line) = getToken(Line);
+ if (!to_integer(Str, *Size, 16))
+ return false;
+ }
std::tie(Str, Line) = getToken(Line);
- lldb::addr_t ParamSize;
if (!to_integer(Str, ParamSize, 16))
- return llvm::None;
+ return false;
- llvm::StringRef Name = Line.trim();
+ Name = Line.trim();
if (Name.empty())
- return llvm::None;
+ return false;
+
+ return true;
+}
+
+llvm::Optional<FuncRecord> FuncRecord::parse(llvm::StringRef Line) {
+ bool Multiple;
+ lldb::addr_t Address, Size, ParamSize;
+ llvm::StringRef Name;
+
+ if (parsePublicOrFunc(Line, Multiple, Address, &Size, ParamSize, Name))
+ return FuncRecord(Multiple, Address, Size, ParamSize, Name);
+
+ return llvm::None;
+}
+
+bool breakpad::operator==(const FuncRecord &L, const FuncRecord &R) {
+ return L.getMultiple() == R.getMultiple() &&
+ L.getAddress() == R.getAddress() && L.getSize() == R.getSize() &&
+ L.getParamSize() == R.getParamSize() && L.getName() == R.getName();
+}
+llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
+ const FuncRecord &R) {
+ return OS << llvm::formatv("FUNC {0}{1:x-} {2:x-} {3:x-} {4}",
+ R.getMultiple() ? "m " : "", R.getAddress(),
+ R.getSize(), R.getParamSize(), R.getName());
+}
+
+llvm::Optional<PublicRecord> PublicRecord::parse(llvm::StringRef Line) {
+ bool Multiple;
+ lldb::addr_t Address, ParamSize;
+ llvm::StringRef Name;
+
+ if (parsePublicOrFunc(Line, Multiple, Address, nullptr, ParamSize, Name))
+ return PublicRecord(Multiple, Address, ParamSize, Name);
- return PublicRecord(Multiple, Address, ParamSize, Name);
+ return llvm::None;
}
bool breakpad::operator==(const PublicRecord &L, const PublicRecord &R) {
OpenPOWER on IntegriCloud