[Lldb-commits] [PATCH] D107297: [RFC/WIP] Only look at the symbol table when resolving JIT symbols
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 2 10:50:05 PDT 2021
JDevlieghere created this revision.
JDevlieghere added reviewers: teemperor, jingham, clayborg.
JDevlieghere requested review of this revision.
When resolving missing symbols for the JIT, only look at the symbol table and skip the debug info. I can't think of a situation where we want to resolve a missing symbol `foo` to a symbol with a different symbol name, but named `foo` in the debug info. Because this isn't specified in the symbol context, we can't discriminate based on that, and `IRExecutionUnit::FindInSymbols` will pick the first matching symbol context with an external load address.
rdar://81241350
https://reviews.llvm.org/D107297
Files:
lldb/include/lldb/Core/Module.h
lldb/source/Core/Module.cpp
lldb/source/Expression/IRExecutionUnit.cpp
Index: lldb/source/Expression/IRExecutionUnit.cpp
===================================================================
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -851,8 +851,10 @@
return false;
};
+ // Skip the debug info and only look at the symbol table.
ModuleFunctionOptions function_options;
function_options.include_symbols = true;
+ function_options.symbols_only = true;
function_options.include_inlines = false;
for (const SearchSpec &spec : specs) {
Index: lldb/source/Core/Module.cpp
===================================================================
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -807,9 +807,10 @@
LookupInfo lookup_info(name, name_type_mask, eLanguageTypeUnknown);
if (symbols) {
- symbols->FindFunctions(lookup_info.GetLookupName(), parent_decl_ctx,
- lookup_info.GetNameTypeMask(),
- options.include_inlines, sc_list);
+ if (!options.symbols_only)
+ symbols->FindFunctions(lookup_info.GetLookupName(), parent_decl_ctx,
+ lookup_info.GetNameTypeMask(),
+ options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
@@ -827,8 +828,9 @@
lookup_info.Prune(sc_list, old_size);
} else {
if (symbols) {
- symbols->FindFunctions(name, parent_decl_ctx, name_type_mask,
- options.include_inlines, sc_list);
+ if (!options.symbols_only)
+ symbols->FindFunctions(name, parent_decl_ctx, name_type_mask,
+ options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
@@ -847,7 +849,9 @@
const size_t start_size = sc_list.GetSize();
if (SymbolFile *symbols = GetSymbolFile()) {
- symbols->FindFunctions(regex, options.include_inlines, sc_list);
+
+ if (!options.symbols_only)
+ symbols->FindFunctions(regex, options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
Index: lldb/include/lldb/Core/Module.h
===================================================================
--- lldb/include/lldb/Core/Module.h
+++ lldb/include/lldb/Core/Module.h
@@ -62,6 +62,8 @@
struct ModuleFunctionOptions {
/// Include the symbol table.
bool include_symbols = false;
+ /// Skip the debug info and only look at the symbol table.
+ bool symbols_only = false;
/// Include inlined functions.
bool include_inlines = false;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107297.363521.patch
Type: text/x-patch
Size: 2704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210802/cd68f72f/attachment.bin>
More information about the lldb-commits
mailing list