LLDB mainline
ProcessWindows.cpp
Go to the documentation of this file.
1//===-- ProcessWindows.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 "ProcessWindows.h"
10
11// Windows includes
13#include <psapi.h>
14
16#include "lldb/Core/IOHandler.h"
17#include "lldb/Core/Module.h"
20#include "lldb/Core/Section.h"
22#include "lldb/Host/HostInfo.h"
25#include "lldb/Host/Pipe.h"
33#include "lldb/Target/Target.h"
35#include "lldb/Utility/Log.h"
36#include "lldb/Utility/State.h"
37
38#include "llvm/Support/ConvertUTF.h"
39#include "llvm/Support/Format.h"
40#include "llvm/Support/Threading.h"
41#include "llvm/Support/raw_ostream.h"
42
43#include "DebuggerThread.h"
44#include "ExceptionRecord.h"
45#include "ForwardDecl.h"
46#include "LocalDebugDelegate.h"
48#include "ProcessWindowsLog.h"
49#include "TargetThreadWindows.h"
50
51using namespace lldb;
52using namespace lldb_private;
53
54LLDB_PLUGIN_DEFINE_ADV(ProcessWindows, ProcessWindowsCommon)
55
56namespace {
57std::string GetProcessExecutableName(HANDLE process_handle) {
58 std::vector<wchar_t> file_name;
59 DWORD file_name_size = MAX_PATH; // first guess, not an absolute limit
60 DWORD copied = 0;
61 do {
62 file_name_size *= 2;
63 file_name.resize(file_name_size);
64 copied = ::GetModuleFileNameExW(process_handle, NULL, file_name.data(),
65 file_name_size);
66 } while (copied >= file_name_size);
67 file_name.resize(copied);
68 std::string result;
69 llvm::convertWideToUTF8(file_name.data(), result);
70 return result;
71}
72
73std::string GetProcessExecutableName(DWORD pid) {
74 std::string file_name;
75 HANDLE process_handle =
76 ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
77 if (process_handle != NULL) {
78 file_name = GetProcessExecutableName(process_handle);
79 ::CloseHandle(process_handle);
80 }
81 return file_name;
82}
83} // anonymous namespace
84
85namespace lldb_private {
86
88 lldb::ListenerSP listener_sp,
89 const FileSpec *crash_file_path,
90 bool can_connect) {
91 if (crash_file_path)
92 return nullptr; // Cannot create a Windows process from a crash_file.
93 return ProcessSP(new ProcessWindows(target_sp, listener_sp));
94}
95
96static bool ShouldUseLLDBServer() {
97 llvm::StringRef use_lldb_server = ::getenv("LLDB_USE_LLDB_SERVER");
98 return use_lldb_server.equals_insensitive("on") ||
99 use_lldb_server.equals_insensitive("yes") ||
100 use_lldb_server.equals_insensitive("1") ||
101 use_lldb_server.equals_insensitive("true");
102}
103
110
115
117 return "Process plugin for Windows";
118}
119
120// Constructors and destructors.
121
123 lldb::ListenerSP listener_sp)
124 : lldb_private::Process(target_sp, listener_sp),
126 RegisterContextWindows::GetNumHardwareBreakpointSlots(),
128
130
132 if (bp_site->HardwareRequired())
133 return Status::FromErrorString("Hardware breakpoints are not supported.");
134
136 LLDB_LOG(log, "bp_site = {0:x}, id={1}, addr={2:x}", bp_site,
137 bp_site->GetID(), bp_site->GetLoadAddress());
138
140 if (!error.Success())
141 LLDB_LOG(log, "error: {0}", error);
142 return error;
143}
144
147 LLDB_LOG(log, "bp_site = {0:x}, id={1}, addr={2:x}", bp_site,
148 bp_site->GetID(), bp_site->GetLoadAddress());
149
151
152 if (!error.Success())
153 LLDB_LOG(log, "error: {0}", error);
154 return error;
155}
156
160 StateType private_state = GetPrivateState();
161 if (private_state != eStateExited && private_state != eStateDetached) {
162 if (!keep_stopped) {
163 // if the thread is suspended by lldb, we have to resume threads before
164 // detaching process. When we do after DetachProcess(), thread handles
165 // become invalid so we do before detach.
166 if (private_state == eStateStopped || private_state == eStateCrashed) {
167 LLDB_LOG(log, "process {0} is in state {1}. Resuming for detach...",
168 m_session_data->m_debugger->GetProcess().GetProcessId(),
170
171 LLDB_LOG(log, "resuming {0} threads for detach.",
172 m_thread_list.GetSize());
173
174 bool failed = false;
175 for (uint32_t i = 0; i < m_thread_list.GetSize(); ++i) {
176 auto thread = std::static_pointer_cast<TargetThreadWindows>(
177 m_thread_list.GetThreadAtIndex(i));
178 Status result = thread->DoResume();
179 if (result.Fail()) {
180 failed = true;
181 LLDB_LOG(log,
182 "Trying to resume thread at index {0}, but failed with "
183 "error {1}.",
184 i, result);
185 }
186 }
187
188 if (failed) {
189 error = Status::FromErrorString("Resuming Threads for Detach failed");
190 }
191 }
192 }
193
195 if (error.Success())
197 else
198 LLDB_LOG(log, "Detaching process error: {0}", error);
199 } else {
201 "error: process {0} in state = {1}, but "
202 "cannot detach it in this state.",
203 GetID(), private_state);
204 LLDB_LOG(log, "error: {0}", error);
205 }
206 return error;
207}
208
210 ProcessLaunchInfo &launch_info) {
212 DebugDelegateSP delegate(new LocalDebugDelegate(shared_from_this()));
213 error = LaunchProcess(launch_info, delegate);
214 if (error.Success())
215 SetID(launch_info.GetProcessID());
216 m_pty = launch_info.TakePTY();
217 return error;
218}
219
220Status
222 const ProcessAttachInfo &attach_info) {
223 DebugDelegateSP delegate(new LocalDebugDelegate(shared_from_this()));
224 Status error = AttachProcess(pid, attach_info, delegate);
225 if (error.Success())
227 return error;
228}
229
232 llvm::sys::ScopedLock lock(m_mutex);
233
234 if (direction == RunDirection::eRunReverse) {
236 "{0} does not support reverse execution of processes", GetPluginName());
237 }
238
240
241 StateType private_state = GetPrivateState();
242 if (private_state == eStateStopped || private_state == eStateCrashed) {
243 LLDB_LOG(log, "process {0} is in state {1}. Resuming...",
244 m_session_data->m_debugger->GetProcess().GetProcessId(),
246
247 LLDB_LOG(log, "resuming {0} threads.", m_thread_list.GetSize());
248
249 bool failed = false;
250 for (uint32_t i = 0; i < m_thread_list.GetSize(); ++i) {
251 auto thread = std::static_pointer_cast<TargetThreadWindows>(
252 m_thread_list.GetThreadAtIndex(i));
253 Status result = thread->DoResume();
254 if (result.Fail()) {
255 failed = true;
256 LLDB_LOG(
257 log,
258 "Trying to resume thread at index {0}, but failed with error {1}.",
259 i, result);
260 }
261 }
262
263 if (failed) {
264 error = Status::FromErrorString("ProcessWindows::DoResume failed");
265 } else {
267 }
268
269 ExceptionRecordSP active_exception =
270 m_session_data->m_debugger->GetActiveException().lock();
271 if (active_exception) {
272 // Resume the process and continue processing debug events. Mask the
273 // exception so that from the process's view, there is no indication that
274 // anything happened.
275 m_session_data->m_debugger->ContinueAsyncException(
277 }
278 } else {
279 LLDB_LOG(log, "error: process {0} is in state {1}. Returning...",
280 m_session_data->m_debugger->GetProcess().GetProcessId(),
282 }
283 return error;
284}
285
287 StateType private_state = GetPrivateState();
288 return DestroyProcess(private_state);
289}
290
291Status ProcessWindows::DoHalt(bool &caused_stop) {
292 StateType state = GetPrivateState();
293 if (state != eStateStopped)
294 return HaltProcess(caused_stop);
295 caused_stop = false;
296 return Status();
297}
298
300 ArchSpec arch_spec;
301 DidAttach(arch_spec);
302}
303
305 llvm::sys::ScopedLock lock(m_mutex);
306
308
309 // The initial stop won't broadcast the state change event, so account for
310 // that here.
312 m_session_data->m_stop_at_entry)
314}
315
316static void
317DumpAdditionalExceptionInformation(llvm::raw_ostream &stream,
318 const ExceptionRecordSP &exception) {
319 // Decode additional exception information for specific exception types based
320 // on
321 // https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_exception_record
322
323 const int addr_min_width = 2 + 8; // "0x" + 4 address bytes
324
325 const std::vector<ULONG_PTR> &args = exception->GetExceptionArguments();
326 switch (exception->GetExceptionCode()) {
327 case EXCEPTION_ACCESS_VIOLATION: {
328 if (args.size() < 2)
329 break;
330
331 stream << ": ";
332 const int access_violation_code = args[0];
333 const lldb::addr_t access_violation_address = args[1];
334 switch (access_violation_code) {
335 case 0:
336 stream << "Access violation reading";
337 break;
338 case 1:
339 stream << "Access violation writing";
340 break;
341 case 8:
342 stream << "User-mode data execution prevention (DEP) violation at";
343 break;
344 default:
345 stream << "Unknown access violation (code " << access_violation_code
346 << ") at";
347 break;
348 }
349 stream << " location "
350 << llvm::format_hex(access_violation_address, addr_min_width);
351 break;
352 }
353 case EXCEPTION_IN_PAGE_ERROR: {
354 if (args.size() < 3)
355 break;
356
357 stream << ": ";
358 const int page_load_error_code = args[0];
359 const lldb::addr_t page_load_error_address = args[1];
360 const DWORD underlying_code = args[2];
361 switch (page_load_error_code) {
362 case 0:
363 stream << "In page error reading";
364 break;
365 case 1:
366 stream << "In page error writing";
367 break;
368 case 8:
369 stream << "User-mode data execution prevention (DEP) violation at";
370 break;
371 default:
372 stream << "Unknown page loading error (code " << page_load_error_code
373 << ") at";
374 break;
375 }
376 stream << " location "
377 << llvm::format_hex(page_load_error_address, addr_min_width)
378 << " (status code " << llvm::format_hex(underlying_code, 8) << ")";
379 break;
380 }
381 }
382}
383
386 llvm::sys::ScopedLock lock(m_mutex);
387
388 if (!m_session_data) {
389 LLDB_LOG(log, "no active session. Returning...");
390 return;
391 }
392
393 m_thread_list.RefreshStateAfterStop();
394
395 std::weak_ptr<ExceptionRecord> exception_record =
396 m_session_data->m_debugger->GetActiveException();
397 ExceptionRecordSP active_exception = exception_record.lock();
398 if (!active_exception) {
399 LLDB_LOG(log,
400 "there is no active exception in process {0}. Why is the "
401 "process stopped?",
402 m_session_data->m_debugger->GetProcess().GetProcessId());
403 return;
404 }
405
406 StopInfoSP stop_info;
407 m_thread_list.SetSelectedThreadByID(active_exception->GetThreadID());
408 ThreadSP stop_thread = m_thread_list.GetSelectedThread();
409 if (!stop_thread)
410 return;
411
412 RegisterContextSP register_context = stop_thread->GetRegisterContext();
413 uint64_t pc = register_context->GetPC();
414
415 // If we're at a BreakpointSite, mark this as an Unexecuted Breakpoint.
416 // We'll clear that state if we've actually executed the breakpoint.
417 BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc));
418 if (site && IsBreakpointSitePhysicallyEnabled(*site))
419 stop_thread->SetThreadStoppedAtUnexecutedBP(pc);
420
421 switch (active_exception->GetExceptionCode()) {
422 case EXCEPTION_SINGLE_STEP: {
423 auto *reg_ctx = static_cast<RegisterContextWindows *>(
424 stop_thread->GetRegisterContext().get());
425 uint32_t slot_id = reg_ctx->GetTriggeredHardwareBreakpointSlotId();
426 if (slot_id != LLDB_INVALID_INDEX32) {
427 int id = m_watchpoint_ids[slot_id];
428 LLDB_LOG(log,
429 "Single-stepped onto a watchpoint in process {0} at address "
430 "{1:x} with watchpoint {2}",
431 m_session_data->m_debugger->GetProcess().GetProcessId(), pc, id);
432
433 stop_info = StopInfo::CreateStopReasonWithWatchpointID(*stop_thread, id);
434 stop_thread->SetStopInfo(stop_info);
435
436 return;
437 }
438
439 LLDB_LOG(log, "single stepping thread {0}", stop_thread->GetID());
440 stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread);
441 stop_thread->SetStopInfo(stop_info);
442
443 return;
444 }
445
446 case EXCEPTION_BREAKPOINT: {
447 int breakpoint_size = 1;
448 switch (GetTarget().GetArchitecture().GetMachine()) {
449 case llvm::Triple::aarch64:
450 breakpoint_size = 4;
451 break;
452
453 case llvm::Triple::arm:
454 case llvm::Triple::thumb:
455 breakpoint_size = 2;
456 break;
457
458 case llvm::Triple::x86:
459 case llvm::Triple::x86_64:
460 breakpoint_size = 1;
461 break;
462
463 default:
464 LLDB_LOG(log, "Unknown breakpoint size for architecture");
465 break;
466 }
467
468 // The current PC is AFTER the BP opcode, on all architectures.
469 pc = register_context->GetPC() - breakpoint_size;
470
472 if (site) {
473 LLDB_LOG(log,
474 "detected breakpoint in process {0} at address {1:x} with "
475 "breakpoint site {2}",
476 m_session_data->m_debugger->GetProcess().GetProcessId(), pc,
477 site->GetID());
478
479 stop_thread->SetThreadHitBreakpointSite();
480 if (site->ValidForThisThread(*stop_thread)) {
481 LLDB_LOG(log,
482 "Breakpoint site {0} is valid for this thread ({1:x}), "
483 "creating stop info.",
484 site->GetID(), stop_thread->GetID());
485
487 *stop_thread, site->GetID());
488 register_context->SetPC(pc);
489 } else {
490 LLDB_LOG(log,
491 "Breakpoint site {0} is not valid for this thread, "
492 "creating empty stop info.",
493 site->GetID());
494 }
495 stop_thread->SetStopInfo(stop_info);
496 return;
497 } else {
498 // The thread hit a hard-coded breakpoint like an `int 3` or
499 // `__debugbreak()`.
500 LLDB_LOG(log,
501 "No breakpoint site matches for this thread. __debugbreak()? "
502 "Creating stop info with the exception.");
503 // FALLTHROUGH: We'll treat this as a generic exception record in the
504 // default case.
505 [[fallthrough]];
506 }
507 }
508
509 default: {
510 std::string desc;
511 llvm::raw_string_ostream desc_stream(desc);
512 desc_stream << "Exception "
513 << llvm::format_hex(active_exception->GetExceptionCode(), 8)
514 << " encountered at address "
515 << llvm::format_hex(active_exception->GetExceptionAddress(), 8);
516 DumpAdditionalExceptionInformation(desc_stream, active_exception);
517
518 stop_info =
519 StopInfo::CreateStopReasonWithException(*stop_thread, desc.c_str());
520 stop_thread->SetStopInfo(stop_info);
521 LLDB_LOG(log, "{0}", desc);
522 return;
523 }
524 }
525}
526
528 bool plugin_specified_by_name) {
529 if (plugin_specified_by_name)
530 return true;
531
532 // For now we are just making sure the file exists for a given module
533 ModuleSP exe_module_sp(target_sp->GetExecutableModule());
534 if (exe_module_sp.get())
535 return FileSystem::Instance().Exists(exe_module_sp->GetFileSpec());
536 // However, if there is no executable module, we return true since we might
537 // be preparing to attach.
538 return true;
539}
540
542 ThreadList &new_thread_list) {
544 // Add all the threads that were previously running and for which we did not
545 // detect a thread exited event.
546 int new_size = 0;
547 int continued_threads = 0;
548 int exited_threads = 0;
549 int new_threads = 0;
550
551 for (ThreadSP old_thread : old_thread_list.Threads()) {
552 lldb::tid_t old_thread_id = old_thread->GetID();
553 auto exited_thread_iter =
554 m_session_data->m_exited_threads.find(old_thread_id);
555 if (exited_thread_iter == m_session_data->m_exited_threads.end()) {
556 new_thread_list.AddThread(old_thread);
557 ++new_size;
558 ++continued_threads;
559 LLDB_LOG_VERBOSE(log, "Thread {0} was running and is still running.",
560 old_thread_id);
561 } else {
562 LLDB_LOG_VERBOSE(log, "Thread {0} was running and has exited.",
563 old_thread_id);
564 ++exited_threads;
565 }
566 }
567
568 // Also add all the threads that are new since the last time we broke into
569 // the debugger.
570 for (const auto &thread_info : m_session_data->m_new_threads) {
571 new_thread_list.AddThread(thread_info.second);
572 ++new_size;
573 ++new_threads;
574 LLDB_LOG_VERBOSE(log, "Thread {0} is new since last update.",
575 thread_info.first);
576 }
577
578 LLDB_LOG(log, "{0} new threads, {1} old threads, {2} exited threads.",
579 new_threads, continued_threads, exited_threads);
580
581 m_session_data->m_new_threads.clear();
582 m_session_data->m_exited_threads.clear();
583
584 return new_size > 0;
585}
586
588 StateType state = GetPrivateState();
589 switch (state) {
590 case eStateCrashed:
591 case eStateDetached:
592 case eStateUnloaded:
593 case eStateExited:
594 case eStateInvalid:
595 return false;
596 default:
597 return true;
598 }
599}
600
602 return HostInfo::GetArchitecture();
603}
604
606 size_t size, Status &error) {
607 size_t bytes_read = 0;
608 error = ProcessDebugger::ReadMemory(vm_addr, buf, size, bytes_read);
609 return bytes_read;
610}
611
612size_t ProcessWindows::DoWriteMemory(lldb::addr_t vm_addr, const void *buf,
613 size_t size, Status &error) {
614 size_t bytes_written = 0;
615 error = ProcessDebugger::WriteMemory(vm_addr, buf, size, bytes_written);
616 return bytes_written;
617}
618
619lldb::addr_t ProcessWindows::DoAllocateMemory(size_t size, uint32_t permissions,
620 Status &error) {
622 error = ProcessDebugger::AllocateMemory(size, permissions, vm_addr);
623 return vm_addr;
624}
625
629
634
636 Target &target = GetTarget();
637 ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile();
638 Address addr = obj_file->GetImageInfoAddress(&target);
639 if (addr.IsValid())
640 return addr.GetLoadAddress(&target);
641 else
643}
644
651
652void ProcessWindows::OnExitProcess(uint32_t exit_code) {
653 // No need to acquire the lock since m_session_data isn't accessed.
655 LLDB_LOG(log, "Process {0} exited with code {1}", GetID(), exit_code);
656
657 if (m_pty) {
659 m_pty->SetStopping(true);
660 m_pty->Close();
661 m_stdio_communication.InterruptRead();
662 m_stdio_communication.StopReadThread();
663 }
664
665 TargetSP target = CalculateTarget();
666 if (target) {
667 ModuleSP executable_module = target->GetExecutableModule();
668 ModuleList unloaded_modules;
669 unloaded_modules.Append(executable_module);
670 target->ModulesDidUnload(unloaded_modules, true);
671 }
672
673 SetExitStatus(exit_code, /*exit_string=*/"");
675
677}
678
680 if (!m_stdio_communication.ReadThreadIsRunning())
681 return;
682 m_stdio_communication.SynchronizeWithReadThread();
683 if (!m_pty || m_pty->GetMode() != PseudoConsole::Mode::ConPTY)
684 return;
685
686 HANDLE pipe = m_pty->GetSTDOUTHandle();
687 for (int consec_empty = 0; consec_empty < 3;) {
688 if (!m_stdio_communication.ReadThreadIsRunning())
689 break;
690 DWORD avail = 0;
691 // PeekNamedPipe is thread safe.
692 if (!::PeekNamedPipe(pipe, nullptr, 0, nullptr, &avail, nullptr))
693 break;
694 if (avail > 0) {
695 consec_empty = 0;
696 m_stdio_communication.SynchronizeWithReadThread();
697 } else {
698 ++consec_empty;
699 if (consec_empty < 3)
700 ::SleepEx(1, FALSE);
701 }
702 }
703}
704
706 DebuggerThreadSP debugger = m_session_data->m_debugger;
708 LLDB_LOG(log, "Debugger connected to process {0}. Image base = {1:x}",
709 debugger->GetProcess().GetProcessId(), image_base);
710
711 ModuleSP module;
712 // During attach, we won't have the executable module, so find it now.
713 const DWORD pid = debugger->GetProcess().GetProcessId();
714 const std::string file_name = GetProcessExecutableName(pid);
715 if (file_name.empty()) {
716 return;
717 }
718
719 FileSpec executable_file(file_name);
720 FileSystem::Instance().Resolve(executable_file);
721 ModuleSpec module_spec(executable_file);
723 module =
724 GetTarget().GetOrCreateModule(module_spec, true /* notify */, &error);
725 if (!module) {
726 return;
727 }
728
730
731 if (auto dyld = GetDynamicLoader())
732 dyld->OnLoadModule(module, ModuleSpec(), image_base);
733
734 // Add the main executable module to the list of pending module loads. We
735 // can't call GetTarget().ModulesDidLoad() here because we still haven't
736 // returned from DoLaunch() / DoAttach() yet so the target may not have set
737 // the process instance to `this` yet.
738 llvm::sys::ScopedLock lock(m_mutex);
739
740 const HostThread &host_main_thread = debugger->GetMainThread();
741 ThreadSP main_thread =
742 std::make_shared<TargetThreadWindows>(*this, host_main_thread);
743
744 tid_t id = host_main_thread.GetNativeThread().GetThreadId();
745 main_thread->SetID(id);
746
747 m_session_data->m_new_threads[id] = main_thread;
748}
749
752 const ExceptionRecord &record) {
754 llvm::sys::ScopedLock lock(m_mutex);
755
756 // FIXME: Without this check, occasionally when running the test suite there
757 // is
758 // an issue where m_session_data can be null. It's not clear how this could
759 // happen but it only surfaces while running the test suite. In order to
760 // properly diagnose this, we probably need to first figure allow the test
761 // suite to print out full lldb logs, and then add logging to the process
762 // plugin.
763 if (!m_session_data) {
764 LLDB_LOG(log,
765 "Debugger thread reported exception {0:x} at address {1:x}, "
766 "but there is no session.",
767 record.GetExceptionCode(), record.GetExceptionAddress());
769 }
770
771 if (!first_chance) {
772 // Not any second chance exception is an application crash by definition.
773 // It may be an expression evaluation crash.
776 }
777
779 switch (record.GetExceptionCode()) {
780 case EXCEPTION_BREAKPOINT:
781 // Handle breakpoints at the first chance.
783
784 if (!m_session_data->m_initial_stop_received) {
785 LLDB_LOG(
786 log,
787 "Hit loader breakpoint at address {0:x}, setting initial stop event.",
788 record.GetExceptionAddress());
789 m_session_data->m_initial_stop_received = true;
790 ::SetEvent(m_session_data->m_initial_stop_event);
791 } else {
792 LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
793 record.GetExceptionAddress());
794 }
795 // Drain any in-flight process output before announcing the stop. The I/O
796 // reader thread and this debug-event thread run concurrently. Without
797 // synchronization the eBroadcastBitStateChanged(Stopped) event can reach
798 // the Debugger event thread before the preceding eBroadcastBitSTDOUT
799 // events.
802 break;
803 case EXCEPTION_SINGLE_STEP:
807 break;
808 default:
809 LLDB_LOG(log,
810 "Debugger thread reported exception {0:x} at address {1:x} "
811 "(first_chance={2})",
812 record.GetExceptionCode(), record.GetExceptionAddress(),
813 first_chance);
814 // For non-breakpoints, give the application a chance to handle the
815 // exception first.
816 if (first_chance)
818 else
820 }
821
822 return result;
823}
824
826 llvm::sys::ScopedLock lock(m_mutex);
827
828 ThreadSP thread = std::make_shared<TargetThreadWindows>(*this, new_thread);
829
830 const HostNativeThread &native_new_thread = new_thread.GetNativeThread();
831 tid_t id = native_new_thread.GetThreadId();
832 thread->SetID(id);
833
834 m_session_data->m_new_threads[id] = thread;
835
836 for (const std::map<int, WatchpointInfo>::value_type &p : m_watchpoints) {
837 auto *reg_ctx = static_cast<RegisterContextWindows *>(
838 thread->GetRegisterContext().get());
839 reg_ctx->AddHardwareBreakpoint(p.second.slot_id, p.second.address,
840 p.second.size, p.second.read,
841 p.second.write);
842 }
843}
844
845void ProcessWindows::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) {
846 llvm::sys::ScopedLock lock(m_mutex);
847
848 // On a forced termination, we may get exit thread events after the session
849 // data has been cleaned up.
850 if (!m_session_data)
851 return;
852
853 // A thread may have started and exited before the debugger stopped allowing a
854 // refresh.
855 // Just remove it from the new threads list in that case.
856 auto iter = m_session_data->m_new_threads.find(thread_id);
857 if (iter != m_session_data->m_new_threads.end())
858 m_session_data->m_new_threads.erase(iter);
859 else
860 m_session_data->m_exited_threads.insert(thread_id);
861}
862
863void ProcessWindows::OnLoadDll(const ModuleSpec &module_spec,
864 lldb::addr_t module_addr) {
865 if (auto dyld = GetDynamicLoader())
866 dyld->OnLoadModule(nullptr, module_spec, module_addr);
867}
868
870 if (auto dyld = GetDynamicLoader())
871 dyld->OnUnloadModule(module_addr);
872}
873
874void ProcessWindows::OnDebugString(const std::string &string) {}
875
876void ProcessWindows::OnDebuggerError(const Status &error, uint32_t type) {
877 llvm::sys::ScopedLock lock(m_mutex);
879
880 if (m_session_data->m_initial_stop_received) {
881 // This happened while debugging. Do we shutdown the debugging session,
882 // try to continue, or do something else?
883 LLDB_LOG(log,
884 "Error {0} occurred during debugging. Unexpected behavior "
885 "may result. {1}",
886 error.GetError(), error);
887 } else {
888 // If we haven't actually launched the process yet, this was an error
889 // launching the process. Set the internal error and signal the initial
890 // stop event so that the DoLaunch method wakes up and returns a failure.
891 m_session_data->m_launch_error = error.Clone();
892 ::SetEvent(m_session_data->m_initial_stop_event);
893 LLDB_LOG(
894 log,
895 "Error {0} occurred launching the process before the initial stop. {1}",
896 error.GetError(), error);
897 return;
898 }
899}
900
904
905std::optional<DWORD> ProcessWindows::GetActiveExceptionCode() const {
906 if (!m_session_data || !m_session_data->m_debugger)
907 return std::nullopt;
908 auto exc = m_session_data->m_debugger->GetActiveException().lock();
909 if (!exc)
910 return std::nullopt;
911 return exc->GetExceptionCode();
912}
913
916
917 if (wp_sp->IsEnabled()) {
918 wp_sp->SetEnabled(true, notify);
919 return error;
920 }
921
922 WatchpointInfo info;
923 for (info.slot_id = 0;
925 info.slot_id++)
927 break;
930 "Can't find free slot for watchpoint %i", wp_sp->GetID());
931 return error;
932 }
933 info.address = wp_sp->GetLoadAddress();
934 info.size = wp_sp->GetByteSize();
935 info.read = wp_sp->WatchpointRead();
936 info.write = wp_sp->WatchpointWrite() || wp_sp->WatchpointModify();
937
938 for (unsigned i = 0U; i < m_thread_list.GetSize(); i++) {
939 Thread *thread = m_thread_list.GetThreadAtIndex(i).get();
940 auto *reg_ctx = static_cast<RegisterContextWindows *>(
941 thread->GetRegisterContext().get());
942 if (!reg_ctx->AddHardwareBreakpoint(info.slot_id, info.address, info.size,
943 info.read, info.write)) {
945 "Can't enable watchpoint %i on thread 0x%llx", wp_sp->GetID(),
946 thread->GetID());
947 break;
948 }
949 }
950 if (error.Fail()) {
951 for (unsigned i = 0U; i < m_thread_list.GetSize(); i++) {
952 Thread *thread = m_thread_list.GetThreadAtIndex(i).get();
953 auto *reg_ctx = static_cast<RegisterContextWindows *>(
954 thread->GetRegisterContext().get());
955 reg_ctx->RemoveHardwareBreakpoint(info.slot_id);
956 }
957 return error;
958 }
959
960 m_watchpoints[wp_sp->GetID()] = info;
961 m_watchpoint_ids[info.slot_id] = wp_sp->GetID();
962
963 wp_sp->SetEnabled(true, notify);
964
965 return error;
966}
967
970
971 if (!wp_sp->IsEnabled()) {
972 wp_sp->SetEnabled(false, notify);
973 return error;
974 }
975
976 auto it = m_watchpoints.find(wp_sp->GetID());
977 if (it == m_watchpoints.end()) {
979 "Info about watchpoint %i is not found", wp_sp->GetID());
980 return error;
981 }
982
983 for (unsigned i = 0U; i < m_thread_list.GetSize(); i++) {
984 Thread *thread = m_thread_list.GetThreadAtIndex(i).get();
985 auto *reg_ctx = static_cast<RegisterContextWindows *>(
986 thread->GetRegisterContext().get());
987 if (!reg_ctx->RemoveHardwareBreakpoint(it->second.slot_id)) {
989 "Can't disable watchpoint %i on thread 0x%llx", wp_sp->GetID(),
990 thread->GetID());
991 break;
992 }
993 }
994 if (error.Fail())
995 return error;
996
997 m_watchpoint_ids[it->second.slot_id] = LLDB_INVALID_BREAK_ID;
998 m_watchpoints.erase(it);
999
1000 wp_sp->SetEnabled(false, notify);
1001
1002 return error;
1003}
1004
1006public:
1008 : IOHandler(process->GetTarget().GetDebugger(),
1010 m_process(process),
1011 m_read_file(GetInputFD(), File::eOpenOptionReadOnly, false),
1012 m_write_file(conpty_input),
1014 CreateEvent(/*lpEventAttributes=*/NULL, /*bManualReset=*/FALSE,
1015 /*bInitialState=*/FALSE, /*lpName=*/NULL)) {}
1016
1018 if (m_interrupt_event != INVALID_HANDLE_VALUE)
1019 ::CloseHandle(m_interrupt_event);
1020 }
1021
1022 void SetIsRunning(bool running) {
1023 std::lock_guard<std::mutex> guard(m_mutex);
1024 SetIsDone(!running);
1025 m_is_running = running;
1026 }
1027
1028 /// Peek the console for input. If it has any, drain the pipe until text input
1029 /// is found or the pipe is empty.
1030 ///
1031 /// \param hStdin
1032 /// The handle to the standard input's pipe.
1033 ///
1034 /// \return
1035 /// true if the pipe has text input.
1036 llvm::Expected<bool> ConsoleHasTextInput(const HANDLE hStdin) {
1037 // Check if there are already characters buffered. Pressing enter counts as
1038 // 2 characters '\r\n' and only one of them is a keyDown event.
1039 DWORD bytesAvailable = 0;
1040 if (PeekNamedPipe(hStdin, NULL, 0, NULL, &bytesAvailable, NULL)) {
1041 if (bytesAvailable > 0)
1042 return true;
1043 }
1044
1045 while (true) {
1046 INPUT_RECORD inputRecord;
1047 DWORD numRead = 0;
1048 if (!PeekConsoleInput(hStdin, &inputRecord, 1, &numRead))
1049 return llvm::createStringError("failed to peek standard input");
1050
1051 if (numRead == 0)
1052 return false;
1053
1054 if (inputRecord.EventType == KEY_EVENT &&
1055 inputRecord.Event.KeyEvent.bKeyDown &&
1056 inputRecord.Event.KeyEvent.uChar.AsciiChar != 0)
1057 return true;
1058
1059 if (!ReadConsoleInput(hStdin, &inputRecord, 1, &numRead))
1060 return llvm::createStringError("failed to read standard input");
1061 }
1062 }
1063
1064 void Run() override {
1065 if (!m_read_file.IsValid() || m_write_file == INVALID_HANDLE_VALUE) {
1066 SetIsDone(true);
1067 return;
1068 }
1069
1070 SetIsDone(false);
1071 SetIsRunning(true);
1072
1073 HANDLE hStdin = m_read_file.GetWaitableHandle();
1074 HANDLE waitHandles[2] = {hStdin, m_interrupt_event};
1075
1076 DWORD consoleMode;
1077 bool isConsole = GetConsoleMode(hStdin, &consoleMode) != 0;
1078 // With ENABLE_LINE_INPUT, ReadFile returns only when a carriage return is
1079 // read. This will block lldb in ReadFile until the user hits enter. Save
1080 // the previous console mode to restore it later and remove
1081 // ENABLE_LINE_INPUT.
1082 DWORD oldConsoleMode = consoleMode;
1083 SetConsoleMode(hStdin,
1084 consoleMode & ~ENABLE_LINE_INPUT & ~ENABLE_ECHO_INPUT);
1085
1086 while (true) {
1087 {
1088 std::lock_guard<std::mutex> guard(m_mutex);
1089 if (GetIsDone())
1090 goto exit_loop;
1091 }
1092
1093 DWORD result = WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE);
1094 switch (result) {
1095 case WAIT_FAILED:
1096 goto exit_loop;
1097 case WAIT_OBJECT_0: {
1098 if (isConsole) {
1099 auto hasInputOrErr = ConsoleHasTextInput(hStdin);
1100 if (!hasInputOrErr) {
1102 LLDB_LOG_ERROR(log, hasInputOrErr.takeError(),
1103 "failed to process debuggee's IO: {0}");
1104 goto exit_loop;
1105 }
1106
1107 // If no text input is ready, go back to waiting.
1108 if (!*hasInputOrErr)
1109 continue;
1110 }
1111
1112 char ch = 0;
1113 DWORD read = 0;
1114 if (!ReadFile(hStdin, &ch, 1, &read, nullptr) || read != 1)
1115 goto exit_loop;
1116
1117 DWORD written = 0;
1118 if (!WriteFile(m_write_file, &ch, 1, &written, nullptr) || written != 1)
1119 goto exit_loop;
1120 break;
1121 }
1122 case WAIT_OBJECT_0 + 1: {
1123 ControlOp op = m_pending_op.exchange(eControlOpNone);
1124 if (op == eControlOpQuit)
1125 goto exit_loop;
1126 if (op == eControlOpInterrupt &&
1127 StateIsRunningState(m_process->GetState()))
1128 m_process->SendAsyncInterrupt();
1129 break;
1130 }
1131 default:
1132 goto exit_loop;
1133 }
1134 }
1135
1136 exit_loop:;
1137 SetIsRunning(false);
1138 SetIsDone(true);
1139 SetConsoleMode(hStdin, oldConsoleMode);
1140 }
1141
1142 void Cancel() override {
1143 std::lock_guard<std::mutex> guard(m_mutex);
1144 SetIsDone(true);
1145 if (m_is_running) {
1147 ::SetEvent(m_interrupt_event);
1148 }
1149 }
1150
1151 bool Interrupt() override {
1152 if (m_active) {
1154 ::SetEvent(m_interrupt_event);
1155 return true;
1156 }
1157 if (StateIsRunningState(m_process->GetState())) {
1158 m_process->SendAsyncInterrupt();
1159 return true;
1160 }
1161 return false;
1162 }
1163
1164 void GotEOF() override {}
1165
1166private:
1172
1174 /// Read from this file (usually actual STDIN for LLDB)
1176 /// Write to this file (usually the primary pty for getting io to debuggee)
1177 HANDLE m_write_file = INVALID_HANDLE_VALUE;
1178 HANDLE m_interrupt_event = INVALID_HANDLE_VALUE;
1179 std::atomic<ControlOp> m_pending_op{eControlOpNone};
1180 std::mutex m_mutex;
1181 bool m_is_running = false;
1182};
1183
1185 if (m_pty == nullptr)
1186 return;
1187 m_stdio_communication.SetConnection(
1188 std::make_unique<ConnectionConPTY>(m_pty));
1189 if (m_stdio_communication.IsConnected()) {
1190 m_stdio_communication.SetReadThreadBytesReceivedCallback(
1192 m_stdio_communication.StartReadThread();
1193
1194 // Now read thread is set up, set up input reader.
1195 {
1196 std::lock_guard<std::mutex> guard(m_process_input_reader_mutex);
1198 m_process_input_reader = std::make_shared<IOHandlerProcessSTDIOWindows>(
1199 this, m_pty->GetSTDINHandle());
1200 }
1201 }
1202}
1203} // namespace lldb_private
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:364
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:394
#define LLDB_LOG_VERBOSE(log,...)
Definition Log.h:371
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
void * HANDLE
A section + offset based address class.
Definition Address.h:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition Address.cpp:301
bool IsValid() const
Check if the object state is valid.
Definition Address.h:355
An architecture specification class.
Definition ArchSpec.h:32
Class that manages the actual breakpoint that will be inserted into the running program.
static DynamicLoader * FindPlugin(Process *process, llvm::StringRef plugin_name)
Find a dynamic loader plugin for a given process.
lldb::addr_t GetExceptionAddress() const
A file utility class.
Definition FileSpec.h:57
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
An abstract base class for files.
Definition File.h:36
HostNativeThread & GetNativeThread()
NativeFile m_read_file
Read from this file (usually actual STDIN for LLDB)
llvm::Expected< bool > ConsoleHasTextInput(const HANDLE hStdin)
Peek the console for input.
HANDLE m_write_file
Write to this file (usually the primary pty for getting io to debuggee)
IOHandlerProcessSTDIOWindows(Process *process, HANDLE conpty_input)
Debugger & GetDebugger()
Definition IOHandler.h:130
IOHandler(Debugger &debugger, IOHandler::Type type)
Definition IOHandler.cpp:55
void SetIsDone(bool b)
Definition IOHandler.h:81
A collection class for Module objects.
Definition ModuleList.h:125
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:46
virtual lldb_private::Address GetImageInfoAddress(Target *target)
Similar to Process::GetImageInfoAddress().
Definition ObjectFile.h:442
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
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)
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)
lldb::pid_t GetProcessID() const
Definition ProcessInfo.h:68
std::shared_ptr< PTY > TakePTY()
void OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr) override
void OnDebugString(const std::string &string) override
ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
void OnDebuggerConnected(lldb::addr_t image_base) override
Status DoDeallocateMemory(lldb::addr_t ptr) override
Actually deallocate memory in the process.
std::shared_ptr< PTY > m_pty
Status EnableBreakpointSite(BreakpointSite *bp_site) override
void DrainProcessStdout()
Block until the stdio read thread has surfaced everything currently buffered in the ConPTY/pipe to th...
void DidLaunch() override
Called after launching a process.
std::optional< uint32_t > GetWatchpointSlotCount() override
Get the number of watchpoints supported by this target.
Status DoResume(lldb::RunDirection direction) override
Resumes all of a process's threads as configured using the Thread run control functions.
void OnUnloadDll(lldb::addr_t module_addr) override
DynamicLoaderWindowsDYLD * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
Status DisableWatchpoint(lldb::WatchpointSP wp_sp, bool notify=true) override
bool IsAlive() override
Check if a process is still alive.
Status DoGetMemoryRegionInfo(lldb::addr_t vm_addr, MemoryRegionInfo &info) override
DoGetMemoryRegionInfo is called by GetMemoryRegionInfo after it has removed non address bits from loa...
void OnCreateThread(const HostThread &thread) override
static llvm::StringRef GetPluginDescriptionStatic()
size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error) override
Actually do the writing of memory to a process.
llvm::StringRef GetPluginName() override
Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override
Launch a new process.
size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error) override
Actually do the reading of memory from a process.
bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override
Check if a plug-in instance can debug the file in module.
static llvm::StringRef GetPluginNameStatic()
void DidAttach(lldb_private::ArchSpec &arch_spec) override
Called after attaching a process.
void OnExitProcess(uint32_t exit_code) override
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *, bool can_connect)
void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override
Status DoAttachToProcessWithID(lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override
Attach to an existing process using a process ID.
lldb::addr_t GetImageInfoAddress() override
Get the image information address for the current process.
ExceptionResult OnDebugException(bool first_chance, const ExceptionRecord &record) override
std::map< lldb::break_id_t, WatchpointInfo > m_watchpoints
std::optional< DWORD > GetActiveExceptionCode() const
Returns the exception code of the active (current) debug exception, or std::nullopt if there is no ac...
void OnDebuggerError(const Status &error, uint32_t type) override
ArchSpec GetSystemArchitecture() override
Get the system architecture for this process.
Status DoDetach(bool keep_stopped) override
Detaches from a running or stopped process.
std::vector< lldb::break_id_t > m_watchpoint_ids
lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error) override
Actually allocate memory in the process.
Status DisableBreakpointSite(BreakpointSite *bp_site) override
Status DoHalt(bool &caused_stop) override
Halts a running process.
Status EnableWatchpoint(lldb::WatchpointSP wp_sp, bool notify=true) override
A plug-in interface definition class for debugging a process.
Definition Process.h:356
lldb::IOHandlerSP m_process_input_reader
Definition Process.h:3488
std::mutex m_process_input_reader_mutex
Definition Process.h:3489
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
Definition Process.cpp:1561
virtual Status DisableSoftwareBreakpoint(BreakpointSite *bp_site)
Definition Process.cpp:1930
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Definition Process.h:539
Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
Construct with a shared pointer to a target, and the Process listener.
Definition Process.cpp:451
lldb::StateType GetPrivateState() const
Definition Process.h:3398
lldb::DynamicLoaderUP m_dyld_up
Definition Process.h:3476
bool IsBreakpointSitePhysicallyEnabled(const BreakpointSite &site)
Definition Process.cpp:1656
lldb::TargetSP CalculateTarget() override
Definition Process.cpp:4810
virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site)
Definition Process.cpp:1850
void SetID(lldb::pid_t new_pid)
Sets the stored pid.
Definition Process.h:544
friend class Target
Definition Process.h:362
virtual bool SetExitStatus(int exit_status, llvm::StringRef exit_string)
Set accessor for the process exit status (return code).
Definition Process.cpp:1044
static void STDIOReadThreadBytesReceived(void *baton, const void *src, size_t src_len)
Definition Process.cpp:4944
void SetPrivateState(lldb::StateType state)
Definition Process.cpp:1402
ThreadList m_thread_list
The threads for this process as the user will see them.
Definition Process.h:3449
ThreadedCommunication m_stdio_communication
Definition Process.h:3490
friend class ThreadList
Definition Process.h:363
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1254
static constexpr uint32_t GetNumHardwareBreakpointSlots()
bool AddHardwareBreakpoint(uint32_t slot, lldb::addr_t address, uint32_t size, bool read, bool write)
An error handling class.
Definition Status.h:118
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
static lldb::StopInfoSP CreateStopReasonToTrace(Thread &thread)
static lldb::StopInfoSP CreateStopReasonWithWatchpointID(Thread &thread, lldb::break_id_t watch_id, bool silently_continue=false)
static lldb::StopInfoSP CreateStopReasonWithException(Thread &thread, const char *description)
static lldb::StopInfoSP CreateStopReasonWithBreakpointSiteID(Thread &thread, lldb::break_id_t break_id)
StopPointSiteSP FindByAddress(lldb::addr_t addr)
Returns a shared pointer to the site at address addr.
lldb::break_id_t GetID() const
virtual lldb::addr_t GetLoadAddress() const
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition Target.cpp:1594
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
Definition Target.cpp:1627
void AddThread(const lldb::ThreadSP &thread_sp)
virtual ThreadIterable Threads()
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_ADDRESS
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
void RegisterMSVCRTCFrameRecognizer(ProcessWindows &process)
Registers the MSVC run-time check failure frame recognizer with the target.
std::shared_ptr< ExceptionRecord > ExceptionRecordSP
Definition ForwardDecl.h:37
HostThreadPosix HostNativeThread
bool StateIsRunningState(lldb::StateType state)
Check if a state represents a state where the process or thread is running.
Definition State.cpp:68
std::shared_ptr< IDebugDelegate > DebugDelegateSP
Definition ForwardDecl.h:35
std::shared_ptr< DebuggerThread > DebuggerThreadSP
Definition ForwardDecl.h:36
static void DumpAdditionalExceptionInformation(llvm::raw_ostream &stream, const ExceptionRecordSP &exception)
static bool ShouldUseLLDBServer()
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
RunDirection
Execution directions.
std::shared_ptr< lldb_private::Thread > ThreadSP
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.
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateExited
Process has exited and can't be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
std::shared_ptr< lldb_private::Process > ProcessSP
uint64_t pid_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
uint64_t tid_t
Definition lldb-types.h:84
std::shared_ptr< lldb_private::Module > ModuleSP