72 uint32_t concrete_frame_idx = 0;
78 bool is_linux =
false;
79 if (concrete_frame_idx == 0) {
88 case llvm::Triple::FreeBSD: {
90 case llvm::Triple::aarch64:
91 case llvm::Triple::arm:
93 case llvm::Triple::ppc:
96 case llvm::Triple::ppc64:
97 case llvm::Triple::ppc64le:
100 case llvm::Triple::x86:
103 case llvm::Triple::x86_64:
112 case llvm::Triple::NetBSD: {
114 case llvm::Triple::aarch64:
116 case llvm::Triple::x86:
119 case llvm::Triple::x86_64:
128 case llvm::Triple::Linux: {
131 case llvm::Triple::aarch64:
133 case llvm::Triple::ppc64le:
136 case llvm::Triple::systemz:
139 case llvm::Triple::x86:
142 case llvm::Triple::x86_64:
151 case llvm::Triple::OpenBSD: {
153 case llvm::Triple::aarch64:
155 case llvm::Triple::x86:
158 case llvm::Triple::x86_64:
171 if (!reg_interface && arch.
GetMachine() != llvm::Triple::aarch64 &&
173 arch.
GetMachine() != llvm::Triple::loongarch64 &&
176 LLDB_LOGF(log,
"elf-core::%s:: Architecture(%d) or OS(%d) not supported",
178 assert(
false &&
"Architecture or OS not supported");
182 case llvm::Triple::aarch64:
186 case llvm::Triple::arm:
191 case llvm::Triple::loongarch64:
195 case llvm::Triple::riscv32:
199 case llvm::Triple::riscv64:
203 case llvm::Triple::ppc:
204 case llvm::Triple::ppc64:
208 case llvm::Triple::ppc64le:
212 case llvm::Triple::systemz:
216 case llvm::Triple::x86:
217 case llvm::Triple::x86_64:
237llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
240 return llvm::createStringError(llvm::inconvertibleErrorCode(),
244 "siginfo note bytes");
252 PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
283 constexpr size_t num_ptr_size_members = 10;
301 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64,
343 return {
static_cast<sec_t
>(oth.tv_sec),
static_cast<usec_t
>(oth.tv_usec)};
346std::optional<ELFLinuxPrStatus>
349 prstatus.
pr_pid = thread_sp->GetID();
352 if (!process_sp->GetProcessInfo(info))
389 "NT_PRPSINFO size should be %zu, but the remaining bytes are: %" PRIu64,
427std::optional<ELFLinuxPrPsInfo>
430 if (!process_sp->GetProcessInfo(info))
433 return Populate(info, process_sp->GetState());
436std::optional<ELFLinuxPrPsInfo>
443 if (
auto zombie_opt = info.
IsZombie(); zombie_opt.value_or(
false)) {
460 switch (process_state) {
504 constexpr size_t fname_len = std::extent_v<
decltype(prpsinfo.
pr_fname)>;
505 static_assert(fname_len > 0,
"This should always be non zero");
507 auto fname_begin = fname.begin();
508 std::copy_n(fname_begin, std::min(fname_len, fname.size()),
510 prpsinfo.
pr_fname[fname_len - 1] =
'\0';
512 auto argentry_iterator = std::begin(args);
514 char *psargs_end = std::end(prpsinfo.
pr_psargs);
515 while (psargs < psargs_end && argentry_iterator != args.end()) {
516 llvm::StringRef argentry = argentry_iterator->ref();
518 std::min<size_t>(std::distance(psargs, psargs_end), argentry.size());
519 auto arg_iterator = std::begin(argentry);
520 psargs = std::copy_n(arg_iterator, len, psargs);
521 if (psargs != psargs_end)
525 *(psargs - 1) =
'\0';
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
static struct compat_timeval copy_timespecs(const ProcessInstanceInfo::timespec &oth)
lldb_private::ArchSpec GetArchitecture()
static std::unique_ptr< RegisterContextCorePOSIX_arm64 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
static std::unique_ptr< RegisterContextCorePOSIX_loongarch64 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
static std::unique_ptr< RegisterContextCorePOSIX_riscv32 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
static std::unique_ptr< RegisterContextCorePOSIX_riscv64 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
void RefreshStateAfterStop() override
lldb::RegisterContextSP GetRegisterContext() override
~ThreadElfCore() override
ThreadElfCore(lldb_private::Process &process, const ThreadData &td)
std::string m_thread_name
lldb::RegisterContextSP CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override
std::vector< lldb_private::CoreNote > m_notes
lldb::RegisterContextSP m_thread_reg_ctx_sp
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo(size_t max_size) const override
lldb_private::DataExtractor m_gpregset_data
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
llvm::StringRef m_siginfo_bytes
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
llvm::Triple & GetTriple()
Architecture triple accessor.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
lldb::pid_t GetProcessID() const
uint32_t GetUserID() const
llvm::StringRef GetNameAsStringRef() const
uint32_t GetGroupID() const
lldb::pid_t GetProcessSessionID() const
bool ProcessSessionIDIsValid() const
struct timespec GetSystemTime() const
lldb::pid_t GetParentProcessID() const
struct timespec GetUserTime() const
std::optional< int8_t > GetPriorityValue() const
struct timespec GetCumulativeSystemTime() const
bool ParentProcessIDIsValid() const
std::optional< bool > IsZombie() const
bool EffectiveUserIDIsValid() const
struct timespec GetCumulativeUserTime() const
bool EffectiveGroupIDIsValid() const
lldb::pid_t GetProcessGroupID() const
bool ProcessGroupIDIsValid() const
A plug-in interface definition class for debugging a process.
RegisterInfo interface to patch RegisterInfo structure for archs.
virtual uint32_t GetConcreteFrameIndex()
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static lldb::StopInfoSP CreateStopReasonWithSignal(Thread &thread, int signo, const char *description=nullptr, std::optional< int > code=std::nullopt)
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
virtual void DestroyThread()
virtual Unwind & GetUnwinder()
Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id=false)
Constructor.
lldb::ProcessSP GetProcess() const
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
@ eStateUnloaded
Process is object is valid, but not currently loaded.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
static size_t GetSize(const lldb_private::ArchSpec &arch)
static std::optional< ELFLinuxPrPsInfo > Populate(const lldb::ProcessSP &process_sp)
static size_t GetSize(const lldb_private::ArchSpec &arch)
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
static std::optional< ELFLinuxPrStatus > Populate(const lldb::ThreadSP &thread_sp)