LLDB mainline
DynamicLoaderPOSIXDYLD.cpp
Go to the documentation of this file.
1//===-- DynamicLoaderPOSIXDYLD.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// Main header include
11
14#include "lldb/Core/Debugger.h"
15#include "lldb/Core/Module.h"
18#include "lldb/Core/Section.h"
24#include "lldb/Target/Target.h"
25#include "lldb/Target/Thread.h"
28#include "lldb/Utility/Log.h"
30#include "llvm/Support/ThreadPool.h"
31
32#include <memory>
33#include <optional>
34
35using namespace lldb;
36using namespace lldb_private;
37
39
44
48
50 return "Dynamic loader plug-in that watches for shared library "
51 "loads/unloads in POSIX processes.";
52}
53
55 bool force) {
56 bool create = force;
57 if (!create) {
58 const llvm::Triple &triple_ref =
59 process->GetTarget().GetArchitecture().GetTriple();
60 if (triple_ref.getOS() == llvm::Triple::FreeBSD ||
61 triple_ref.getOS() == llvm::Triple::Linux ||
62 triple_ref.getOS() == llvm::Triple::NetBSD ||
63 triple_ref.getOS() == llvm::Triple::OpenBSD)
64 create = true;
65 }
66
67 if (create)
68 return new DynamicLoaderPOSIXDYLD(process);
69 return nullptr;
70}
71
79
86
89 LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
91 m_auxv = std::make_unique<AuxVector>(m_process->GetAuxvData());
92
94 log, "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
95 __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
96
97 ModuleSP executable_sp = GetTargetExecutable();
98 ResolveExecutableModule(executable_sp);
99 m_rendezvous.UpdateExecutablePath();
100
101 // find the main process load offset
102 addr_t load_offset = ComputeLoadOffset();
103 LLDB_LOGF(log,
104 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
105 " executable '%s', load_offset 0x%" PRIx64,
106 __FUNCTION__,
108 executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
109 : "<null executable>",
110 load_offset);
111
113
114 // if we dont have a load address we cant re-base
115 bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS;
116
117 // if the target executable should be re-based
118 if (rebase_exec) {
119 ModuleList module_list;
120
121 module_list.Append(executable_sp);
122 LLDB_LOGF(log,
123 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
124 " added executable '%s' to module load list",
125 __FUNCTION__,
127 executable_sp->GetFileSpec().GetPath().c_str());
128
129 UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset,
130 true);
131
133
134 m_process->GetTarget().ModulesDidLoad(module_list);
135 if (log) {
136 LLDB_LOGF(log,
137 "DynamicLoaderPOSIXDYLD::%s told the target about the "
138 "modules that loaded:",
139 __FUNCTION__);
140 for (auto module_sp : module_list.Modules()) {
141 LLDB_LOGF(log, "-- [module] %s (pid %" PRIu64 ")",
142 module_sp ? module_sp->GetFileSpec().GetPath().c_str()
143 : "<null>",
145 }
146 }
147 }
148
149 if (executable_sp.get()) {
151 // If we cannot establish rendezvous breakpoint right now we'll try again
152 // at entry point.
153 ProbeEntry();
154 }
155 }
156}
157
160 LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
161
162 ModuleSP executable;
163 addr_t load_offset;
164
165 m_auxv = std::make_unique<AuxVector>(m_process->GetAuxvData());
166
167 executable = GetTargetExecutable();
168 load_offset = ComputeLoadOffset();
170
171 if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) {
172 ModuleList module_list;
173 module_list.Append(executable);
174 UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true);
175
176 LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
177 __FUNCTION__);
178
180 // If we cannot establish rendezvous breakpoint right now we'll try again
181 // at entry point.
182 ProbeEntry();
183 }
184
185 LoadVDSO();
186 m_process->GetTarget().ModulesDidLoad(module_list);
187 }
188}
189
191
193 addr_t link_map_addr) {
194 llvm::sys::ScopedWriter lock(m_loaded_modules_rw_mutex);
195 m_loaded_modules[module_sp] = link_map_addr;
196}
197
199 llvm::sys::ScopedWriter lock(m_loaded_modules_rw_mutex);
200 m_loaded_modules.erase(module_sp);
201}
202
203std::optional<lldb::addr_t>
205 llvm::sys::ScopedReader lock(m_loaded_modules_rw_mutex);
206 auto it = m_loaded_modules.find(module_sp);
207 if (it != m_loaded_modules.end())
208 return it->second;
209 return std::nullopt;
210}
211
213 addr_t link_map_addr,
214 addr_t base_addr,
215 bool base_addr_is_offset) {
216 SetLoadedModule(module, link_map_addr);
217
218 UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset);
219}
220
222 UnloadModule(module);
223
224 UnloadSectionsCommon(module);
225}
226
229
230 // If we have a core file, we don't need any breakpoints.
231 if (IsCoreFile())
232 return;
233
234 const addr_t entry = GetEntryPoint();
235 if (entry == LLDB_INVALID_ADDRESS) {
236 LLDB_LOGF(
237 log,
238 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
239 " GetEntryPoint() returned no address, not setting entry breakpoint",
240 __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
241 return;
242 }
243
244 LLDB_LOGF(log,
245 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
246 " GetEntryPoint() returned address 0x%" PRIx64
247 ", setting entry breakpoint",
248 __FUNCTION__,
249 m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, entry);
250
251 if (m_process) {
252 Breakpoint *const entry_break =
253 m_process->GetTarget().CreateBreakpoint(entry, true, false).get();
254 entry_break->SetCallback(EntryBreakpointHit, this, true);
255 entry_break->SetBreakpointKind("shared-library-event");
256
257 // Shoudn't hit this more than once.
258 entry_break->SetOneShot(true);
259 }
260}
261
262// The runtime linker has run and initialized the rendezvous structure once the
263// process has hit its entry point. When we hit the corresponding breakpoint
264// we interrogate the rendezvous structure to get the load addresses of all
265// dependent modules for the process. Similarly, we can discover the runtime
266// linker function and setup a breakpoint to notify us of any dynamically
267// loaded modules (via dlopen).
269 void *baton, StoppointCallbackContext *context, user_id_t break_id,
270 user_id_t break_loc_id) {
271 assert(baton && "null baton");
272 if (!baton)
273 return false;
274
276 DynamicLoaderPOSIXDYLD *const dyld_instance =
277 static_cast<DynamicLoaderPOSIXDYLD *>(baton);
278 LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
279 __FUNCTION__,
280 dyld_instance->m_process ? dyld_instance->m_process->GetID()
282
283 // Disable the breakpoint --- if a stop happens right after this, which we've
284 // seen on occasion, we don't want the breakpoint stepping thread-plan logic
285 // to show a breakpoint instruction at the disassembled entry point to the
286 // program. Disabling it prevents it. (One-shot is not enough - one-shot
287 // removal logic only happens after the breakpoint goes public, which wasn't
288 // happening in our scenario).
289 if (dyld_instance->m_process) {
290 BreakpointSP breakpoint_sp =
291 dyld_instance->m_process->GetTarget().GetBreakpointByID(break_id);
292 if (breakpoint_sp) {
293 LLDB_LOGF(log,
294 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
295 " disabling breakpoint id %" PRIu64,
296 __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
297 breakpoint_sp->SetEnabled(false);
298 } else {
299 LLDB_LOGF(log,
300 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
301 " failed to find breakpoint for breakpoint id %" PRIu64,
302 __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
303 }
304 } else {
305 LLDB_LOGF(log,
306 "DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
307 " no Process instance! Cannot disable breakpoint",
308 __FUNCTION__, break_id);
309 }
310
311 dyld_instance->LoadAllCurrentModules();
312 dyld_instance->SetRendezvousBreakpoint();
313 return false; // Continue running.
314}
315
318
319 // If we have a core file, we don't need any breakpoints.
320 if (IsCoreFile())
321 return false;
322
324 LLDB_LOG(log,
325 "Rendezvous breakpoint breakpoint id {0} for pid {1}"
326 "is already set.",
329 return true;
330 }
331
332 addr_t break_addr;
333 Target &target = m_process->GetTarget();
334 BreakpointSP dyld_break;
335 if (m_rendezvous.IsValid() && m_rendezvous.GetBreakAddress() != 0) {
336 break_addr = m_rendezvous.GetBreakAddress();
337 LLDB_LOG(log, "Setting rendezvous break address for pid {0} at {1:x}",
339 break_addr);
340 dyld_break = target.CreateBreakpoint(break_addr, true, false);
341 } else {
342 LLDB_LOG(log, "Rendezvous structure is not set up yet. "
343 "Trying to locate rendezvous breakpoint in the interpreter "
344 "by symbol name.");
345 // Function names from different dynamic loaders that are known to be
346 // used as rendezvous between the loader and debuggers.
347 static std::vector<std::string> DebugStateCandidates{
348 "_dl_debug_state", "rtld_db_dlactivity", "__dl_rtld_db_dlactivity",
349 "r_debug_state", "_r_debug_state", "_rtld_debug_state",
350 };
351
352 ModuleSP interpreter = LoadInterpreterModule();
353 FileSpecList containingModules;
354 if (interpreter)
355 containingModules.Append(interpreter->GetFileSpec());
356 else
357 containingModules.Append(
358 m_process->GetTarget().GetExecutableModulePointer()->GetFileSpec());
359
360 dyld_break = target.CreateBreakpoint(
361 &containingModules, /*containingSourceFiles=*/nullptr,
362 DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
363 /*m_offset=*/0,
364 /*skip_prologue=*/eLazyBoolNo,
365 /*internal=*/true,
366 /*request_hardware=*/false);
367 }
368
369 if (dyld_break->GetNumResolvedLocations() != 1) {
370 LLDB_LOG(
371 log,
372 "Rendezvous breakpoint has abnormal number of"
373 " resolved locations ({0}) in pid {1}. It's supposed to be exactly 1.",
374 dyld_break->GetNumResolvedLocations(),
376
377 target.RemoveBreakpointByID(dyld_break->GetID());
378 return false;
379 }
380
381 BreakpointLocationSP location = dyld_break->GetLocationAtIndex(0);
382 LLDB_LOG(log,
383 "Successfully set rendezvous breakpoint at address {0:x} "
384 "for pid {1}",
385 location->GetLoadAddress(),
387
388 dyld_break->SetCallback(RendezvousBreakpointHit, this, true);
389 dyld_break->SetBreakpointKind("shared-library-event");
390 m_dyld_bid = dyld_break->GetID();
391 return true;
392}
393
395 void *baton, StoppointCallbackContext *context, user_id_t break_id,
396 user_id_t break_loc_id) {
397 assert(baton && "null baton");
398 if (!baton)
399 return false;
400
402 DynamicLoaderPOSIXDYLD *const dyld_instance =
403 static_cast<DynamicLoaderPOSIXDYLD *>(baton);
404 LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
405 __FUNCTION__,
406 dyld_instance->m_process ? dyld_instance->m_process->GetID()
408
409 dyld_instance->RefreshModules();
410
411 // Return true to stop the target, false to just let the target run.
412 const bool stop_when_images_change = dyld_instance->GetStopWhenImagesChange();
413 LLDB_LOGF(log,
414 "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
415 " stop_when_images_change=%s",
416 __FUNCTION__,
417 dyld_instance->m_process ? dyld_instance->m_process->GetID()
419 stop_when_images_change ? "true" : "false");
420 return stop_when_images_change;
421}
422
424 if (!m_rendezvous.Resolve())
425 return;
426
427 // The rendezvous class doesn't enumerate the main module, so track that
428 // ourselves here.
429 ModuleSP executable = GetTargetExecutable();
430 SetLoadedModule(executable, m_rendezvous.GetLinkMapAddress());
431
434
435 ModuleList &loaded_modules = m_process->GetTarget().GetImages();
436
437 if (m_rendezvous.ModulesDidLoad() || !m_initial_modules_added) {
438 ModuleList new_modules;
439
440 // If this is the first time rendezvous breakpoint fires, we need
441 // to take care of adding all the initial modules reported by
442 // the loader. This is necessary to list ld-linux.so on Linux,
443 // and all DT_NEEDED entries on *BSD.
445 I = m_rendezvous.loaded_begin();
446 E = m_rendezvous.loaded_end();
447 } else {
448 I = m_rendezvous.begin();
449 E = m_rendezvous.end();
451 }
452
453 // Synchronize reading and writing of `m_interpreter_module`.
454 std::mutex interpreter_module_mutex;
455 // We should be able to take SOEntry as reference since the data
456 // exists for the duration of this call in `m_rendezvous`.
457 auto load_module_fn =
458 [this, &loaded_modules, &new_modules,
459 &interpreter_module_mutex](const DYLDRendezvous::SOEntry &so_entry) {
460 // Don't load a duplicate copy of ld.so if we have already loaded it
461 // earlier in LoadInterpreterModule. If we instead loaded then
462 // unloaded it later, the section information for ld.so would be
463 // removed. That information is required for placing breakpoints on
464 // Arm/Thumb systems.
465 {
466 // `m_interpreter_module` may be modified by another thread at the
467 // same time, so we guard the access here.
468 std::lock_guard<std::mutex> lock(interpreter_module_mutex);
469 if ((m_interpreter_module.lock() != nullptr) &&
470 (so_entry.base_addr == m_interpreter_base))
471 return;
472 }
473
474 ModuleSP module_sp = LoadModuleAtAddress(
475 so_entry.file_spec, so_entry.link_addr, so_entry.base_addr,
476 /*base_addr_is_offset=*/true);
477 if (!module_sp.get())
478 return;
479
480 {
481 // `m_interpreter_module` may be modified by another thread at the
482 // same time, so we guard the access here.
483 std::lock_guard<std::mutex> lock(interpreter_module_mutex);
484 // Set the interpreter module, if this is the interpreter.
485 if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
486 &m_process->GetTarget()) == m_interpreter_base) {
487 ModuleSP interpreter_sp = m_interpreter_module.lock();
488 if (m_interpreter_module.lock() == nullptr) {
489 m_interpreter_module = module_sp;
490 } else if (module_sp == interpreter_sp) {
491 // Module already loaded.
492 return;
493 }
494 }
495 }
496
497 // Note: in a multi-threaded environment, these module lists may be
498 // appended to out-of-order. This is fine, since there's no
499 // expectation for `loaded_modules` or `new_modules` to be in any
500 // particular order, and appending to each module list is thread-safe.
501 // Also, `new_modules` is only used for the `ModulesDidLoad` call at
502 // the end of this function.
503 loaded_modules.AppendIfNeeded(module_sp);
504 new_modules.Append(module_sp);
505 };
506
507 if (m_process->GetTarget().GetParallelModuleLoad()) {
508 llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
509 for (; I != E; ++I)
510 task_group.async(load_module_fn, *I);
511 task_group.wait();
512 } else {
513 for (; I != E; ++I)
514 load_module_fn(*I);
515 }
516
517 m_process->GetTarget().ModulesDidLoad(new_modules);
518 }
519
520 if (m_rendezvous.ModulesDidUnload()) {
521 ModuleList old_modules;
522
523 E = m_rendezvous.unloaded_end();
524 for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
525 ModuleSpec module_spec{I->file_spec};
526 ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
527
528 if (module_sp.get()) {
529 old_modules.Append(module_sp);
530 UnloadSections(module_sp);
531 }
532 }
533 loaded_modules.Remove(old_modules);
534 m_process->GetTarget().ModulesDidUnload(old_modules, false);
535 }
536}
537
540 bool stop) {
541 ThreadPlanSP thread_plan_sp;
542
543 StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
544 const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol);
545 const Symbol *sym = context.symbol;
546
547 if (sym == nullptr || !sym->IsTrampoline())
548 return thread_plan_sp;
549
551 if (!sym_name)
552 return thread_plan_sp;
553
554 SymbolContextList target_symbols;
555 Target &target = thread.GetProcess()->GetTarget();
556 const ModuleList &images = target.GetImages();
557
558 llvm::StringRef target_name = sym_name.GetStringRef();
559 // On AArch64, the trampoline name has a prefix (__AArch64ADRPThunk_ or
560 // __AArch64AbsLongThunk_) added to the function name. If we detect a
561 // trampoline with the prefix, we need to remove the prefix to find the
562 // function symbol.
563 if (target_name.consume_front("__AArch64ADRPThunk_") ||
564 target_name.consume_front("__AArch64AbsLongThunk_")) {
565 // An empty target name can happen for trampolines generated for
566 // section-referencing relocations.
567 if (!target_name.empty()) {
568 sym_name = ConstString(target_name);
569 }
570 }
571 images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
572 if (!target_symbols.GetSize())
573 return thread_plan_sp;
574
575 typedef std::vector<lldb::addr_t> AddressVector;
576 AddressVector addrs;
577 for (const SymbolContext &context : target_symbols) {
578 addr_t addr = context.GetFunctionOrSymbolAddress().GetLoadAddress(&target);
579 if (addr != LLDB_INVALID_ADDRESS)
580 addrs.push_back(addr);
581 }
582
583 if (addrs.size() > 0) {
584 AddressVector::iterator start = addrs.begin();
585 AddressVector::iterator end = addrs.end();
586
587 llvm::sort(start, end);
588 addrs.erase(std::unique(start, end), end);
589 thread_plan_sp =
590 std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
591 }
592
593 return thread_plan_sp;
594}
595
598 return;
599
600 FileSpec file("[vdso]");
601
603 MemoryRegionInfo info;
604 Status status = m_process->GetMemoryRegionInfo(m_vdso_base, info);
605 if (status.Fail()) {
606 LLDB_LOG(log, "Failed to get vdso region info: {0}", status);
607 return;
608 }
609
610 llvm::Expected<ModuleSP> module_sp_or_err = m_process->ReadModuleFromMemory(
611 file, m_vdso_base, info.GetRange().GetByteSize());
612 if (auto err = module_sp_or_err.takeError()) {
613 LLDB_LOG_ERROR(log, std::move(err),
614 "Failed to read module from memory: {0}");
615 } else if (ModuleSP module_sp = *module_sp_or_err) {
617 m_process->GetTarget().GetImages().AppendIfNeeded(module_sp);
618 }
619}
620
623 return nullptr;
624
625 MemoryRegionInfo info;
626 Target &target = m_process->GetTarget();
627 Status status = m_process->GetMemoryRegionInfo(m_interpreter_base, info);
628 if (status.Fail() || info.GetMapped() != MemoryRegionInfo::eYes ||
629 info.GetName().IsEmpty()) {
631 LLDB_LOG(log, "Failed to get interpreter region info: {0}", status);
632 return nullptr;
633 }
634
635 FileSpec file(info.GetName().GetCString());
636 ModuleSpec module_spec(file, target.GetArchitecture());
637
638 // Don't notify that module is added here because its loading section
639 // addresses are not updated yet. We manually notify it below.
640 if (ModuleSP module_sp =
641 target.GetOrCreateModule(module_spec, /*notify=*/false)) {
643 false);
644 // Manually notify that dynamic linker is loaded after updating load section
645 // addersses so that breakpoints can be resolved.
646 ModuleList module_list;
647 module_list.Append(module_sp);
648 target.ModulesDidLoad(module_list);
649 m_interpreter_module = module_sp;
650 return module_sp;
651 }
652 return nullptr;
653}
654
656 addr_t link_map_addr,
657 addr_t base_addr,
658 bool base_addr_is_offset) {
660 file, link_map_addr, base_addr, base_addr_is_offset))
661 return module_sp;
662
663 // This works around an dynamic linker "bug" on android <= 23, where the
664 // dynamic linker would report the application name
665 // (e.g. com.example.myapplication) instead of the main process binary
666 // (/system/bin/app_process(32)). The logic is not sound in general (it
667 // assumes base_addr is the real address, even though it actually is a load
668 // bias), but it happens to work on android because app_process has a file
669 // address of zero.
670 // This should be removed after we drop support for android-23.
671 if (m_process->GetTarget().GetArchitecture().GetTriple().isAndroid()) {
672 MemoryRegionInfo memory_info;
673 Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
674 if (error.Success() && memory_info.GetMapped() &&
675 memory_info.GetRange().GetRangeBase() == base_addr &&
676 !(memory_info.GetName().IsEmpty())) {
678 FileSpec(memory_info.GetName().GetStringRef()), link_map_addr,
679 base_addr, base_addr_is_offset))
680 return module_sp;
681 }
682 }
683
684 return nullptr;
685}
686
690 ModuleList module_list;
692
693 LoadVDSO();
694
695 if (!m_rendezvous.Resolve()) {
696 LLDB_LOGF(log,
697 "DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
698 "rendezvous address",
699 __FUNCTION__);
700 return;
701 }
702
703 // The rendezvous class doesn't enumerate the main module, so track that
704 // ourselves here.
705 ModuleSP executable = GetTargetExecutable();
706 SetLoadedModule(executable, m_rendezvous.GetLinkMapAddress());
707
708 Target &target = m_process->GetTarget();
709 std::vector<FileSpec> module_names;
710 for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
711 module_names.push_back(I->file_spec);
712 m_process->PrefetchModuleSpecs(module_names,
713 target.GetArchitecture().GetTriple());
714
715 auto load_module_fn = [this, &module_list, &target,
716 &log](const DYLDRendezvous::SOEntry &so_entry) {
717 ModuleSP module_sp = LoadModuleAtAddress(
718 so_entry.file_spec, so_entry.link_addr, so_entry.base_addr, true);
719 if (!module_sp && !m_process->IsLiveDebugSession()) {
720 // Create placeholder modules for any modules we couldn't load from disk
721 // or from memory.
722 ModuleSpec module_spec(so_entry.file_spec, target.GetArchitecture());
723 if (UUID uuid = m_process->FindModuleUUID(so_entry.file_spec.GetPath()))
724 module_spec.GetUUID() = uuid;
726 module_spec, so_entry.base_addr, 512);
727 bool load_addr_changed = false;
728 target.GetImages().Append(module_sp, false);
729 module_sp->SetLoadAddress(target, so_entry.base_addr, false,
730 load_addr_changed);
731 }
732 if (module_sp.get()) {
733 LLDB_LOG(log, "LoadAllCurrentModules loading module: {0}",
734 so_entry.file_spec.GetFilename());
735 module_list.Append(module_sp);
736 } else {
737 LLDB_LOGF(
738 log,
739 "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
740 __FUNCTION__, so_entry.file_spec.GetPath().c_str(),
741 so_entry.base_addr);
742 }
743 };
744 if (m_process->GetTarget().GetParallelModuleLoad()) {
745 llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
746 for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
747 task_group.async(load_module_fn, *I);
748 task_group.wait();
749 } else {
750 for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
751 load_module_fn(*I);
752 }
753
754 m_process->GetTarget().ModulesDidLoad(module_list);
756}
757
759 addr_t virt_entry;
760
762 return m_load_offset;
763
764 if ((virt_entry = GetEntryPoint()) == LLDB_INVALID_ADDRESS)
766
767 ModuleSP module = m_process->GetTarget().GetExecutableModule();
768 if (!module)
770
771 ObjectFile *exe = module->GetObjectFile();
772 if (!exe)
774
775 Address file_entry = exe->GetEntryPointAddress();
776
777 if (!file_entry.IsValid())
779
780 m_load_offset = virt_entry - file_entry.GetFileAddress();
781 return m_load_offset;
782}
783
785 if (std::optional<uint64_t> vdso_base =
787 m_vdso_base = *vdso_base;
788
789 if (std::optional<uint64_t> interpreter_base =
790 m_auxv->GetAuxValue(AuxVector::AUXV_AT_BASE))
791 m_interpreter_base = *interpreter_base;
792}
793
796 return m_entry_point;
797
798 if (m_auxv == nullptr)
800
801 std::optional<uint64_t> entry_point =
802 m_auxv->GetAuxValue(AuxVector::AUXV_AT_ENTRY);
803 if (!entry_point)
805
806 m_entry_point = static_cast<addr_t>(*entry_point);
807
808 const ArchSpec &arch = m_process->GetTarget().GetArchitecture();
809
810 // On ppc64, the entry point is actually a descriptor. Dereference it.
811 if (arch.GetMachine() == llvm::Triple::ppc64)
813
814 return m_entry_point;
815}
816
819 const lldb::ThreadSP thread,
820 lldb::addr_t tls_file_addr) {
822 std::optional<addr_t> link_map_addr_opt = GetLoadedModuleLinkAddr(module_sp);
823 if (!link_map_addr_opt.has_value()) {
824 LLDB_LOGF(
825 log, "GetThreadLocalData error: module(%s) not found in loaded modules",
826 module_sp->GetObjectName().AsCString());
828 }
829
830 addr_t link_map = link_map_addr_opt.value();
831 if (link_map == LLDB_INVALID_ADDRESS || link_map == 0) {
832 LLDB_LOGF(log,
833 "GetThreadLocalData error: invalid link map address=0x%" PRIx64,
834 link_map);
836 }
837
838 const DYLDRendezvous::ThreadInfo &metadata = m_rendezvous.GetThreadInfo();
839 if (!metadata.valid) {
840 LLDB_LOGF(log,
841 "GetThreadLocalData error: fail to read thread info metadata");
843 }
844
845 LLDB_LOGF(log,
846 "GetThreadLocalData info: link_map=0x%" PRIx64
847 ", thread info metadata: "
848 "modid_offset=0x%" PRIx32 ", pthread_size=0x%" PRIx32
849 ", dtv_offset=0x%" PRIx32 ", tls_offset=0x%" PRIx32
850 ", dtv_slot_size=%" PRIx32 "\n",
851 link_map, metadata.modid_offset, metadata.pthread_size,
852 metadata.dtv_offset, metadata.tls_offset, metadata.dtv_slot_size);
853
854 // Get the thread pointer.
855 addr_t tp = thread->GetThreadPointer();
856 if (tp == LLDB_INVALID_ADDRESS) {
857 LLDB_LOGF(log, "GetThreadLocalData error: fail to read thread pointer");
859 }
860
861 // Find the module's modid.
862 int modid_size = 4; // FIXME(spucci): This isn't right for big-endian 64-bit
863 int64_t modid = ReadUnsignedIntWithSizeInBytes(
864 link_map + metadata.modid_offset, modid_size);
865 if (modid == -1) {
866 LLDB_LOGF(log, "GetThreadLocalData error: fail to read modid");
868 }
869
870 // Lookup the DTV structure for this thread.
872 if (metadata.dtv_offset < metadata.pthread_size) {
873 // The DTV pointer field lies within `pthread`. This indicates that `libc`
874 // placed `tcbhead_t header`, which contains the `dtv` field, inside
875 // `pthread`, so, for this architecture, `TLS_TCB_AT_TP` is set to `1` and
876 // `TLS_DTV_AT_TP` is `0`. This corresponds to the "Variant II" memory
877 // layout described in Ulrich Drepper's ELF TLS document
878 // (https://akkadia.org/drepper/tls.pdf). The thread pointer points to the
879 // start of `pthread`, and the address of the `dtv` field can be calculated
880 // by adding its offset.
881 dtv_ptr = tp + metadata.dtv_offset;
882 } else if (metadata.dtv_offset == metadata.pthread_size) {
883 // The DTV pointer field is located right after `pthread`. This means that,
884 // for this architecture, `TLS_DTV_AT_TP` is set to `1` in `libc`, which may
885 // correspond to the "Variant I" memory layout, in which the thread pointer
886 // points directly to the `dtv` field. However, for different architectures,
887 // the position of the `dtv` field relative to the thread pointer may vary,
888 // so the following calculations must be adjusted for each platform.
889 //
890 // On AArch64 and ARM, `tp` is known to point directly to `dtv`.
891 const llvm::Triple &triple = module_sp->GetArchitecture().GetTriple();
892 if (triple.isAArch64() || triple.isARM()) {
893 dtv_ptr = tp;
894 }
895 }
896 addr_t dtv = (dtv_ptr != LLDB_INVALID_ADDRESS) ? ReadPointer(dtv_ptr)
898 if (dtv == LLDB_INVALID_ADDRESS) {
899 LLDB_LOGF(log, "GetThreadLocalData error: fail to read dtv");
901 }
902
903 // Find the TLS block for this module.
904 addr_t dtv_slot = dtv + metadata.dtv_slot_size * modid;
905 addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
906
907 LLDB_LOGF(log,
908 "DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
909 "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
910 ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
911 module_sp->GetObjectName().AsCString(""), link_map, tp,
912 (int64_t)modid, tls_block);
913
914 if (tls_block == LLDB_INVALID_ADDRESS) {
915 LLDB_LOGF(log, "GetThreadLocalData error: fail to read tls_block");
917 } else
918 return tls_block + tls_file_addr;
919}
920
922 lldb::ModuleSP &module_sp) {
924
925 if (m_process == nullptr)
926 return;
927
928 auto &target = m_process->GetTarget();
929 const auto platform_sp = target.GetPlatform();
930
931 ProcessInstanceInfo process_info;
932 if (!m_process->GetProcessInfo(process_info)) {
933 LLDB_LOGF(log,
934 "DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
935 "pid %" PRIu64,
936 __FUNCTION__, m_process->GetID());
937 return;
938 }
939
940 LLDB_LOGF(
941 log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
942 __FUNCTION__, m_process->GetID(),
943 process_info.GetExecutableFile().GetPath().c_str());
944
945 ModuleSpec module_spec(process_info.GetExecutableFile(),
946 process_info.GetArchitecture());
947 if (module_sp && module_sp->MatchesModuleSpec(module_spec))
948 return;
949
950 module_spec.SetTarget(target.shared_from_this());
951 const auto executable_search_paths(Target::GetDefaultExecutableSearchPaths());
952 auto error = platform_sp->ResolveExecutable(module_spec, module_sp);
953 if (error.Fail()) {
954 StreamString stream;
955 module_spec.Dump(stream);
956
957 LLDB_LOGF(log,
958 "DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
959 "with module spec \"%s\": %s",
960 __FUNCTION__, stream.GetData(), error.AsCString());
961 return;
962 }
963
964 target.SetExecutableModule(module_sp, eLoadDependentsNo);
965}
966
969 ModuleSP module_sp;
970 if (sym_ctx.symbol)
971 module_sp = sym_ctx.symbol->GetAddressRef().GetModule();
972 if (!module_sp && sym_ctx.function)
973 module_sp = sym_ctx.function->GetAddress().GetModule();
974 if (!module_sp)
975 return false;
976
977 return module_sp->GetFileSpec().GetPath() == "[vdso]";
978}
979
981 return !m_process->IsLiveDebugSession();
982}
983
984// For our ELF/POSIX builds save off the fs_base/gs_base regions
985static void AddThreadLocalMemoryRegions(Process &process, ThreadSP &thread_sp,
986 std::vector<MemoryRegionInfo> &ranges) {
987 lldb::RegisterContextSP reg_ctx = thread_sp->GetRegisterContext();
988 if (!reg_ctx)
989 return;
990
991 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
993 if (!reg_info)
994 return;
995
996 lldb_private::RegisterValue thread_local_register_value;
997 bool success = reg_ctx->ReadRegister(reg_info, thread_local_register_value);
998 if (!success)
999 return;
1000
1001 const uint64_t fail_value = UINT64_MAX;
1002 bool readSuccess = false;
1003 const lldb::addr_t reg_value_addr =
1004 thread_local_register_value.GetAsUInt64(fail_value, &readSuccess);
1005 if (!readSuccess || reg_value_addr == fail_value)
1006 return;
1007
1008 MemoryRegionInfo thread_local_region;
1009 Status err = process.GetMemoryRegionInfo(reg_value_addr, thread_local_region);
1010 if (err.Fail())
1011 return;
1012
1013 ranges.push_back(thread_local_region);
1014}
1015
1016// Save off the link map for core files.
1017static void AddLinkMapSections(Process &process,
1018 std::vector<MemoryRegionInfo> &ranges) {
1019 ModuleList &module_list = process.GetTarget().GetImages();
1020 Target *target = &process.GetTarget();
1021 for (size_t idx = 0; idx < module_list.GetSize(); idx++) {
1022 ModuleSP module_sp = module_list.GetModuleAtIndex(idx);
1023 if (!module_sp)
1024 continue;
1025
1026 ObjectFile *obj = module_sp->GetObjectFile();
1027 if (!obj)
1028 continue;
1029 Address addr = obj->GetImageInfoAddress(target);
1030 addr_t load_addr = addr.GetLoadAddress(target);
1031 if (load_addr == LLDB_INVALID_ADDRESS)
1032 continue;
1033
1034 MemoryRegionInfo link_map_section;
1035 Status err = process.GetMemoryRegionInfo(load_addr, link_map_section);
1036 if (err.Fail())
1037 continue;
1038
1039 ranges.push_back(link_map_section);
1040 }
1041}
1042
1044 lldb_private::Process &process,
1045 std::vector<lldb_private::MemoryRegionInfo> &ranges,
1046 llvm::function_ref<bool(const lldb_private::Thread &)>
1047 save_thread_predicate) {
1048 ThreadList &thread_list = process.GetThreadList();
1049 for (size_t idx = 0; idx < thread_list.GetSize(); idx++) {
1050 ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
1051 if (!thread_sp)
1052 continue;
1053
1054 if (!save_thread_predicate(*thread_sp))
1055 continue;
1056
1057 AddThreadLocalMemoryRegions(process, thread_sp, ranges);
1058 }
1059
1060 AddLinkMapSections(process, ranges);
1061}
static llvm::raw_ostream & error(Stream &strm)
static void AddLinkMapSections(Process &process, std::vector< MemoryRegionInfo > &ranges)
static void AddThreadLocalMemoryRegions(Process &process, ThreadSP &thread_sp, std::vector< MemoryRegionInfo > &ranges)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:369
#define LLDB_LOGF(log,...)
Definition Log.h:376
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:392
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
@ AUXV_AT_SYSINFO_EHDR
Definition AuxVector.h:64
@ AUXV_AT_ENTRY
Program entry point.
Definition AuxVector.h:36
@ AUXV_AT_BASE
Interpreter base address.
Definition AuxVector.h:34
SOEntryList::const_iterator iterator
static bool RendezvousBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine which updates the current list of loaded modules based on the information supplied b...
std::map< lldb::ModuleWP, lldb::addr_t, std::owner_less< lldb::ModuleWP > > m_loaded_modules
Loaded module list.
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
llvm::sys::RWMutex m_loaded_modules_rw_mutex
bool m_initial_modules_added
Indicates whether the initial set of modules was reported added.
lldb::addr_t m_load_offset
Virtual load address of the inferior process.
lldb::break_id_t m_dyld_bid
Rendezvous breakpoint.
lldb::addr_t GetEntryPoint()
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS...
std::unique_ptr< AuxVector > m_auxv
Auxiliary vector of the inferior process.
static llvm::StringRef GetPluginDescriptionStatic()
void EvalSpecialModulesStatus()
Evaluate if Aux vectors contain vDSO and LD information in case they do, read and assign the address ...
lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) override
Retrieves the per-module TLS block for a given thread.
bool SetRendezvousBreakpoint()
If possible sets a breakpoint on a function called by the runtime linker each time a module is loaded...
void RefreshModules()
Helper method for RendezvousBreakpointHit.
bool AlwaysRelyOnEHUnwindInfo(lldb_private::SymbolContext &sym_ctx) override
Ask if the eh_frame information for the given SymbolContext should be relied on even when it's the fi...
lldb::addr_t m_interpreter_base
Contains AT_BASE, which means a dynamic loader has been mapped to the address space.
void ProbeEntry()
Resolves the entry point for the current inferior process and sets a breakpoint at that address.
lldb_private::Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
lldb::addr_t m_vdso_base
Contains AT_SYSINFO_EHDR, which means a vDSO has been mapped to the address space.
void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override
Updates the load address of every allocatable section in module.
lldb::addr_t ComputeLoadOffset()
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS...
void SetLoadedModule(const lldb::ModuleSP &module_sp, lldb::addr_t link_map_addr)
void UnloadSections(const lldb::ModuleSP module) override
Removes the loaded sections from the target in module.
std::optional< lldb::addr_t > GetLoadedModuleLinkAddr(const lldb::ModuleSP &module_sp)
DYLDRendezvous m_rendezvous
Runtime linker rendezvous structure.
void DidLaunch() override
Called after launching a process.
lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override
Locates or creates a module given by file and updates/loads the resulting module at the virtual base ...
static bool EntryBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine invoked when we hit the breakpoint on process entry.
void DidAttach() override
Called after attaching a process.
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
static llvm::StringRef GetPluginNameStatic()
void ResolveExecutableModule(lldb::ModuleSP &module_sp)
Loads Module from inferior process.
lldb::addr_t m_entry_point
Virtual entry address of the inferior process.
virtual void LoadAllCurrentModules()
Helper for the entry breakpoint callback.
std::weak_ptr< lldb_private::Module > m_interpreter_module
Contains the pointer to the interpret module, if loaded.
bool IsCoreFile() const
Returns true if the process is for a core file.
DynamicLoaderPOSIXDYLD(lldb_private::Process *process)
void CalculateDynamicSaveCoreRanges(lldb_private::Process &process, std::vector< lldb_private::MemoryRegionInfo > &ranges, llvm::function_ref< bool(const lldb_private::Thread &)> save_thread_predicate) override
void UnloadModule(const lldb::ModuleSP &module_sp)
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
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition Address.cpp:273
lldb::addr_t GetFileAddress() const
Get the file address.
Definition Address.cpp:281
bool IsValid() const
Check if the object state is valid.
Definition Address.h:355
An architecture specification class.
Definition ArchSpec.h:32
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:457
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition ArchSpec.cpp:673
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition Breakpoint.h:81
void SetOneShot(bool one_shot)
If one_shot is true, breakpoint will be deleted on first hit.
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition Breakpoint.h:482
void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous=false)
Set the callback action invoked when the breakpoint is hit.
A uniqued constant string class.
Definition ConstString.h:40
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
static llvm::ThreadPoolInterface & GetThreadPool()
Shared thread pool. Use only with ThreadPoolTaskGroup.
int64_t ReadUnsignedIntWithSizeInBytes(lldb::addr_t addr, int size_in_bytes)
lldb::addr_t ReadPointer(lldb::addr_t addr)
Process * m_process
The process that this dynamic loader plug-in is tracking.
void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset)
lldb::ModuleSP GetTargetExecutable()
Checks to see if the target module has changed, updates the target accordingly and returns the target...
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
virtual lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset)
Locates or creates a module given by file and updates/loads the resulting module at the virtual base ...
DynamicLoader(Process *process)
Construct with a process.
void UnloadSectionsCommon(const lldb::ModuleSP module)
A file collection class.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
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
const Address & GetAddress() const
Return the address of the function (its entry point).
Definition Function.h:453
ConstString GetName(NamePreference preference=ePreferDemangled) const
Best name get accessor.
Definition Mangled.cpp:369
A collection class for Module objects.
Definition ModuleList.h:125
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Finds the first module whose file specification matches module_spec.
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
ModuleIterable Modules() const
Definition ModuleList.h:566
size_t GetSize() const
Gets the size of the module list.
void Dump(Stream &strm) const
Definition ModuleSpec.h:187
void SetTarget(lldb::TargetSP target)
Set the target to be used when resolving a module.
Definition ModuleSpec.h:141
static lldb::ModuleSP CreateModuleFromObjectFile(Args &&...args)
Definition Module.h:135
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:444
virtual lldb_private::Address GetEntryPointAddress()
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
Definition ObjectFile.h:454
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
FileSpec & GetExecutableFile()
Definition ProcessInfo.h:43
ArchSpec & GetArchitecture()
Definition ProcessInfo.h:62
A plug-in interface definition class for debugging a process.
Definition Process.h:354
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:537
ThreadList & GetThreadList()
Definition Process.h:2269
Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
Locate the memory region that contains load_addr.
Definition Process.cpp:6354
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1250
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
This base class provides an interface to stack frames.
Definition StackFrame.h:44
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
An error handling class.
Definition Status.h:118
bool Fail() const
Test for error condition.
Definition Status.cpp:293
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
const char * GetData() const
Defines a list of symbol context objects.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Symbol * symbol
The Symbol for a given query.
Address GetFunctionOrSymbolAddress() const
Get the address of the function or symbol represented by this symbol context.
Mangled & GetMangled()
Definition Symbol.h:147
bool IsTrampoline() const
Definition Symbol.cpp:221
Address & GetAddressRef()
Definition Symbol.h:73
void ModulesDidLoad(ModuleList &module_list)
This call may preload module symbols, and may do so in parallel depending on the following target set...
Definition Target.cpp:1859
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:422
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1107
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
Definition Target.cpp:2352
static FileSpecList GetDefaultExecutableSearchPaths()
Definition Target.cpp:2799
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition Target.cpp:489
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1141
const ArchSpec & GetArchitecture() const
Definition Target.h:1183
uint32_t GetSize(bool can_update=true)
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
Represents UUID's of various sizes.
Definition UUID.h:27
#define UINT64_MAX
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_ADDRESS
#define LLDB_REGNUM_GENERIC_TP
#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:332
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Thread > ThreadSP
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
uint64_t user_id_t
Definition lldb-types.h:82
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
std::shared_ptr< lldb_private::Module > ModuleSP
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
Structure representing the shared objects currently loaded into the inferior process.
BaseType GetRangeBase() const
Definition RangeMap.h:45
SizeType GetByteSize() const
Definition RangeMap.h:87
Every register is described in detail including its name, alternate name (optional),...