53 :
Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
54 m_gpregset_data(td.gpregset), m_notes(td.notes),
55 m_siginfo(std::move(td.siginfo)) {}
73 uint32_t concrete_frame_idx = 0;
79 bool is_linux =
false;
80 if (concrete_frame_idx == 0) {
89 case llvm::Triple::FreeBSD: {
91 case llvm::Triple::aarch64:
92 case llvm::Triple::arm:
94 case llvm::Triple::ppc:
97 case llvm::Triple::ppc64:
100 case llvm::Triple::mips64:
103 case llvm::Triple::x86:
106 case llvm::Triple::x86_64:
115 case llvm::Triple::NetBSD: {
117 case llvm::Triple::aarch64:
119 case llvm::Triple::x86:
122 case llvm::Triple::x86_64:
131 case llvm::Triple::Linux: {
134 case llvm::Triple::aarch64:
136 case llvm::Triple::ppc64le:
139 case llvm::Triple::systemz:
142 case llvm::Triple::x86:
145 case llvm::Triple::x86_64:
154 case llvm::Triple::OpenBSD: {
156 case llvm::Triple::aarch64:
158 case llvm::Triple::x86:
161 case llvm::Triple::x86_64:
174 if (!reg_interface && arch.
GetMachine() != llvm::Triple::aarch64 &&
176 arch.
GetMachine() != llvm::Triple::loongarch64 &&
178 LLDB_LOGF(log,
"elf-core::%s:: Architecture(%d) or OS(%d) not supported",
180 assert(
false &&
"Architecture or OS not supported");
184 case llvm::Triple::aarch64:
188 case llvm::Triple::arm:
193 case llvm::Triple::loongarch64:
197 case llvm::Triple::riscv64:
201 case llvm::Triple::mipsel:
202 case llvm::Triple::mips:
206 case llvm::Triple::mips64:
207 case llvm::Triple::mips64el:
211 case llvm::Triple::ppc:
212 case llvm::Triple::ppc64:
216 case llvm::Triple::ppc64le:
220 case llvm::Triple::systemz:
224 case llvm::Triple::x86:
225 case llvm::Triple::x86_64:
251 if (!unix_signals_sp)
254 const char *sig_description;
256 if (description.empty())
257 sig_description =
nullptr;
259 sig_description = description.c_str();
274 constexpr size_t mips_linux_pr_status_size_o32 = 96;
275 constexpr size_t mips_linux_pr_status_size_n32 = 72;
276 constexpr size_t num_ptr_size_members = 10;
279 assert(!abi.empty() &&
"ABI is not set");
280 if (!abi.compare(
"n64"))
282 else if (!abi.compare(
"o32"))
283 return mips_linux_pr_status_size_o32;
285 return mips_linux_pr_status_size_n32;
304 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64,
346 return {
static_cast<sec_t
>(oth.tv_sec),
static_cast<usec_t
>(oth.tv_usec)};
349std::optional<ELFLinuxPrStatus>
352 prstatus.
pr_pid = thread_sp->GetID();
355 if (!process_sp->GetProcessInfo(info))
374 constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128;
377 if (address_byte_size == 8)
379 return mips_linux_pr_psinfo_size_o32_n32;
400 "NT_PRPSINFO size should be %zu, but the remaining bytes are: %" PRIu64,
444std::optional<ELFLinuxPrPsInfo>
447 if (!process_sp->GetProcessInfo(info))
450 return Populate(info, process_sp->GetState());
453std::optional<ELFLinuxPrPsInfo>
459 prpsinfo.pr_zomb = 0;
460 if (
auto zombie_opt = info.
IsZombie(); zombie_opt.value_or(
false)) {
461 prpsinfo.pr_zomb = 1;
477 switch (process_state) {
479 prpsinfo.pr_sname =
'S';
480 prpsinfo.pr_state = 1;
485 prpsinfo.pr_sname =
'T';
486 prpsinfo.pr_state = 3;
491 prpsinfo.pr_sname =
'R';
492 prpsinfo.pr_state = 0;
521 constexpr size_t fname_len = std::extent_v<
decltype(prpsinfo.pr_fname)>;
522 static_assert(fname_len > 0,
"This should always be non zero");
524 auto fname_begin = fname.begin();
525 std::copy_n(fname_begin, std::min(fname_len, fname.size()),
527 prpsinfo.pr_fname[fname_len - 1] =
'\0';
529 auto argentry_iterator = std::begin(args);
530 char *psargs = prpsinfo.pr_psargs;
531 char *psargs_end = std::end(prpsinfo.pr_psargs);
532 while (psargs < psargs_end && argentry_iterator != args.end()) {
533 llvm::StringRef argentry = argentry_iterator->ref();
535 std::min<size_t>(std::distance(psargs, psargs_end), argentry.size());
536 auto arg_iterator = std::begin(argentry);
537 psargs = std::copy_n(arg_iterator, len, psargs);
538 if (psargs != psargs_end)
542 *(psargs - 1) =
'\0';
570 "NT_SIGINFO size should be %zu, but the remaining bytes are: %" PRIu64,
623 return std::string();
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_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)
lldb::RegisterContextSP CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override
std::vector< lldb_private::CoreNote > m_notes
lldb::RegisterContextSP m_thread_reg_ctx_sp
lldb_private::DataExtractor m_gpregset_data
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
ELFLinuxSigInfo m_siginfo
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.
bool IsMIPS() const
if MIPS architecture return true.
std::string GetTargetABI() const
Return a string representing target application ABI.
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.
This base class provides an interface to stack frames.
uint32_t GetConcreteFrameIndex() const
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()
lldb::ProcessSP GetProcess() const
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
bool GetShouldStop(int32_t signo) const
std::string GetSignalDescription(int32_t signo, std::optional< int32_t > code=std::nullopt, std::optional< lldb::addr_t > addr=std::nullopt, std::optional< lldb::addr_t > lower=std::nullopt, std::optional< lldb::addr_t > upper=std::nullopt) const
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::UnixSignals > UnixSignalsSP
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::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)
struct ELFLinuxSigInfo::alignas::@76::@77 _addr_bnd
union ELFLinuxSigInfo::alignas::@76 bounds
struct ELFLinuxSigInfo::alignas sigfault
static size_t GetSize(const lldb_private::ArchSpec &arch)
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch, const lldb_private::UnixSignals &unix_signals)
SigInfoNoteType note_type
std::string GetDescription(const lldb_private::UnixSignals &unix_signals) const