Skip to content

Commit 5968b05

Browse files
committed
use existing SBTarget::ResolveSymbolContextForAddress instead of adding new API
1 parent e9d2fd0 commit 5968b05

File tree

4 files changed

+11
-34
lines changed

4 files changed

+11
-34
lines changed

lldb/include/lldb/API/SBAddress.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "lldb/API/SBDefines.h"
1313
#include "lldb/API/SBModule.h"
14-
#include "lldb/API/SBTarget.h"
1514

1615
namespace lldb {
1716

@@ -59,12 +58,6 @@ class LLDB_API SBAddress {
5958
// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
6059
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
6160

62-
/// Same as the previous function, but uses the given target in the symbol
63-
/// context. This can help to resolve things that require the target,
64-
// for example it's necessary in order to apply source map on SBLineEntry.
65-
lldb::SBSymbolContext GetSymbolContext(const SBTarget &target,
66-
uint32_t resolve_scope);
67-
6861
// The following functions grab individual objects for a given address and
6962
// are less efficient if you want more than one symbol related objects. Use
7063
// one of the following when you want multiple debug symbol related objects
@@ -129,9 +122,6 @@ class LLDB_API SBAddress {
129122

130123
void SetAddress(const lldb_private::Address &address);
131124

132-
void CalculateSymbolContext(lldb_private::SymbolContext &sc,
133-
uint32_t resolve_scope);
134-
135125
private:
136126
std::unique_ptr<lldb_private::Address> m_opaque_up;
137127
};

lldb/source/API/SBAddress.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,9 @@ SBSymbolContext SBAddress::GetSymbolContext(uint32_t resolve_scope) {
213213
LLDB_INSTRUMENT_VA(this, resolve_scope);
214214

215215
SBSymbolContext sb_sc;
216-
CalculateSymbolContext(sb_sc.ref(), resolve_scope);
217-
return sb_sc;
218-
}
219-
220-
SBSymbolContext SBAddress::GetSymbolContext(const SBTarget &target,
221-
uint32_t resolve_scope) {
222-
LLDB_INSTRUMENT_VA(this, target, resolve_scope);
223-
224-
SBSymbolContext sb_sc;
225-
lldb_private::SymbolContext &sc = sb_sc.ref();
226-
sc.target_sp = target.GetSP();
227-
CalculateSymbolContext(sc, resolve_scope);
216+
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
217+
if (m_opaque_up->IsValid())
218+
m_opaque_up->CalculateSymbolContext(&sb_sc.ref(), scope);
228219
return sb_sc;
229220
}
230221

@@ -275,10 +266,3 @@ SBLineEntry SBAddress::GetLineEntry() {
275266
}
276267
return sb_line_entry;
277268
}
278-
279-
void SBAddress::CalculateSymbolContext(lldb_private::SymbolContext &sc,
280-
uint32_t resolve_scope) {
281-
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
282-
if (m_opaque_up->IsValid())
283-
m_opaque_up->CalculateSymbolContext(&sc, scope);
284-
}

lldb/source/API/SBTarget.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,17 @@ SBTarget::ResolveSymbolContextForAddress(const SBAddress &addr,
636636
uint32_t resolve_scope) {
637637
LLDB_INSTRUMENT_VA(this, addr, resolve_scope);
638638

639-
SBSymbolContext sc;
639+
SBSymbolContext sb_sc;
640640
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
641641
if (addr.IsValid()) {
642-
if (TargetSP target_sp = GetSP())
642+
if (TargetSP target_sp = GetSP()) {
643+
lldb_private::SymbolContext &sc = sb_sc.ref();
644+
sc.target_sp = target_sp;
643645
target_sp->GetImages().ResolveSymbolContextForAddress(addr.ref(), scope,
644-
sc.ref());
646+
sc);
647+
}
645648
}
646-
return sc;
649+
return sb_sc;
647650
}
648651

649652
size_t SBTarget::ReadMemory(const SBAddress addr, void *buf, size_t size,

lldb/tools/lldb-dap/LLDBUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ std::string GetSBFileSpecPath(const lldb::SBFileSpec &file_spec) {
255255
lldb::SBLineEntry GetLineEntryForAddress(lldb::SBTarget &target,
256256
lldb::SBAddress &address) {
257257
lldb::SBSymbolContext sc =
258-
address.GetSymbolContext(target, lldb::eSymbolContextLineEntry);
258+
target.ResolveSymbolContextForAddress(address, lldb::eSymbolContextLineEntry);
259259
return sc.GetLineEntry();
260260
}
261261

0 commit comments

Comments
 (0)