LLDB mainline
IRExecutionUnit.cpp
Go to the documentation of this file.
1//===-- IRExecutionUnit.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 "llvm/ExecutionEngine/ExecutionEngine.h"
10#include "llvm/ExecutionEngine/ObjectCache.h"
11#include "llvm/IR/Constants.h"
12#include "llvm/IR/DiagnosticHandler.h"
13#include "llvm/IR/DiagnosticInfo.h"
14#include "llvm/IR/LLVMContext.h"
15#include "llvm/IR/Module.h"
16#include "llvm/Support/SourceMgr.h"
17#include "llvm/Support/raw_ostream.h"
18
19#include "lldb/Core/Debugger.h"
21#include "lldb/Core/Module.h"
22#include "lldb/Core/Section.h"
25#include "lldb/Host/HostInfo.h"
33#include "lldb/Target/Target.h"
38#include "lldb/Utility/Log.h"
39
40#include <optional>
41
42using namespace lldb_private;
43
44IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,
45 std::unique_ptr<llvm::Module> &module_up,
46 ConstString &name,
47 const lldb::TargetSP &target_sp,
48 const SymbolContext &sym_ctx,
49 std::vector<std::string> &cpu_features)
50 : IRMemoryMap(target_sp), m_context_up(context_up.release()),
51 m_module_up(module_up.release()), m_module(m_module_up.get()),
52 m_cpu_features(cpu_features), m_name(name), m_sym_ctx(sym_ctx),
53 m_did_jit(false), m_function_load_addr(LLDB_INVALID_ADDRESS),
54 m_function_end_load_addr(LLDB_INVALID_ADDRESS),
55 m_reported_allocations(false) {}
56
57lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
58 Status &error) {
59 const bool zero_memory = false;
60 lldb::addr_t allocation_process_addr =
61 Malloc(size, 8, lldb::ePermissionsWritable | lldb::ePermissionsReadable,
62 eAllocationPolicyMirror, zero_memory, error);
63
64 if (!error.Success())
66
67 WriteMemory(allocation_process_addr, bytes, size, error);
68
69 if (!error.Success()) {
70 Status err;
71 Free(allocation_process_addr, err);
72
74 }
75
76 if (Log *log = GetLog(LLDBLog::Expressions)) {
77 DataBufferHeap my_buffer(size, 0);
78 Status err;
79 ReadMemory(my_buffer.GetBytes(), allocation_process_addr, size, err);
80
81 if (err.Success()) {
82 DataExtractor my_extractor(my_buffer.GetBytes(), my_buffer.GetByteSize(),
84 my_extractor.PutToLog(log, 0, my_buffer.GetByteSize(),
85 allocation_process_addr, 16,
87 }
88 }
89
90 return allocation_process_addr;
91}
92
94 if (allocation == LLDB_INVALID_ADDRESS)
95 return;
96
97 Status err;
98
99 Free(allocation, err);
100}
101
103 lldb::ProcessSP &process_wp) {
105
106 ExecutionContext exe_ctx(process_wp);
107
108 Status ret;
109
110 ret.Clear();
111
112 lldb::addr_t func_local_addr = LLDB_INVALID_ADDRESS;
113 lldb::addr_t func_remote_addr = LLDB_INVALID_ADDRESS;
114
115 for (JittedFunction &function : m_jitted_functions) {
116 if (function.m_name == m_name) {
117 func_local_addr = function.m_local_addr;
118 func_remote_addr = function.m_remote_addr;
119 }
120 }
121
122 if (func_local_addr == LLDB_INVALID_ADDRESS) {
124 "Couldn't find function %s for disassembly", m_name.AsCString());
125 return ret;
126 }
127
128 LLDB_LOGF(log,
129 "Found function, has local address 0x%" PRIx64
130 " and remote address 0x%" PRIx64,
131 (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
132
133 std::pair<lldb::addr_t, lldb::addr_t> func_range;
134
135 func_range = GetRemoteRangeForLocal(func_local_addr);
136
137 if (func_range.first == 0 && func_range.second == 0) {
139 "Couldn't find code range for function %s", m_name.AsCString());
140 return ret;
141 }
142
143 LLDB_LOGF(log, "Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]",
144 func_range.first, func_range.second);
145
146 Target *target = exe_ctx.GetTargetPtr();
147 if (!target) {
148 ret = Status::FromErrorString("Couldn't find the target");
149 return ret;
150 }
151
153 new DataBufferHeap(func_range.second, 0));
154
155 Process *process = exe_ctx.GetProcessPtr();
156 Status err;
157 process->ReadMemory(func_remote_addr, buffer_sp->GetBytes(),
158 buffer_sp->GetByteSize(), err);
159
160 if (!err.Success()) {
161 ret = Status::FromErrorStringWithFormat("Couldn't read from process: %s",
162 err.AsCString("unknown error"));
163 return ret;
164 }
165
166 ArchSpec arch(target->GetArchitecture());
167
168 const char *plugin_name = nullptr;
169 const char *flavor_string = nullptr;
170 const char *cpu_string = nullptr;
171 const char *features_string = nullptr;
173 arch, flavor_string, cpu_string, features_string, plugin_name);
174
175 if (!disassembler_sp) {
177 "Unable to find disassembler plug-in for %s architecture.",
178 arch.GetArchitectureName());
179 return ret;
180 }
181
182 if (!process) {
183 ret = Status::FromErrorString("Couldn't find the process");
184 return ret;
185 }
186
187 DataExtractor extractor(buffer_sp, process->GetByteOrder(),
189
190 if (log) {
191 LLDB_LOGF(log, "Function data has contents:");
192 extractor.PutToLog(log, 0, extractor.GetByteSize(), func_remote_addr, 16,
194 }
195
196 disassembler_sp->DecodeInstructions(Address(func_remote_addr), extractor, 0,
197 UINT32_MAX, false, false);
198
199 InstructionList &instruction_list = disassembler_sp->GetInstructionList();
200 instruction_list.Dump(&stream, true, true, /*show_control_flow_kind=*/false,
201 &exe_ctx);
202
203 return ret;
204}
205
206namespace {
207struct IRExecDiagnosticHandler : public llvm::DiagnosticHandler {
208 Status *err;
209 IRExecDiagnosticHandler(Status *err) : err(err) {}
210 bool handleDiagnostics(const llvm::DiagnosticInfo &DI) override {
211 if (DI.getSeverity() == llvm::DS_Error) {
212 const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
213 if (err && err->Success()) {
215 "IRExecution error: %s",
216 DISM.getSMDiag().getMessage().str().c_str());
217 }
218 }
219
220 return true;
221 }
222};
223} // namespace
224
226 m_failed_lookups.push_back(name);
227}
228
230 lldb::addr_t &func_end) {
231 lldb::ProcessSP process_sp(GetProcessWP().lock());
232
233 static std::recursive_mutex s_runnable_info_mutex;
234
235 func_addr = LLDB_INVALID_ADDRESS;
236 func_end = LLDB_INVALID_ADDRESS;
237
238 if (!process_sp) {
239 error =
240 Status::FromErrorString("Couldn't write the JIT compiled code into the "
241 "process because the process is invalid");
242 return;
243 }
244
245 if (m_did_jit) {
246 func_addr = m_function_load_addr;
247 func_end = m_function_end_load_addr;
248
249 return;
250 };
251
252 std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
253
254 m_did_jit = true;
255
257
258 std::string error_string;
259
260 if (log) {
261 std::string s;
262 llvm::raw_string_ostream oss(s);
263
264 m_module->print(oss, nullptr);
265
266 LLDB_LOGF(log, "Module being sent to JIT: \n%s", s.c_str());
267 }
268
269 m_module_up->getContext().setDiagnosticHandler(
270 std::make_unique<IRExecDiagnosticHandler>(&error));
271
272 llvm::EngineBuilder builder(std::move(m_module_up));
273 llvm::Triple triple(m_module->getTargetTriple());
274
275 builder.setEngineKind(llvm::EngineKind::JIT)
276 .setErrorStr(&error_string)
277 .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_
278 : llvm::Reloc::Static)
279 .setMCJITMemoryManager(std::make_unique<MemoryManager>(*this))
280 .setOptLevel(llvm::CodeGenOptLevel::Less);
281
282 // Resulted jitted code can be placed too far from the code in the binary
283 // and thus can contain more than +-2GB jumps, that are not available
284 // in RISC-V without large code model.
285 if (triple.isRISCV64())
286 builder.setCodeModel(llvm::CodeModel::Large);
287
288 llvm::StringRef mArch;
289 llvm::StringRef mCPU;
290 llvm::SmallVector<std::string, 0> mAttrs;
291
292 for (std::string &feature : m_cpu_features)
293 mAttrs.push_back(feature);
294
295 llvm::TargetMachine *target_machine =
296 builder.selectTarget(triple, mArch, mCPU, mAttrs);
297
298 m_execution_engine_up.reset(builder.create(target_machine));
299
301 error = Status::FromErrorStringWithFormat("Couldn't JIT the function: %s",
302 error_string.c_str());
303 return;
304 }
305
307 (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
308
309 class ObjectDumper : public llvm::ObjectCache {
310 public:
311 ObjectDumper(FileSpec output_dir) : m_out_dir(output_dir) {}
312 void notifyObjectCompiled(const llvm::Module *module,
313 llvm::MemoryBufferRef object) override {
314 int fd = 0;
315 llvm::SmallVector<char, 256> result_path;
316 std::string object_name_model =
317 "jit-object-" + module->getModuleIdentifier() + "-%%%.o";
318 FileSpec model_spec
319 = m_out_dir.CopyByAppendingPathComponent(object_name_model);
320 std::string model_path = model_spec.GetPath();
321
322 std::error_code result
323 = llvm::sys::fs::createUniqueFile(model_path, fd, result_path);
324 if (!result) {
325 llvm::raw_fd_ostream fds(fd, true);
326 fds.write(object.getBufferStart(), object.getBufferSize());
327 }
328 }
329 std::unique_ptr<llvm::MemoryBuffer>
330 getObject(const llvm::Module *module) override {
331 // Return nothing - we're just abusing the object-cache mechanism to dump
332 // objects.
333 return nullptr;
334 }
335 private:
336 FileSpec m_out_dir;
337 };
338
339 FileSpec save_objects_dir = process_sp->GetTarget().GetSaveJITObjectsDir();
340 if (save_objects_dir) {
341 m_object_cache_up = std::make_unique<ObjectDumper>(save_objects_dir);
342 m_execution_engine_up->setObjectCache(m_object_cache_up.get());
343 }
344
345 // Make sure we see all sections, including ones that don't have
346 // relocations...
347 m_execution_engine_up->setProcessAllSections(true);
348
349 m_execution_engine_up->DisableLazyCompilation();
350
351 for (llvm::Function &function : *m_module) {
352 if (function.isDeclaration() || function.hasPrivateLinkage())
353 continue;
354
355 const bool external = !function.hasLocalLinkage();
356
357 void *fun_ptr = m_execution_engine_up->getPointerToFunction(&function);
358
359 if (!error.Success()) {
360 // We got an error through our callback!
361 return;
362 }
363
364 if (!fun_ptr) {
366 "'%s' was in the JITted module but wasn't lowered",
367 function.getName().str().c_str());
368 return;
369 }
371 function.getName().str().c_str(), external, reinterpret_cast<uintptr_t>(fun_ptr)));
372 }
373
374 CommitAllocations(process_sp);
376
377 // We have to do this after calling ReportAllocations because for the MCJIT,
378 // getGlobalValueAddress will cause the JIT to perform all relocations. That
379 // can only be done once, and has to happen after we do the remapping from
380 // local -> remote. That means we don't know the local address of the
381 // Variables, but we don't need that for anything, so that's okay.
382
383 std::function<void(llvm::GlobalValue &)> RegisterOneValue = [this](
384 llvm::GlobalValue &val) {
385 if (val.hasExternalLinkage() && !val.isDeclaration()) {
386 uint64_t var_ptr_addr =
387 m_execution_engine_up->getGlobalValueAddress(val.getName().str());
388
389 lldb::addr_t remote_addr = GetRemoteAddressForLocal(var_ptr_addr);
390
391 // This is a really unfortunae API that sometimes returns local addresses
392 // and sometimes returns remote addresses, based on whether the variable
393 // was relocated during ReportAllocations or not.
394
395 if (remote_addr == LLDB_INVALID_ADDRESS) {
396 remote_addr = var_ptr_addr;
397 }
398
399 if (var_ptr_addr != 0)
401 val.getName().str().c_str(), LLDB_INVALID_ADDRESS, remote_addr));
402 }
403 };
404
405 for (llvm::GlobalVariable &global_var : m_module->globals()) {
406 RegisterOneValue(global_var);
407 }
408
409 for (llvm::GlobalAlias &global_alias : m_module->aliases()) {
410 RegisterOneValue(global_alias);
411 }
412
413 WriteData(process_sp);
414
415 if (m_failed_lookups.size()) {
416 StreamString ss;
417
418 ss.PutCString("Couldn't look up symbols:\n");
419
420 bool emitNewLine = false;
421
422 for (ConstString failed_lookup : m_failed_lookups) {
423 if (emitNewLine)
424 ss.PutCString("\n");
425 emitNewLine = true;
426 ss.PutCString(" ");
427 ss.PutCString(Mangled(failed_lookup).GetDemangledName().GetStringRef());
428 }
429
430 m_failed_lookups.clear();
431 ss.PutCString(
432 "\nHint: The expression tried to call a function that is not present "
433 "in the target, perhaps because it was optimized out by the compiler.");
434 error = Status(ss.GetString().str());
435
436 return;
437 }
438
441
442 for (JittedFunction &jitted_function : m_jitted_functions) {
443 jitted_function.m_remote_addr =
444 GetRemoteAddressForLocal(jitted_function.m_local_addr);
445
446 if (!m_name.IsEmpty() && jitted_function.m_name == m_name) {
447 AddrRange func_range =
448 GetRemoteRangeForLocal(jitted_function.m_local_addr);
449 m_function_end_load_addr = func_range.first + func_range.second;
450 m_function_load_addr = jitted_function.m_remote_addr;
451 }
452 }
453
454 if (log) {
455 LLDB_LOGF(log, "Code can be run in the target.");
456
457 StreamString disassembly_stream;
458
459 Status err = DisassembleFunction(disassembly_stream, process_sp);
460
461 if (!err.Success()) {
462 LLDB_LOGF(log, "Couldn't disassemble function : %s",
463 err.AsCString("unknown error"));
464 } else {
465 LLDB_LOGF(log, "Function disassembly:\n%s", disassembly_stream.GetData());
466 }
467
468 LLDB_LOGF(log, "Sections: ");
469 for (AllocationRecord &record : m_records) {
470 if (record.m_process_address != LLDB_INVALID_ADDRESS) {
471 record.dump(log);
472
473 DataBufferHeap my_buffer(record.m_size, 0);
474 Status err;
475 ReadMemory(my_buffer.GetBytes(), record.m_process_address,
476 record.m_size, err);
477
478 if (err.Success()) {
479 DataExtractor my_extractor(my_buffer.GetBytes(),
480 my_buffer.GetByteSize(),
482 my_extractor.PutToLog(log, 0, my_buffer.GetByteSize(),
483 record.m_process_address, 16,
485 }
486 } else {
487 record.dump(log);
488
489 DataExtractor my_extractor((const void *)record.m_host_address,
490 record.m_size, lldb::eByteOrderBig, 8);
491 my_extractor.PutToLog(log, 0, record.m_size, record.m_host_address, 16,
493 }
494 }
495 }
496
497 func_addr = m_function_load_addr;
498 func_end = m_function_end_load_addr;
499}
500
502 m_module_up.reset();
503 m_execution_engine_up.reset();
504 m_context_up.reset();
505}
506
508 : m_default_mm_up(new llvm::SectionMemoryManager()), m_parent(parent) {}
509
511
513 const llvm::StringRef &name, IRExecutionUnit::AllocationKind alloc_kind) {
515 switch (alloc_kind) {
517 sect_type = lldb::eSectionTypeCode;
518 break;
520 sect_type = lldb::eSectionTypeCode;
521 break;
523 sect_type = lldb::eSectionTypeData;
524 break;
526 sect_type = lldb::eSectionTypeData;
527 break;
529 sect_type = lldb::eSectionTypeOther;
530 break;
531 }
532
533 if (!name.empty()) {
534 if (name == "__text" || name == ".text")
535 sect_type = lldb::eSectionTypeCode;
536 else if (name == "__data" || name == ".data")
537 sect_type = lldb::eSectionTypeCode;
538 else if (name.starts_with("__debug_") || name.starts_with(".debug_")) {
539 const uint32_t name_idx = name[0] == '_' ? 8 : 7;
540 llvm::StringRef dwarf_name(name.substr(name_idx));
541 switch (dwarf_name[0]) {
542 case 'a':
543 if (dwarf_name == "abbrev")
545 else if (dwarf_name == "aranges")
547 else if (dwarf_name == "addr")
549 break;
550
551 case 'f':
552 if (dwarf_name == "frame")
554 break;
555
556 case 'i':
557 if (dwarf_name == "info")
559 break;
560
561 case 'l':
562 if (dwarf_name == "line")
564 else if (dwarf_name == "loc")
566 else if (dwarf_name == "loclists")
568 break;
569
570 case 'm':
571 if (dwarf_name == "macinfo")
573 break;
574
575 case 'p':
576 if (dwarf_name == "pubnames")
578 else if (dwarf_name == "pubtypes")
580 break;
581
582 case 's':
583 if (dwarf_name == "str")
585 else if (dwarf_name == "str_offsets")
587 break;
588
589 case 'r':
590 if (dwarf_name == "ranges")
592 break;
593
594 default:
595 break;
596 }
597 } else if (name.starts_with("__apple_") || name.starts_with(".apple_"))
598 sect_type = lldb::eSectionTypeInvalid;
599 else if (name == "__objc_imageinfo")
600 sect_type = lldb::eSectionTypeOther;
601 }
602 return sect_type;
603}
604
606 uintptr_t Size, unsigned Alignment, unsigned SectionID,
607 llvm::StringRef SectionName) {
609
610 uint8_t *return_value = m_default_mm_up->allocateCodeSection(
611 Size, Alignment, SectionID, SectionName);
612
613 m_parent.m_records.push_back(AllocationRecord(
614 (uintptr_t)return_value,
615 lldb::ePermissionsReadable | lldb::ePermissionsExecutable,
617 Alignment, SectionID, SectionName.str().c_str()));
618
619 LLDB_LOGF(log,
620 "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
621 ", Alignment=%u, SectionID=%u) = %p",
622 (uint64_t)Size, Alignment, SectionID, (void *)return_value);
623
624 if (m_parent.m_reported_allocations) {
625 Status err;
626 lldb::ProcessSP process_sp =
627 m_parent.GetBestExecutionContextScope()->CalculateProcess();
628
629 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
630 }
631
632 return return_value;
633}
634
636 uintptr_t Size, unsigned Alignment, unsigned SectionID,
637 llvm::StringRef SectionName, bool IsReadOnly) {
639
640 uint8_t *return_value = m_default_mm_up->allocateDataSection(
641 Size, Alignment, SectionID, SectionName, IsReadOnly);
642
643 uint32_t permissions = lldb::ePermissionsReadable;
644 if (!IsReadOnly)
645 permissions |= lldb::ePermissionsWritable;
646 m_parent.m_records.push_back(AllocationRecord(
647 (uintptr_t)return_value, permissions,
649 Alignment, SectionID, SectionName.str().c_str()));
650 LLDB_LOGF(log,
651 "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
652 ", Alignment=%u, SectionID=%u) = %p",
653 (uint64_t)Size, Alignment, SectionID, (void *)return_value);
654
655 if (m_parent.m_reported_allocations) {
656 Status err;
657 lldb::ProcessSP process_sp =
658 m_parent.GetBestExecutionContextScope()->CalculateProcess();
659
660 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
661 }
662
663 return return_value;
664}
665
666void IRExecutionUnit::CollectCandidateCNames(std::vector<ConstString> &C_names,
667 ConstString name) {
668 if (m_strip_underscore && name.AsCString()[0] == '_')
669 C_names.insert(C_names.begin(), ConstString(&name.AsCString()[1]));
670 C_names.push_back(name);
671}
672
674 std::vector<ConstString> &CPP_names,
675 const std::vector<ConstString> &C_names, const SymbolContext &sc) {
677 for (const ConstString &name : C_names) {
678 Mangled mangled(name);
679 if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
680 if (ConstString best_alternate =
681 cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
682 CPP_names.push_back(best_alternate);
683 }
684 }
685
686 std::vector<ConstString> alternates =
687 cpp_lang->GenerateAlternateFunctionManglings(name);
688 CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
689
690 // As a last-ditch fallback, try the base name for C++ names. It's
691 // terrible, but the DWARF doesn't always encode "extern C" correctly.
692 ConstString basename =
693 cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
694 CPP_names.push_back(basename);
695 }
696 }
697}
698
700public:
701 LoadAddressResolver(Target *target, bool &symbol_was_missing_weak)
702 : m_target(target), m_symbol_was_missing_weak(symbol_was_missing_weak) {}
703
704 std::optional<lldb::addr_t> Resolve(SymbolContextList &sc_list) {
705 if (sc_list.IsEmpty())
706 return std::nullopt;
707
708 lldb::addr_t load_address = LLDB_INVALID_ADDRESS;
709
710 // Missing_weak_symbol will be true only if we found only weak undefined
711 // references to this symbol.
712 m_symbol_was_missing_weak = true;
713
714 for (auto candidate_sc : sc_list.SymbolContexts()) {
715 // Only symbols can be weak undefined.
716 if (!candidate_sc.symbol ||
717 candidate_sc.symbol->GetType() != lldb::eSymbolTypeUndefined ||
718 !candidate_sc.symbol->IsWeak())
719 m_symbol_was_missing_weak = false;
720
721 // First try the symbol.
722 if (candidate_sc.symbol) {
723 load_address = candidate_sc.symbol->ResolveCallableAddress(*m_target);
724 if (load_address == LLDB_INVALID_ADDRESS) {
725 Address addr = candidate_sc.symbol->GetAddress();
726 load_address = m_target->GetProcessSP()
727 ? addr.GetLoadAddress(m_target)
728 : addr.GetFileAddress();
729 }
730 }
731
732 // If that didn't work, try the function.
733 if (load_address == LLDB_INVALID_ADDRESS && candidate_sc.function) {
734 Address addr =
735 candidate_sc.function->GetAddressRange().GetBaseAddress();
736 load_address = m_target->GetProcessSP() ? addr.GetLoadAddress(m_target)
737 : addr.GetFileAddress();
738 }
739
740 // We found a load address.
741 if (load_address != LLDB_INVALID_ADDRESS) {
742 // If the load address is external, we're done.
743 const bool is_external =
744 (candidate_sc.function) ||
745 (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
746 if (is_external)
747 return load_address;
748
749 // Otherwise, remember the best internal load address.
750 if (m_best_internal_load_address == LLDB_INVALID_ADDRESS)
751 m_best_internal_load_address = load_address;
752 }
753 }
754
755 // You test the address of a weak symbol against NULL to see if it is
756 // present. So we should return 0 for a missing weak symbol.
757 if (m_symbol_was_missing_weak)
758 return 0;
759
760 return std::nullopt;
761 }
762
764 return m_best_internal_load_address;
765 }
766
767private:
770 lldb::addr_t m_best_internal_load_address = LLDB_INVALID_ADDRESS;
771};
772
774IRExecutionUnit::FindInSymbols(const std::vector<ConstString> &names,
776 bool &symbol_was_missing_weak) {
777 symbol_was_missing_weak = false;
778
779 Target *target = sc.target_sp.get();
780 if (!target) {
781 // We shouldn't be doing any symbol lookup at all without a target.
783 }
784
785 ModuleList non_local_images = target->GetImages();
786 // We'll process module_sp separately, before the other modules.
787 non_local_images.Remove(sc.module_sp);
788
789 LoadAddressResolver resolver(target, symbol_was_missing_weak);
790
791 ModuleFunctionSearchOptions function_options;
792 function_options.include_symbols = true;
793 function_options.include_inlines = false;
794
795 for (const ConstString &name : names) {
796 // The lookup order here is as follows:
797 // 1) Functions in `sc.module_sp`
798 // 2) Functions in the other modules
799 // 3) Symbols in `sc.module_sp`
800 // 4) Symbols in the other modules
801 if (sc.module_sp) {
802 SymbolContextList sc_list;
803 sc.module_sp->FindFunctions(name, CompilerDeclContext(),
804 lldb::eFunctionNameTypeFull, function_options,
805 sc_list);
806 if (auto load_addr = resolver.Resolve(sc_list))
807 return *load_addr;
808 }
809
810 {
811 SymbolContextList sc_list;
812 non_local_images.FindFunctions(name, lldb::eFunctionNameTypeFull,
813 function_options, sc_list);
814 if (auto load_addr = resolver.Resolve(sc_list))
815 return *load_addr;
816 }
817
818 if (sc.module_sp) {
819 SymbolContextList sc_list;
820 sc.module_sp->FindSymbolsWithNameAndType(name, lldb::eSymbolTypeAny,
821 sc_list);
822 if (auto load_addr = resolver.Resolve(sc_list))
823 return *load_addr;
824 }
825
826 {
827 SymbolContextList sc_list;
829 sc_list);
830 if (auto load_addr = resolver.Resolve(sc_list))
831 return *load_addr;
832 }
833
834 lldb::addr_t best_internal_load_address =
836 if (best_internal_load_address != LLDB_INVALID_ADDRESS)
837 return best_internal_load_address;
838 }
839
841}
842
844IRExecutionUnit::FindInRuntimes(const std::vector<ConstString> &names,
845 const lldb_private::SymbolContext &sc) {
846 lldb::TargetSP target_sp = sc.target_sp;
847
848 if (!target_sp) {
850 }
851
852 lldb::ProcessSP process_sp = sc.target_sp->GetProcessSP();
853
854 if (!process_sp) {
856 }
857
858 for (const ConstString &name : names) {
859 for (LanguageRuntime *runtime : process_sp->GetLanguageRuntimes()) {
860 lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(name);
861
862 if (symbol_load_addr != LLDB_INVALID_ADDRESS)
863 return symbol_load_addr;
864 }
865 }
866
868}
869
871 const std::vector<ConstString> &names,
872 const lldb_private::SymbolContext &sc) {
873 lldb::TargetSP target_sp = sc.target_sp;
874
875 for (const ConstString &name : names) {
876 lldb::addr_t symbol_load_addr = target_sp->GetPersistentSymbol(name);
877
878 if (symbol_load_addr != LLDB_INVALID_ADDRESS)
879 return symbol_load_addr;
880 }
881
883}
884
886 bool &missing_weak) {
887 std::vector<ConstString> candidate_C_names;
888 std::vector<ConstString> candidate_CPlusPlus_names;
889
890 CollectCandidateCNames(candidate_C_names, name);
891
892 lldb::addr_t ret = FindInSymbols(candidate_C_names, m_sym_ctx, missing_weak);
893 if (ret != LLDB_INVALID_ADDRESS)
894 return ret;
895
896 // If we find the symbol in runtimes or user defined symbols it can't be
897 // a missing weak symbol.
898 missing_weak = false;
899 ret = FindInRuntimes(candidate_C_names, m_sym_ctx);
900 if (ret != LLDB_INVALID_ADDRESS)
901 return ret;
902
903 ret = FindInUserDefinedSymbols(candidate_C_names, m_sym_ctx);
904 if (ret != LLDB_INVALID_ADDRESS)
905 return ret;
906
907 CollectCandidateCPlusPlusNames(candidate_CPlusPlus_names, candidate_C_names,
908 m_sym_ctx);
909 ret = FindInSymbols(candidate_CPlusPlus_names, m_sym_ctx, missing_weak);
910 return ret;
911}
912
914 std::vector<lldb::addr_t> &static_initializers) {
916
917 llvm::GlobalVariable *global_ctors =
918 m_module->getNamedGlobal("llvm.global_ctors");
919 if (!global_ctors) {
920 LLDB_LOG(log, "Couldn't find llvm.global_ctors.");
921 return;
922 }
923 auto *ctor_array =
924 llvm::dyn_cast<llvm::ConstantArray>(global_ctors->getInitializer());
925 if (!ctor_array) {
926 LLDB_LOG(log, "llvm.global_ctors not a ConstantArray.");
927 return;
928 }
929
930 for (llvm::Use &ctor_use : ctor_array->operands()) {
931 auto *ctor_struct = llvm::dyn_cast<llvm::ConstantStruct>(ctor_use);
932 if (!ctor_struct)
933 continue;
934 // this is standardized
935 lldbassert(ctor_struct->getNumOperands() == 3);
936 auto *ctor_function =
937 llvm::dyn_cast<llvm::Function>(ctor_struct->getOperand(1));
938 if (!ctor_function) {
939 LLDB_LOG(log, "global_ctor doesn't contain an llvm::Function");
940 continue;
941 }
942
943 ConstString ctor_function_name(ctor_function->getName().str());
944 LLDB_LOG(log, "Looking for callable jitted function with name {0}.",
945 ctor_function_name);
946
947 for (JittedFunction &jitted_function : m_jitted_functions) {
948 if (ctor_function_name != jitted_function.m_name)
949 continue;
950 if (jitted_function.m_remote_addr == LLDB_INVALID_ADDRESS) {
951 LLDB_LOG(log, "Found jitted function with invalid address.");
952 continue;
953 }
954 static_initializers.push_back(jitted_function.m_remote_addr);
955 LLDB_LOG(log, "Calling function at address {0:x}.",
956 jitted_function.m_remote_addr);
957 break;
958 }
959 }
960}
961
962llvm::JITSymbol
964 bool missing_weak = false;
965 uint64_t addr = GetSymbolAddressAndPresence(Name, missing_weak);
966 // This is a weak symbol:
967 if (missing_weak)
968 return llvm::JITSymbol(addr,
969 llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Weak);
970 else
971 return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported);
972}
973
974uint64_t
976 bool missing_weak = false;
977 return GetSymbolAddressAndPresence(Name, missing_weak);
978}
979
980uint64_t
982 const std::string &Name, bool &missing_weak) {
984
985 ConstString name_cs(Name.c_str());
986
987 lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
988
989 if (ret == LLDB_INVALID_ADDRESS) {
990 LLDB_LOGF(log,
991 "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
992 Name.c_str());
993
994 m_parent.ReportSymbolLookupError(name_cs);
995 return 0;
996 } else {
997 LLDB_LOGF(log, "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
998 Name.c_str(), ret);
999 return ret;
1000 }
1001}
1002
1004 const std::string &Name, bool AbortOnFailure) {
1005 return (void *)getSymbolAddress(Name);
1006}
1007
1011
1012 for (AllocationRecord &record : m_records) {
1013 if (local_address >= record.m_host_address &&
1014 local_address < record.m_host_address + record.m_size) {
1015 if (record.m_process_address == LLDB_INVALID_ADDRESS)
1016 return LLDB_INVALID_ADDRESS;
1017
1018 lldb::addr_t ret =
1019 record.m_process_address + (local_address - record.m_host_address);
1020
1021 LLDB_LOGF(log,
1022 "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
1023 " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64
1024 " from [0x%" PRIx64 "..0x%" PRIx64 "].",
1025 local_address, (uint64_t)record.m_host_address,
1026 (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
1027 record.m_process_address,
1028 record.m_process_address + record.m_size);
1029
1030 return ret;
1031 }
1032 }
1033
1034 return LLDB_INVALID_ADDRESS;
1035}
1036
1039 for (AllocationRecord &record : m_records) {
1040 if (local_address >= record.m_host_address &&
1041 local_address < record.m_host_address + record.m_size) {
1042 if (record.m_process_address == LLDB_INVALID_ADDRESS)
1043 return AddrRange(0, 0);
1044
1045 return AddrRange(record.m_process_address, record.m_size);
1046 }
1047 }
1048
1049 return AddrRange(0, 0);
1050}
1051
1053 Status &error,
1054 AllocationRecord &record) {
1056 return true;
1057 }
1058
1059 switch (record.m_sect_type) {
1081 error.Clear();
1082 break;
1083 default:
1084 const bool zero_memory = false;
1085 record.m_process_address =
1086 Malloc(record.m_size, record.m_alignment, record.m_permissions,
1087 eAllocationPolicyProcessOnly, zero_memory, error);
1088 break;
1089 }
1090
1091 return error.Success();
1092}
1093
1095 bool ret = true;
1096
1098
1099 for (AllocationRecord &record : m_records) {
1100 ret = CommitOneAllocation(process_sp, err, record);
1101
1102 if (!ret) {
1103 break;
1104 }
1105 }
1106
1107 if (!ret) {
1108 for (AllocationRecord &record : m_records) {
1109 if (record.m_process_address != LLDB_INVALID_ADDRESS) {
1110 Free(record.m_process_address, err);
1111 record.m_process_address = LLDB_INVALID_ADDRESS;
1112 }
1113 }
1114 }
1115
1116 return ret;
1117}
1118
1119void IRExecutionUnit::ReportAllocations(llvm::ExecutionEngine &engine) {
1121
1122 for (AllocationRecord &record : m_records) {
1123 if (record.m_process_address == LLDB_INVALID_ADDRESS)
1124 continue;
1125
1126 if (record.m_section_id == eSectionIDInvalid)
1127 continue;
1128
1129 engine.mapSectionAddress((void *)record.m_host_address,
1130 record.m_process_address);
1131 }
1132
1133 // Trigger re-application of relocations.
1134 engine.finalizeObject();
1135}
1136
1138 bool wrote_something = false;
1139 for (AllocationRecord &record : m_records) {
1140 if (record.m_process_address != LLDB_INVALID_ADDRESS) {
1142 WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
1143 record.m_size, err);
1144 if (err.Success())
1145 wrote_something = true;
1146 }
1147 }
1148 return wrote_something;
1149}
1150
1152 if (!log)
1153 return;
1154
1155 LLDB_LOGF(log,
1156 "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
1157 (unsigned long long)m_host_address, (unsigned long long)m_size,
1158 (unsigned long long)m_process_address, (unsigned)m_alignment,
1159 (unsigned)m_section_id, m_name.c_str());
1160}
1161
1164 return exe_ctx.GetByteOrder();
1165}
1166
1169 return exe_ctx.GetAddressByteSize();
1170}
1171
1173 lldb_private::Symtab &symtab) {
1174 // No symbols yet...
1175}
1176
1178 lldb_private::ObjectFile *obj_file,
1179 lldb_private::SectionList &section_list) {
1180 for (AllocationRecord &record : m_records) {
1181 if (record.m_size > 0) {
1183 obj_file->GetModule(), obj_file, record.m_section_id,
1184 ConstString(record.m_name), record.m_sect_type,
1185 record.m_process_address, record.m_size,
1186 record.m_host_address, // file_offset (which is the host address for
1187 // the data)
1188 record.m_size, // file_size
1189 0,
1190 record.m_permissions)); // flags
1191 section_list.AddSection(section_sp);
1192 }
1193 }
1194}
1195
1198 if(Target *target = exe_ctx.GetTargetPtr())
1199 return target->GetArchitecture();
1200 return ArchSpec();
1201}
1202
1205 Target *target = exe_ctx.GetTargetPtr();
1206 if (!target)
1207 return nullptr;
1208
1209 auto Delegate = std::static_pointer_cast<lldb_private::ObjectFileJITDelegate>(
1210 shared_from_this());
1211
1212 lldb::ModuleSP jit_module_sp =
1213 lldb_private::Module::CreateModuleFromObjectFile<ObjectFileJIT>(Delegate);
1214 if (!jit_module_sp)
1215 return nullptr;
1216
1217 bool changed = false;
1218 jit_module_sp->SetLoadAddress(*target, 0, true, changed);
1219 return jit_module_sp;
1220}
static llvm::raw_ostream & error(Stream &strm)
#define lldbassert(x)
Definition: LLDBAssert.h:15
#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
LoadAddressResolver(Target *target, bool &symbol_was_missing_weak)
std::optional< lldb::addr_t > Resolve(SymbolContextList &sc_list)
lldb::addr_t GetBestInternalLoadAddress() const
A section + offset based address class.
Definition: Address.h:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:313
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:293
An architecture specification class.
Definition: ArchSpec.h:31
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:709
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:570
Represents a generic declaration context in a program.
A uniqued constant string class.
Definition: ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:188
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:304
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
An data extractor class.
Definition: DataExtractor.h:48
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
@ TypeUInt8
Format output as unsigned 8 bit integers.
Definition: DataExtractor.h:53
lldb::offset_t PutToLog(Log *log, lldb::offset_t offset, lldb::offset_t length, uint64_t base_addr, uint32_t num_per_line, Type type) const
Dumps the binary data as type objects to stream s (or to Log() if s is nullptr) starting offset bytes...
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
lldb::ByteOrder GetByteOrder() const
Target * GetTargetPtr() const
Returns a pointer to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
A file utility class.
Definition: FileSpec.h:56
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const
Definition: FileSpec.cpp:418
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:367
void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true) override
uint64_t getSymbolAddress(const std::string &Name) override
uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName, bool IsReadOnly) override
Allocate space for data, and add it to the m_spaceBlocks map.
uint64_t GetSymbolAddressAndPresence(const std::string &Name, bool &missing_weak)
llvm::JITSymbol findSymbol(const std::string &Name) override
uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName) override
Allocate space for executable code, and add it to the m_spaceBlocks map.
"lldb/Expression/IRExecutionUnit.h" Contains the IR and, optionally, JIT- compiled code for a module.
std::vector< std::string > m_cpu_features
void CollectCandidateCPlusPlusNames(std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error)
Accessors for IRForTarget and other clients that may want binary data placed on their behalf.
static const unsigned eSectionIDInvalid
void PopulateSymtab(lldb_private::ObjectFile *obj_file, lldb_private::Symtab &symtab) override
lldb::addr_t FindInSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
void GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end)
lldb::ByteOrder GetByteOrder() const override
ObjectFileJITDelegate overrides.
SymbolContext m_sym_ctx
Used for symbol lookups.
std::vector< JittedFunction > m_jitted_functions
A vector of all functions that have been JITted into machine code.
Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp)
std::vector< ConstString > m_failed_lookups
std::unique_ptr< llvm::Module > m_module_up
Holder for the module until it's been handed off.
lldb::addr_t FindSymbol(ConstString name, bool &missing_weak)
lldb::addr_t FindInRuntimes(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
IRExecutionUnit(std::unique_ptr< llvm::LLVMContext > &context_up, std::unique_ptr< llvm::Module > &module_up, ConstString &name, const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx, std::vector< std::string > &cpu_features)
Constructor.
static lldb::SectionType GetSectionTypeFromSectionName(const llvm::StringRef &name, AllocationKind alloc_kind)
uint32_t GetAddressByteSize() const override
bool CommitAllocations(lldb::ProcessSP &process_sp)
Commit all allocations to the process and record where they were stored.
bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error, AllocationRecord &record)
void GetStaticInitializers(std::vector< lldb::addr_t > &static_initializers)
void CollectCandidateCNames(std::vector< ConstString > &C_names, ConstString name)
std::unique_ptr< llvm::ExecutionEngine > m_execution_engine_up
llvm::Module * m_module
Owned by the execution engine.
std::unique_ptr< llvm::LLVMContext > m_context_up
ArchSpec GetArchitecture() override
AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address)
Look up the object in m_address_map that contains a given address, find where it was copied to,...
bool m_strip_underscore
True for platforms where global symbols have a _ prefix.
void ReportSymbolLookupError(ConstString name)
lldb::addr_t FindInUserDefinedSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
void PopulateSectionList(lldb_private::ObjectFile *obj_file, lldb_private::SectionList &section_list) override
std::pair< lldb::addr_t, uintptr_t > AddrRange
void FreeNow(lldb::addr_t allocation)
std::atomic< bool > m_did_jit
std::vector< JittedGlobalVariable > m_jitted_global_variables
A vector of all functions that have been JITted into machine code.
bool WriteData(lldb::ProcessSP &process_sp)
Write the contents of all allocations to the process.
std::unique_ptr< llvm::ObjectCache > m_object_cache_up
~IRExecutionUnit() override
Destructor.
void ReportAllocations(llvm::ExecutionEngine &engine)
Report all committed allocations to the execution engine.
lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address)
Look up the object in m_address_map that contains a given address, find where it was copied to,...
bool m_reported_allocations
True after allocations have been reported.
Encapsulates memory that may exist in the process but must also be available in the host process.
Definition: IRMemoryMap.h:34
void Free(lldb::addr_t process_address, Status &error)
ExecutionContextScope * GetBestExecutionContextScope() const
lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error)
lldb::ProcessWP & GetProcessWP()
Definition: IRMemoryMap.h:86
void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, size_t size, Status &error)
void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, Status &error)
@ eAllocationPolicyProcessOnly
The intent is that this allocation exist only in the process.
Definition: IRMemoryMap.h:49
@ eAllocationPolicyMirror
The intent is that this allocation exist both in the host and the process and have the same content i...
Definition: IRMemoryMap.h:46
void Dump(Stream *s, bool show_address, bool show_bytes, bool show_control_flow_kind, const ExecutionContext *exe_ctx)
static Language * FindPlugin(lldb::LanguageType language)
Definition: Language.cpp:84
A class that handles mangled names.
Definition: Mangled.h:33
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
A collection class for Module objects.
Definition: ModuleList.h:103
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) const
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:527
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
Definition: ModuleList.cpp:334
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:44
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1953
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3611
size_t AddSection(const lldb::SectionSP &section_sp)
Definition: Section.cpp:481
An error handling class.
Definition: Status.h:118
void Clear()
Clear the object state.
Definition: Status.cpp:215
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition: Status.cpp:106
static Status FromErrorString(const char *str)
Definition: Status.h:141
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:195
bool Success() const
Test for success condition.
Definition: Status.cpp:304
const char * GetData() const
Definition: StreamString.h:45
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:65
Defines a list of symbol context objects.
SymbolContextIterable SymbolContexts()
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:34
lldb::ModuleSP module_sp
The Module for a given query.
lldb::TargetSP target_sp
The Target for a given query.
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:997
const ArchSpec & GetArchitecture() const
Definition: Target.h:1039
uint8_t * GetBytes()
Get a pointer to the data.
Definition: DataBuffer.h:108
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
#define UINT32_MAX
Definition: lldb-defines.h:19
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
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:389
@ eSymbolTypeUndefined
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
Definition: lldb-forward.h:341
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Section > SectionSP
Definition: lldb-forward.h:418
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:337
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:448
@ eSectionTypeDWARFDebugStrOffsets
@ eSectionTypeData
@ eSectionTypeInvalid
@ eSectionTypeDWARFDebugPubNames
@ eSectionTypeDWARFDebugFrame
@ eSectionTypeDWARFDebugLocLists
DWARF v5 .debug_loclists.
@ eSectionTypeDWARFDebugMacInfo
@ eSectionTypeDWARFAppleNamespaces
@ eSectionTypeOther
@ eSectionTypeDWARFAppleTypes
@ eSectionTypeDWARFDebugInfo
@ eSectionTypeDWARFDebugRanges
@ eSectionTypeDWARFDebugLine
@ eSectionTypeDWARFDebugPubTypes
@ eSectionTypeDWARFDebugStr
@ eSectionTypeDWARFDebugLoc
@ eSectionTypeDWARFAppleNames
@ eSectionTypeDWARFAppleObjC
@ eSectionTypeCode
@ eSectionTypeDWARFDebugCuIndex
@ eSectionTypeDWARFDebugAranges
@ eSectionTypeDWARFGNUDebugAltLink
@ eSectionTypeDWARFDebugAbbrev
@ eSectionTypeDWARFDebugAddr
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:373
Definition: Debugger.h:54
Encapsulates a single allocation request made by the JIT.
"lldb/Expression/IRExecutionUnit.h" Encapsulates a single function that has been generated by the JIT...
Options used by Module::FindFunctions.
Definition: Module.h:66
bool include_inlines
Include inlined functions.
Definition: Module.h:70
bool include_symbols
Include the symbol table.
Definition: Module.h:68