LLDB  mainline
NativeThreadLinux.cpp
Go to the documentation of this file.
1 //===-- NativeThreadLinux.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 
9 #include "NativeThreadLinux.h"
10 
11 #include <csignal>
12 #include <sstream>
13 
14 #include "NativeProcessLinux.h"
16 #include "SingleStepCheck.h"
17 
19 #include "lldb/Host/linux/Ptrace.h"
22 #include "lldb/Utility/LLDBLog.h"
23 #include "lldb/Utility/Log.h"
24 #include "lldb/Utility/State.h"
25 #include "lldb/lldb-enumerations.h"
26 
27 #include "llvm/ADT/SmallString.h"
28 
31 
32 #include <sys/syscall.h>
33 // Try to define a macro to encapsulate the tgkill syscall
34 #define tgkill(pid, tid, sig) \
35  syscall(__NR_tgkill, static_cast<::pid_t>(pid), static_cast<::pid_t>(tid), \
36  sig)
37 
38 using namespace lldb;
39 using namespace lldb_private;
40 using namespace lldb_private::process_linux;
41 
42 namespace {
43 void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
44  const char *const header) {
45  switch (stop_info.reason) {
46  case eStopReasonNone:
47  log.Printf("%s: %s no stop reason", __FUNCTION__, header);
48  return;
49  case eStopReasonTrace:
50  log.Printf("%s: %s trace, stopping signal 0x%" PRIx32, __FUNCTION__, header,
51  stop_info.signo);
52  return;
54  log.Printf("%s: %s breakpoint, stopping signal 0x%" PRIx32, __FUNCTION__,
55  header, stop_info.signo);
56  return;
58  log.Printf("%s: %s watchpoint, stopping signal 0x%" PRIx32, __FUNCTION__,
59  header, stop_info.signo);
60  return;
61  case eStopReasonSignal:
62  log.Printf("%s: %s signal 0x%02" PRIx32, __FUNCTION__, header,
63  stop_info.signo);
64  return;
66  log.Printf("%s: %s exception type 0x%02" PRIx64, __FUNCTION__, header,
67  stop_info.details.exception.type);
68  return;
69  case eStopReasonExec:
70  log.Printf("%s: %s exec, stopping signal 0x%" PRIx32, __FUNCTION__, header,
71  stop_info.signo);
72  return;
74  log.Printf("%s: %s plan complete", __FUNCTION__, header);
75  return;
77  log.Printf("%s: %s thread exiting", __FUNCTION__, header);
78  return;
80  log.Printf("%s: %s instrumentation", __FUNCTION__, header);
81  return;
83  log.Printf("%s: %s processor trace", __FUNCTION__, header);
84  return;
85  default:
86  log.Printf("%s: %s invalid stop reason %" PRIu32, __FUNCTION__, header,
87  static_cast<uint32_t>(stop_info.reason));
88  }
89 }
90 }
91 
92 NativeThreadLinux::NativeThreadLinux(NativeProcessLinux &process,
93  lldb::tid_t tid)
94  : NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
95  m_stop_info(),
96  m_reg_context_up(
97  NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
98  process.GetArchitecture(), *this)),
99  m_stop_description() {}
100 
102  NativeProcessLinux &process = GetProcess();
103 
104  auto BufferOrError = getProcFile(process.GetID(), GetID(), "comm");
105  if (!BufferOrError)
106  return "";
107  return std::string(BufferOrError.get()->getBuffer().rtrim('\n'));
108 }
109 
111 
113  std::string &description) {
114  Log *log = GetLog(LLDBLog::Thread);
115 
116  description.clear();
117 
118  switch (m_state) {
119  case eStateStopped:
120  case eStateCrashed:
121  case eStateExited:
122  case eStateSuspended:
123  case eStateUnloaded:
124  if (log)
125  LogThreadStopInfo(*log, m_stop_info, "m_stop_info in thread:");
126  stop_info = m_stop_info;
127  description = m_stop_description;
128  if (log)
129  LogThreadStopInfo(*log, stop_info, "returned stop_info:");
130 
131  return true;
132 
133  case eStateInvalid:
134  case eStateConnected:
135  case eStateAttaching:
136  case eStateLaunching:
137  case eStateRunning:
138  case eStateStepping:
139  case eStateDetached:
140  if (log) {
141  LLDB_LOGF(log,
142  "NativeThreadLinux::%s tid %" PRIu64
143  " in state %s cannot answer stop reason",
144  __FUNCTION__, GetID(), StateAsCString(m_state));
145  }
146  return false;
147  }
148  llvm_unreachable("unhandled StateType!");
149 }
150 
152  uint32_t watch_flags, bool hardware) {
153  if (!hardware)
154  return Status("not implemented");
155  if (m_state == eStateLaunching)
156  return Status();
157  Status error = RemoveWatchpoint(addr);
158  if (error.Fail())
159  return error;
160  uint32_t wp_index =
161  m_reg_context_up->SetHardwareWatchpoint(addr, size, watch_flags);
162  if (wp_index == LLDB_INVALID_INDEX32)
163  return Status("Setting hardware watchpoint failed.");
164  m_watchpoint_index_map.insert({addr, wp_index});
165  return Status();
166 }
167 
169  auto wp = m_watchpoint_index_map.find(addr);
170  if (wp == m_watchpoint_index_map.end())
171  return Status();
172  uint32_t wp_index = wp->second;
173  m_watchpoint_index_map.erase(wp);
174  if (m_reg_context_up->ClearHardwareWatchpoint(wp_index))
175  return Status();
176  return Status("Clearing hardware watchpoint failed.");
177 }
178 
180  size_t size) {
181  if (m_state == eStateLaunching)
182  return Status();
183 
185  if (error.Fail())
186  return error;
187 
188  uint32_t bp_index = m_reg_context_up->SetHardwareBreakpoint(addr, size);
189 
190  if (bp_index == LLDB_INVALID_INDEX32)
191  return Status("Setting hardware breakpoint failed.");
192 
193  m_hw_break_index_map.insert({addr, bp_index});
194  return Status();
195 }
196 
198  auto bp = m_hw_break_index_map.find(addr);
199  if (bp == m_hw_break_index_map.end())
200  return Status();
201 
202  uint32_t bp_index = bp->second;
203  if (m_reg_context_up->ClearHardwareBreakpoint(bp_index)) {
204  m_hw_break_index_map.erase(bp);
205  return Status();
206  }
207 
208  return Status("Clearing hardware breakpoint failed.");
209 }
210 
212  const StateType new_state = StateType::eStateRunning;
213  MaybeLogStateChange(new_state);
214  m_state = new_state;
215 
217  m_stop_description.clear();
218 
219  // If watchpoints have been set, but none on this thread, then this is a new
220  // thread. So set all existing watchpoints.
221  if (m_watchpoint_index_map.empty()) {
222  NativeProcessLinux &process = GetProcess();
223 
224  const auto &watchpoint_map = process.GetWatchpointMap();
225  m_reg_context_up->ClearAllHardwareWatchpoints();
226  for (const auto &pair : watchpoint_map) {
227  const auto &wp = pair.second;
228  SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags, wp.m_hardware);
229  }
230  }
231 
232  // Set all active hardware breakpoint on all threads.
233  if (m_hw_break_index_map.empty()) {
234  NativeProcessLinux &process = GetProcess();
235 
236  const auto &hw_breakpoint_map = process.GetHardwareBreakpointMap();
237  m_reg_context_up->ClearAllHardwareBreakpoints();
238  for (const auto &pair : hw_breakpoint_map) {
239  const auto &bp = pair.second;
240  SetHardwareBreakpoint(bp.m_addr, bp.m_size);
241  }
242  }
243 
244  intptr_t data = 0;
245 
246  if (signo != LLDB_INVALID_SIGNAL_NUMBER)
247  data = signo;
248 
249  return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
250  reinterpret_cast<void *>(data));
251 }
252 
254  const StateType new_state = StateType::eStateStepping;
255  MaybeLogStateChange(new_state);
256  m_state = new_state;
258 
259  if(!m_step_workaround) {
260  // If we already hava a workaround inplace, don't reset it. Otherwise, the
261  // destructor of the existing instance will run after the new instance has
262  // fetched the cpu mask, and the thread will end up with the wrong mask.
264  }
265 
266  intptr_t data = 0;
267  if (signo != LLDB_INVALID_SIGNAL_NUMBER)
268  data = signo;
269 
270  // If hardware single-stepping is not supported, we just do a continue. The
271  // breakpoint on the next instruction has been setup in
272  // NativeProcessLinux::Resume.
274  GetProcess().SupportHardwareSingleStepping() ? PTRACE_SINGLESTEP
275  : PTRACE_CONT,
276  m_tid, nullptr, reinterpret_cast<void *>(data));
277 }
278 
280  const siginfo_t *info) {
281  Log *log = GetLog(LLDBLog::Thread);
282  LLDB_LOGF(log, "NativeThreadLinux::%s called with signal 0x%02" PRIx32,
283  __FUNCTION__, signo);
284 
285  SetStopped();
286 
288  m_stop_info.signo = signo;
289 
290  m_stop_description.clear();
291  if (info) {
292  switch (signo) {
293  case SIGSEGV:
294  case SIGBUS:
295  case SIGFPE:
296  case SIGILL:
297  // In case of MIPS64 target, SI_KERNEL is generated for invalid 64bit
298  // address.
299  const auto reason =
300  (info->si_signo == SIGBUS && info->si_code == SI_KERNEL)
302  : GetCrashReason(*info);
303  m_stop_description = GetCrashReasonString(reason, *info);
304 
305  if (reason == CrashReason::eSyncTagCheckFault) {
307  }
308 
309  break;
310  }
311  }
312 }
313 
314 void NativeThreadLinux::AnnotateSyncTagCheckFault(const siginfo_t *info) {
315  int32_t allocation_tag_type = 0;
316  switch (GetProcess().GetArchitecture().GetMachine()) {
317  // aarch64_32 deliberately not here because there's no 32 bit MTE
318  case llvm::Triple::aarch64:
319  case llvm::Triple::aarch64_be:
320  allocation_tag_type = MemoryTagManagerAArch64MTE::eMTE_allocation;
321  break;
322  default:
323  return;
324  }
325 
326  auto details =
327  GetRegisterContext().GetMemoryTaggingDetails(allocation_tag_type);
328  if (!details) {
329  llvm::consumeError(details.takeError());
330  return;
331  }
332 
333  // We assume that the stop description is currently:
334  // signal SIGSEGV: sync tag check fault (fault address: <addr>)
335  // Remove the closing )
336  m_stop_description.pop_back();
337 
338  std::stringstream ss;
339  lldb::addr_t fault_addr = reinterpret_cast<uintptr_t>(info->si_addr);
340  std::unique_ptr<MemoryTagManager> manager(std::move(details->manager));
341 
342  ss << " logical tag: 0x" << std::hex << manager->GetLogicalTag(fault_addr);
343 
344  std::vector<uint8_t> allocation_tag_data;
345  // The fault address may not be granule aligned. ReadMemoryTags will granule
346  // align any range you give it, potentially making it larger.
347  // To prevent this set len to 1. This always results in a range that is at
348  // most 1 granule in size and includes fault_addr.
349  Status status = GetProcess().ReadMemoryTags(allocation_tag_type, fault_addr,
350  1, allocation_tag_data);
351 
352  if (status.Success()) {
353  llvm::Expected<std::vector<lldb::addr_t>> allocation_tag =
354  manager->UnpackTagsData(allocation_tag_data, 1);
355  if (allocation_tag) {
356  ss << " allocation tag: 0x" << std::hex << allocation_tag->front() << ")";
357  } else {
358  llvm::consumeError(allocation_tag.takeError());
359  ss << ")";
360  }
361  } else
362  ss << ")";
363 
364  m_stop_description += ss.str();
365 }
366 
368  if (!StateIsStoppedState(m_state, false))
369  return false;
370 
371  // If we are stopped by a signal, return the signo.
372  if (signo && m_state == StateType::eStateStopped &&
374  *signo = m_stop_info.signo;
375  }
376 
377  // Regardless, we are stopped.
378  return true;
379 }
380 
383  m_step_workaround.reset();
384 
385  // On every stop, clear any cached register data structures
387 
388  const StateType new_state = StateType::eStateStopped;
389  MaybeLogStateChange(new_state);
390  m_state = new_state;
391  m_stop_description.clear();
392 }
393 
395  Log *log = GetLog(LLDBLog::Thread);
396  LLDB_LOGF(log, "NativeThreadLinux::%s()", __FUNCTION__);
397 
398  SetStopped();
399 
402 }
403 
405  SetStopped();
406 
409  m_stop_description.clear();
410 }
411 
413  SetStopped();
414 
415  lldbassert(wp_index != LLDB_INVALID_INDEX32 && "wp_index cannot be invalid");
416 
417  std::ostringstream ostr;
418  ostr << m_reg_context_up->GetWatchpointAddress(wp_index) << " ";
419  ostr << wp_index;
420 
421  /*
422  * MIPS: Last 3bits of the watchpoint address are masked by the kernel. For
423  * example:
424  * 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at
425  * 'm', then
426  * watch exception is generated even when 'n' is read/written. To handle this
427  * case,
428  * find the base address of the load/store instruction and append it in the
429  * stop-info
430  * packet.
431  */
432  ostr << " " << m_reg_context_up->GetWatchpointHitAddress(wp_index);
433 
434  m_stop_description = ostr.str();
435 
438 }
439 
441  return GetState() == StateType::eStateStopped &&
443 }
444 
446  return GetState() == StateType::eStateStopped &&
448 }
449 
451  SetStopped();
452 
455 }
456 
457 void NativeThreadLinux::SetStoppedByFork(bool is_vfork, lldb::pid_t child_pid) {
458  SetStopped();
459 
463  m_stop_info.details.fork.child_pid = child_pid;
464  m_stop_info.details.fork.child_tid = child_pid;
465 }
466 
468  SetStopped();
469 
472 }
473 
475  SetStopped();
476 
478  m_stop_info.signo = 0;
479 }
480 
482  llvm::StringRef description) {
483  SetStopped();
484 
486  m_stop_info.signo = 0;
487  m_stop_description = description.str();
488 }
489 
491  const StateType new_state = StateType::eStateExited;
492  MaybeLogStateChange(new_state);
493  m_state = new_state;
494 
496 }
497 
499  Log *log = GetLog(LLDBLog::Thread);
500 
501  NativeProcessLinux &process = GetProcess();
502 
503  lldb::pid_t pid = process.GetID();
504  lldb::tid_t tid = GetID();
505 
506  LLDB_LOGF(log,
507  "NativeThreadLinux::%s requesting thread stop(pid: %" PRIu64
508  ", tid: %" PRIu64 ")",
509  __FUNCTION__, pid, tid);
510 
511  Status err;
512  errno = 0;
513  if (::tgkill(pid, tid, SIGSTOP) != 0) {
514  err.SetErrorToErrno();
515  LLDB_LOGF(log,
516  "NativeThreadLinux::%s tgkill(%" PRIu64 ", %" PRIu64
517  ", SIGSTOP) failed: %s",
518  __FUNCTION__, pid, tid, err.AsCString());
519  }
520 
521  return err;
522 }
523 
525  Log *log = GetLog(LLDBLog::Thread);
526  // If we're not logging, we're done.
527  if (!log)
528  return;
529 
530  // If this is a state change to the same state, we're done.
531  lldb::StateType old_state = m_state;
532  if (new_state == old_state)
533  return;
534 
535  LLDB_LOG(log, "pid={0}, tid={1}: changing from state {2} to {3}",
536  m_process.GetID(), GetID(), old_state, new_state);
537 }
538 
540  return static_cast<NativeProcessLinux &>(m_process);
541 }
542 
544  return static_cast<const NativeProcessLinux &>(m_process);
545 }
546 
547 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
549  auto siginfo_buf =
550  llvm::WritableMemoryBuffer::getNewUninitMemBuffer(sizeof(siginfo_t));
551  Status error =
552  GetProcess().GetSignalInfo(GetID(), siginfo_buf->getBufferStart());
553  if (!error.Success())
554  return error.ToError();
555  return std::move(siginfo_buf);
556 }
lldb_private::process_linux::NativeThreadLinux::SetStoppedByVForkDone
void SetStoppedByVForkDone()
Definition: NativeThreadLinux.cpp:467
lldb_private::process_linux::NativeThreadLinux::IsStopped
bool IsStopped(int *signo)
Return true if the thread is stopped.
Definition: NativeThreadLinux.cpp:367
lldb_private::process_linux::NativeProcessLinux::PtraceWrapper
static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr=nullptr, void *data=nullptr, size_t data_size=0, long *result=nullptr)
}
Definition: NativeProcessLinux.cpp:1935
lldb_private::NativeThreadProtocol
Definition: NativeThreadProtocol.h:24
lldb::eStopReasonVFork
@ eStopReasonVFork
Definition: lldb-enumerations.h:253
lldb_private::process_linux::NativeThreadLinux::Resume
Status Resume(uint32_t signo)
Resumes the thread.
Definition: NativeThreadLinux.cpp:211
lldb_private::process_linux::NativeRegisterContextLinux
Definition: NativeRegisterContextLinux.h:22
lldb_private::process_linux::NativeThreadLinux::SetStoppedByProcessorTrace
void SetStoppedByProcessorTrace(llvm::StringRef description)
Definition: NativeThreadLinux.cpp:481
lldb_private::process_linux::NativeProcessLinux::GetSignalInfo
Status GetSignalInfo(lldb::tid_t tid, void *siginfo) const
Writes a siginfo_t structure corresponding to the given thread ID to the memory region pointed to by ...
Definition: NativeProcessLinux.cpp:1627
lldb::eStateAttaching
@ eStateAttaching
Process is currently trying to attach.
Definition: lldb-enumerations.h:78
lldb_private::process_linux::NativeThreadLinux::m_stop_info
ThreadStopInfo m_stop_info
Definition: NativeThreadLinux.h:117
lldb_private::process_linux::NativeThreadLinux::m_watchpoint_index_map
WatchpointIndexMap m_watchpoint_index_map
Definition: NativeThreadLinux.h:121
lldb::eStopReasonThreadExiting
@ eStopReasonThreadExiting
Definition: lldb-enumerations.h:249
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:343
lldb_private::StateAsCString
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
Definition: State.cpp:14
lldb_private::process_linux::NativeThreadLinux::GetSiginfo
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo() const override
Definition: NativeThreadLinux.cpp:548
lldb_private::process_linux::NativeThreadLinux::m_step_workaround
std::unique_ptr< SingleStepWorkaround > m_step_workaround
Definition: NativeThreadLinux.h:123
lldb::eStopReasonException
@ eStopReasonException
Definition: lldb-enumerations.h:246
lldb_private::ThreadStopInfo::details
union lldb_private::ThreadStopInfo::@13 details
lldb_private::process_linux::NativeThreadLinux::m_state
lldb::StateType m_state
Definition: NativeThreadLinux.h:116
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
NativeThreadLinux.h
SIGSTOP
#define SIGSTOP
Definition: windows/PosixApi.h:32
lldb::eStopReasonTrace
@ eStopReasonTrace
Definition: lldb-enumerations.h:242
lldb::eStateExited
@ eStateExited
Process has exited and can't be examined.
Definition: lldb-enumerations.h:90
lldb_private::ThreadStopInfo::fork
struct lldb_private::ThreadStopInfo::@13::@15 fork
lldb::eStateStopped
@ eStateStopped
Process or thread is stopped and can be examined.
Definition: lldb-enumerations.h:84
lldb_private::Log::Printf
void Printf(const char *format,...) __attribute__((format(printf
Prefer using LLDB_LOGF whenever possible.
Definition: Log.cpp:137
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
LLDB_INVALID_SIGNAL_NUMBER
#define LLDB_INVALID_SIGNAL_NUMBER
Definition: lldb-defines.h:84
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:287
lldb::eStateCrashed
@ eStateCrashed
Process or thread has crashed and can be examined.
Definition: lldb-enumerations.h:88
lldb_private::process_linux::NativeThreadLinux::SetStoppedByFork
void SetStoppedByFork(bool is_vfork, lldb::pid_t child_pid)
Definition: NativeThreadLinux.cpp:457
lldb::eStopReasonProcessorTrace
@ eStopReasonProcessorTrace
Definition: lldb-enumerations.h:251
LLDBAssert.h
lldb_private::StateIsStoppedState
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
Definition: State.cpp:89
lldb_private::process_linux::NativeThreadLinux::RemoveHardwareBreakpoint
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
Definition: NativeThreadLinux.cpp:197
lldb_private::process_linux::NativeThreadLinux::SetStoppedByExec
void SetStoppedByExec()
Definition: NativeThreadLinux.cpp:394
lldb_private::process_linux::NativeThreadLinux::GetName
std::string GetName() override
Definition: NativeThreadLinux.cpp:101
lldb_private::process_linux
Definition: IntelPTCollector.h:29
Log.h
lldb::eStopReasonWatchpoint
@ eStopReasonWatchpoint
Definition: lldb-enumerations.h:244
lldb_private::process_linux::NativeThreadLinux::m_stop_description
std::string m_stop_description
Definition: NativeThreadLinux.h:119
lldb::eStopReasonNone
@ eStopReasonNone
Definition: lldb-enumerations.h:241
lldb::eStateConnected
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
Definition: lldb-enumerations.h:76
SIGTRAP
#define SIGTRAP
Definition: windows/PosixApi.h:30
lldb::eStateLaunching
@ eStateLaunching
Process is in the process of launching.
Definition: lldb-enumerations.h:79
lldb_private::LLDBLog::Thread
@ Thread
CrashReason::eSyncTagCheckFault
@ eSyncTagCheckFault
lldb::eStopReasonInstrumentation
@ eStopReasonInstrumentation
Definition: lldb-enumerations.h:250
lldb_private::ThreadStopInfo::reason
lldb::StopReason reason
Definition: Debug.h:132
lldb_private::NativeProcessProtocol::GetID
lldb::pid_t GetID() const
Definition: NativeProcessProtocol.h:183
lldb_private::process_linux::NativeThreadLinux::SingleStep
Status SingleStep(uint32_t signo)
Single steps the thread.
Definition: NativeThreadLinux.cpp:253
lldb_private::process_linux::SingleStepWorkaround::Get
static std::unique_ptr< SingleStepWorkaround > Get(::pid_t tid)
Definition: SingleStepCheck.h:47
lldb-enumerations.h
lldb_private::process_linux::NativeThreadLinux::RemoveWatchpoint
Status RemoveWatchpoint(lldb::addr_t addr) override
Definition: NativeThreadLinux.cpp:168
CrashReason::eInvalidAddress
@ eInvalidAddress
lldb_private::process_linux::NativeProcessLinux
Definition: NativeProcessLinux.h:40
SingleStepCheck.h
lldb_private::process_linux::NativeThreadLinux::SetStopped
void SetStopped()
Definition: NativeThreadLinux.cpp:381
lldb_private::process_linux::NativeThreadLinux::GetState
lldb::StateType GetState() override
Definition: NativeThreadLinux.cpp:110
lldb::eStateDetached
@ eStateDetached
Process has been detached and can't be examined.
Definition: lldb-enumerations.h:89
lldb_private::process_linux::NativeThreadLinux::SetStoppedByTrace
void SetStoppedByTrace()
Definition: NativeThreadLinux.cpp:450
lldb_private::process_linux::NativeThreadLinux::MaybeLogStateChange
void MaybeLogStateChange(lldb::StateType new_state)
Definition: NativeThreadLinux.cpp:524
lldb_private::process_linux::NativeThreadLinux::IsStoppedAtBreakpoint
bool IsStoppedAtBreakpoint()
Definition: NativeThreadLinux.cpp:440
lldb_private::process_linux::NativeThreadLinux::SetWatchpoint
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
Definition: NativeThreadLinux.cpp:151
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::getProcFile
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file)
Definition: Support.cpp:15
lldb_private::process_linux::NativeThreadLinux::RequestStop
Status RequestStop()
Definition: NativeThreadLinux.cpp:498
lldb_private::process_linux::NativeThreadLinux::SetHardwareBreakpoint
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
Definition: NativeThreadLinux.cpp:179
lldb_private::process_linux::NativeThreadLinux::m_hw_break_index_map
WatchpointIndexMap m_hw_break_index_map
Definition: NativeThreadLinux.h:122
tgkill
#define tgkill(pid, tid, sig)
Definition: NativeThreadLinux.cpp:34
lldb::eStateUnloaded
@ eStateUnloaded
Process is object is valid, but not currently loaded.
Definition: lldb-enumerations.h:75
lldb_private::process_linux::NativeThreadLinux::SetStoppedByBreakpoint
void SetStoppedByBreakpoint()
Definition: NativeThreadLinux.cpp:404
MemoryTagManagerAArch64MTE.h
lldb_private::ThreadStopInfo
Definition: Debug.h:131
lldb_private::process_linux::NativeThreadLinux::SetExited
void SetExited()
Definition: NativeThreadLinux.cpp:490
lldb_private::process_linux::NativeThreadLinux::GetProcess
NativeProcessLinux & GetProcess()
Definition: NativeThreadLinux.cpp:539
lldb_private::process_linux::NativeThreadLinux::SetStoppedBySignal
void SetStoppedBySignal(uint32_t signo, const siginfo_t *info=nullptr)
Definition: NativeThreadLinux.cpp:279
lldb::eStateStepping
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
Definition: lldb-enumerations.h:86
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb::eStateSuspended
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
Definition: lldb-enumerations.h:91
lldb::eStopReasonSignal
@ eStopReasonSignal
Definition: lldb-enumerations.h:245
GetCrashReasonString
std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info)
Definition: CrashReason.cpp:144
lldb::eStopReasonExec
@ eStopReasonExec
Program was re-exec'ed.
Definition: lldb-enumerations.h:247
lldb_private::Status
Definition: Status.h:44
lldb_private::process_linux::NativeThreadLinux::SetStoppedByWatchpoint
void SetStoppedByWatchpoint(uint32_t wp_index)
Definition: NativeThreadLinux.cpp:412
uint32_t
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb::eStopReasonPlanComplete
@ eStopReasonPlanComplete
Definition: lldb-enumerations.h:248
Support.h
lldb_private::process_linux::NativeRegisterContextLinux::GetMemoryTaggingDetails
virtual llvm::Expected< MemoryTaggingDetails > GetMemoryTaggingDetails(int32_t type)
Return architecture specific data needed to use memory tags, if they are supported.
Definition: NativeRegisterContextLinux.h:72
lldb_private::NativeThreadProtocol::GetID
lldb::tid_t GetID() const
Definition: NativeThreadProtocol.h:39
lldb_private::process_linux::NativeThreadLinux::AnnotateSyncTagCheckFault
void AnnotateSyncTagCheckFault(const siginfo_t *info)
Extend m_stop_description with logical and allocation tag values.
Definition: NativeThreadLinux.cpp:314
lldb_private::ThreadStopInfo::signo
uint32_t signo
Definition: Debug.h:133
lldb_private::process_linux::NativeThreadLinux::m_reg_context_up
std::unique_ptr< NativeRegisterContextLinux > m_reg_context_up
Definition: NativeThreadLinux.h:118
Ptrace.h
lldb_private::process_linux::NativeThreadLinux::SetStoppedWithNoReason
void SetStoppedWithNoReason()
Definition: NativeThreadLinux.cpp:474
lldb::eStopReasonBreakpoint
@ eStopReasonBreakpoint
Definition: lldb-enumerations.h:243
lldb_private::Status::SetErrorToErrno
void SetErrorToErrno()
Set the current error to errno.
Definition: Status.cpp:223
lldb_private::NativeProcessProtocol::GetHardwareBreakpointMap
virtual const HardwareBreakpointMap & GetHardwareBreakpointMap() const
Definition: NativeProcessProtocol.cpp:231
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:336
lldb_private::MemoryTagManagerAArch64MTE::eMTE_allocation
@ eMTE_allocation
Definition: MemoryTagManagerAArch64MTE.h:22
NativeRegisterContextLinux.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::NativeThreadProtocol::m_process
NativeProcessProtocol & m_process
Definition: NativeThreadProtocol.h:60
NativeProcessLinux.h
lldb_private::NativeProcessProtocol::GetWatchpointMap
virtual const NativeWatchpointList::WatchpointMap & GetWatchpointMap() const
Definition: NativeProcessProtocol.cpp:126
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
lldb_private::process_linux::NativeThreadLinux::GetRegisterContext
NativeRegisterContextLinux & GetRegisterContext() override
Definition: NativeThreadLinux.h:43
State.h
lldb_private::process_linux::NativeRegisterContextLinux::InvalidateAllRegisters
virtual void InvalidateAllRegisters()
Definition: NativeRegisterContextLinux.h:34
LLDB_INVALID_INDEX32
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:75
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::Log
Definition: Log.h:115
lldb_private::ThreadStopInfo::exception
struct lldb_private::ThreadStopInfo::@13::@14 exception
HostNativeThread.h
lldb_private::process_linux::NativeThreadLinux::IsStoppedAtWatchpoint
bool IsStoppedAtWatchpoint()
Definition: NativeThreadLinux.cpp:445
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:308
lldb::eStopReasonVForkDone
@ eStopReasonVForkDone
Definition: lldb-enumerations.h:254
lldb_private::process_linux::NativeThreadLinux::GetStopReason
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
Definition: NativeThreadLinux.cpp:112
lldb
Definition: SBAddress.h:15
lldb::eStateRunning
@ eStateRunning
Process or thread is running and can't be examined.
Definition: lldb-enumerations.h:85
lldb::eStopReasonFork
@ eStopReasonFork
Definition: lldb-enumerations.h:252
LLDBLog.h
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
CrashReason.h
lldb_private::NativeThreadProtocol::m_tid
lldb::tid_t m_tid
Definition: NativeThreadProtocol.h:61
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
GetCrashReason
CrashReason GetCrashReason(const siginfo_t &info)
Definition: CrashReason.cpp:341
lldb_private::process_linux::NativeProcessLinux::ReadMemoryTags
Status ReadMemoryTags(int32_t type, lldb::addr_t addr, size_t len, std::vector< uint8_t > &tags) override
Definition: NativeProcessLinux.cpp:1357