llvm/lldb/source/Target/Thread.cpp

//===-- Thread.cpp --------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Target/Thread.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/Property.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/ScriptedThreadPlan.h"
#include "lldb/Target/StackFrameRecognizer.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanBase.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
#include "lldb/Target/ThreadPlanStack.h"
#include "lldb/Target/ThreadPlanStepInRange.h"
#include "lldb/Target/ThreadPlanStepInstruction.h"
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepOverBreakpoint.h"
#include "lldb/Target/ThreadPlanStepOverRange.h"
#include "lldb/Target/ThreadPlanStepThrough.h"
#include "lldb/Target/ThreadPlanStepUntil.h"
#include "lldb/Target/ThreadSpec.h"
#include "lldb/Target/UnwindLLDB.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/State.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/lldb-enumerations.h"

#include <memory>
#include <optional>

usingnamespacelldb;
usingnamespacelldb_private;

ThreadProperties &Thread::GetGlobalProperties() {}

#define LLDB_PROPERTIES_thread
#include "TargetProperties.inc"

enum {};

class ThreadOptionValueProperties
    : public Cloneable<ThreadOptionValueProperties, OptionValueProperties> {};

ThreadProperties::ThreadProperties(bool is_global) :{}

ThreadProperties::~ThreadProperties() = default;

const RegularExpression *ThreadProperties::GetSymbolsToAvoidRegexp() {}

FileSpecList ThreadProperties::GetLibrariesToAvoid() const {}

bool ThreadProperties::GetTraceEnabledState() const {}

bool ThreadProperties::GetStepInAvoidsNoDebug() const {}

bool ThreadProperties::GetStepOutAvoidsNoDebug() const {}

uint64_t ThreadProperties::GetMaxBacktraceDepth() const {}

uint64_t ThreadProperties::GetSingleThreadPlanTimeout() const {}

// Thread Event Data

llvm::StringRef Thread::ThreadEventData::GetFlavorString() {}

Thread::ThreadEventData::ThreadEventData(const lldb::ThreadSP thread_sp)
    :{}

Thread::ThreadEventData::ThreadEventData(const lldb::ThreadSP thread_sp,
                                         const StackID &stack_id)
    :{}

Thread::ThreadEventData::ThreadEventData() :{}

Thread::ThreadEventData::~ThreadEventData() = default;

void Thread::ThreadEventData::Dump(Stream *s) const {}

const Thread::ThreadEventData *
Thread::ThreadEventData::GetEventDataFromEvent(const Event *event_ptr) {}

ThreadSP Thread::ThreadEventData::GetThreadFromEvent(const Event *event_ptr) {}

StackID Thread::ThreadEventData::GetStackIDFromEvent(const Event *event_ptr) {}

StackFrameSP
Thread::ThreadEventData::GetStackFrameFromEvent(const Event *event_ptr) {}

// Thread class

llvm::StringRef Thread::GetStaticBroadcasterClass() {}

Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id)
    :{}

Thread::~Thread() {}

void Thread::DestroyThread() {}

void Thread::BroadcastSelectedFrameChange(StackID &new_frame_id) {}

lldb::StackFrameSP
Thread::GetSelectedFrame(SelectMostRelevant select_most_relevant) {}

uint32_t Thread::SetSelectedFrame(lldb_private::StackFrame *frame,
                                  bool broadcast) {}

bool Thread::SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast) {}

bool Thread::SetSelectedFrameByIndexNoisily(uint32_t frame_idx,
                                            Stream &output_stream) {}

void Thread::FrameSelectedCallback(StackFrame *frame) {}

lldb::StopInfoSP Thread::GetStopInfo() {}

void Thread::CalculatePublicStopInfo() {}

lldb::StopInfoSP Thread::GetPrivateStopInfo(bool calculate) {}

lldb::StopReason Thread::GetStopReason() {}

bool Thread::StopInfoIsUpToDate() const {}

void Thread::ResetStopInfo() {}

void Thread::SetStopInfo(const lldb::StopInfoSP &stop_info_sp) {}

void Thread::SetShouldReportStop(Vote vote) {}

void Thread::SetStopInfoToNothing() {}

bool Thread::ThreadStoppedForAReason() {}

bool Thread::CheckpointThreadState(ThreadStateCheckpoint &saved_state) {}

bool Thread::RestoreRegisterStateFromCheckpoint(
    ThreadStateCheckpoint &saved_state) {}

void Thread::RestoreThreadStateFromCheckpoint(
    ThreadStateCheckpoint &saved_state) {}

StateType Thread::GetState() const {}

void Thread::SetState(StateType state) {}

std::string Thread::GetStopDescription() {}

std::string Thread::GetStopDescriptionRaw() {}

void Thread::WillStop() {}

void Thread::SetupForResume() {}

bool Thread::ShouldResume(StateType resume_state) {}

void Thread::DidResume() {}

void Thread::DidStop() {}

bool Thread::ShouldStop(Event *event_ptr) {}

Vote Thread::ShouldReportStop(Event *event_ptr) {}

Vote Thread::ShouldReportRun(Event *event_ptr) {}

bool Thread::MatchesSpec(const ThreadSpec *spec) {}

ThreadPlanStack &Thread::GetPlans() const {}

void Thread::PushPlan(ThreadPlanSP thread_plan_sp) {}

void Thread::PopPlan() {}

void Thread::DiscardPlan() {}

void Thread::AutoCompleteThreadPlans(CompletionRequest &request) const {}

ThreadPlan *Thread::GetCurrentPlan() const {}

ThreadPlanSP Thread::GetCompletedPlan() const {}

ValueObjectSP Thread::GetReturnValueObject() const {}

ExpressionVariableSP Thread::GetExpressionVariable() const {}

bool Thread::IsThreadPlanDone(ThreadPlan *plan) const {}

bool Thread::WasThreadPlanDiscarded(ThreadPlan *plan) const {}

bool Thread::CompletedPlanOverridesBreakpoint() const {}

ThreadPlan *Thread::GetPreviousPlan(ThreadPlan *current_plan) const{}

Status Thread::QueueThreadPlan(ThreadPlanSP &thread_plan_sp,
                               bool abort_other_plans) {}

bool Thread::DiscardUserThreadPlansUpToIndex(uint32_t plan_index) {}

void Thread::DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp) {}

void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) {}

void Thread::DiscardThreadPlans(bool force) {}

Status Thread::UnwindInnermostExpression() {}

ThreadPlanSP Thread::QueueBasePlan(bool abort_other_plans) {}

ThreadPlanSP Thread::QueueThreadPlanForStepSingleInstruction(
    bool step_over, bool abort_other_plans, bool stop_other_threads,
    Status &status) {}

ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
    bool abort_other_plans, const AddressRange &range,
    const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
    Status &status, LazyBool step_out_avoids_code_withoug_debug_info) {}

// Call the QueueThreadPlanForStepOverRange method which takes an address
// range.
ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
    bool abort_other_plans, const LineEntry &line_entry,
    const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
    Status &status, LazyBool step_out_avoids_code_withoug_debug_info) {}

ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
    bool abort_other_plans, const AddressRange &range,
    const SymbolContext &addr_context, const char *step_in_target,
    lldb::RunMode stop_other_threads, Status &status,
    LazyBool step_in_avoids_code_without_debug_info,
    LazyBool step_out_avoids_code_without_debug_info) {}

// Call the QueueThreadPlanForStepInRange method which takes an address range.
ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
    bool abort_other_plans, const LineEntry &line_entry,
    const SymbolContext &addr_context, const char *step_in_target,
    lldb::RunMode stop_other_threads, Status &status,
    LazyBool step_in_avoids_code_without_debug_info,
    LazyBool step_out_avoids_code_without_debug_info) {}

ThreadPlanSP Thread::QueueThreadPlanForStepOut(
    bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
    bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
    uint32_t frame_idx, Status &status,
    LazyBool step_out_avoids_code_without_debug_info) {}

ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop(
    bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
    bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
    uint32_t frame_idx, Status &status, bool continue_to_next_branch) {}

ThreadPlanSP Thread::QueueThreadPlanForStepThrough(StackID &return_stack_id,
                                                   bool abort_other_plans,
                                                   bool stop_other_threads,
                                                   Status &status) {}

ThreadPlanSP Thread::QueueThreadPlanForRunToAddress(bool abort_other_plans,
                                                    Address &target_addr,
                                                    bool stop_other_threads,
                                                    Status &status) {}

ThreadPlanSP Thread::QueueThreadPlanForStepUntil(
    bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
    bool stop_other_threads, uint32_t frame_idx, Status &status) {}

lldb::ThreadPlanSP Thread::QueueThreadPlanForStepScripted(
    bool abort_other_plans, const char *class_name,
    StructuredData::ObjectSP extra_args_sp, bool stop_other_threads,
    Status &status) {}

uint32_t Thread::GetIndexID() const {}

TargetSP Thread::CalculateTarget() {}

ProcessSP Thread::CalculateProcess() {}

ThreadSP Thread::CalculateThread() {}

StackFrameSP Thread::CalculateStackFrame() {}

void Thread::CalculateExecutionContext(ExecutionContext &exe_ctx) {}

StackFrameListSP Thread::GetStackFrameList() {}

std::optional<addr_t> Thread::GetPreviousFrameZeroPC() {}

void Thread::ClearStackFrames() {}

lldb::StackFrameSP Thread::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) {}

Status Thread::ReturnFromFrameWithIndex(uint32_t frame_idx,
                                        lldb::ValueObjectSP return_value_sp,
                                        bool broadcast) {}

Status Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp,
                               lldb::ValueObjectSP return_value_sp,
                               bool broadcast) {}

static void DumpAddressList(Stream &s, const std::vector<Address> &list,
                            ExecutionContextScope *exe_scope) {}

Status Thread::JumpToLine(const FileSpec &file, uint32_t line,
                          bool can_leave_function, std::string *warnings) {}

bool Thread::DumpUsingFormat(Stream &strm, uint32_t frame_idx,
                             const FormatEntity::Entry *format) {}

void Thread::DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx,
                                     bool stop_format) {}

void Thread::SettingsInitialize() {}

void Thread::SettingsTerminate() {}

lldb::addr_t Thread::GetThreadPointer() {}

addr_t Thread::GetThreadLocalData(const ModuleSP module,
                                  lldb::addr_t tls_file_addr) {}

bool Thread::SafeToCallFunctions() {}

lldb::StackFrameSP
Thread::GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr) {}

std::string Thread::StopReasonAsString(lldb::StopReason reason) {}

std::string Thread::RunModeAsString(lldb::RunMode mode) {}

size_t Thread::GetStatus(Stream &strm, uint32_t start_frame,
                         uint32_t num_frames, uint32_t num_frames_with_source,
                         bool stop_format, bool show_hidden, bool only_stacks) {}

bool Thread::GetDescription(Stream &strm, lldb::DescriptionLevel level,
                            bool print_json_thread, bool print_json_stopinfo) {}

size_t Thread::GetStackFrameStatus(Stream &strm, uint32_t first_frame,
                                   uint32_t num_frames, bool show_frame_info,
                                   uint32_t num_frames_with_source,
                                   bool show_hidden) {}

Unwind &Thread::GetUnwinder() {}

void Thread::Flush() {}

bool Thread::IsStillAtLastBreakpointHit() {}

Status Thread::StepIn(bool source_step,
                      LazyBool step_in_avoids_code_without_debug_info,
                      LazyBool step_out_avoids_code_without_debug_info)

{}

Status Thread::StepOver(bool source_step,
                        LazyBool step_out_avoids_code_without_debug_info) {}

Status Thread::StepOut(uint32_t frame_idx) {}

ValueObjectSP Thread::GetCurrentException() {}

ThreadSP Thread::GetCurrentExceptionBacktrace() {}

lldb::ValueObjectSP Thread::GetSiginfoValue() {}