74 uint32_t concrete_frame_idx = 0;
80 bool is_linux =
false;
81 if (concrete_frame_idx == 0) {
90 case llvm::Triple::FreeBSD: {
92 case llvm::Triple::aarch64:
93 case llvm::Triple::arm:
95 case llvm::Triple::ppc:
98 case llvm::Triple::ppc64:
99 case llvm::Triple::ppc64le:
102 case llvm::Triple::mips64:
105 case llvm::Triple::x86:
108 case llvm::Triple::x86_64:
117 case llvm::Triple::NetBSD: {
119 case llvm::Triple::aarch64:
121 case llvm::Triple::x86:
124 case llvm::Triple::x86_64:
133 case llvm::Triple::Linux: {
136 case llvm::Triple::aarch64:
138 case llvm::Triple::ppc64le:
141 case llvm::Triple::systemz:
144 case llvm::Triple::x86:
147 case llvm::Triple::x86_64:
156 case llvm::Triple::OpenBSD: {
158 case llvm::Triple::aarch64:
160 case llvm::Triple::x86:
163 case llvm::Triple::x86_64:
176 if (!reg_interface && arch.
GetMachine() != llvm::Triple::aarch64 &&
178 arch.
GetMachine() != llvm::Triple::loongarch64 &&
181 LLDB_LOGF(log,
"elf-core::%s:: Architecture(%d) or OS(%d) not supported",
183 assert(
false &&
"Architecture or OS not supported");
187 case llvm::Triple::aarch64:
191 case llvm::Triple::arm:
196 case llvm::Triple::loongarch64:
200 case llvm::Triple::riscv32:
204 case llvm::Triple::riscv64:
208 case llvm::Triple::mipsel:
209 case llvm::Triple::mips:
213 case llvm::Triple::mips64:
214 case llvm::Triple::mips64el:
218 case llvm::Triple::ppc:
219 case llvm::Triple::ppc64:
223 case llvm::Triple::ppc64le:
227 case llvm::Triple::systemz:
231 case llvm::Triple::x86:
232 case llvm::Triple::x86_64:
252llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
255 return llvm::createStringError(llvm::inconvertibleErrorCode(),
259 "siginfo note bytes");
267 PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
289 constexpr size_t mips_linux_pr_status_size_o32 = 96;
290 constexpr size_t mips_linux_pr_status_size_n32 = 72;
291 constexpr size_t num_ptr_size_members = 10;
294 assert(!abi.empty() &&
"ABI is not set");
297 else if (abi ==
"o32")
298 return mips_linux_pr_status_size_o32;
300 return mips_linux_pr_status_size_n32;
319 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64,
361 return {
static_cast<sec_t
>(oth.tv_sec),
static_cast<usec_t
>(oth.tv_usec)};
364std::optional<ELFLinuxPrStatus>
367 prstatus.
pr_pid = thread_sp->GetID();
370 if (!process_sp->GetProcessInfo(info))
389 constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128;
392 if (address_byte_size == 8)
394 return mips_linux_pr_psinfo_size_o32_n32;
415 "NT_PRPSINFO size should be %zu, but the remaining bytes are: %" PRIu64,
459std::optional<ELFLinuxPrPsInfo>
462 if (!process_sp->GetProcessInfo(info))
465 return Populate(info, process_sp->GetState());
468std::optional<ELFLinuxPrPsInfo>
475 if (
auto zombie_opt = info.
IsZombie(); zombie_opt.value_or(
false)) {
492 switch (process_state) {
536 constexpr size_t fname_len = std::extent_v<
decltype(prpsinfo.
pr_fname)>;
537 static_assert(fname_len > 0,
"This should always be non zero");
539 auto fname_begin = fname.begin();
540 std::copy_n(fname_begin, std::min(fname_len, fname.size()),
542 prpsinfo.
pr_fname[fname_len - 1] =
'\0';
544 auto argentry_iterator = std::begin(args);
546 char *psargs_end = std::end(prpsinfo.
pr_psargs);
547 while (psargs < psargs_end && argentry_iterator != args.end()) {
548 llvm::StringRef argentry = argentry_iterator->ref();
550 std::min<size_t>(std::distance(psargs, psargs_end), argentry.size());
551 auto arg_iterator = std::begin(argentry);
552 psargs = std::copy_n(arg_iterator, len, psargs);
553 if (psargs != psargs_end)
557 *(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.
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.
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()
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)