LLDB mainline
lldb_private::LanguageRuntime Class Referenceabstract

#include <LanguageRuntime.h>

Inheritance diagram for lldb_private::LanguageRuntime:
[legend]

Classes

class  ThrownErrorLocation
 A description of how to find an error thrown by a function. More...
struct  VTableInfo

Public Member Functions

virtual lldb::LanguageType GetLanguageType () const =0
virtual LanguageRuntime * GetPreferredLanguageRuntime (ValueObject &in_value)
 Return the preferred language runtime instance, which in most cases will be the current instance.
virtual bool IsPreferredLanguageRuntimeFor (ValueObject &in_value)
 Returns whether this runtime is the preferred runtime for in_value, an object of another language, for example because code in this runtime's language uses it.
virtual llvm::Error GetObjectDescription (Stream &str, ValueObject &object)=0
virtual llvm::Error GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope)=0
virtual llvm::Expected< VTableInfo > GetVTableInfo (ValueObject &in_value, bool check_type)
 Get the vtable information for a given value.
virtual bool GetDynamicTypeAndAddress (ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer)=0
 This call should return true if it could set the name and/or the type Sets address to the address of the dynamic type if value_type is set to a file or load address.
virtual CompilerType GetConcreteType (ExecutionContextScope *exe_scope, llvm::StringRef abstract_type_name)
virtual bool CouldHaveDynamicValue (ValueObject &in_value)=0
virtual TypeAndOrName FixUpDynamicType (const TypeAndOrName &type_and_or_name, ValueObject &static_value)=0
virtual llvm::Expected< lldb::addr_t > FixupPointerValue (lldb::addr_t pointer, CompilerType type)
 Returns the address of the instance that pointer refers to, where pointer is the value of an object of type, whose instances are pointers (see eTypeInstanceIsPointer).
virtual llvm::Error FixupVariableLocation (Variable &variable, Value &value)
 This allows a language runtime to adjust the location of variable computed from its debug info, for storage whose indirection is only known at runtime.
virtual std::optional< Value > EvaluateEntryValue (StackFrame &frame, llvm::ArrayRef< uint8_t > entry_value, llvm::ArrayRef< uint8_t > &following)
 This allows a language runtime to evaluate DW_OP_entry_value(entry_value) in frame without call site information from the caller, when the runtime knows the value the register had on entry.
virtual void SetExceptionBreakpoints ()
virtual void ClearExceptionBreakpoints ()
virtual bool ExceptionBreakpointsAreSet ()
virtual bool ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
virtual lldb::BreakpointSP CreateErrorBackstopBreakpoint ()
 Create a breakpoint that catches an error escaping an expression that runs as top-level code, such as a REPL line, where no handler encloses it.
virtual lldb::ValueObjectSP GetErrorValueAtBackstop (StackFrame &frame)
 Return the error value that reached the breakpoint from CreateErrorBackstopBreakpoint, with frame stopped there.
virtual std::optional< Value > GetThrownErrorLocation (StackFrame &frame)
 Given a frame, compute the location where its function would place an error, if one is thrown by the function.
virtual std::optional< lldb::ValueObjectSP > GetThrownError (StackFrame &frame, const Value &location)
 Given frame, the frame a callee returned to, and location, computed by GetThrownErrorLocation from the callee's frame, get the error the callee threw.
virtual lldb::ValueObjectSP GetExceptionObjectForThread (lldb::ThreadSP thread_sp)
virtual lldb::ThreadSP GetBacktraceThreadFromException (lldb::ValueObjectSP thread_sp)
virtual DeclVendor * GetDeclVendor ()
virtual lldb::BreakpointResolverSP CreateExceptionResolver (const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp)=0
virtual lldb::SearchFilterSP CreateExceptionSearchFilter ()
virtual std::optional< uint64_t > GetTypeBitSize (const CompilerType &compiler_type)
virtual void SymbolsDidLoad (const ModuleList &module_list)
virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)=0
virtual bool IsAllowedRuntimeValue (llvm::StringRef name)
 Identify whether a name is a runtime value that should not be hidden by from the user interface.
virtual std::optional< CompilerType > GetRuntimeType (CompilerType base_type)
void ModulesDidLoad (const ModuleList &module_list) override
 Called when modules have been loaded in the process.
virtual bool GetIRPasses (LLVMUserExpression::IRPasses &custom_passes)
virtual bool IsSymbolARuntimeThunk (const Symbol &symbol)
virtual lldb::addr_t LookupRuntimeSymbol (llvm::StringRef name)
virtual bool isA (const void *ClassID) const
virtual StructuredData::ObjectSP GetLanguageSpecificData (SymbolContext sc)
 Language runtime plugins can use this API to report language-specific runtime information about this compile unit, such as additional language version details or feature flags.
Public Member Functions inherited from lldb_private::Runtime
 Runtime (Process *process)
virtual ~Runtime ()=default
 Runtime (const Runtime &)=delete
const Runtime & operator= (const Runtime &)=delete
Process * GetProcess ()
Target & GetTargetRef ()
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
virtual llvm::StringRef GetPluginName ()=0
 PluginInterface (const PluginInterface &)=delete
PluginInterface & operator= (const PluginInterface &)=delete

Static Public Member Functions

static LanguageRuntime * FindPlugin (Process *process, lldb::LanguageType language)
static void InitializeCommands (CommandObject *parent)
static lldb::BreakpointSP CreateExceptionBreakpoint (Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
static lldb::BreakpointPreconditionSP GetExceptionPrecondition (lldb::LanguageType language, bool throw_bp)
static lldb::UnwindPlanSP GetRuntimeUnwindPlan (lldb_private::Thread &thread, lldb_private::RegisterContext *regctx, bool &behaves_like_zeroth_frame)
 A language runtime may be able to provide a special UnwindPlan for the frame represented by the register contents regctx when that frame is not following the normal ABI conventions.
static CFAComparison CompareCFAs (Process &process, const StackID &lhs, const StackID &rhs)
 Compares the frames identified by lhs and rhs, if a language runtime of process can order them.

Static Public Attributes

static char ID = 0

Protected Member Functions

virtual lldb::UnwindPlanSP GetRuntimeUnwindPlan (lldb::ProcessSP process_sp, lldb_private::RegisterContext *regctx, bool &behaves_like_zeroth_frame)
virtual CFAComparison CompareCFAs (const StackID &lhs, const StackID &rhs)
 LanguageRuntime (Process *process)

Additional Inherited Members

Protected Attributes inherited from lldb_private::Runtime
Process * m_process

Detailed Description

Definition at line 62 of file LanguageRuntime.h.

Constructor & Destructor Documentation

◆ LanguageRuntime()

Member Function Documentation

◆ ClearExceptionBreakpoints()

virtual void lldb_private::LanguageRuntime::ClearExceptionBreakpoints ( )
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime, and lldb_private::CPPLanguageRuntime.

Definition at line 188 of file LanguageRuntime.h.

◆ CompareCFAs() [1/2]

virtual CFAComparison lldb_private::LanguageRuntime::CompareCFAs ( const StackID & lhs,
const StackID & rhs )
inlineprotectedvirtual

Definition at line 376 of file LanguageRuntime.h.

References lldb_private::NoOpinion.

◆ CompareCFAs() [2/2]

CFAComparison LanguageRuntime::CompareCFAs ( Process & process,
const StackID & lhs,
const StackID & rhs )
static

Compares the frames identified by lhs and rhs, if a language runtime of process can order them.

For example, a runtime whose unwind plans produce call frame addresses that aren't stack addresses knows how those frames relate.

Returns
Younger if lhs is younger than rhs, Older if it is older, and NoOpinion if no language runtime orders the frames.

Definition at line 291 of file LanguageRuntime.cpp.

References lldb_private::Process::GetLanguageRuntimes(), LanguageRuntime(), and lldb_private::NoOpinion.

Referenced by lldb_private::StackID::IsYoungerThan().

◆ CouldHaveDynamicValue()

virtual bool lldb_private::LanguageRuntime::CouldHaveDynamicValue ( ValueObject & in_value)
pure virtual

◆ CreateErrorBackstopBreakpoint()

virtual lldb::BreakpointSP lldb_private::LanguageRuntime::CreateErrorBackstopBreakpoint ( )
inlinevirtual

Create a breakpoint that catches an error escaping an expression that runs as top-level code, such as a REPL line, where no handler encloses it.

Definition at line 199 of file LanguageRuntime.h.

◆ CreateExceptionBreakpoint()

BreakpointSP LanguageRuntime::CreateExceptionBreakpoint ( Target & target,
lldb::LanguageType language,
bool catch_bp,
bool throw_bp,
bool is_internal = false )
static

◆ CreateExceptionResolver()

virtual lldb::BreakpointResolverSP lldb_private::LanguageRuntime::CreateExceptionResolver ( const lldb::BreakpointSP & bkpt,
bool catch_bp,
bool throw_bp )
pure virtual

◆ CreateExceptionSearchFilter()

virtual lldb::SearchFilterSP lldb_private::LanguageRuntime::CreateExceptionSearchFilter ( )
inlinevirtual

◆ EvaluateEntryValue()

virtual std::optional< Value > lldb_private::LanguageRuntime::EvaluateEntryValue ( StackFrame & frame,
llvm::ArrayRef< uint8_t > entry_value,
llvm::ArrayRef< uint8_t > & following )
inlinevirtual

This allows a language runtime to evaluate DW_OP_entry_value(entry_value) in frame without call site information from the caller, when the runtime knows the value the register had on entry.

For example, a runtime that unwinds the frame with GetRuntimeUnwindPlan() may know how that value relates to the CFA.

Parameters
[in,out]followingThe operations after the DW_OP_entry_value. The runtime may evaluate the first of them together with the entry value, and consume them from the front, when it knows their combined result but not the entry value alone.
Returns
The entry value, or std::nullopt to look it up in the call site parameters of the caller.

Definition at line 181 of file LanguageRuntime.h.

Referenced by EvaluateEntryValueInLanguageRuntime().

◆ ExceptionBreakpointsAreSet()

virtual bool lldb_private::LanguageRuntime::ExceptionBreakpointsAreSet ( )
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime, and lldb_private::CPPLanguageRuntime.

Definition at line 190 of file LanguageRuntime.h.

◆ ExceptionBreakpointsExplainStop()

virtual bool lldb_private::LanguageRuntime::ExceptionBreakpointsExplainStop ( lldb::StopInfoSP stop_reason)
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime, and lldb_private::CPPLanguageRuntime.

Definition at line 192 of file LanguageRuntime.h.

◆ FindPlugin()

LanguageRuntime * LanguageRuntime::FindPlugin ( Process * process,
lldb::LanguageType language )
static

◆ FixUpDynamicType()

virtual TypeAndOrName lldb_private::LanguageRuntime::FixUpDynamicType ( const TypeAndOrName & type_and_or_name,
ValueObject & static_value )
pure virtual

◆ FixupPointerValue()

virtual llvm::Expected< lldb::addr_t > lldb_private::LanguageRuntime::FixupPointerValue ( lldb::addr_t pointer,
CompilerType type )
inlinevirtual

Returns the address of the instance that pointer refers to, where pointer is the value of an object of type, whose instances are pointers (see eTypeInstanceIsPointer).

A runtime can remove information that it stores in the spare bits of such pointers, or follow a reference that refers to the instance indirectly.

Definition at line 153 of file LanguageRuntime.h.

◆ FixupVariableLocation()

virtual llvm::Error lldb_private::LanguageRuntime::FixupVariableLocation ( Variable & variable,
Value & value )
inlinevirtual

This allows a language runtime to adjust the location of variable computed from its debug info, for storage whose indirection is only known at runtime.

Definition at line 161 of file LanguageRuntime.h.

◆ GetBacktraceThreadFromException()

virtual lldb::ThreadSP lldb_private::LanguageRuntime::GetBacktraceThreadFromException ( lldb::ValueObjectSP thread_sp)
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime.

Definition at line 258 of file LanguageRuntime.h.

◆ GetConcreteType()

virtual CompilerType lldb_private::LanguageRuntime::GetConcreteType ( ExecutionContextScope * exe_scope,
llvm::StringRef abstract_type_name )
inlinevirtual

Definition at line 131 of file LanguageRuntime.h.

◆ GetDeclVendor()

◆ GetDynamicTypeAndAddress()

virtual bool lldb_private::LanguageRuntime::GetDynamicTypeAndAddress ( ValueObject & in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName & class_type_or_name,
Address & address,
Value::ValueType & value_type,
llvm::ArrayRef< uint8_t > & local_buffer )
pure virtual

This call should return true if it could set the name and/or the type Sets address to the address of the dynamic type if value_type is set to a file or load address.

Sets local_buffer to a buffer containing the data of the dynamic type if value_type is set to a host address. Callers should copy local_buffer over into their own buffer if they want to keep the data alive.

Implemented in lldb_private::AppleObjCRuntime, lldb_private::AppleObjCRuntimeV2, lldb_private::CPPLanguageRuntime, and lldb_private::GNUstepObjCRuntime.

Referenced by lldb_private::ValueObjectDynamicValue::UpdateValue().

◆ GetErrorValueAtBackstop()

virtual lldb::ValueObjectSP lldb_private::LanguageRuntime::GetErrorValueAtBackstop ( StackFrame & frame)
inlinevirtual

Return the error value that reached the breakpoint from CreateErrorBackstopBreakpoint, with frame stopped there.

Definition at line 203 of file LanguageRuntime.h.

◆ GetExceptionObjectForThread()

virtual lldb::ValueObjectSP lldb_private::LanguageRuntime::GetExceptionObjectForThread ( lldb::ThreadSP thread_sp)
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime, and lldb_private::CPPLanguageRuntime.

Definition at line 253 of file LanguageRuntime.h.

◆ GetExceptionPrecondition()

BreakpointPreconditionSP LanguageRuntime::GetExceptionPrecondition ( lldb::LanguageType language,
bool throw_bp )
static

◆ GetIRPasses()

virtual bool lldb_private::LanguageRuntime::GetIRPasses ( LLVMUserExpression::IRPasses & custom_passes)
inlinevirtual

Definition at line 296 of file LanguageRuntime.h.

◆ GetLanguageSpecificData()

StructuredData::ObjectSP LanguageRuntime::GetLanguageSpecificData ( SymbolContext sc)
virtual

Language runtime plugins can use this API to report language-specific runtime information about this compile unit, such as additional language version details or feature flags.

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 302 of file LanguageRuntime.cpp.

◆ GetLanguageType()

virtual lldb::LanguageType lldb_private::LanguageRuntime::GetLanguageType ( ) const
pure virtual

◆ GetObjectDescription() [1/2]

virtual llvm::Error lldb_private::LanguageRuntime::GetObjectDescription ( Stream & str,
Value & value,
ExecutionContextScope * exe_scope )
pure virtual

◆ GetObjectDescription() [2/2]

virtual llvm::Error lldb_private::LanguageRuntime::GetObjectDescription ( Stream & str,
ValueObject & object )
pure virtual

◆ GetPreferredLanguageRuntime()

virtual LanguageRuntime * lldb_private::LanguageRuntime::GetPreferredLanguageRuntime ( ValueObject & in_value)
inlinevirtual

Return the preferred language runtime instance, which in most cases will be the current instance.

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 73 of file LanguageRuntime.h.

References LanguageRuntime().

Referenced by lldb_private::ValueObjectDynamicValue::UpdateValue().

◆ GetRuntimeType()

virtual std::optional< CompilerType > lldb_private::LanguageRuntime::GetRuntimeType ( CompilerType base_type)
inlinevirtual

Reimplemented in lldb_private::ObjCLanguageRuntime.

Definition at line 287 of file LanguageRuntime.h.

◆ GetRuntimeUnwindPlan() [1/2]

virtual lldb::UnwindPlanSP lldb_private::LanguageRuntime::GetRuntimeUnwindPlan ( lldb::ProcessSP process_sp,
lldb_private::RegisterContext * regctx,
bool & behaves_like_zeroth_frame )
inlineprotectedvirtual

Definition at line 367 of file LanguageRuntime.h.

◆ GetRuntimeUnwindPlan() [2/2]

UnwindPlanSP LanguageRuntime::GetRuntimeUnwindPlan ( lldb_private::Thread & thread,
lldb_private::RegisterContext * regctx,
bool & behaves_like_zeroth_frame )
static

A language runtime may be able to provide a special UnwindPlan for the frame represented by the register contents regctx when that frame is not following the normal ABI conventions.

Instead of using the normal UnwindPlan for the function, we will use this special UnwindPlan for this one backtrace. One example of this would be a language that has asynchronous functions, functions that may not be currently-executing, while waiting on other asynchronous calls they made, but are part of a logical backtrace that we want to show the developer because that's how they think of the program flow.

Parameters
[in]threadThe thread that the unwind is happening on.
[in]regctxThe RegisterContext for the frame we need to create an UnwindPlan. We don't yet have a StackFrame when we're selecting the UnwindPlan.
[out]behaves_like_zeroth_frameWith normal ABI calls, all stack frames except the zeroth frame need to have the return-pc value backed up by 1 for symbolication purposes. For these LanguageRuntime unwind plans, they may not follow normal ABI calling conventions and the return pc may need to be symbolicated as-is.
Returns
Returns an UnwindPlan to find the caller frame if it should be used, instead of the UnwindPlan that would normally be used for this function.

Definition at line 273 of file LanguageRuntime.cpp.

References lldb_private::Language::GetSupportedLanguages(), and LanguageRuntime().

Referenced by lldb_private::RegisterContextUnwind::InitializeNonZerothFrame(), and lldb_private::RegisterContextUnwind::InitializeZerothFrame().

◆ GetStepThroughTrampolinePlan()

virtual lldb::ThreadPlanSP lldb_private::LanguageRuntime::GetStepThroughTrampolinePlan ( Thread & thread,
bool stop_others )
pure virtual

◆ GetThrownError()

virtual std::optional< lldb::ValueObjectSP > lldb_private::LanguageRuntime::GetThrownError ( StackFrame & frame,
const Value & location )
inlinevirtual

Given frame, the frame a callee returned to, and location, computed by GetThrownErrorLocation from the callee's frame, get the error the callee threw.

Returns
std::nullopt if the callee did not throw. Otherwise the thrown error, which is null if the error could not be read.

Definition at line 225 of file LanguageRuntime.h.

◆ GetThrownErrorLocation()

virtual std::optional< Value > lldb_private::LanguageRuntime::GetThrownErrorLocation ( StackFrame & frame)
inlinevirtual

Given a frame, compute the location where its function would place an error, if one is thrown by the function.

Returns
std::nullopt if the function cannot throw. A register location is read in the frame the function returns to.

Definition at line 213 of file LanguageRuntime.h.

◆ GetTypeBitSize()

virtual std::optional< uint64_t > lldb_private::LanguageRuntime::GetTypeBitSize ( const CompilerType & compiler_type)
inlinevirtual

Reimplemented in lldb_private::ObjCLanguageRuntime.

Definition at line 274 of file LanguageRuntime.h.

◆ GetVTableInfo()

virtual llvm::Expected< VTableInfo > lldb_private::LanguageRuntime::GetVTableInfo ( ValueObject & in_value,
bool check_type )
inlinevirtual

Get the vtable information for a given value.

Parameters
[in]in_valueThe value object to try and extract the VTableInfo from.
[in]check_typeIf true, the compiler type of in_value will be checked to see if it is an instance to, or pointer or reference to a class or struct that has a vtable. If the type doesn't meet the requirements, an error will be returned explaining why the type isn't suitable.
Returns
An error if anything goes wrong while trying to extract the vtable or if check_type is true and the type doesn't have a vtable.

Reimplemented in lldb_private::CPPLanguageRuntime.

Definition at line 110 of file LanguageRuntime.h.

Referenced by lldb_private::ValueObjectVTable::UpdateValue().

◆ InitializeCommands()

◆ isA()

◆ IsAllowedRuntimeValue()

virtual bool lldb_private::LanguageRuntime::IsAllowedRuntimeValue ( llvm::StringRef name)
inlinevirtual

Identify whether a name is a runtime value that should not be hidden by from the user interface.

Reimplemented in lldb_private::CPPLanguageRuntime, and lldb_private::ObjCLanguageRuntime.

Definition at line 285 of file LanguageRuntime.h.

◆ IsPreferredLanguageRuntimeFor()

virtual bool lldb_private::LanguageRuntime::IsPreferredLanguageRuntimeFor ( ValueObject & in_value)
inlinevirtual

Returns whether this runtime is the preferred runtime for in_value, an object of another language, for example because code in this runtime's language uses it.

The runtime of the object's language can then return this runtime from GetPreferredLanguageRuntime().

Definition at line 81 of file LanguageRuntime.h.

◆ IsSymbolARuntimeThunk()

virtual bool lldb_private::LanguageRuntime::IsSymbolARuntimeThunk ( const Symbol & symbol)
inlinevirtual

Reimplemented in lldb_private::CPPLanguageRuntime.

Definition at line 300 of file LanguageRuntime.h.

◆ LookupRuntimeSymbol()

virtual lldb::addr_t lldb_private::LanguageRuntime::LookupRuntimeSymbol ( llvm::StringRef name)
inlinevirtual

◆ ModulesDidLoad()

void lldb_private::LanguageRuntime::ModulesDidLoad ( const ModuleList & module_list)
inlineoverridevirtual

Called when modules have been loaded in the process.

Implements lldb_private::Runtime.

Definition at line 291 of file LanguageRuntime.h.

◆ SetExceptionBreakpoints()

virtual void lldb_private::LanguageRuntime::SetExceptionBreakpoints ( )
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntime, and lldb_private::CPPLanguageRuntime.

Definition at line 186 of file LanguageRuntime.h.

◆ SymbolsDidLoad()

virtual void lldb_private::LanguageRuntime::SymbolsDidLoad ( const ModuleList & module_list)
inlinevirtual

Reimplemented in lldb_private::ObjCLanguageRuntime.

Definition at line 278 of file LanguageRuntime.h.

Member Data Documentation

◆ ID

char LanguageRuntime::ID = 0
static

Definition at line 310 of file LanguageRuntime.h.

Referenced by isA().


The documentation for this class was generated from the following files: