1 //===-- ObjectFile.cpp ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Symbol/ObjectFile.h"
11 #include "lldb/Core/Module.h"
12 #include "lldb/Core/ModuleSpec.h"
13 #include "lldb/Core/PluginManager.h"
14 #include "lldb/Core/Section.h"
15 #include "lldb/Symbol/ObjectContainer.h"
16 #include "lldb/Symbol/SymbolFile.h"
17 #include "lldb/Target/Process.h"
18 #include "lldb/Target/SectionLoadList.h"
19 #include "lldb/Target/Target.h"
20 #include "lldb/Utility/DataBuffer.h"
21 #include "lldb/Utility/DataBufferHeap.h"
22 #include "lldb/Utility/Log.h"
23 #include "lldb/Utility/RegularExpression.h"
24 #include "lldb/Utility/Timer.h"
25 #include "lldb/lldb-private.h"
28 using namespace lldb_private;
31 ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
32 lldb::offset_t file_offset, lldb::offset_t file_size,
33 DataBufferSP &data_sp, lldb::offset_t &data_offset) {
34 ObjectFileSP object_file_sp;
37 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
40 "ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
41 "0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
42 module_sp->GetFileSpec().GetPath().c_str(),
43 static_cast<const void *>(file), static_cast<uint64_t>(file_offset),
44 static_cast<uint64_t>(file_size));
46 FileSpec archive_file;
47 ObjectContainerCreateInstance create_object_container_callback;
49 const bool file_exists = FileSystem::Instance().Exists(*file);
51 // We have an object name which most likely means we have a .o file in
52 // a static archive (.a file). Try and see if we have a cached archive
53 // first without reading any data first
54 if (file_exists && module_sp->GetObjectName()) {
55 for (uint32_t idx = 0;
56 (create_object_container_callback =
57 PluginManager::GetObjectContainerCreateCallbackAtIndex(
60 std::unique_ptr<ObjectContainer> object_container_ap(
61 create_object_container_callback(module_sp, data_sp,
62 data_offset, file, file_offset,
65 if (object_container_ap.get())
66 object_file_sp = object_container_ap->GetObjectFile(file);
68 if (object_file_sp.get())
69 return object_file_sp;
72 // Ok, we didn't find any containers that have a named object, now lets
73 // read the first 512 bytes from the file so the object file and object
74 // container plug-ins can use these bytes to see if they can parse this
77 data_sp = FileSystem::Instance().CreateDataBuffer(file->GetPath(),
83 if (!data_sp || data_sp->GetByteSize() == 0) {
84 // Check for archive file with format "/path/to/archive.a(object.o)"
85 char path_with_object[PATH_MAX * 2];
86 module_sp->GetFileSpec().GetPath(path_with_object,
87 sizeof(path_with_object));
89 ConstString archive_object;
90 const bool must_exist = true;
91 if (ObjectFile::SplitArchivePathWithObject(
92 path_with_object, archive_file, archive_object, must_exist)) {
93 file_size = FileSystem::Instance().GetByteSize(archive_file);
96 module_sp->SetFileSpecAndObjectName(archive_file, archive_object);
97 // Check if this is a object container by iterating through all
98 // object container plugin instances and then trying to get an
99 // object file from the container plugins since we had a name.
101 // ANY data in case there is data cached in the container plug-ins
102 // (like BSD archives caching the contained objects within an
104 for (uint32_t idx = 0;
105 (create_object_container_callback =
106 PluginManager::GetObjectContainerCreateCallbackAtIndex(
109 std::unique_ptr<ObjectContainer> object_container_ap(
110 create_object_container_callback(module_sp, data_sp,
112 file_offset, file_size));
114 if (object_container_ap.get())
115 object_file_sp = object_container_ap->GetObjectFile(file);
117 if (object_file_sp.get())
118 return object_file_sp;
120 // We failed to find any cached object files in the container plug-
121 // ins, so lets read the first 512 bytes and try again below...
122 data_sp = FileSystem::Instance().CreateDataBuffer(
123 archive_file.GetPath(), 512, file_offset);
128 if (data_sp && data_sp->GetByteSize() > 0) {
129 // Check if this is a normal object file by iterating through all
130 // object file plugin instances.
131 ObjectFileCreateInstance create_object_file_callback;
132 for (uint32_t idx = 0;
133 (create_object_file_callback =
134 PluginManager::GetObjectFileCreateCallbackAtIndex(idx)) !=
137 object_file_sp.reset(create_object_file_callback(
138 module_sp, data_sp, data_offset, file, file_offset, file_size));
139 if (object_file_sp.get())
140 return object_file_sp;
143 // Check if this is a object container by iterating through all object
144 // container plugin instances and then trying to get an object file
145 // from the container.
146 for (uint32_t idx = 0;
147 (create_object_container_callback =
148 PluginManager::GetObjectContainerCreateCallbackAtIndex(
151 std::unique_ptr<ObjectContainer> object_container_ap(
152 create_object_container_callback(module_sp, data_sp, data_offset,
153 file, file_offset, file_size));
155 if (object_container_ap.get())
156 object_file_sp = object_container_ap->GetObjectFile(file);
158 if (object_file_sp.get())
159 return object_file_sp;
164 // We didn't find it, so clear our shared pointer in case it contains
165 // anything and return an empty shared pointer
166 object_file_sp.reset();
167 return object_file_sp;
170 ObjectFileSP ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp,
171 const ProcessSP &process_sp,
172 lldb::addr_t header_addr,
173 DataBufferSP &data_sp) {
174 ObjectFileSP object_file_sp;
177 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
178 Timer scoped_timer(func_cat,
179 "ObjectFile::FindPlugin (module = "
180 "%s, process = %p, header_addr = "
182 module_sp->GetFileSpec().GetPath().c_str(),
183 static_cast<void *>(process_sp.get()), header_addr);
186 // Check if this is a normal object file by iterating through all object
187 // file plugin instances.
188 ObjectFileCreateMemoryInstance create_callback;
191 PluginManager::GetObjectFileCreateMemoryCallbackAtIndex(idx)) !=
194 object_file_sp.reset(
195 create_callback(module_sp, data_sp, process_sp, header_addr));
196 if (object_file_sp.get())
197 return object_file_sp;
201 // We didn't find it, so clear our shared pointer in case it contains
202 // anything and return an empty shared pointer
203 object_file_sp.reset();
204 return object_file_sp;
207 size_t ObjectFile::GetModuleSpecifications(const FileSpec &file,
208 lldb::offset_t file_offset,
209 lldb::offset_t file_size,
210 ModuleSpecList &specs) {
211 DataBufferSP data_sp =
212 FileSystem::Instance().CreateDataBuffer(file.GetPath(), 512, file_offset);
214 if (file_size == 0) {
215 const lldb::offset_t actual_file_size =
216 FileSystem::Instance().GetByteSize(file);
217 if (actual_file_size > file_offset)
218 file_size = actual_file_size - file_offset;
220 return ObjectFile::GetModuleSpecifications(file, // file spec
221 data_sp, // data bytes
223 file_offset, // file offset
224 file_size, // file length
230 size_t ObjectFile::GetModuleSpecifications(
231 const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp,
232 lldb::offset_t data_offset, lldb::offset_t file_offset,
233 lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) {
234 const size_t initial_count = specs.GetSize();
235 ObjectFileGetModuleSpecifications callback;
237 // Try the ObjectFile plug-ins
240 PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(
243 if (callback(file, data_sp, data_offset, file_offset, file_size, specs) > 0)
244 return specs.GetSize() - initial_count;
247 // Try the ObjectContainer plug-ins
249 (callback = PluginManager::
250 GetObjectContainerGetModuleSpecificationsCallbackAtIndex(i)) !=
253 if (callback(file, data_sp, data_offset, file_offset, file_size, specs) > 0)
254 return specs.GetSize() - initial_count;
259 ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp,
260 const FileSpec *file_spec_ptr,
261 lldb::offset_t file_offset, lldb::offset_t length,
262 const lldb::DataBufferSP &data_sp,
263 lldb::offset_t data_offset)
264 : ModuleChild(module_sp),
265 m_file(), // This file could be different from the original module's file
266 m_type(eTypeInvalid), m_strata(eStrataInvalid),
267 m_file_offset(file_offset), m_length(length), m_data(),
268 m_unwind_table(*this), m_process_wp(),
269 m_memory_addr(LLDB_INVALID_ADDRESS), m_sections_ap(), m_symtab_ap(),
270 m_synthetic_symbol_idx(0) {
272 m_file = *file_spec_ptr;
274 m_data.SetData(data_sp, data_offset, length);
275 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
277 log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, "
278 "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64,
279 static_cast<void *>(this), static_cast<void *>(module_sp.get()),
280 module_sp->GetSpecificationDescription().c_str(),
281 m_file ? m_file.GetPath().c_str() : "<NULL>", m_file_offset,
285 ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp,
286 const ProcessSP &process_sp, lldb::addr_t header_addr,
287 DataBufferSP &header_data_sp)
288 : ModuleChild(module_sp), m_file(), m_type(eTypeInvalid),
289 m_strata(eStrataInvalid), m_file_offset(0), m_length(0), m_data(),
290 m_unwind_table(*this), m_process_wp(process_sp),
291 m_memory_addr(header_addr), m_sections_ap(), m_symtab_ap(),
292 m_synthetic_symbol_idx(0) {
294 m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize());
295 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
297 log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, "
298 "header_addr = 0x%" PRIx64,
299 static_cast<void *>(this), static_cast<void *>(module_sp.get()),
300 module_sp->GetSpecificationDescription().c_str(),
301 static_cast<void *>(process_sp.get()), m_memory_addr);
304 ObjectFile::~ObjectFile() {
305 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
307 log->Printf("%p ObjectFile::~ObjectFile ()\n", static_cast<void *>(this));
310 bool ObjectFile::SetModulesArchitecture(const ArchSpec &new_arch) {
311 ModuleSP module_sp(GetModule());
313 return module_sp->SetArchitecture(new_arch);
317 AddressClass ObjectFile::GetAddressClass(addr_t file_addr) {
318 Symtab *symtab = GetSymtab();
320 Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr);
322 if (symbol->ValueIsAddress()) {
323 const SectionSP section_sp(symbol->GetAddressRef().GetSection());
325 const SectionType section_type = section_sp->GetType();
326 switch (section_type) {
327 case eSectionTypeInvalid:
328 return AddressClass::eUnknown;
329 case eSectionTypeCode:
330 return AddressClass::eCode;
331 case eSectionTypeContainer:
332 return AddressClass::eUnknown;
333 case eSectionTypeData:
334 case eSectionTypeDataCString:
335 case eSectionTypeDataCStringPointers:
336 case eSectionTypeDataSymbolAddress:
337 case eSectionTypeData4:
338 case eSectionTypeData8:
339 case eSectionTypeData16:
340 case eSectionTypeDataPointers:
341 case eSectionTypeZeroFill:
342 case eSectionTypeDataObjCMessageRefs:
343 case eSectionTypeDataObjCCFStrings:
344 case eSectionTypeGoSymtab:
345 return AddressClass::eData;
346 case eSectionTypeDebug:
347 case eSectionTypeDWARFDebugAbbrev:
348 case eSectionTypeDWARFDebugAbbrevDwo:
349 case eSectionTypeDWARFDebugAddr:
350 case eSectionTypeDWARFDebugAranges:
351 case eSectionTypeDWARFDebugCuIndex:
352 case eSectionTypeDWARFDebugFrame:
353 case eSectionTypeDWARFDebugInfo:
354 case eSectionTypeDWARFDebugInfoDwo:
355 case eSectionTypeDWARFDebugLine:
356 case eSectionTypeDWARFDebugLineStr:
357 case eSectionTypeDWARFDebugLoc:
358 case eSectionTypeDWARFDebugLocLists:
359 case eSectionTypeDWARFDebugMacInfo:
360 case eSectionTypeDWARFDebugMacro:
361 case eSectionTypeDWARFDebugNames:
362 case eSectionTypeDWARFDebugPubNames:
363 case eSectionTypeDWARFDebugPubTypes:
364 case eSectionTypeDWARFDebugRanges:
365 case eSectionTypeDWARFDebugRngLists:
366 case eSectionTypeDWARFDebugStr:
367 case eSectionTypeDWARFDebugStrDwo:
368 case eSectionTypeDWARFDebugStrOffsets:
369 case eSectionTypeDWARFDebugStrOffsetsDwo:
370 case eSectionTypeDWARFDebugTypes:
371 case eSectionTypeDWARFAppleNames:
372 case eSectionTypeDWARFAppleTypes:
373 case eSectionTypeDWARFAppleNamespaces:
374 case eSectionTypeDWARFAppleObjC:
375 case eSectionTypeDWARFGNUDebugAltLink:
376 return AddressClass::eDebug;
377 case eSectionTypeEHFrame:
378 case eSectionTypeARMexidx:
379 case eSectionTypeARMextab:
380 case eSectionTypeCompactUnwind:
381 return AddressClass::eRuntime;
382 case eSectionTypeELFSymbolTable:
383 case eSectionTypeELFDynamicSymbols:
384 case eSectionTypeELFRelocationEntries:
385 case eSectionTypeELFDynamicLinkInfo:
386 case eSectionTypeOther:
387 return AddressClass::eUnknown;
388 case eSectionTypeAbsoluteAddress:
389 // In case of absolute sections decide the address class based on
390 // the symbol type because the section type isn't specify if it is
391 // a code or a data section.
397 const SymbolType symbol_type = symbol->GetType();
398 switch (symbol_type) {
400 return AddressClass::eUnknown;
401 case eSymbolTypeAbsolute:
402 return AddressClass::eUnknown;
403 case eSymbolTypeCode:
404 return AddressClass::eCode;
405 case eSymbolTypeTrampoline:
406 return AddressClass::eCode;
407 case eSymbolTypeResolver:
408 return AddressClass::eCode;
409 case eSymbolTypeData:
410 return AddressClass::eData;
411 case eSymbolTypeRuntime:
412 return AddressClass::eRuntime;
413 case eSymbolTypeException:
414 return AddressClass::eRuntime;
415 case eSymbolTypeSourceFile:
416 return AddressClass::eDebug;
417 case eSymbolTypeHeaderFile:
418 return AddressClass::eDebug;
419 case eSymbolTypeObjectFile:
420 return AddressClass::eDebug;
421 case eSymbolTypeCommonBlock:
422 return AddressClass::eDebug;
423 case eSymbolTypeBlock:
424 return AddressClass::eDebug;
425 case eSymbolTypeLocal:
426 return AddressClass::eData;
427 case eSymbolTypeParam:
428 return AddressClass::eData;
429 case eSymbolTypeVariable:
430 return AddressClass::eData;
431 case eSymbolTypeVariableType:
432 return AddressClass::eDebug;
433 case eSymbolTypeLineEntry:
434 return AddressClass::eDebug;
435 case eSymbolTypeLineHeader:
436 return AddressClass::eDebug;
437 case eSymbolTypeScopeBegin:
438 return AddressClass::eDebug;
439 case eSymbolTypeScopeEnd:
440 return AddressClass::eDebug;
441 case eSymbolTypeAdditional:
442 return AddressClass::eUnknown;
443 case eSymbolTypeCompiler:
444 return AddressClass::eDebug;
445 case eSymbolTypeInstrumentation:
446 return AddressClass::eDebug;
447 case eSymbolTypeUndefined:
448 return AddressClass::eUnknown;
449 case eSymbolTypeObjCClass:
450 return AddressClass::eRuntime;
451 case eSymbolTypeObjCMetaClass:
452 return AddressClass::eRuntime;
453 case eSymbolTypeObjCIVar:
454 return AddressClass::eRuntime;
455 case eSymbolTypeReExported:
456 return AddressClass::eRuntime;
460 return AddressClass::eUnknown;
463 DataBufferSP ObjectFile::ReadMemory(const ProcessSP &process_sp,
464 lldb::addr_t addr, size_t byte_size) {
465 DataBufferSP data_sp;
467 std::unique_ptr<DataBufferHeap> data_ap(new DataBufferHeap(byte_size, 0));
469 const size_t bytes_read = process_sp->ReadMemory(
470 addr, data_ap->GetBytes(), data_ap->GetByteSize(), error);
471 if (bytes_read == byte_size)
472 data_sp.reset(data_ap.release());
477 size_t ObjectFile::GetData(lldb::offset_t offset, size_t length,
478 DataExtractor &data) const {
479 // The entire file has already been mmap'ed into m_data, so just copy from
480 // there as the back mmap buffer will be shared with shared pointers.
481 return data.SetData(m_data, offset, length);
484 size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
486 // The entire file has already been mmap'ed into m_data, so just copy from
487 // there Note that the data remains in target byte order.
488 return m_data.CopyData(offset, length, dst);
491 size_t ObjectFile::ReadSectionData(Section *section,
492 lldb::offset_t section_offset, void *dst,
495 section_offset *= section->GetTargetByteSize();
497 // If some other objectfile owns this data, pass this to them.
498 if (section->GetObjectFile() != this)
499 return section->GetObjectFile()->ReadSectionData(section, section_offset,
503 ProcessSP process_sp(m_process_wp.lock());
506 const addr_t base_load_addr =
507 section->GetLoadBaseAddress(&process_sp->GetTarget());
508 if (base_load_addr != LLDB_INVALID_ADDRESS)
509 return process_sp->ReadMemory(base_load_addr + section_offset, dst,
513 if (!section->IsRelocated())
514 RelocateSection(section);
516 const lldb::offset_t section_file_size = section->GetFileSize();
517 if (section_offset < section_file_size) {
518 const size_t section_bytes_left = section_file_size - section_offset;
519 size_t section_dst_len = dst_len;
520 if (section_dst_len > section_bytes_left)
521 section_dst_len = section_bytes_left;
522 return CopyData(section->GetFileOffset() + section_offset,
523 section_dst_len, dst);
525 if (section->GetType() == eSectionTypeZeroFill) {
526 const uint64_t section_size = section->GetByteSize();
527 const uint64_t section_bytes_left = section_size - section_offset;
528 uint64_t section_dst_len = dst_len;
529 if (section_dst_len > section_bytes_left)
530 section_dst_len = section_bytes_left;
531 memset(dst, 0, section_dst_len);
532 return section_dst_len;
539 //----------------------------------------------------------------------
540 // Get the section data the file on disk
541 //----------------------------------------------------------------------
542 size_t ObjectFile::ReadSectionData(Section *section,
543 DataExtractor §ion_data) {
544 // If some other objectfile owns this data, pass this to them.
545 if (section->GetObjectFile() != this)
546 return section->GetObjectFile()->ReadSectionData(section, section_data);
549 ProcessSP process_sp(m_process_wp.lock());
551 const addr_t base_load_addr =
552 section->GetLoadBaseAddress(&process_sp->GetTarget());
553 if (base_load_addr != LLDB_INVALID_ADDRESS) {
554 DataBufferSP data_sp(
555 ReadMemory(process_sp, base_load_addr, section->GetByteSize()));
557 section_data.SetData(data_sp, 0, data_sp->GetByteSize());
558 section_data.SetByteOrder(process_sp->GetByteOrder());
559 section_data.SetAddressByteSize(process_sp->GetAddressByteSize());
560 return section_data.GetByteSize();
564 return GetData(section->GetFileOffset(), section->GetFileSize(),
567 // The object file now contains a full mmap'ed copy of the object file
568 // data, so just use this
569 if (!section->IsRelocated())
570 RelocateSection(section);
572 return GetData(section->GetFileOffset(), section->GetFileSize(),
577 bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object,
578 FileSpec &archive_file,
579 ConstString &archive_object,
581 RegularExpression g_object_regex(llvm::StringRef("(.*)\\(([^\\)]+)\\)$"));
582 RegularExpression::Match regex_match(2);
583 if (g_object_regex.Execute(llvm::StringRef::withNullAsEmpty(path_with_object),
587 if (regex_match.GetMatchAtIndex(path_with_object, 1, path) &&
588 regex_match.GetMatchAtIndex(path_with_object, 2, obj)) {
589 archive_file.SetFile(path, FileSpec::Style::native);
590 archive_object.SetCString(obj.c_str());
591 return !(must_exist && !FileSystem::Instance().Exists(archive_file));
597 void ObjectFile::ClearSymtab() {
598 ModuleSP module_sp(GetModule());
600 std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
601 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
603 log->Printf("%p ObjectFile::ClearSymtab () symtab = %p",
604 static_cast<void *>(this),
605 static_cast<void *>(m_symtab_ap.get()));
610 SectionList *ObjectFile::GetSectionList(bool update_module_section_list) {
611 if (m_sections_ap.get() == nullptr) {
612 if (update_module_section_list) {
613 ModuleSP module_sp(GetModule());
615 std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
616 CreateSections(*module_sp->GetUnifiedSectionList());
619 SectionList unified_section_list;
620 CreateSections(unified_section_list);
623 return m_sections_ap.get();
627 ObjectFile::GetSymbolTypeFromName(llvm::StringRef name,
628 lldb::SymbolType symbol_type_hint) {
630 if (name.startswith("_OBJC_")) {
632 if (name.startswith("_OBJC_CLASS_$_"))
633 return lldb::eSymbolTypeObjCClass;
634 if (name.startswith("_OBJC_METACLASS_$_"))
635 return lldb::eSymbolTypeObjCMetaClass;
636 if (name.startswith("_OBJC_IVAR_$_"))
637 return lldb::eSymbolTypeObjCIVar;
638 } else if (name.startswith(".objc_class_name_")) {
640 return lldb::eSymbolTypeObjCClass;
643 return symbol_type_hint;
646 ConstString ObjectFile::GetNextSyntheticSymbolName() {
648 ConstString file_name = GetModule()->GetFileSpec().GetFilename();
649 ss.Printf("___lldb_unnamed_symbol%u$$%s", ++m_synthetic_symbol_idx,
650 file_name.GetCString());
651 return ConstString(ss.GetString());
654 std::vector<ObjectFile::LoadableData>
655 ObjectFile::GetLoadableData(Target &target) {
656 std::vector<LoadableData> loadables;
657 SectionList *section_list = GetSectionList();
660 // Create a list of loadable data from loadable sections
661 size_t section_count = section_list->GetNumSections(0);
662 for (size_t i = 0; i < section_count; ++i) {
663 LoadableData loadable;
664 SectionSP section_sp = section_list->GetSectionAtIndex(i);
666 target.GetSectionLoadList().GetSectionLoadAddress(section_sp);
667 if (loadable.Dest == LLDB_INVALID_ADDRESS)
669 // We can skip sections like bss
670 if (section_sp->GetFileSize() == 0)
672 DataExtractor section_data;
673 section_sp->GetSectionData(section_data);
674 loadable.Contents = llvm::ArrayRef<uint8_t>(section_data.GetDataStart(),
675 section_data.GetByteSize());
676 loadables.push_back(loadable);
681 void ObjectFile::RelocateSection(lldb_private::Section *section)
685 DataBufferSP ObjectFile::MapFileData(const FileSpec &file, uint64_t Size,
687 return FileSystem::Instance().CreateDataBuffer(file.GetPath(), Size, Offset);
690 void llvm::format_provider<ObjectFile::Type>::format(
691 const ObjectFile::Type &type, raw_ostream &OS, StringRef Style) {
693 case ObjectFile::eTypeInvalid:
696 case ObjectFile::eTypeCoreFile:
699 case ObjectFile::eTypeExecutable:
702 case ObjectFile::eTypeDebugInfo:
705 case ObjectFile::eTypeDynamicLinker:
706 OS << "dynamic linker";
708 case ObjectFile::eTypeObjectFile:
711 case ObjectFile::eTypeSharedLibrary:
712 OS << "shared library";
714 case ObjectFile::eTypeStubLibrary:
715 OS << "stub library";
717 case ObjectFile::eTypeJIT:
720 case ObjectFile::eTypeUnknown:
726 void llvm::format_provider<ObjectFile::Strata>::format(
727 const ObjectFile::Strata &strata, raw_ostream &OS, StringRef Style) {
729 case ObjectFile::eStrataInvalid:
732 case ObjectFile::eStrataUnknown:
735 case ObjectFile::eStrataUser:
738 case ObjectFile::eStrataKernel:
741 case ObjectFile::eStrataRawImage:
744 case ObjectFile::eStrataJIT: