LLDB mainline
ThreadElfCore.cpp
Go to the documentation of this file.
1//===-- ThreadElfCore.cpp -------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "lldb/Target/Target.h"
13#include "lldb/Target/Unwind.h"
16#include "lldb/Utility/Log.h"
18
33#include "ProcessElfCore.h"
44#include "ThreadElfCore.h"
45
46#include <memory>
47
48using namespace lldb;
49using namespace lldb_private;
50
51// Construct a Thread object with given data
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)) {}
56
58
60 GetRegisterContext()->InvalidateIfNeeded(false);
61}
62
64 if (!m_reg_context_sp) {
66 }
67 return m_reg_context_sp;
68}
69
72 RegisterContextSP reg_ctx_sp;
73 uint32_t concrete_frame_idx = 0;
74 Log *log = GetLog(LLDBLog::Thread);
75
76 if (frame)
77 concrete_frame_idx = frame->GetConcreteFrameIndex();
78
79 bool is_linux = false;
80 if (concrete_frame_idx == 0) {
83
84 ProcessElfCore *process = static_cast<ProcessElfCore *>(GetProcess().get());
85 ArchSpec arch = process->GetArchitecture();
86 RegisterInfoInterface *reg_interface = nullptr;
87
88 switch (arch.GetTriple().getOS()) {
89 case llvm::Triple::FreeBSD: {
90 switch (arch.GetMachine()) {
91 case llvm::Triple::aarch64:
92 case llvm::Triple::arm:
93 break;
94 case llvm::Triple::ppc:
95 reg_interface = new RegisterContextFreeBSD_powerpc32(arch);
96 break;
97 case llvm::Triple::ppc64:
98 reg_interface = new RegisterContextFreeBSD_powerpc64(arch);
99 break;
100 case llvm::Triple::mips64:
101 reg_interface = new RegisterContextFreeBSD_mips64(arch);
102 break;
103 case llvm::Triple::x86:
104 reg_interface = new RegisterContextFreeBSD_i386(arch);
105 break;
106 case llvm::Triple::x86_64:
107 reg_interface = new RegisterContextFreeBSD_x86_64(arch);
108 break;
109 default:
110 break;
111 }
112 break;
113 }
114
115 case llvm::Triple::NetBSD: {
116 switch (arch.GetMachine()) {
117 case llvm::Triple::aarch64:
118 break;
119 case llvm::Triple::x86:
120 reg_interface = new RegisterContextNetBSD_i386(arch);
121 break;
122 case llvm::Triple::x86_64:
123 reg_interface = new RegisterContextNetBSD_x86_64(arch);
124 break;
125 default:
126 break;
127 }
128 break;
129 }
130
131 case llvm::Triple::Linux: {
132 is_linux = true;
133 switch (arch.GetMachine()) {
134 case llvm::Triple::aarch64:
135 break;
136 case llvm::Triple::ppc64le:
137 reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
138 break;
139 case llvm::Triple::systemz:
140 reg_interface = new RegisterContextLinux_s390x(arch);
141 break;
142 case llvm::Triple::x86:
143 reg_interface = new RegisterContextLinux_i386(arch);
144 break;
145 case llvm::Triple::x86_64:
146 reg_interface = new RegisterContextLinux_x86_64(arch);
147 break;
148 default:
149 break;
150 }
151 break;
152 }
153
154 case llvm::Triple::OpenBSD: {
155 switch (arch.GetMachine()) {
156 case llvm::Triple::aarch64:
157 break;
158 case llvm::Triple::x86:
159 reg_interface = new RegisterContextOpenBSD_i386(arch);
160 break;
161 case llvm::Triple::x86_64:
162 reg_interface = new RegisterContextOpenBSD_x86_64(arch);
163 break;
164 default:
165 break;
166 }
167 break;
168 }
169
170 default:
171 break;
172 }
173
174 if (!reg_interface && arch.GetMachine() != llvm::Triple::aarch64 &&
175 arch.GetMachine() != llvm::Triple::arm &&
176 arch.GetMachine() != llvm::Triple::loongarch64 &&
177 arch.GetMachine() != llvm::Triple::riscv64) {
178 LLDB_LOGF(log, "elf-core::%s:: Architecture(%d) or OS(%d) not supported",
179 __FUNCTION__, arch.GetMachine(), arch.GetTriple().getOS());
180 assert(false && "Architecture or OS not supported");
181 }
182
183 switch (arch.GetMachine()) {
184 case llvm::Triple::aarch64:
186 *this, arch, m_gpregset_data, m_notes);
187 break;
188 case llvm::Triple::arm:
189 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_arm>(
190 *this, std::make_unique<RegisterInfoPOSIX_arm>(arch), m_gpregset_data,
191 m_notes);
192 break;
193 case llvm::Triple::loongarch64:
195 *this, arch, m_gpregset_data, m_notes);
196 break;
197 case llvm::Triple::riscv64:
199 *this, arch, m_gpregset_data, m_notes);
200 break;
201 case llvm::Triple::mipsel:
202 case llvm::Triple::mips:
203 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_mips64>(
204 *this, reg_interface, m_gpregset_data, m_notes);
205 break;
206 case llvm::Triple::mips64:
207 case llvm::Triple::mips64el:
208 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_mips64>(
209 *this, reg_interface, m_gpregset_data, m_notes);
210 break;
211 case llvm::Triple::ppc:
212 case llvm::Triple::ppc64:
213 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_powerpc>(
214 *this, reg_interface, m_gpregset_data, m_notes);
215 break;
216 case llvm::Triple::ppc64le:
217 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_ppc64le>(
218 *this, reg_interface, m_gpregset_data, m_notes);
219 break;
220 case llvm::Triple::systemz:
221 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_s390x>(
222 *this, reg_interface, m_gpregset_data, m_notes);
223 break;
224 case llvm::Triple::x86:
225 case llvm::Triple::x86_64:
226 if (is_linux) {
227 m_thread_reg_ctx_sp = std::make_shared<RegisterContextLinuxCore_x86_64>(
228 *this, reg_interface, m_gpregset_data, m_notes);
229 } else {
230 m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
231 *this, reg_interface, m_gpregset_data, m_notes);
232 }
233 break;
234 default:
235 break;
236 }
237
238 reg_ctx_sp = m_thread_reg_ctx_sp;
239 } else {
240 reg_ctx_sp = GetUnwinder().CreateRegisterContextForFrame(frame);
241 }
242 return reg_ctx_sp;
243}
244
246 ProcessSP process_sp(GetProcess());
247 if (!process_sp)
248 return false;
249
250 lldb::UnixSignalsSP unix_signals_sp(process_sp->GetUnixSignals());
251 if (!unix_signals_sp)
252 return false;
253
254 const char *sig_description;
255 std::string description = m_siginfo.GetDescription(*unix_signals_sp);
256 if (description.empty())
257 sig_description = nullptr;
258 else
259 sig_description = description.c_str();
260
262 *this, m_siginfo.si_signo, sig_description, m_siginfo.si_code));
263
265 return true;
266}
267
268// Parse PRSTATUS from NOTE entry
270 memset(this, 0, sizeof(ELFLinuxPrStatus));
271}
272
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;
277 if (arch.IsMIPS()) {
278 std::string abi = arch.GetTargetABI();
279 assert(!abi.empty() && "ABI is not set");
280 if (!abi.compare("n64"))
281 return sizeof(ELFLinuxPrStatus);
282 else if (!abi.compare("o32"))
283 return mips_linux_pr_status_size_o32;
284 // N32 ABI
285 return mips_linux_pr_status_size_n32;
286 }
287 switch (arch.GetCore()) {
290 return 72;
291 default:
292 if (arch.GetAddressByteSize() == 8)
293 return sizeof(ELFLinuxPrStatus);
294 else
295 return sizeof(ELFLinuxPrStatus) - num_ptr_size_members * 4;
296 }
297}
298
300 const ArchSpec &arch) {
302 if (GetSize(arch) > data.GetByteSize()) {
304 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64,
305 GetSize(arch), data.GetByteSize());
306 return error;
307 }
308
309 // Read field by field to correctly account for endianess of both the core
310 // dump and the platform running lldb.
311 offset_t offset = 0;
312 si_signo = data.GetU32(&offset);
313 si_code = data.GetU32(&offset);
314 si_errno = data.GetU32(&offset);
315
316 pr_cursig = data.GetU16(&offset);
317 offset += 2; // pad
318
319 pr_sigpend = data.GetAddress(&offset);
320 pr_sighold = data.GetAddress(&offset);
321
322 pr_pid = data.GetU32(&offset);
323 pr_ppid = data.GetU32(&offset);
324 pr_pgrp = data.GetU32(&offset);
325 pr_sid = data.GetU32(&offset);
326
327 pr_utime.tv_sec = data.GetAddress(&offset);
328 pr_utime.tv_usec = data.GetAddress(&offset);
329
330 pr_stime.tv_sec = data.GetAddress(&offset);
331 pr_stime.tv_usec = data.GetAddress(&offset);
332
333 pr_cutime.tv_sec = data.GetAddress(&offset);
334 pr_cutime.tv_usec = data.GetAddress(&offset);
335
336 pr_cstime.tv_sec = data.GetAddress(&offset);
337 pr_cstime.tv_usec = data.GetAddress(&offset);
338
339 return error;
340}
341
342static struct compat_timeval
343copy_timespecs(const ProcessInstanceInfo::timespec &oth) {
344 using sec_t = decltype(compat_timeval::tv_sec);
345 using usec_t = decltype(compat_timeval::tv_usec);
346 return {static_cast<sec_t>(oth.tv_sec), static_cast<usec_t>(oth.tv_usec)};
347}
348
349std::optional<ELFLinuxPrStatus>
351 ELFLinuxPrStatus prstatus{};
352 prstatus.pr_pid = thread_sp->GetID();
353 lldb::ProcessSP process_sp = thread_sp->GetProcess();
355 if (!process_sp->GetProcessInfo(info))
356 return std::nullopt;
357
358 prstatus.pr_ppid = info.GetParentProcessID();
359 prstatus.pr_pgrp = info.GetProcessGroupID();
360 prstatus.pr_sid = info.GetProcessSessionID();
361 prstatus.pr_utime = copy_timespecs(info.GetUserTime());
362 prstatus.pr_stime = copy_timespecs(info.GetSystemTime());
363 prstatus.pr_cutime = copy_timespecs(info.GetCumulativeUserTime());
364 prstatus.pr_cstime = copy_timespecs(info.GetCumulativeSystemTime());
365 return prstatus;
366}
367
368// Parse PRPSINFO from NOTE entry
370 memset(this, 0, sizeof(ELFLinuxPrPsInfo));
371}
372
374 constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128;
375 if (arch.IsMIPS()) {
376 uint8_t address_byte_size = arch.GetAddressByteSize();
377 if (address_byte_size == 8)
378 return sizeof(ELFLinuxPrPsInfo);
379 return mips_linux_pr_psinfo_size_o32_n32;
380 }
381
382 switch (arch.GetCore()) {
385 return sizeof(ELFLinuxPrPsInfo);
388 return 124;
389 default:
390 return 0;
391 }
392}
393
395 const ArchSpec &arch) {
397 ByteOrder byteorder = data.GetByteOrder();
398 if (GetSize(arch) > data.GetByteSize()) {
400 "NT_PRPSINFO size should be %zu, but the remaining bytes are: %" PRIu64,
401 GetSize(arch), data.GetByteSize());
402 return error;
403 }
404 size_t size = 0;
405 offset_t offset = 0;
406
407 pr_state = data.GetU8(&offset);
408 pr_sname = data.GetU8(&offset);
409 pr_zomb = data.GetU8(&offset);
410 pr_nice = data.GetU8(&offset);
411 if (data.GetAddressByteSize() == 8) {
412 // Word align the next field on 64 bit.
413 offset += 4;
414 }
415
416 pr_flag = data.GetAddress(&offset);
417
418 if (arch.IsMIPS()) {
419 // The pr_uid and pr_gid is always 32 bit irrespective of platforms
420 pr_uid = data.GetU32(&offset);
421 pr_gid = data.GetU32(&offset);
422 } else {
423 // 16 bit on 32 bit platforms, 32 bit on 64 bit platforms
424 pr_uid = data.GetMaxU64(&offset, data.GetAddressByteSize() >> 1);
425 pr_gid = data.GetMaxU64(&offset, data.GetAddressByteSize() >> 1);
426 }
427
428 pr_pid = data.GetU32(&offset);
429 pr_ppid = data.GetU32(&offset);
430 pr_pgrp = data.GetU32(&offset);
431 pr_sid = data.GetU32(&offset);
432
433 size = 16;
434 data.ExtractBytes(offset, size, byteorder, pr_fname);
435 offset += size;
436
437 size = 80;
438 data.ExtractBytes(offset, size, byteorder, pr_psargs);
439 offset += size;
440
441 return error;
442}
443
444std::optional<ELFLinuxPrPsInfo>
447 if (!process_sp->GetProcessInfo(info))
448 return std::nullopt;
449
450 return Populate(info, process_sp->GetState());
451}
452
453std::optional<ELFLinuxPrPsInfo>
455 lldb::StateType process_state) {
456 ELFLinuxPrPsInfo prpsinfo{};
457 prpsinfo.pr_pid = info.GetProcessID();
458 prpsinfo.pr_nice = info.GetPriorityValue().value_or(0);
459 prpsinfo.pr_zomb = 0;
460 if (auto zombie_opt = info.IsZombie(); zombie_opt.value_or(false)) {
461 prpsinfo.pr_zomb = 1;
462 }
463 /**
464 * In the linux kernel this comes from:
465 * state = READ_ONCE(p->__state);
466 * i = state ? ffz(~state) + 1 : 0;
467 * psinfo->pr_sname = (i > 5) ? '.' : "RSDTZW"[i];
468 *
469 * So we replicate that here. From proc_pid_stats(5)
470 * R = Running
471 * S = Sleeping on uninterrutible wait
472 * D = Waiting on uninterruptable disk sleep
473 * T = Tracing stop
474 * Z = Zombie
475 * W = Paging
476 */
477 switch (process_state) {
479 prpsinfo.pr_sname = 'S';
480 prpsinfo.pr_state = 1;
481 break;
483 [[fallthrough]];
485 prpsinfo.pr_sname = 'T';
486 prpsinfo.pr_state = 3;
487 break;
489 [[fallthrough]];
491 prpsinfo.pr_sname = 'R';
492 prpsinfo.pr_state = 0;
493 break;
494 default:
495 break;
496 }
497
498 /**
499 * pr_flags is left as 0. The values (in linux) are specific
500 * to the kernel. We recover them from the proc filesystem
501 * but don't put them in ProcessInfo because it would really
502 * become very linux specific and the utility here seems pretty
503 * dubious
504 */
505
506 if (info.EffectiveUserIDIsValid())
507 prpsinfo.pr_uid = info.GetUserID();
508
509 if (info.EffectiveGroupIDIsValid())
510 prpsinfo.pr_gid = info.GetGroupID();
511
512 if (info.ParentProcessIDIsValid())
513 prpsinfo.pr_ppid = info.GetParentProcessID();
514
515 if (info.ProcessGroupIDIsValid())
516 prpsinfo.pr_pgrp = info.GetProcessGroupID();
517
518 if (info.ProcessSessionIDIsValid())
519 prpsinfo.pr_sid = info.GetProcessSessionID();
520
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");
523 const llvm::StringRef fname = info.GetNameAsStringRef();
524 auto fname_begin = fname.begin();
525 std::copy_n(fname_begin, std::min(fname_len, fname.size()),
526 prpsinfo.pr_fname);
527 prpsinfo.pr_fname[fname_len - 1] = '\0';
528 auto args = info.GetArguments();
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();
534 size_t len =
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)
539 *(psargs++) = ' ';
540 ++argentry_iterator;
541 }
542 *(psargs - 1) = '\0';
543 return prpsinfo;
544}
545
546// Parse SIGINFO from NOTE entry
548
550 if (arch.IsMIPS())
551 return sizeof(ELFLinuxSigInfo);
552 switch (arch.GetCore()) {
554 return sizeof(ELFLinuxSigInfo);
558 return 12;
559 default:
560 return 0;
561 }
562}
563
565 const lldb_private::UnixSignals &unix_signals) {
567 uint64_t size = GetSize(arch);
568 if (size > data.GetByteSize()) {
570 "NT_SIGINFO size should be %zu, but the remaining bytes are: %" PRIu64,
571 GetSize(arch), data.GetByteSize());
572 return error;
573 }
574
575 // Set that we've parsed the siginfo from a SIGINFO note.
577 // Parsing from a 32 bit ELF core file, and populating/reusing the structure
578 // properly, because the struct is for the 64 bit version
579 offset_t offset = 0;
580 si_signo = data.GetU32(&offset);
581 si_errno = data.GetU32(&offset);
582 si_code = data.GetU32(&offset);
583 // 64b ELF have a 4 byte pad.
584 if (data.GetAddressByteSize() == 8)
585 offset += 4;
586 // Not every stop signal has a valid address, but that will get resolved in
587 // the unix_signals.GetSignalDescription() call below.
588 if (unix_signals.GetShouldStop(si_signo)) {
589 // Instead of memcpy we call all these individually as the extractor will
590 // handle endianness for us.
591 sigfault.si_addr = data.GetAddress(&offset);
592 sigfault.si_addr_lsb = data.GetU16(&offset);
593 if (data.GetByteSize() - offset >= sizeof(sigfault.bounds)) {
594 sigfault.bounds._addr_bnd._lower = data.GetAddress(&offset);
595 sigfault.bounds._addr_bnd._upper = data.GetAddress(&offset);
596 sigfault.bounds._pkey = data.GetU32(&offset);
597 } else {
598 // Set these to 0 so we don't use bogus data for the description.
602 }
603 }
604
605 return error;
606}
607
609 const lldb_private::UnixSignals &unix_signals) const {
610 if (unix_signals.GetShouldStop(si_signo) && note_type == eNT_SIGINFO) {
612 return unix_signals.GetSignalDescription(
615 else
616 return unix_signals.GetSignalDescription(si_signo, si_code,
618 }
619
620 // This looks weird, but there is an existing pattern where we don't pass a
621 // description to keep up with that, we return empty here, and then the above
622 // function will set the description whether or not this is empty.
623 return std::string();
624}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
Definition: Log.h:376
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.
Definition: ArchSpec.h:31
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:709
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:461
bool IsMIPS() const
if MIPS architecture return true.
Definition: ArchSpec.cpp:577
std::string GetTargetABI() const
Return a string representing target application ABI.
Definition: ArchSpec.cpp:579
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:701
Core GetCore() const
Definition: ArchSpec.h:440
An data extractor class.
Definition: DataExtractor.h:48
uint32_t GetU32(lldb::offset_t *offset_ptr) const
Extract a uint32_t value from *offset_ptr.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
uint64_t GetAddress(lldb::offset_t *offset_ptr) const
Extract an address from *offset_ptr.
uint16_t GetU16(lldb::offset_t *offset_ptr) const
Extract a uint16_t value from *offset_ptr.
uint32_t GetAddressByteSize() const
Get the current address size.
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
uint8_t GetU8(lldb::offset_t *offset_ptr) const
Extract a uint8_t value from *offset_ptr.
size_t ExtractBytes(lldb::offset_t offset, lldb::offset_t length, lldb::ByteOrder dst_byte_order, void *dst) const
Extract an arbitrary number of bytes in the specified byte order.
lldb::pid_t GetProcessID() const
Definition: ProcessInfo.h:68
uint32_t GetUserID() const
Definition: ProcessInfo.h:50
llvm::StringRef GetNameAsStringRef() const
Definition: ProcessInfo.cpp:49
uint32_t GetGroupID() const
Definition: ProcessInfo.h:52
lldb::pid_t GetProcessSessionID() const
Definition: ProcessInfo.h:188
struct timespec GetSystemTime() const
Definition: ProcessInfo.h:206
lldb::pid_t GetParentProcessID() const
Definition: ProcessInfo.h:172
struct timespec GetUserTime() const
Definition: ProcessInfo.h:198
std::optional< int8_t > GetPriorityValue() const
Definition: ProcessInfo.h:240
struct timespec GetCumulativeSystemTime() const
Definition: ProcessInfo.h:227
std::optional< bool > IsZombie() const
Definition: ProcessInfo.h:248
struct timespec GetCumulativeUserTime() const
Definition: ProcessInfo.h:214
lldb::pid_t GetProcessGroupID() const
Definition: ProcessInfo.h:180
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
RegisterInfo interface to patch RegisterInfo structure for archs.
This base class provides an interface to stack frames.
Definition: StackFrame.h:44
uint32_t GetConcreteFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
Definition: StackFrame.h:448
An error handling class.
Definition: Status.h:115
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition: Status.cpp:106
static lldb::StopInfoSP CreateStopReasonWithSignal(Thread &thread, int signo, const char *description=nullptr, std::optional< int > code=std::nullopt)
Definition: StopInfo.cpp:1466
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
Definition: Thread.cpp:463
virtual void DestroyThread()
Definition: Thread.cpp:251
virtual Unwind & GetUnwinder()
Definition: Thread.cpp:1915
lldb::ProcessSP GetProcess() const
Definition: Thread.h:157
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
Definition: Thread.h:1306
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
Definition: Thread.h:1319
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)
Definition: Unwind.h:56
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.
Definition: Log.h:332
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:450
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
Definition: lldb-forward.h:480
uint64_t offset_t
Definition: lldb-types.h:85
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
Definition: lldb-forward.h:389
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Definition: lldb-forward.h:394
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)
uint64_t pr_sighold
Definition: ThreadElfCore.h:49
compat_timeval pr_cutime
Definition: ThreadElfCore.h:58
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
uint64_t pr_sigpend
Definition: ThreadElfCore.h:48
compat_timeval pr_stime
Definition: ThreadElfCore.h:57
compat_timeval pr_utime
Definition: ThreadElfCore.h:56
static std::optional< ELFLinuxPrStatus > Populate(const lldb::ThreadSP &thread_sp)
compat_timeval pr_cstime
Definition: ThreadElfCore.h:59
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
uint64_t tv_sec
Definition: ThreadElfCore.h:20
uint64_t tv_usec
Definition: ThreadElfCore.h:21