Skip to content

Commit 2b4412e

Browse files
Merge pull request #9451 from felipepiovezan/felipe/cherry_pick_language_api
[cherry-pick][lldb] Introduce Language::AreEquivalentFunctions (llvm#112720)
2 parents 16fdc84 + fdc624d commit 2b4412e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lldb/include/lldb/Target/Language.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ class Language : public PluginInterface {
365365
return false;
366366
}
367367

368+
/// Returns a boolean indicating whether two symbol contexts are equal for the
369+
/// purposes of frame comparison. If the plugin has no opinion, it should
370+
/// return nullopt.
371+
virtual std::optional<bool>
372+
AreEqualForFrameComparison(const SymbolContext &sc1,
373+
const SymbolContext &sc2) const {
374+
return {};
375+
}
376+
368377
/// Returns true if this Language supports exception breakpoints on throw via
369378
/// a corresponding LanguageRuntime plugin.
370379
virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; }

lldb/source/Target/ThreadPlanStepOverRange.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "lldb/Symbol/CompileUnit.h"
1212
#include "lldb/Symbol/Function.h"
1313
#include "lldb/Symbol/LineTable.h"
14+
#include "lldb/Target/Language.h"
1415
#include "lldb/Target/Process.h"
1516
#include "lldb/Target/RegisterContext.h"
1617
#include "lldb/Target/Target.h"
@@ -101,6 +102,10 @@ void ThreadPlanStepOverRange::SetupAvoidNoDebug(
101102

102103
bool ThreadPlanStepOverRange::IsEquivalentContext(
103104
const SymbolContext &context) {
105+
if (Language *language = Language::FindPlugin(context.GetLanguage()))
106+
if (std::optional<bool> maybe_equivalent =
107+
language->AreEqualForFrameComparison(context, m_addr_context))
108+
return *maybe_equivalent;
104109
// Match as much as is specified in the m_addr_context: This is a fairly
105110
// loose sanity check. Note, sometimes the target doesn't get filled in so I
106111
// left out the target check. And sometimes the module comes in as the .o

0 commit comments

Comments
 (0)