51 :
Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
52 m_signo(td.signo), m_code(td.code), m_gpregset_data(td.gpregset),
71 uint32_t concrete_frame_idx = 0;
77 bool is_linux =
false;
78 if (concrete_frame_idx == 0) {
87 case llvm::Triple::FreeBSD: {
89 case llvm::Triple::aarch64:
90 case llvm::Triple::arm:
92 case llvm::Triple::ppc:
95 case llvm::Triple::ppc64:
98 case llvm::Triple::mips64:
101 case llvm::Triple::x86:
104 case llvm::Triple::x86_64:
113 case llvm::Triple::NetBSD: {
115 case llvm::Triple::aarch64:
117 case llvm::Triple::x86:
120 case llvm::Triple::x86_64:
129 case llvm::Triple::Linux: {
132 case llvm::Triple::aarch64:
134 case llvm::Triple::ppc64le:
137 case llvm::Triple::systemz:
140 case llvm::Triple::x86:
143 case llvm::Triple::x86_64:
152 case llvm::Triple::OpenBSD: {
154 case llvm::Triple::aarch64:
156 case llvm::Triple::x86:
159 case llvm::Triple::x86_64:
172 if (!reg_interface && arch.
GetMachine() != llvm::Triple::aarch64 &&
175 LLDB_LOGF(log,
"elf-core::%s:: Architecture(%d) or OS(%d) not supported",
177 assert(
false &&
"Architecture or OS not supported");
181 case llvm::Triple::aarch64:
185 case llvm::Triple::arm:
190 case llvm::Triple::riscv64:
194 case llvm::Triple::mipsel:
195 case llvm::Triple::mips:
199 case llvm::Triple::mips64:
200 case llvm::Triple::mips64el:
204 case llvm::Triple::ppc:
205 case llvm::Triple::ppc64:
209 case llvm::Triple::ppc64le:
213 case llvm::Triple::systemz:
217 case llvm::Triple::x86:
218 case llvm::Triple::x86_64:
254 constexpr size_t mips_linux_pr_status_size_o32 = 96;
255 constexpr size_t mips_linux_pr_status_size_n32 = 72;
256 constexpr size_t num_ptr_size_members = 10;
259 assert(!abi.empty() &&
"ABI is not set");
260 if (!abi.compare(
"n64"))
262 else if (!abi.compare(
"o32"))
263 return mips_linux_pr_status_size_o32;
265 return mips_linux_pr_status_size_n32;
283 error.SetErrorStringWithFormat(
284 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64,
326 return {
static_cast<sec_t
>(oth.tv_sec),
static_cast<usec_t
>(oth.tv_usec)};
329std::optional<ELFLinuxPrStatus>
332 prstatus.
pr_pid = thread_sp->GetID();
335 if (!process_sp->GetProcessInfo(info))
354 constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128;
357 if (address_byte_size == 8)
359 return mips_linux_pr_psinfo_size_o32_n32;
379 error.SetErrorStringWithFormat(
380 "NT_PRPSINFO size should be %zu, but the remaining bytes are: %" PRIu64,
424std::optional<ELFLinuxPrPsInfo>
427 if (!process_sp->GetProcessInfo(info))
430 return Populate(info, process_sp->GetState());
433std::optional<ELFLinuxPrPsInfo>
439 prpsinfo.pr_zomb = 0;
440 if (
auto zombie_opt = info.
IsZombie(); zombie_opt.value_or(
false)) {
441 prpsinfo.pr_zomb = 1;
457 switch (process_state) {
459 prpsinfo.pr_sname =
'S';
460 prpsinfo.pr_state = 1;
465 prpsinfo.pr_sname =
'T';
466 prpsinfo.pr_state = 3;
471 prpsinfo.pr_sname =
'R';
472 prpsinfo.pr_state = 0;
501 constexpr size_t fname_len = std::extent_v<
decltype(prpsinfo.pr_fname)>;
502 static_assert(fname_len > 0,
"This should always be non zero");
504 auto fname_begin = fname.begin();
505 std::copy_n(fname_begin, std::min(fname_len, fname.size()),
507 prpsinfo.pr_fname[fname_len - 1] =
'\0';
509 auto argentry_iterator = std::begin(args);
510 char *psargs = prpsinfo.pr_psargs;
511 char *psargs_end = std::end(prpsinfo.pr_psargs);
512 while (psargs < psargs_end && argentry_iterator != args.end()) {
513 llvm::StringRef argentry = argentry_iterator->ref();
515 std::min<size_t>(std::distance(psargs, psargs_end), argentry.size());
516 auto arg_iterator = std::begin(argentry);
517 psargs = std::copy_n(arg_iterator, len, psargs);
518 if (psargs != psargs_end)
522 *(psargs - 1) =
'\0';
547 error.SetErrorStringWithFormat(
548 "NT_SIGINFO size should be %zu, but the remaining bytes are: %" PRIu64,
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_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.
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 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::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
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)
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
static size_t GetSize(const lldb_private::ArchSpec &arch)