Skip to content

[cherry-pick][lldb] Introduce Language::AreEquivalentFunctions (#112720) #9451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lldb/include/lldb/Target/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ class Language : public PluginInterface {
return false;
}

/// Returns a boolean indicating whether two symbol contexts are equal for the
/// purposes of frame comparison. If the plugin has no opinion, it should
/// return nullopt.
virtual std::optional<bool>
AreEqualForFrameComparison(const SymbolContext &sc1,
const SymbolContext &sc2) const {
return {};
}

/// Returns true if this Language supports exception breakpoints on throw via
/// a corresponding LanguageRuntime plugin.
virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; }
Expand Down
5 changes: 5 additions & 0 deletions lldb/source/Target/ThreadPlanStepOverRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
Expand Down Expand Up @@ -101,6 +102,10 @@ void ThreadPlanStepOverRange::SetupAvoidNoDebug(

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