summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSymbolClient/Client.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-04 23:33:27 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-04 23:35:10 +0100
commitacabc37c242ab2769eaa2b8bd1ac133f97c9bbf0 (patch)
tree2678fc0726dbcb93a392ada5e954cfb9820f7946 /Userland/Libraries/LibSymbolClient/Client.cpp
parent5dd555fe2fc407b035ea994474eb19bd633038bb (diff)
downloadserenity-acabc37c242ab2769eaa2b8bd1ac133f97c9bbf0.zip
SymbolServer+LibSymbolClient: Just do one symbol per IPC message
I originally wanted to batch the symbolication requests but that just makes the client logic significantly more complicated with no real benefit other than architectural feelgood points.
Diffstat (limited to 'Userland/Libraries/LibSymbolClient/Client.cpp')
-rw-r--r--Userland/Libraries/LibSymbolClient/Client.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/Userland/Libraries/LibSymbolClient/Client.cpp b/Userland/Libraries/LibSymbolClient/Client.cpp
index 3ef06b44a4..2c1835e5f6 100644
--- a/Userland/Libraries/LibSymbolClient/Client.cpp
+++ b/Userland/Libraries/LibSymbolClient/Client.cpp
@@ -47,19 +47,19 @@ void Client::handle(const Messages::SymbolClient::Dummy&)
{
}
-Vector<Symbol> Client::symbolicate(const String& path, const Vector<FlatPtr>& addresses)
+Optional<Symbol> Client::symbolicate(const String& path, FlatPtr address)
{
- auto response = send_sync<Messages::SymbolServer::Symbolicate>(path, addresses);
+ auto response = send_sync<Messages::SymbolServer::Symbolicate>(path, address);
if (!response->success())
return {};
- Vector<Symbol> symbols;
- for (auto& symbol : response->symbols()) {
- Symbol s;
- s.name = symbol;
- symbols.append(move(s));
- }
- return symbols;
+ return Symbol {
+ .address = address,
+ .name = response->name(),
+ .offset = response->offset(),
+ .filename = response->filename(),
+ .line_number = response->line()
+ };
}
Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
@@ -159,23 +159,21 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
continue;
}
- Vector<FlatPtr> addresses;
+ FlatPtr adjusted_address;
if (found_region->is_relative)
- addresses.append(address - found_region->base);
+ adjusted_address = address - found_region->base;
else
- addresses.append(address);
+ adjusted_address = address;
- auto result = client->symbolicate(found_region->path, addresses);
- if (result.is_empty()) {
+ auto result = client->symbolicate(found_region->path, adjusted_address);
+ if (!result.has_value()) {
symbols.append(Symbol {
.address = address,
});
continue;
}
- symbols.append(Symbol {
- .address = address,
- .name = result[0].name });
+ symbols.append(result.value());
}
return symbols;
}