[Lldb-commits] [lldb] [lldb] Add a unified entry point for locating a binary and its symbols (PR #215391)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 12 08:20:41 PDT 2026
================
@@ -9,15 +9,73 @@
#ifndef LLDB_SYMBOL_SYMBOLLOCATOR_H
#define LLDB_SYMBOL_SYMBOLLOCATOR_H
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Target/Statistics.h"
+#include "lldb/Utility/Status.h"
#include "lldb/Utility/UUID.h"
+#include "llvm/Support/Error.h"
+
+#include <system_error>
+
namespace lldb_private {
class SymbolLocator : public PluginInterface {
public:
SymbolLocator() = default;
+ /// A binary was not found and nothing could say why. Its own error type, so
+ /// that a caller composing its own message for that case cannot mistake a
+ /// real failure for it.
+ class NotFound : public llvm::ErrorInfo<NotFound> {
+ public:
+ static char ID;
+
+ void log(llvm::raw_ostream &os) const override;
+ std::error_code convertToErrorCode() const override;
+ };
+
+ /// One binary to search for.
+ struct Request {
+ /// What to look for.
+ ModuleSpec module_spec;
+
+ /// Allow contacting an external symbol server when the local searches come
+ /// up empty.
+ bool external_lookup = false;
+ };
+
+ /// What a search found.
+ struct Result {
+ /// The binary, and its symbol file if there is one to be had.
+ ModuleSpec module_spec;
+
+ /// What an external symbol server had to say about the symbols, even
+ /// though the binary itself was found. Recorded rather than reported, so
+ /// that it reaches the user in the caller's order.
+ Status symbol_error;
----------------
JDevlieghere wrote:
I'm not entirely sure what you mean. Are you suggesting something like an `llvm::Error` to force checking it? I think Status is already the more ergonomic way of doing that (i.e. storing an Error) but maybe you had something different in mind?
https://github.com/llvm/llvm-project/pull/215391
More information about the lldb-commits
mailing list