LLDB mainline
NativeProcessWindows.cpp
Go to the documentation of this file.
1//===-- NativeProcessWindows.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
10#include <psapi.h>
11
13#include "NativeThreadWindows.h"
23#include "lldb/Target/Process.h"
24#include "lldb/Utility/State.h"
25#include "llvm/Support/ConvertUTF.h"
26#include "llvm/Support/Errc.h"
27#include "llvm/Support/Error.h"
28#include "llvm/Support/Format.h"
29#include "llvm/Support/Threading.h"
30#include "llvm/Support/raw_ostream.h"
31
32#include "DebuggerThread.h"
33#include "ExceptionRecord.h"
34#include "ProcessWindowsLog.h"
35
36#include <tlhelp32.h>
37
38#pragma warning(disable : 4005)
39#include "winternl.h"
40#include <ntstatus.h>
41
42using namespace lldb;
43using namespace lldb_private;
44using namespace llvm;
45
46namespace lldb_private {
47
49 NativeDelegate &delegate,
50 llvm::Error &E)
53 PseudoTerminal::invalid_fd, // TODO: Implement on Windows
54 delegate),
55 ProcessDebugger(), m_arch(launch_info.GetArchitecture()) {
56 ErrorAsOutParameter EOut(&E);
57 DebugDelegateSP delegate_sp(new NativeDebugDelegate(*this));
58 E = LaunchProcess(launch_info, delegate_sp).ToError();
59 if (E)
60 return;
61
63}
64
66 NativeDelegate &delegate,
67 llvm::Error &E)
68 : NativeProcessProtocol(pid, terminal_fd, delegate), ProcessDebugger() {
69 ErrorAsOutParameter EOut(&E);
70 DebugDelegateSP delegate_sp(new NativeDebugDelegate(*this));
71 ProcessAttachInfo attach_info;
72 attach_info.SetProcessID(pid);
73 E = AttachProcess(pid, attach_info, delegate_sp).ToError();
74 if (E)
75 return;
76
78
80 if (!Host::GetProcessInfo(pid, info)) {
81 E = createStringError(inconvertibleErrorCode(),
82 "Cannot get process information");
83 return;
84 }
85 m_arch = info.GetArchitecture();
86}
87
91 llvm::sys::ScopedLock lock(m_mutex);
92
93 StateType state = GetState();
94 if (state == eStateStopped || state == eStateCrashed) {
95 LLDB_LOG(log, "process {0} is in state {1}. Resuming...",
96 GetDebuggedProcessId(), state);
97 LLDB_LOG(log, "resuming {0} threads.", m_threads.size());
98
100
101 bool failed = false;
102 for (uint32_t i = 0; i < m_threads.size(); ++i) {
103 auto thread = static_cast<NativeThreadWindows *>(m_threads[i].get());
104 const ResumeAction *const action =
105 resume_actions.GetActionForThread(thread->GetID(), true);
106 if (action == nullptr)
107 continue;
108
109 switch (action->state) {
110 case eStateRunning:
111 case eStateStepping: {
112 Status result = thread->DoResume(action->state);
113 if (result.Fail()) {
114 failed = true;
115 LLDB_LOG(log,
116 "Trying to resume thread at index {0}, but failed with "
117 "error {1}.",
118 i, result);
119 }
120 break;
121 }
122 case eStateSuspended:
123 case eStateStopped:
124 break;
125
126 default:
128 "NativeProcessWindows::%s (): unexpected state %s specified "
129 "for pid %" PRIu64 ", tid %" PRIu64,
130 __FUNCTION__, StateAsCString(action->state), GetID(),
131 thread->GetID());
132 }
133 }
134
135 if (failed) {
136 error = Status::FromErrorString("NativeProcessWindows::DoResume failed");
137 } else {
139 }
140
141 // Resume the debug loop.
142 ExceptionRecordSP active_exception =
143 m_session_data->m_debugger->GetActiveException().lock();
144 if (active_exception) {
145 // Resume the process and continue processing debug events. Mask the
146 // exception so that from the process's view, there is no indication that
147 // anything happened.
148 m_session_data->m_debugger->ContinueAsyncException(
150 }
151 } else {
152 LLDB_LOG(log, "error: process {0} is in state {1}. Returning...",
154 }
155
156 return error;
157}
158
164
166 bool caused_stop = false;
167 StateType state = GetState();
168 if (state != eStateStopped)
169 return HaltProcess(caused_stop);
170 return Status();
171}
172
176 StateType state = GetState();
177 if (state != eStateExited && state != eStateDetached) {
179 if (error.Success())
181 else
182 LLDB_LOG(log, "Detaching process error: {0}", error);
183 } else {
185 "error: process {0} in state = {1}, but "
186 "cannot detach it in this state.",
187 GetID(), state);
188 LLDB_LOG(log, "error: {0}", error);
189 }
190 return error;
191}
192
196 "Windows does not support sending signals to processes");
197 return error;
198}
199
201
203 StateType state = GetState();
204 return DestroyProcess(state);
205}
206
207Status NativeProcessWindows::IgnoreSignals(llvm::ArrayRef<int> signals) {
208 return Status();
209}
210
215
217 size_t size, size_t &bytes_read) {
218 return ProcessDebugger::ReadMemory(addr, buf, size, bytes_read);
219}
220
222 size_t size, size_t &bytes_written) {
223 return ProcessDebugger::WriteMemory(addr, buf, size, bytes_written);
224}
225
226llvm::Expected<lldb::addr_t>
227NativeProcessWindows::AllocateMemory(size_t size, uint32_t permissions) {
228 lldb::addr_t addr;
229 Status ST = ProcessDebugger::AllocateMemory(size, permissions, addr);
230 if (ST.Success())
231 return addr;
232 return ST.ToError();
233}
234
238
240
242 StateType state = GetState();
243 switch (state) {
244 case eStateCrashed:
245 case eStateDetached:
246 case eStateExited:
247 case eStateInvalid:
248 case eStateUnloaded:
249 return false;
250 default:
251 return true;
252 }
253}
254
256 lldb::StopReason reason,
257 std::string description) {
258 SetCurrentThreadID(thread.GetID());
259
260 ThreadStopInfo stop_info;
261 stop_info.reason = reason;
262 // No signal support on Windows but required to provide a 'valid' signum.
263 stop_info.signo = SIGTRAP;
264
265 if (reason == StopReason::eStopReasonException) {
266 stop_info.details.exception.type = 0;
267 stop_info.details.exception.data_count = 0;
268 }
269
270 thread.SetStopReason(stop_info, description);
271}
272
274 lldb::StopReason reason,
275 std::string description) {
276 NativeThreadWindows *thread = GetThreadByID(thread_id);
277 if (!thread)
278 return;
279
281 for (uint32_t i = 0; i < m_threads.size(); ++i) {
282 auto t = static_cast<NativeThreadWindows *>(m_threads[i].get());
283 if (Status error = t->DoStop(); error.Fail())
284 LLDB_LOG(log, "failed to stop thread {0}: {1}", t->GetID(), error);
285 }
286 SetStopReasonForThread(*thread, reason, description);
287}
288
290
291llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
293 // Not available on this target.
294 return llvm::errc::not_supported;
295}
296
297llvm::Expected<llvm::ArrayRef<uint8_t>>
299 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x3e,
300 0xd4}; // brk #0xf000
301 static const uint8_t g_thumb_opcode[] = {0xfe, 0xde}; // udf #0xfe
302
303 switch (GetArchitecture().GetMachine()) {
304 case llvm::Triple::aarch64:
305 return llvm::ArrayRef(g_aarch64_opcode);
306
307 case llvm::Triple::arm:
308 case llvm::Triple::thumb:
309 return llvm::ArrayRef(g_thumb_opcode);
310
311 default:
313 }
314}
315
317 // Windows always reports an incremented PC after a breakpoint is hit,
318 // even on ARM.
319 return cantFail(GetSoftwareBreakpointTrapOpcode(0)).size();
320}
321
325
327 bool hardware) {
328 if (hardware)
329 return SetHardwareBreakpoint(addr, size);
330 return SetSoftwareBreakpoint(addr, size);
331}
332
334 bool hardware) {
335 if (hardware)
336 return RemoveHardwareBreakpoint(addr);
337 return RemoveSoftwareBreakpoint(addr);
338}
339
342 if (!m_loaded_modules.empty())
343 return Status();
344
345 // Retrieve loaded modules by a Target/Module free implemenation.
346 AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetID()));
347 if (snapshot.IsValid()) {
348 MODULEENTRY32W me;
349 me.dwSize = sizeof(MODULEENTRY32W);
350 if (Module32FirstW(snapshot.get(), &me)) {
351 do {
352 std::string path;
353 if (!llvm::convertWideToUTF8(me.szExePath, path))
354 continue;
355
356 FileSpec file_spec(path);
357 FileSystem::Instance().Resolve(file_spec);
358 m_loaded_modules[file_spec] = (addr_t)me.modBaseAddr;
359 } while (Module32Next(snapshot.get(), &me));
360 }
361
362 if (!m_loaded_modules.empty())
363 return Status();
364 }
365
366 error = Status(::GetLastError(), lldb::ErrorType::eErrorTypeWin32);
367 return error;
368}
369
371 FileSpec &file_spec) {
373 if (error.Fail())
374 return error;
375
376 FileSpec module_file_spec(module_path);
377 FileSystem::Instance().Resolve(module_file_spec);
378 for (auto &it : m_loaded_modules) {
379 if (it.first == module_file_spec) {
380 file_spec = it.first;
381 return Status();
382 }
383 }
385 "Module (%s) not found in process %" PRIu64 "!",
386 module_file_spec.GetPath().c_str(), GetID());
387}
388
389Status
390NativeProcessWindows::GetFileLoadAddress(const llvm::StringRef &file_name,
391 lldb::addr_t &load_addr) {
393 if (error.Fail())
394 return error;
395
396 load_addr = LLDB_INVALID_ADDRESS;
397 FileSpec file_spec(file_name);
398 FileSystem::Instance().Resolve(file_spec);
399 for (auto &it : m_loaded_modules) {
400 if (it.first == file_spec) {
401 load_addr = it.second;
402 return Status();
403 }
404 }
406 "Can't get loaded address of file (%s) in process %" PRIu64 "!",
407 file_spec.GetPath().c_str(), GetID());
408}
409
410llvm::Expected<std::vector<LoadedLibraryInfo>>
412 if (Status error = CacheLoadedModules(); error.Fail())
413 return error.ToError();
414
415 std::vector<LoadedLibraryInfo> libs;
416 libs.reserve(m_loaded_modules.size());
417 for (const auto &[file_spec, base] : m_loaded_modules) {
419 info.name = file_spec.GetPath();
420 info.base_addr = base;
421 libs.push_back(std::move(info));
422 }
423 return libs;
424}
425
429
430void NativeProcessWindows::OnExitProcess(uint32_t exit_code) {
432 LLDB_LOG(log, "Process {0} exited with code {1}", GetID(), exit_code);
433
435
436 // No signal involved. It is just an exit event.
437 WaitStatus wait_status(WaitStatus::Exit, exit_code);
438 SetExitStatus(wait_status, true);
439
440 // Notify the native delegate.
441 SetState(eStateExited, true);
442}
443
446 LLDB_LOG(log, "Debugger connected to process {0}. Image base = {1:x}",
447 GetDebuggedProcessId(), image_base);
448
449 // This is the earliest chance we can resolve the process ID and
450 // architecture if we don't know them yet.
453
454 if (GetArchitecture().GetMachine() == llvm::Triple::UnknownArch) {
455 ProcessInstanceInfo process_info;
456 if (!Host::GetProcessInfo(GetDebuggedProcessId(), process_info)) {
457 LLDB_LOG(log, "Cannot get process information during debugger connecting "
458 "to process");
459 return;
460 }
461 SetArchitecture(process_info.GetArchitecture());
462 }
463
464 // The very first one shall always be the main thread.
465 assert(m_threads.empty());
466 m_threads.push_back(std::make_unique<NativeThreadWindows>(
467 *this, m_session_data->m_debugger->GetMainThread()));
468}
469
473 uint32_t wp_id = LLDB_INVALID_INDEX32;
474#ifndef __aarch64__
475 if (NativeThreadWindows *thread = GetThreadByID(record.GetThreadID())) {
476 NativeRegisterContextWindows &reg_ctx = thread->GetRegisterContext();
477 Status error =
478 reg_ctx.GetWatchpointHitIndex(wp_id, record.GetExceptionAddress());
479 if (error.Fail())
480 LLDB_LOG(log,
481 "received error while checking for watchpoint hits, pid = "
482 "{0}, error = {1}",
483 thread->GetID(), error);
484 if (wp_id != LLDB_INVALID_INDEX32) {
485 addr_t wp_addr = reg_ctx.GetWatchpointAddress(wp_id);
486 addr_t wp_hit_addr = reg_ctx.GetWatchpointHitAddress(wp_id);
487 std::string desc =
488 formatv("{0} {1} {2}", wp_addr, wp_id, wp_hit_addr).str();
490 }
491 }
492#endif
493 if (wp_id == LLDB_INVALID_INDEX32)
495
496 SetState(eStateStopped, true);
498}
499
503 const auto exception_addr = record.GetExceptionAddress();
504 const auto thread_id = record.GetThreadID();
505
506 if (NativeThreadWindows *stop_thread = GetThreadByID(thread_id)) {
507 auto &reg_ctx = stop_thread->GetRegisterContext();
508
509 if (FindSoftwareBreakpoint(exception_addr)) {
510 LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
511 exception_addr);
513 // The current PC is AFTER the BP opcode, on all architectures.
514 reg_ctx.SetPC(reg_ctx.GetPC() - GetSoftwareBreakpointPCOffset());
515 SetState(eStateStopped, true);
517 }
518
519 // This block of code will only be entered in case of a hardware
520 // watchpoint or breakpoint hit on AArch64. However, we only handle
521 // hardware watchpoints below as breakpoints are not yet supported.
522 const std::vector<ULONG_PTR> &args = record.GetExceptionArguments();
523 // Check that the ExceptionInformation array of EXCEPTION_RECORD
524 // contains at least two elements: the first is a read-write flag
525 // indicating the type of data access operation (read or write) while
526 // the second contains the virtual address of the accessed data.
527 if (args.size() >= 2) {
528 uint32_t hw_id = LLDB_INVALID_INDEX32;
529 Status error = reg_ctx.GetWatchpointHitIndex(hw_id, args[1]);
530 if (error.Fail())
531 LLDB_LOG(log,
532 "received error while checking for watchpoint hits, pid = "
533 "{0}, error = {1}",
534 thread_id, error);
535
536 if (hw_id != LLDB_INVALID_INDEX32) {
537 std::string desc =
538 formatv("{0} {1} {2}", reg_ctx.GetWatchpointAddress(hw_id), hw_id,
539 exception_addr)
540 .str();
542 SetState(eStateStopped, true);
544 }
545 }
546 }
547
548 if (!m_initial_stop_seen) {
549 m_initial_stop_seen = true;
550 LLDB_LOG(log,
551 "Hit loader breakpoint at address {0:x}, setting initial stop "
552 "event.",
553 exception_addr);
554
555 // We are required to report the reason for the first stop after
556 // launching or being attached.
557 if (NativeThreadWindows *thread = GetThreadByID(thread_id))
559
560 // Do not notify the native delegate (e.g. llgs) since at this moment
561 // the program hasn't returned from Manager::Launch() and the delegate
562 // might not have an valid native process to operate on.
563 SetState(eStateStopped, false);
564
565 // Hit the initial stop. Continue the application.
567 }
568
569 // Any remaining STATUS_BREAKPOINT is a breakpoint instruction in the
570 // program's own code (e.g. `__debugbreak()` or `__builtin_debugtrap()`).
571 // Stop the debugger and let the user decide what to do.
572 std::string desc = formatv("Exception {0:x8} encountered at address {1:x8}",
573 record.GetExceptionCode(), exception_addr)
574 .str();
575 StopThread(thread_id, StopReason::eStopReasonException, std::move(desc));
576 SetState(eStateStopped, true);
578}
579
582 const ExceptionRecord &record) {
584 LLDB_LOG(log,
585 "Debugger thread reported exception {0:x} at address {1:x} "
586 "(first_chance={2})",
587 record.GetExceptionCode(), record.GetExceptionAddress(),
588 first_chance);
589
590 if (first_chance)
592
593 std::string desc;
594 llvm::raw_string_ostream desc_stream(desc);
595 desc_stream << "Exception " << llvm::format_hex(record.GetExceptionCode(), 8)
596 << " encountered at address "
597 << llvm::format_hex(record.GetExceptionAddress(), 8);
599 desc.c_str());
600
601 SetState(eStateStopped, true);
603}
604
607 const ExceptionRecord &record) {
608 llvm::sys::ScopedLock lock(m_mutex);
609
610 // Let the debugger establish the internal status.
611 ProcessDebugger::OnDebugException(first_chance, record);
612
613 switch (record.GetExceptionCode()) {
614 case DWORD(STATUS_SINGLE_STEP):
615 case STATUS_WX86_SINGLE_STEP:
616 return HandleSingleStepException(record);
617 case DWORD(STATUS_BREAKPOINT):
619 return HandleBreakpointException(record);
620 default:
621 return HandleGenericException(first_chance, record);
622 }
623}
624
626 llvm::sys::ScopedLock lock(m_mutex);
627
628 auto thread = std::make_unique<NativeThreadWindows>(*this, new_thread);
629 thread->GetRegisterContext().ClearAllHardwareWatchpoints();
630 for (const auto &pair : GetWatchpointMap()) {
631 const NativeWatchpoint &wp = pair.second;
632 thread->SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags,
633 wp.m_hardware);
634 }
635
636 m_threads.push_back(std::move(thread));
637}
638
640 uint32_t exit_code) {
641 llvm::sys::ScopedLock lock(m_mutex);
642 NativeThreadWindows *thread = GetThreadByID(thread_id);
643 if (!thread)
644 return;
645
646 for (auto t = m_threads.begin(); t != m_threads.end();) {
647 if ((*t)->GetID() == thread_id) {
648 t = m_threads.erase(t);
649 } else {
650 ++t;
651 }
652 }
653}
654
656 lldb::addr_t module_addr) {
657 m_loaded_modules.clear();
659}
660
665
666llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
668 ProcessLaunchInfo &launch_info,
669 NativeProcessProtocol::NativeDelegate &native_delegate) {
670 Error E = Error::success();
671 auto process_up = std::unique_ptr<NativeProcessWindows>(
672 new NativeProcessWindows(launch_info, native_delegate, E));
673 if (E)
674 return std::move(E);
675 return std::move(process_up);
676}
677
678llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
681 Error E = Error::success();
682 // Set pty primary fd invalid since it is not available.
683 auto process_up = std::unique_ptr<NativeProcessWindows>(
684 new NativeProcessWindows(pid, -1, native_delegate, E));
685 if (E)
686 return std::move(E);
687 return std::move(process_up);
688}
689} // namespace lldb_private
static llvm::raw_ostream & error(Stream &strm)
#define STATUS_WX86_BREAKPOINT
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:364
lldb::tid_t GetThreadID() const
const std::vector< ULONG_PTR > & GetExceptionArguments() const
lldb::addr_t GetExceptionAddress() const
A file utility class.
Definition FileSpec.h:57
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:374
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info)
Definition aix/Host.cpp:211
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint)
virtual const NativeWatchpointList::WatchpointMap & GetWatchpointMap() const
void SetState(lldb::StateType state, bool notify_delegates=true)
NativeThreadProtocol * GetThreadByID(lldb::tid_t tid)
std::vector< std::unique_ptr< NativeThreadProtocol > > m_threads
virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange)
Status RemoveSoftwareBreakpoint(lldb::addr_t addr)
virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
virtual llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode(size_t size_hint)
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr)
std::unordered_map< lldb::addr_t, SoftwareBreakpoint > m_software_breakpoints
llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate) override
Launch a process for debugging.
llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Attach(lldb::pid_t pid, NativeDelegate &native_delegate) override
Attach to an existing process.
Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info) override
ExceptionResult HandleBreakpointException(const ExceptionRecord &record)
llvm::Error DeallocateMemory(lldb::addr_t addr) override
Status Resume(const ResumeActionList &resume_actions) override
void OnCreateThread(const HostThread &thread) override
void OnExitProcess(uint32_t exit_code) override
Status GetLoadedModuleFileSpec(const char *module_path, FileSpec &file_spec) override
llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode(size_t size_hint) override
void OnDebuggerConnected(lldb::addr_t image_base) override
Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) override
NativeProcessWindows(ProcessLaunchInfo &launch_info, NativeDelegate &delegate, llvm::Error &E)
Status SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override
ExceptionResult HandleGenericException(bool first_chance, const ExceptionRecord &record)
void SetArchitecture(const ArchSpec &arch_spec)
ExceptionResult OnDebugException(bool first_chance, const ExceptionRecord &record) override
size_t GetSoftwareBreakpointPCOffset() override
Return the offset of the PC relative to the software breakpoint that was hit.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData() const override
void OnUnloadDll(lldb::addr_t module_addr) override
Status GetFileLoadAddress(const llvm::StringRef &file_name, lldb::addr_t &load_addr) override
NativeThreadWindows * GetThreadByID(lldb::tid_t thread_id)
Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) override
void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override
llvm::Expected< lldb::addr_t > AllocateMemory(size_t size, uint32_t permissions) override
Status Signal(int signo) override
Sends a process a UNIX signal signal.
Status RemoveBreakpoint(lldb::addr_t addr, bool hardware=false) override
const ArchSpec & GetArchitecture() const override
void SetStopReasonForThread(NativeThreadWindows &thread, lldb::StopReason reason, std::string description="")
Status Interrupt() override
Tells a process to interrupt all operations as if by a Ctrl-C.
void OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr) override
void StopThread(lldb::tid_t thread_id, lldb::StopReason reason, std::string description="")
ExceptionResult HandleSingleStepException(const ExceptionRecord &record)
bool m_initial_stop_seen
Whether we've seen the loader breakpoint that fires once per process at launch / attach.
bool m_pending_library_events
Set whenever an OS DLL load/unload event has been seen since the last stop reply.
llvm::Expected< std::vector< LoadedLibraryInfo > > GetLoadedLibraries() override
Return the currently loaded libraries of the target in the qXfer:libraries:read form (generic name + ...
lldb::addr_t GetSharedLibraryInfoAddress() override
Status IgnoreSignals(llvm::ArrayRef< int > signals) override
std::map< lldb_private::FileSpec, lldb::addr_t > m_loaded_modules
virtual Status GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr)
virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index)
virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index)
Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)
Status DestroyProcess(lldb::StateType process_state)
Status LaunchProcess(ProcessLaunchInfo &launch_info, DebugDelegateSP delegate)
Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
std::unique_ptr< ProcessWindowsData > m_session_data
Status AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr)
virtual ExceptionResult OnDebugException(bool first_chance, const ExceptionRecord &record)
Status AttachProcess(lldb::pid_t pid, const ProcessAttachInfo &attach_info, DebugDelegateSP delegate)
lldb::pid_t GetDebuggedProcessId() const
Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
virtual void OnExitProcess(uint32_t exit_code)
Status HaltProcess(bool &caused_stop)
Status DeallocateMemory(lldb::addr_t addr)
void SetProcessID(lldb::pid_t pid)
Definition ProcessInfo.h:70
ArchSpec & GetArchitecture()
Definition ProcessInfo.h:62
A pseudo terminal helper class.
const ResumeAction * GetActionForThread(lldb::tid_t tid, bool default_ok) const
Definition Debug.h:74
An error handling class.
Definition Status.h:118
llvm::Error ToError() const
FIXME: Replace all uses with takeError() instead.
Definition Status.cpp:138
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
bool Fail() const
Test for error condition.
Definition Status.cpp:293
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
bool Success() const
Test for success condition.
Definition Status.cpp:303
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_PROCESS_ID
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:327
std::shared_ptr< IDebugDelegate > DebugDelegateSP
Definition ForwardDecl.h:35
std::shared_ptr< ExceptionRecord > ExceptionRecordSP
Definition ForwardDecl.h:37
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
Definition State.cpp:14
StateType
Process and Thread States.
@ eStateUnloaded
Process is object is valid, but not currently loaded.
@ eStateDetached
Process has been detached and can't be examined.
@ 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.
@ eStateExited
Process has exited and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
@ eErrorTypeWin32
Standard Win32 error codes.
uint64_t pid_t
Definition lldb-types.h:83
uint64_t addr_t
Definition lldb-types.h:80
StopReason
Thread stop reasons.
@ eStopReasonBreakpoint
@ eStopReasonException
@ eStopReasonWatchpoint
uint64_t tid_t
Definition lldb-types.h:84
Generic loaded-library entry used by the non-SVR4 qXfer:libraries:read form of the GDB remote library...
lldb::StateType state
Definition Debug.h:23
struct lldb_private::ThreadStopInfo::@116236113001137253323017204263037302160273237376::@034237007264067231263360140073224264215170222231 exception
lldb::StopReason reason
Definition Debug.h:132
union lldb_private::ThreadStopInfo::@116236113001137253323017204263037302160273237376 details
#define SIGTRAP