Skip to content

Commit e2ce08a

Browse files
committed
Remove Target::FindLoadAddrForNameInSymbolsAndPersistentVariables
This reverts commit 2542856. Remove `Target::FindLoadAddrForNameInSymbolsAndPersistentVariables` as this is going unused in the codebase. As such the implementation being used in `FindSymbolForSwiftObject` is reverted to its original version.
1 parent 2542856 commit e2ce08a

File tree

3 files changed

+12
-80
lines changed

3 files changed

+12
-80
lines changed

lldb/include/lldb/Target/Target.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,20 +1355,6 @@ class Target : public std::enable_shared_from_this<Target>,
13551355
const EvaluateExpressionOptions &options = EvaluateExpressionOptions(),
13561356
std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
13571357

1358-
lldb::addr_t FindLoadAddrForNameInSymbols(
1359-
ConstString name_const_str, lldb::SymbolType symbol_type);
1360-
1361-
lldb::addr_t FindLoadAddrForNameInPersistentVariables(
1362-
ConstString name_const_str, lldb::SymbolType symbol_type);
1363-
1364-
// Look up a symbol by name and type in both the target's symbols and the
1365-
// persistent symbols from the
1366-
// expression parser. The symbol_type is ignored in that case, for now we
1367-
// don't have symbol types for the
1368-
// persistent variables.
1369-
lldb::addr_t FindLoadAddrForNameInSymbolsAndPersistentVariables(
1370-
ConstString name_const_str, lldb::SymbolType symbol_type);
1371-
13721358
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name);
13731359

13741360
lldb::addr_t GetPersistentSymbol(ConstString name);

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,19 @@ FindSymbolForSwiftObject(Process &process, RuntimeKind runtime_kind,
180180
return {};
181181
}
182182

183+
SymbolContextList sc_list;
184+
image->FindSymbolsWithNameAndType(ConstString(object), sym_type, sc_list);
185+
if (sc_list.GetSize() != 1)
186+
return {};
187+
188+
SymbolContext SwiftObject_Class;
189+
if (!sc_list.GetContextAtIndex(0, SwiftObject_Class))
190+
return {};
191+
if (!SwiftObject_Class.symbol)
192+
return {};
183193
lldb::addr_t addr =
184-
target.FindLoadAddrForNameInSymbols(ConstString(object), sym_type);
185-
if (addr != LLDB_INVALID_ADDRESS)
194+
SwiftObject_Class.symbol->GetAddress().GetLoadAddress(&target);
195+
if (addr && addr != LLDB_INVALID_ADDRESS)
186196
return addr;
187197

188198
return {};

lldb/source/Target/Target.cpp

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,70 +3693,6 @@ bool Target::SetSectionUnloaded(const lldb::SectionSP &section_sp,
36933693

36943694
void Target::ClearAllLoadedSections() { m_section_load_history.Clear(); }
36953695

3696-
lldb::addr_t Target::FindLoadAddrForNameInSymbols(ConstString name_const_str,
3697-
SymbolType symbol_type) {
3698-
lldb::addr_t symbol_addr = LLDB_INVALID_ADDRESS;
3699-
SymbolContextList sc_list;
3700-
3701-
GetImages().FindSymbolsWithNameAndType(name_const_str, symbol_type, sc_list);
3702-
if (!sc_list.IsEmpty()) {
3703-
SymbolContext desired_symbol;
3704-
3705-
if (sc_list.GetSize() == 1 &&
3706-
sc_list.GetContextAtIndex(0, desired_symbol)) {
3707-
if (desired_symbol.symbol) {
3708-
symbol_addr = desired_symbol.symbol->GetAddress().GetLoadAddress(this);
3709-
}
3710-
} else if (sc_list.GetSize() > 1) {
3711-
for (size_t i = 0; i < sc_list.GetSize(); i++) {
3712-
if (sc_list.GetContextAtIndex(i, desired_symbol)) {
3713-
if (desired_symbol.symbol) {
3714-
symbol_addr =
3715-
desired_symbol.symbol->GetAddress().GetLoadAddress(this);
3716-
if (symbol_addr != LLDB_INVALID_ADDRESS)
3717-
break;
3718-
}
3719-
}
3720-
}
3721-
}
3722-
}
3723-
return symbol_addr;
3724-
}
3725-
3726-
lldb::addr_t
3727-
Target::FindLoadAddrForNameInPersistentVariables(ConstString name_const_str,
3728-
lldb::SymbolType symbol_type) {
3729-
lldb::addr_t symbol_addr = LLDB_INVALID_ADDRESS;
3730-
ConstString mangled_const_str;
3731-
3732-
if (name_const_str.GetMangledCounterpart(mangled_const_str)) {
3733-
symbol_addr = GetPersistentSymbol(mangled_const_str);
3734-
}
3735-
3736-
// Check in persistent variables using the name that was passed in
3737-
if (symbol_addr == LLDB_INVALID_ADDRESS) {
3738-
symbol_addr = GetPersistentSymbol(name_const_str);
3739-
}
3740-
3741-
return symbol_addr;
3742-
}
3743-
3744-
lldb::addr_t Target::FindLoadAddrForNameInSymbolsAndPersistentVariables(
3745-
ConstString name_const_str, SymbolType symbol_type) {
3746-
lldb::addr_t symbol_addr = LLDB_INVALID_ADDRESS;
3747-
3748-
// Try to find the name in the symbol list
3749-
symbol_addr =
3750-
Target::FindLoadAddrForNameInSymbols(name_const_str, symbol_type);
3751-
3752-
// If that doesn't work, look for it in persistent variables
3753-
if (symbol_addr == LLDB_INVALID_ADDRESS)
3754-
Target::FindLoadAddrForNameInPersistentVariables(name_const_str,
3755-
symbol_type);
3756-
3757-
return symbol_addr;
3758-
}
3759-
37603696
void Target::SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info) {
37613697
if (process_info.IsScriptedProcess()) {
37623698
// Only copy scripted process launch options.

0 commit comments

Comments
 (0)