LLDB mainline
Section.cpp
Go to the documentation of this file.
1//===-- Section.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 "lldb/Core/Section.h"
10#include "lldb/Core/Address.h"
11#include "lldb/Core/Module.h"
14#include "lldb/Target/Target.h"
16#include <cinttypes>
17#include <limits>
18#include <utility>
19
20namespace lldb_private {
21class DataExtractor;
22}
23using namespace lldb;
24using namespace lldb_private;
25
26const char *Section::GetTypeAsCString() const {
27 switch (m_type) {
29 return "invalid";
31 return "code";
33 return "container";
35 return "data";
37 return "data-cstr";
39 return "data-cstr-ptr";
41 return "data-symbol-addr";
43 return "data-4-byte";
45 return "data-8-byte";
47 return "data-16-byte";
49 return "data-ptrs";
51 return "debug";
53 return "zero-fill";
55 return "objc-message-refs";
57 return "objc-cfstrings";
59 return "dwarf-abbrev";
61 return "dwarf-abbrev-dwo";
63 return "dwarf-addr";
65 return "dwarf-aranges";
67 return "dwarf-cu-index";
69 return "dwarf-tu-index";
71 return "dwarf-frame";
73 return "dwarf-info";
75 return "dwarf-info-dwo";
77 return "dwarf-line";
79 return "dwarf-line-str";
81 return "dwarf-loc";
83 return "dwarf-loc-dwo";
85 return "dwarf-loclists";
87 return "dwarf-loclists-dwo";
89 return "dwarf-macinfo";
91 return "dwarf-macro";
93 return "dwarf-pubnames";
95 return "dwarf-pubtypes";
97 return "dwarf-ranges";
99 return "dwarf-rnglists";
101 return "dwarf-rnglists-dwo";
103 return "dwarf-str";
105 return "dwarf-str-dwo";
107 return "dwarf-str-offsets";
109 return "dwarf-str-offsets-dwo";
111 return "dwarf-types";
113 return "dwarf-types-dwo";
115 return "dwarf-names";
117 return "elf-symbol-table";
119 return "elf-dynamic-symbols";
121 return "elf-relocation-entries";
123 return "elf-dynamic-link-info";
125 return "apple-names";
127 return "apple-types";
129 return "apple-namespaces";
131 return "apple-objc";
133 return "eh-frame";
135 return "ARM.exidx";
137 return "ARM.extab";
139 return "compact-unwind";
141 return "go-symtab";
143 return "absolute";
145 return "dwarf-gnu-debugaltlink";
146 case eSectionTypeCTF:
147 return "ctf";
149 return "lldb-type-summaries";
151 return "lldb-formatters";
153 return "swift-modules";
155 return "wasm-name";
157 return "regular";
158 }
159 return "unknown";
160}
161
162Section::Section(const ModuleSP &module_sp, ObjectFile *obj_file,
163 user_id_t sect_id, ConstString name, SectionType sect_type,
164 addr_t file_addr, addr_t byte_size, lldb::offset_t file_offset,
165 lldb::offset_t file_size, uint32_t log2align, uint32_t flags)
166 : ModuleChild(module_sp), UserID(sect_id), Flags(flags),
167 m_obj_file(obj_file), m_type(sect_type), m_parent_wp(), m_name(name),
168 m_file_addr(file_addr), m_byte_size(byte_size),
169 m_file_offset(file_offset), m_file_size(file_size),
170 m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
171 m_thread_specific(false), m_readable(false), m_writable(false),
172 m_executable(false), m_relocated(false) {}
173
174Section::Section(const lldb::SectionSP &parent_section_sp,
175 const ModuleSP &module_sp, ObjectFile *obj_file,
176 user_id_t sect_id, ConstString name, SectionType sect_type,
177 addr_t file_addr, addr_t byte_size, lldb::offset_t file_offset,
178 lldb::offset_t file_size, uint32_t log2align, uint32_t flags)
179 : ModuleChild(module_sp), UserID(sect_id), Flags(flags),
180 m_obj_file(obj_file), m_type(sect_type), m_parent_wp(), m_name(name),
181 m_file_addr(file_addr), m_byte_size(byte_size),
182 m_file_offset(file_offset), m_file_size(file_size),
183 m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
184 m_thread_specific(false), m_readable(false), m_writable(false),
185 m_executable(false), m_relocated(false) {
186 if (parent_section_sp)
187 m_parent_wp = parent_section_sp;
188}
189
190Section::~Section() = default;
191
193 SectionSP parent_sp(GetParent());
194 if (parent_sp) {
195 // This section has a parent which means m_file_addr is an offset into the
196 // parent section, so the file address for this section is the file address
197 // of the parent plus the offset
198 return parent_sp->GetFileAddress() + m_file_addr;
199 }
200 // This section has no parent, so m_file_addr is the file base address
201 return m_file_addr;
202}
203
205 SectionSP parent_sp(GetParent());
206 if (parent_sp) {
207 if (m_file_addr >= file_addr)
208 return parent_sp->SetFileAddress(m_file_addr - file_addr);
209 return false;
210 } else {
211 // This section has no parent, so m_file_addr is the file base address
212 m_file_addr = file_addr;
213 return true;
214 }
215}
216
218 // This section has a parent which means m_file_addr is an offset.
219 SectionSP parent_sp(GetParent());
220 if (parent_sp)
221 return m_file_addr;
222
223 // This section has no parent, so there is no offset to be had
224 return 0;
225}
226
228 addr_t load_base_addr = LLDB_INVALID_ADDRESS;
229 SectionSP parent_sp(GetParent());
230 if (parent_sp) {
231 load_base_addr = parent_sp->GetLoadBaseAddress(target);
232 if (load_base_addr != LLDB_INVALID_ADDRESS)
233 load_base_addr += GetOffset();
234 }
235 if (load_base_addr == LLDB_INVALID_ADDRESS) {
236 load_base_addr = target->GetSectionLoadAddress(
237 const_cast<Section *>(this)->shared_from_this());
238 }
239 return load_base_addr;
240}
241
243 bool allow_section_end) const {
244 const size_t num_children = m_children.GetSize();
245 for (size_t i = 0; i < num_children; i++) {
246 Section *child_section = m_children.GetSectionAtIndex(i).get();
247
248 addr_t child_offset = child_section->GetOffset();
249 if (child_offset <= offset &&
250 offset - child_offset <
251 child_section->GetByteSize() + (allow_section_end ? 1 : 0))
252 return child_section->ResolveContainedAddress(offset - child_offset,
253 so_addr, allow_section_end);
254 }
255 so_addr = Address(const_cast<Section *>(this)->shared_from_this(), offset);
256
257 // Ensure that there are no orphaned (i.e., moduleless) sections.
258 assert(GetModule().get());
259 return true;
260}
261
263 const addr_t file_addr = GetFileAddress();
264 if (file_addr != LLDB_INVALID_ADDRESS && !IsThreadSpecific()) {
265 if (file_addr <= vm_addr) {
266 const addr_t offset = vm_addr - file_addr;
267 return offset < GetByteSize();
268 }
269 }
270 return false;
271}
272
273void Section::Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
274 uint32_t depth) const {
275 s.indent(indent);
276 s << llvm::format("0x%16.16" PRIx64 " %-22s ", GetID(), GetTypeAsCString());
277 bool resolved = true;
279
280 if (GetByteSize() == 0)
281 s.indent(39);
282 else {
283 if (target)
284 addr = GetLoadBaseAddress(target);
285
286 if (addr == LLDB_INVALID_ADDRESS) {
287 if (target)
288 resolved = false;
289 addr = GetFileAddress();
290 }
291
292 DumpAddressRange(s, addr, addr + m_byte_size, 8);
293 }
294
295 s << llvm::format("%c %c%c%c 0x%8.8" PRIx64 " 0x%8.8" PRIx64 " 0x%8.8x ",
296 resolved ? ' ' : '*', m_readable ? 'r' : '-',
297 m_writable ? 'w' : '-', m_executable ? 'x' : '-',
299
300 DumpName(s);
301
302 s << "\n";
303
304 if (depth > 0)
305 m_children.Dump(s, indent, target, false, depth - 1);
306}
307
308void Section::DumpName(llvm::raw_ostream &s) const {
309 SectionSP parent_sp(GetParent());
310 if (parent_sp) {
311 parent_sp->DumpName(s);
312 s << '.';
313 } else {
314 // The top most section prints the module basename
315 const char *name = nullptr;
316 ModuleSP module_sp(GetModule());
317
318 if (m_obj_file) {
319 const FileSpec &file_spec = m_obj_file->GetFileSpec();
320 name = file_spec.GetFilename().AsCString(nullptr);
321 }
322 if ((!name || !name[0]) && module_sp)
323 name = module_sp->GetFileSpec().GetFilename().AsCString(nullptr);
324 if (name && name[0])
325 s << name << '.';
326 }
327 s << m_name;
328}
329
330bool Section::IsDescendant(const Section *section) {
331 if (this == section)
332 return true;
333 SectionSP parent_sp(GetParent());
334 if (parent_sp)
335 return parent_sp->IsDescendant(section);
336 return false;
337}
338
339bool Section::Slide(addr_t slide_amount, bool slide_children) {
341 if (slide_amount == 0)
342 return true;
343
344 m_file_addr += slide_amount;
345
346 if (slide_children)
347 m_children.Slide(slide_amount, slide_children);
348
349 return true;
350 }
351 return false;
352}
353
354/// Get the permissions as OR'ed bits from lldb::Permissions
355uint32_t Section::GetPermissions() const {
356 uint32_t permissions = 0;
357 if (m_readable)
358 permissions |= ePermissionsReadable;
359 if (m_writable)
360 permissions |= ePermissionsWritable;
361 if (m_executable)
362 permissions |= ePermissionsExecutable;
363 return permissions;
364}
365
366/// Set the permissions using bits OR'ed from lldb::Permissions
367void Section::SetPermissions(uint32_t permissions) {
368 m_readable = (permissions & ePermissionsReadable) != 0;
369 m_writable = (permissions & ePermissionsWritable) != 0;
370 m_executable = (permissions & ePermissionsExecutable) != 0;
371}
372
374 lldb::offset_t offset) {
375 if (m_obj_file)
376 return m_obj_file->ReadSectionData(this, offset, dst, dst_len);
377 return 0;
378}
379
381 if (m_obj_file)
382 return m_obj_file->ReadSectionData(this, section_data);
383 return 0;
384}
385
387 switch (m_type) {
389 case eSectionTypeCode:
391 case eSectionTypeData:
414 // Used for "__dof_cache" in mach-o or ".debug" for COFF which isn't debug
415 // information that we parse at all. This was causing system files with no
416 // debug info to show debug info byte sizes in the "statistics dump" output
417 // for each module. New "eSectionType" enums should be created for dedicated
418 // debug info that has a predefined format if we wish for these sections to
419 // show up as debug info.
421 return false;
422
457 case eSectionTypeCTF:
461 return true;
462 }
463 return false;
464}
465
467 return GetObjectFile()->IsGOTSection(*this);
468}
469
470#pragma mark SectionList
471
473
475 if (this != &rhs)
477 return *this;
478}
479
480size_t SectionList::AddSection(const lldb::SectionSP &section_sp) {
481 if (section_sp) {
482 size_t section_index = m_sections.size();
483 m_sections.push_back(section_sp);
484 return section_index;
485 }
486
487 return std::numeric_limits<size_t>::max();
488}
489
490// Warning, this can be slow as it's removing items from a std::vector.
492 if (idx < m_sections.size()) {
493 m_sections.erase(m_sections.begin() + idx);
494 return true;
495 }
496 return false;
497}
498
500 iterator sect_iter;
501 iterator begin = m_sections.begin();
502 iterator end = m_sections.end();
503 for (sect_iter = begin; sect_iter != end; ++sect_iter) {
504 if (sect_iter->get() == sect) {
505 // The secton was already in this section list
506 return std::distance(begin, sect_iter);
507 }
508 }
509 return UINT32_MAX;
510}
511
513 size_t sect_idx = FindSectionIndex(sect_sp.get());
514 if (sect_idx == UINT32_MAX) {
515 sect_idx = AddSection(sect_sp);
516 }
517 return sect_idx;
518}
519
521 const lldb::SectionSP &sect_sp,
522 uint32_t depth) {
523 iterator sect_iter, end = m_sections.end();
524 for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) {
525 if ((*sect_iter)->GetID() == sect_id) {
526 *sect_iter = sect_sp;
527 return true;
528 } else if (depth > 0) {
529 if ((*sect_iter)
530 ->GetChildren()
531 .ReplaceSection(sect_id, sect_sp, depth - 1))
532 return true;
533 }
534 }
535 return false;
536}
537
538size_t SectionList::GetNumSections(uint32_t depth) const {
539 size_t count = m_sections.size();
540 if (depth > 0) {
541 const_iterator sect_iter, end = m_sections.end();
542 for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) {
543 count += (*sect_iter)->GetChildren().GetNumSections(depth - 1);
544 }
545 }
546 return count;
547}
548
550 SectionSP sect_sp;
551 if (idx < m_sections.size())
552 sect_sp = m_sections[idx];
553 return sect_sp;
554}
555
557 SectionSP sect_sp;
558 // Check if we have a valid section string
559 if (section_dstr && !m_sections.empty()) {
560 const_iterator sect_iter;
562 for (sect_iter = m_sections.begin();
563 sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
564 Section *child_section = sect_iter->get();
565 if (child_section) {
566 if (child_section->GetName() == section_dstr) {
567 sect_sp = *sect_iter;
568 } else {
569 sect_sp =
570 child_section->GetChildren().FindSectionByName(section_dstr);
571 }
572 }
573 }
574 }
575 return sect_sp;
576}
577
579 SectionSP sect_sp;
580 if (sect_id) {
581 const_iterator sect_iter;
583 for (sect_iter = m_sections.begin();
584 sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
585 if ((*sect_iter)->GetID() == sect_id) {
586 sect_sp = *sect_iter;
587 break;
588 } else {
589 sect_sp = (*sect_iter)->GetChildren().FindSectionByID(sect_id);
590 }
591 }
592 }
593 return sect_sp;
594}
595
597 bool check_children,
598 size_t start_idx) const {
599 SectionSP sect_sp;
600 size_t num_sections = m_sections.size();
601 for (size_t idx = start_idx; idx < num_sections; ++idx) {
602 if (m_sections[idx]->GetType() == sect_type) {
603 sect_sp = m_sections[idx];
604 break;
605 } else if (check_children) {
606 sect_sp = m_sections[idx]->GetChildren().FindSectionByType(
607 sect_type, check_children, 0);
608 if (sect_sp)
609 break;
610 }
611 }
612 return sect_sp;
613}
614
616 uint32_t depth) const {
617 SectionSP sect_sp;
618 const_iterator sect_iter;
620 for (sect_iter = m_sections.begin();
621 sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
622 Section *sect = sect_iter->get();
623 if (sect->ContainsFileAddress(vm_addr)) {
624 // The file address is in this section. We need to make sure one of our
625 // child sections doesn't contain this address as well as obeying the
626 // depth limit that was passed in.
627 if (depth > 0)
629 vm_addr, depth - 1);
630
631 if (sect_sp.get() == nullptr && !sect->IsFake())
632 sect_sp = *sect_iter;
633 }
634 }
635 return sect_sp;
636}
637
639 return FindSectionByID(sect_id).get() != nullptr;
640}
641
642void SectionList::Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
643 bool show_header, uint32_t depth) const {
644 bool target_has_loaded_sections = target && target->HasLoadedSections();
645 if (show_header && !m_sections.empty()) {
646 s.indent(indent);
647 s << llvm::formatv(
648 "SectID Type {0} Address "
649 " Perm File Off. File Size Flags Section Name\n",
650 target_has_loaded_sections ? "Load" : "File");
651 s.indent(indent);
652 s << "------------------ ---------------------- "
653 "--------------------------------------- ---- ---------- ---------- "
654 "---------- ----------------------------\n";
655 }
656
657 for (const auto &section_sp : m_sections)
658 section_sp->Dump(s, indent, target_has_loaded_sections ? target : nullptr,
659 depth);
660}
661
662size_t SectionList::Slide(addr_t slide_amount, bool slide_children) {
663 size_t count = 0;
664 const_iterator pos, end = m_sections.end();
665 for (pos = m_sections.begin(); pos != end; ++pos) {
666 if ((*pos)->Slide(slide_amount, slide_children))
667 ++count;
668 }
669 return count;
670}
671
673 uint64_t debug_info_size = 0;
674 for (const auto &section : m_sections) {
675 const SectionList &sub_sections = section->GetChildren();
676 if (sub_sections.GetSize() > 0)
677 debug_info_size += sub_sections.GetDebugInfoSize();
678 else if (section->ContainsOnlyDebugInfo())
679 debug_info_size += section->GetFileSize();
680 }
681 return debug_info_size;
682}
683
685 MergeCallback filter) {
686 SectionList output_list;
687
688 // Iterate through all the sections in lhs and see if we have matches in
689 // the rhs list.
690 for (const auto &lhs_section : lhs) {
691 auto rhs_section = rhs.FindSectionByName(lhs_section->GetName());
692 if (rhs_section)
693 output_list.AddSection(filter(lhs_section, rhs_section));
694 else
695 output_list.AddSection(lhs_section);
696 }
697
698 // Now that we've visited all possible duplicates, we can iterate over
699 // the rhs and take any values not in lhs.
700 for (const auto &rhs_section : rhs) {
701 auto lhs_section = lhs.FindSectionByName(rhs_section->GetName());
702 // Because we already visited everything overlapping between rhs
703 // and lhs, any section not in lhs is unique and can be output.
704 if (!lhs_section)
705 output_list.AddSection(rhs_section);
706 }
707
708 return output_list;
709}
710
711namespace llvm {
712namespace json {
713
714bool fromJSON(const llvm::json::Value &value,
715 lldb_private::JSONSection &section, llvm::json::Path path) {
716 llvm::json::ObjectMapper o(value, path);
717 return o && o.map("name", section.name) && o.map("type", section.type) &&
718 o.map("address", section.address) && o.map("size", section.size) &&
719 o.map("read", section.read) && o.map("write", section.write) &&
720 o.map("execute", section.execute) &&
721 o.mapOptional("subsections", section.subsections) &&
722 o.map("user_id", section.user_id) &&
723 o.map("file_offset", section.file_offset) &&
724 o.map("file_size", section.file_size) &&
725 o.map("alignment", section.log2align) &&
726 o.map("flags", section.flags) && o.map("fake", section.fake) &&
727 o.map("encrypted", section.encrypted) &&
728 o.map("thread_specific", section.thread_specific);
729}
730
731bool fromJSON(const llvm::json::Value &value, lldb::SectionType &type,
732 llvm::json::Path path) {
733 if (auto str = value.getAsString()) {
734 type = llvm::StringSwitch<lldb::SectionType>(*str)
735 .Case("code", eSectionTypeCode)
736 .Case("container", eSectionTypeContainer)
737 .Case("data", eSectionTypeData)
738 .Case("debug", eSectionTypeDebug)
739 .Default(eSectionTypeInvalid);
740
741 if (type == eSectionTypeInvalid) {
742 path.report("invalid section type");
743 return false;
744 }
745
746 return true;
747 }
748 path.report("expected string");
749 return false;
750}
751} // namespace json
752} // namespace llvm
A section + offset based address class.
Definition Address.h:62
A uniqued constant string class.
Definition ConstString.h:40
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
An data extractor class.
A file utility class.
Definition FileSpec.h:57
const ConstString & GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:250
Flags(ValueType flags=0)
Construct with initial flag bit values.
Definition Flags.h:34
ValueType Get() const
Get accessor for all flags.
Definition Flags.h:40
ModuleChild(const lldb::ModuleSP &module_sp)
Construct with owning module.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:46
virtual bool IsGOTSection(const lldb_private::Section &section) const
Returns true if the section is a global offset table section.
Definition ObjectFile.h:738
const_iterator begin() const
Definition Section.h:41
bool ContainsSection(lldb::user_id_t sect_id) const
Definition Section.cpp:638
const_iterator end() const
Definition Section.h:42
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition Section.cpp:556
collection::iterator iterator
Definition Section.h:38
static SectionList Merge(SectionList &lhs, SectionList &rhs, MergeCallback filter)
Definition Section.cpp:684
size_t GetNumSections(uint32_t depth) const
Definition Section.cpp:538
lldb::SectionSP FindSectionByID(lldb::user_id_t sect_id) const
Definition Section.cpp:578
SectionList()=default
Create an empty list.
size_t Slide(lldb::addr_t slide_amount, bool slide_children)
Definition Section.cpp:662
lldb::SectionSP FindSectionContainingFileAddress(lldb::addr_t addr, uint32_t depth=UINT32_MAX) const
Definition Section.cpp:615
uint64_t GetDebugInfoSize() const
Get the debug information size from all sections that contain debug information.
Definition Section.cpp:672
size_t GetSize() const
Definition Section.h:77
std::function< lldb::SectionSP(lldb::SectionSP, lldb::SectionSP)> MergeCallback
Definition Section.h:103
bool DeleteSection(size_t idx)
Definition Section.cpp:491
size_t AddSection(const lldb::SectionSP &section_sp)
Definition Section.cpp:480
bool ReplaceSection(lldb::user_id_t sect_id, const lldb::SectionSP &section_sp, uint32_t depth=UINT32_MAX)
Definition Section.cpp:520
SectionList & operator=(const SectionList &rhs)
Definition Section.cpp:474
size_t FindSectionIndex(const Section *sect)
Definition Section.cpp:499
lldb::SectionSP FindSectionByType(lldb::SectionType sect_type, bool check_children, size_t start_idx=0) const
Definition Section.cpp:596
size_t AddUniqueSection(const lldb::SectionSP &section_sp)
Definition Section.cpp:512
void Dump(llvm::raw_ostream &s, unsigned indent, Target *target, bool show_header, uint32_t depth) const
Definition Section.cpp:642
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition Section.cpp:549
collection::const_iterator const_iterator
Definition Section.h:39
bool IsThreadSpecific() const
Definition Section.h:221
bool ContainsFileAddress(lldb::addr_t vm_addr) const
Definition Section.cpp:262
lldb::addr_t m_byte_size
Definition Section.h:296
lldb::addr_t GetOffset() const
Definition Section.cpp:217
lldb::addr_t m_file_addr
Definition Section.h:293
void SetPermissions(uint32_t permissions)
Set the permissions using bits OR'ed from lldb::Permissions.
Definition Section.cpp:367
ConstString GetName() const
Definition Section.h:211
bool IsFake() const
Definition Section.h:201
void DumpName(llvm::raw_ostream &s) const
Definition Section.cpp:308
lldb::offset_t GetSectionData(void *dst, lldb::offset_t dst_len, lldb::offset_t offset=0)
Read the section data from the object file that the section resides in.
Definition Section.cpp:373
bool IsDescendant(const Section *section)
Definition Section.cpp:330
bool IsGOTSection() const
Returns true if this is a global offset table section.
Definition Section.cpp:466
ObjectFile * m_obj_file
Definition Section.h:288
lldb::SectionSP GetParent() const
Definition Section.h:219
uint32_t GetPermissions() const
Get the permissions as OR'ed bits from lldb::Permissions.
Definition Section.cpp:355
bool SetFileAddress(lldb::addr_t file_addr)
Definition Section.cpp:204
lldb::SectionWP m_parent_wp
Definition Section.h:291
ConstString m_name
Definition Section.h:292
lldb::addr_t GetFileAddress() const
Definition Section.cpp:192
SectionList & GetChildren()
Definition Section.h:167
lldb::SectionType m_type
Definition Section.h:290
ObjectFile * GetObjectFile()
Definition Section.h:231
bool ContainsOnlyDebugInfo() const
Returns true if this section contains debug information.
Definition Section.cpp:386
void Dump(llvm::raw_ostream &s, unsigned indent, Target *target, uint32_t depth) const
Definition Section.cpp:273
const char * GetTypeAsCString() const
Definition Section.cpp:26
lldb::addr_t GetLoadBaseAddress(Target *target) const
Definition Section.cpp:227
bool Slide(lldb::addr_t slide_amount, bool slide_children)
Definition Section.cpp:339
bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr, bool allow_section_end=false) const
Definition Section.cpp:242
lldb::offset_t m_file_offset
Definition Section.h:298
lldb::offset_t m_file_size
Definition Section.h:299
lldb::addr_t GetByteSize() const
Definition Section.h:197
SectionList m_children
Definition Section.h:303
Section(const lldb::ModuleSP &module_sp, ObjectFile *obj_file, lldb::user_id_t sect_id, ConstString name, lldb::SectionType sect_type, lldb::addr_t file_vm_addr, lldb::addr_t vm_size, lldb::offset_t file_offset, lldb::offset_t file_size, uint32_t log2align, uint32_t flags)
Definition Section.cpp:162
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp)
Definition Target.cpp:5409
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
A class that represents a running process on the host machine.
void DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix=nullptr, const char *suffix=nullptr)
Output an address range to this stream.
Definition Stream.cpp:118
bool fromJSON(const llvm::json::Value &value, TraceSupportedResponse &info, llvm::json::Path path)
uint64_t offset_t
Definition lldb-types.h:85
uint64_t user_id_t
Definition lldb-types.h:82
std::shared_ptr< lldb_private::Section > SectionSP
uint64_t addr_t
Definition lldb-types.h:80
@ eSectionTypeDWARFDebugStrOffsets
@ eSectionTypeELFDynamicSymbols
Elf SHT_DYNSYM section.
@ eSectionTypeInvalid
@ eSectionTypeDWARFDebugPubNames
@ eSectionTypeDataObjCCFStrings
Objective-C const CFString/NSString objects.
@ eSectionTypeZeroFill
@ eSectionTypeDWARFDebugLocDwo
@ eSectionTypeDWARFDebugFrame
@ eSectionTypeARMextab
@ eSectionTypeContainer
The section contains child sections.
@ eSectionTypeDWARFDebugLocLists
DWARF v5 .debug_loclists.
@ eSectionTypeDWARFDebugTypes
DWARF .debug_types section.
@ eSectionTypeDataSymbolAddress
Address of a symbol in the symbol table.
@ eSectionTypeELFDynamicLinkInfo
Elf SHT_DYNAMIC section.
@ eSectionTypeDWARFDebugMacInfo
@ eSectionTypeAbsoluteAddress
Dummy section for symbols with absolute address.
@ eSectionTypeCompactUnwind
compact unwind section in Mach-O, __TEXT,__unwind_info
@ eSectionTypeELFRelocationEntries
Elf SHT_REL or SHT_REL section.
@ eSectionTypeDWARFAppleNamespaces
@ eSectionTypeLLDBFormatters
@ eSectionTypeDWARFDebugNames
DWARF v5 .debug_names.
@ eSectionTypeDWARFDebugRngLists
DWARF v5 .debug_rnglists.
@ eSectionTypeEHFrame
@ eSectionTypeDWARFDebugStrOffsetsDwo
@ eSectionTypeDWARFDebugMacro
@ eSectionTypeDWARFAppleTypes
@ eSectionTypeDWARFDebugInfo
@ eSectionTypeDWARFDebugTypesDwo
@ eSectionTypeDWARFDebugRanges
@ eSectionTypeDWARFDebugRngListsDwo
@ eSectionTypeLLDBTypeSummaries
@ eSectionTypeGoSymtab
@ eSectionTypeARMexidx
@ eSectionTypeDWARFDebugLine
@ eSectionTypeDWARFDebugPubTypes
@ eSectionTypeDataObjCMessageRefs
Pointer to function pointer + selector.
@ eSectionTypeDWARFDebugTuIndex
@ eSectionTypeDWARFDebugStr
@ eSectionTypeDWARFDebugLineStr
DWARF v5 .debug_line_str.
@ eSectionTypeDWARFDebugLoc
@ eSectionTypeDWARFAppleNames
@ eSectionTypeDataCStringPointers
Pointers to C string data.
@ eSectionTypeDWARFAppleObjC
@ eSectionTypeSwiftModules
@ eSectionTypeDWARFDebugCuIndex
@ eSectionTypeDWARFDebugAranges
@ eSectionTypeDWARFDebugAbbrevDwo
@ eSectionTypeDWARFGNUDebugAltLink
@ eSectionTypeDWARFDebugStrDwo
@ eSectionTypeDWARFDebugAbbrev
@ eSectionTypeDataPointers
@ eSectionTypeDWARFDebugLocListsDwo
@ eSectionTypeDWARFDebugInfoDwo
@ eSectionTypeDWARFDebugAddr
@ eSectionTypeWasmName
@ eSectionTypeDataCString
Inlined C string data.
@ eSectionTypeELFSymbolTable
Elf SHT_SYMTAB section.
std::shared_ptr< lldb_private::Module > ModuleSP
std::optional< lldb::user_id_t > user_id
Definition Section.h:117
std::optional< uint64_t > log2align
Definition Section.h:124
std::optional< uint64_t > size
Definition Section.h:121
std::optional< uint64_t > flags
Definition Section.h:125
std::optional< bool > encrypted
Definition Section.h:133
std::optional< bool > fake
Definition Section.h:132
std::optional< lldb::SectionType > type
Definition Section.h:119
std::optional< bool > write
Definition Section.h:129
std::optional< bool > execute
Definition Section.h:130
std::optional< uint64_t > file_offset
Definition Section.h:122
std::optional< uint64_t > address
Definition Section.h:120
std::optional< bool > thread_specific
Definition Section.h:134
std::optional< uint64_t > file_size
Definition Section.h:123
std::vector< JSONSection > subsections
Definition Section.h:136
std::optional< bool > read
Definition Section.h:128
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition UserID.h:47