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"
12 #include "lldb/Symbol/ObjectFile.h"
14 #include "lldb/Target/Target.h"
15 #include "lldb/Utility/FileSpec.h"
16 #include "lldb/Utility/VMRange.h"
17 
18 #include <cinttypes>
19 #include <limits>
20 #include <utility>
21 
22 namespace lldb_private {
23 class DataExtractor;
24 }
25 using namespace lldb;
26 using namespace lldb_private;
27 
28 const char *Section::GetTypeAsCString() const {
29  switch (m_type) {
31  return "invalid";
32  case eSectionTypeCode:
33  return "code";
35  return "container";
36  case eSectionTypeData:
37  return "data";
39  return "data-cstr";
41  return "data-cstr-ptr";
43  return "data-symbol-addr";
44  case eSectionTypeData4:
45  return "data-4-byte";
46  case eSectionTypeData8:
47  return "data-8-byte";
48  case eSectionTypeData16:
49  return "data-16-byte";
51  return "data-ptrs";
52  case eSectionTypeDebug:
53  return "debug";
55  return "zero-fill";
57  return "objc-message-refs";
59  return "objc-cfstrings";
61  return "dwarf-abbrev";
63  return "dwarf-abbrev-dwo";
65  return "dwarf-addr";
67  return "dwarf-aranges";
69  return "dwarf-cu-index";
71  return "dwarf-tu-index";
73  return "dwarf-frame";
75  return "dwarf-info";
77  return "dwarf-info-dwo";
79  return "dwarf-line";
81  return "dwarf-line-str";
83  return "dwarf-loc";
85  return "dwarf-loc-dwo";
87  return "dwarf-loclists";
89  return "dwarf-loclists-dwo";
91  return "dwarf-macinfo";
93  return "dwarf-macro";
95  return "dwarf-pubnames";
97  return "dwarf-pubtypes";
99  return "dwarf-ranges";
101  return "dwarf-rnglists";
103  return "dwarf-rnglists-dwo";
105  return "dwarf-str";
107  return "dwarf-str-dwo";
109  return "dwarf-str-offsets";
111  return "dwarf-str-offsets-dwo";
113  return "dwarf-types";
115  return "dwarf-types-dwo";
117  return "dwarf-names";
119  return "elf-symbol-table";
121  return "elf-dynamic-symbols";
123  return "elf-relocation-entries";
125  return "elf-dynamic-link-info";
127  return "apple-names";
129  return "apple-types";
131  return "apple-namespaces";
133  return "apple-objc";
134  case eSectionTypeEHFrame:
135  return "eh-frame";
137  return "ARM.exidx";
139  return "ARM.extab";
141  return "compact-unwind";
143  return "go-symtab";
145  return "absolute";
147  return "dwarf-gnu-debugaltlink";
148  case eSectionTypeOther:
149  return "regular";
150  }
151  return "unknown";
152 }
153 
154 Section::Section(const ModuleSP &module_sp, ObjectFile *obj_file,
155  user_id_t sect_id, ConstString name,
156  SectionType sect_type, addr_t file_addr, addr_t byte_size,
157  lldb::offset_t file_offset, lldb::offset_t file_size,
158  uint32_t log2align, uint32_t flags,
159  uint32_t target_byte_size /*=1*/)
160  : ModuleChild(module_sp), UserID(sect_id), Flags(flags),
161  m_obj_file(obj_file), m_type(sect_type), m_parent_wp(), m_name(name),
162  m_file_addr(file_addr), m_byte_size(byte_size),
163  m_file_offset(file_offset), m_file_size(file_size),
164  m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
165  m_thread_specific(false), m_readable(false), m_writable(false),
166  m_executable(false), m_relocated(false), m_target_byte_size(target_byte_size) {
167  // printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
168  // addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 "
169  // - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s\n",
170  // this, module_sp.get(), sect_id, file_addr, file_addr +
171  // byte_size, file_offset, file_offset + file_size, flags,
172  // name.GetCString());
173 }
174 
175 Section::Section(const lldb::SectionSP &parent_section_sp,
176  const ModuleSP &module_sp, ObjectFile *obj_file,
177  user_id_t sect_id, ConstString name,
178  SectionType sect_type, addr_t file_addr, addr_t byte_size,
179  lldb::offset_t file_offset, lldb::offset_t file_size,
180  uint32_t log2align, uint32_t flags,
181  uint32_t target_byte_size /*=1*/)
182  : ModuleChild(module_sp), UserID(sect_id), Flags(flags),
183  m_obj_file(obj_file), m_type(sect_type), m_parent_wp(), m_name(name),
184  m_file_addr(file_addr), m_byte_size(byte_size),
185  m_file_offset(file_offset), m_file_size(file_size),
186  m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
187  m_thread_specific(false), m_readable(false), m_writable(false),
188  m_executable(false), m_relocated(false), m_target_byte_size(target_byte_size) {
189  // printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
190  // addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 "
191  // - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s.%s\n",
192  // this, module_sp.get(), sect_id, file_addr, file_addr +
193  // byte_size, file_offset, file_offset + file_size, flags,
194  // parent_section_sp->GetName().GetCString(), name.GetCString());
195  if (parent_section_sp)
196  m_parent_wp = parent_section_sp;
197 }
198 
200  // printf ("Section::~Section(%p)\n", this);
201 }
202 
204  SectionSP parent_sp(GetParent());
205  if (parent_sp) {
206  // This section has a parent which means m_file_addr is an offset into the
207  // parent section, so the file address for this section is the file address
208  // of the parent plus the offset
209  return parent_sp->GetFileAddress() + m_file_addr;
210  }
211  // This section has no parent, so m_file_addr is the file base address
212  return m_file_addr;
213 }
214 
216  SectionSP parent_sp(GetParent());
217  if (parent_sp) {
218  if (m_file_addr >= file_addr)
219  return parent_sp->SetFileAddress(m_file_addr - file_addr);
220  return false;
221  } else {
222  // This section has no parent, so m_file_addr is the file base address
223  m_file_addr = file_addr;
224  return true;
225  }
226 }
227 
229  // This section has a parent which means m_file_addr is an offset.
230  SectionSP parent_sp(GetParent());
231  if (parent_sp)
232  return m_file_addr;
233 
234  // This section has no parent, so there is no offset to be had
235  return 0;
236 }
237 
239  addr_t load_base_addr = LLDB_INVALID_ADDRESS;
240  SectionSP parent_sp(GetParent());
241  if (parent_sp) {
242  load_base_addr = parent_sp->GetLoadBaseAddress(target);
243  if (load_base_addr != LLDB_INVALID_ADDRESS)
244  load_base_addr += GetOffset();
245  }
246  if (load_base_addr == LLDB_INVALID_ADDRESS) {
247  load_base_addr = target->GetSectionLoadList().GetSectionLoadAddress(
248  const_cast<Section *>(this)->shared_from_this());
249  }
250  return load_base_addr;
251 }
252 
254  bool allow_section_end) const {
255  const size_t num_children = m_children.GetSize();
256  for (size_t i = 0; i < num_children; i++) {
257  Section *child_section = m_children.GetSectionAtIndex(i).get();
258 
259  addr_t child_offset = child_section->GetOffset();
260  if (child_offset <= offset &&
261  offset - child_offset <
262  child_section->GetByteSize() + (allow_section_end ? 1 : 0))
263  return child_section->ResolveContainedAddress(offset - child_offset,
264  so_addr, allow_section_end);
265  }
266  so_addr.SetOffset(offset);
267  so_addr.SetSection(const_cast<Section *>(this)->shared_from_this());
268 
269  // Ensure that there are no orphaned (i.e., moduleless) sections.
270  assert(GetModule().get());
271  return true;
272 }
273 
275  const addr_t file_addr = GetFileAddress();
276  if (file_addr != LLDB_INVALID_ADDRESS && !IsThreadSpecific()) {
277  if (file_addr <= vm_addr) {
278  const addr_t offset = (vm_addr - file_addr) * m_target_byte_size;
279  return offset < GetByteSize();
280  }
281  }
282  return false;
283 }
284 
285 void Section::Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
286  uint32_t depth) const {
287  s.indent(indent);
288  s << llvm::format("0x%8.8" PRIx64 " %-16s ", GetID(), GetTypeAsCString());
289  bool resolved = true;
291 
292  if (GetByteSize() == 0)
293  s.indent(39);
294  else {
295  if (target)
296  addr = GetLoadBaseAddress(target);
297 
298  if (addr == LLDB_INVALID_ADDRESS) {
299  if (target)
300  resolved = false;
301  addr = GetFileAddress();
302  }
303 
304  VMRange range(addr, addr + m_byte_size);
305  range.Dump(s, 0);
306  }
307 
308  s << llvm::format("%c %c%c%c 0x%8.8" PRIx64 " 0x%8.8" PRIx64 " 0x%8.8x ",
309  resolved ? ' ' : '*', m_readable ? 'r' : '-',
310  m_writable ? 'w' : '-', m_executable ? 'x' : '-',
312 
313  DumpName(s);
314 
315  s << "\n";
316 
317  if (depth > 0)
318  m_children.Dump(s, indent, target, false, depth - 1);
319 }
320 
321 void Section::DumpName(llvm::raw_ostream &s) const {
322  SectionSP parent_sp(GetParent());
323  if (parent_sp) {
324  parent_sp->DumpName(s);
325  s << '.';
326  } else {
327  // The top most section prints the module basename
328  const char *name = nullptr;
329  ModuleSP module_sp(GetModule());
330 
331  if (m_obj_file) {
332  const FileSpec &file_spec = m_obj_file->GetFileSpec();
333  name = file_spec.GetFilename().AsCString();
334  }
335  if ((!name || !name[0]) && module_sp)
336  name = module_sp->GetFileSpec().GetFilename().AsCString();
337  if (name && name[0])
338  s << name << '.';
339  }
340  s << m_name;
341 }
342 
343 bool Section::IsDescendant(const Section *section) {
344  if (this == section)
345  return true;
346  SectionSP parent_sp(GetParent());
347  if (parent_sp)
348  return parent_sp->IsDescendant(section);
349  return false;
350 }
351 
352 bool Section::Slide(addr_t slide_amount, bool slide_children) {
354  if (slide_amount == 0)
355  return true;
356 
357  m_file_addr += slide_amount;
358 
359  if (slide_children)
360  m_children.Slide(slide_amount, slide_children);
361 
362  return true;
363  }
364  return false;
365 }
366 
367 /// Get the permissions as OR'ed bits from lldb::Permissions
369  uint32_t permissions = 0;
370  if (m_readable)
371  permissions |= ePermissionsReadable;
372  if (m_writable)
373  permissions |= ePermissionsWritable;
374  if (m_executable)
375  permissions |= ePermissionsExecutable;
376  return permissions;
377 }
378 
379 /// Set the permissions using bits OR'ed from lldb::Permissions
381  m_readable = (permissions & ePermissionsReadable) != 0;
382  m_writable = (permissions & ePermissionsWritable) != 0;
383  m_executable = (permissions & ePermissionsExecutable) != 0;
384 }
385 
387  lldb::offset_t offset) {
388  if (m_obj_file)
389  return m_obj_file->ReadSectionData(this, offset, dst, dst_len);
390  return 0;
391 }
392 
394  if (m_obj_file)
395  return m_obj_file->ReadSectionData(this, section_data);
396  return 0;
397 }
398 
399 #pragma mark SectionList
400 
402  if (this != &rhs)
403  m_sections = rhs.m_sections;
404  return *this;
405 }
406 
407 size_t SectionList::AddSection(const lldb::SectionSP &section_sp) {
408  if (section_sp) {
409  size_t section_index = m_sections.size();
410  m_sections.push_back(section_sp);
411  return section_index;
412  }
413 
414  return std::numeric_limits<size_t>::max();
415 }
416 
417 // Warning, this can be slow as it's removing items from a std::vector.
418 bool SectionList::DeleteSection(size_t idx) {
419  if (idx < m_sections.size()) {
420  m_sections.erase(m_sections.begin() + idx);
421  return true;
422  }
423  return false;
424 }
425 
427  iterator sect_iter;
428  iterator begin = m_sections.begin();
429  iterator end = m_sections.end();
430  for (sect_iter = begin; sect_iter != end; ++sect_iter) {
431  if (sect_iter->get() == sect) {
432  // The secton was already in this section list
433  return std::distance(begin, sect_iter);
434  }
435  }
436  return UINT32_MAX;
437 }
438 
439 size_t SectionList::AddUniqueSection(const lldb::SectionSP &sect_sp) {
440  size_t sect_idx = FindSectionIndex(sect_sp.get());
441  if (sect_idx == UINT32_MAX) {
442  sect_idx = AddSection(sect_sp);
443  }
444  return sect_idx;
445 }
446 
448  const lldb::SectionSP &sect_sp,
449  uint32_t depth) {
450  iterator sect_iter, end = m_sections.end();
451  for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) {
452  if ((*sect_iter)->GetID() == sect_id) {
453  *sect_iter = sect_sp;
454  return true;
455  } else if (depth > 0) {
456  if ((*sect_iter)
457  ->GetChildren()
458  .ReplaceSection(sect_id, sect_sp, depth - 1))
459  return true;
460  }
461  }
462  return false;
463 }
464 
466  size_t count = m_sections.size();
467  if (depth > 0) {
468  const_iterator sect_iter, end = m_sections.end();
469  for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) {
470  count += (*sect_iter)->GetChildren().GetNumSections(depth - 1);
471  }
472  }
473  return count;
474 }
475 
476 SectionSP SectionList::GetSectionAtIndex(size_t idx) const {
477  SectionSP sect_sp;
478  if (idx < m_sections.size())
479  sect_sp = m_sections[idx];
480  return sect_sp;
481 }
482 
483 SectionSP
485  SectionSP sect_sp;
486  // Check if we have a valid section string
487  if (section_dstr && !m_sections.empty()) {
488  const_iterator sect_iter;
489  const_iterator end = m_sections.end();
490  for (sect_iter = m_sections.begin();
491  sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
492  Section *child_section = sect_iter->get();
493  if (child_section) {
494  if (child_section->GetName() == section_dstr) {
495  sect_sp = *sect_iter;
496  } else {
497  sect_sp =
498  child_section->GetChildren().FindSectionByName(section_dstr);
499  }
500  }
501  }
502  }
503  return sect_sp;
504 }
505 
506 SectionSP SectionList::FindSectionByID(user_id_t sect_id) const {
507  SectionSP sect_sp;
508  if (sect_id) {
509  const_iterator sect_iter;
510  const_iterator end = m_sections.end();
511  for (sect_iter = m_sections.begin();
512  sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
513  if ((*sect_iter)->GetID() == sect_id) {
514  sect_sp = *sect_iter;
515  break;
516  } else {
517  sect_sp = (*sect_iter)->GetChildren().FindSectionByID(sect_id);
518  }
519  }
520  }
521  return sect_sp;
522 }
523 
525  bool check_children,
526  size_t start_idx) const {
527  SectionSP sect_sp;
528  size_t num_sections = m_sections.size();
529  for (size_t idx = start_idx; idx < num_sections; ++idx) {
530  if (m_sections[idx]->GetType() == sect_type) {
531  sect_sp = m_sections[idx];
532  break;
533  } else if (check_children) {
534  sect_sp = m_sections[idx]->GetChildren().FindSectionByType(
535  sect_type, check_children, 0);
536  if (sect_sp)
537  break;
538  }
539  }
540  return sect_sp;
541 }
542 
544  uint32_t depth) const {
545  SectionSP sect_sp;
546  const_iterator sect_iter;
547  const_iterator end = m_sections.end();
548  for (sect_iter = m_sections.begin();
549  sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
550  Section *sect = sect_iter->get();
551  if (sect->ContainsFileAddress(vm_addr)) {
552  // The file address is in this section. We need to make sure one of our
553  // child sections doesn't contain this address as well as obeying the
554  // depth limit that was passed in.
555  if (depth > 0)
557  vm_addr, depth - 1);
558 
559  if (sect_sp.get() == nullptr && !sect->IsFake())
560  sect_sp = *sect_iter;
561  }
562  }
563  return sect_sp;
564 }
565 
567  return FindSectionByID(sect_id).get() != nullptr;
568 }
569 
570 void SectionList::Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
571  bool show_header, uint32_t depth) const {
572  bool target_has_loaded_sections =
573  target && !target->GetSectionLoadList().IsEmpty();
574  if (show_header && !m_sections.empty()) {
575  s.indent(indent);
576  s << llvm::formatv(
577  "SectID Type {0} Address "
578  " Perm File Off. File Size Flags "
579  " Section Name\n",
580  target_has_loaded_sections ? "Load" : "File");
581  s.indent(indent);
582  s << "---------- ---------------- "
583  "--------------------------------------- ---- ---------- "
584  "---------- "
585  "---------- ----------------------------\n";
586  }
587 
588  for (const auto &section_sp : m_sections)
589  section_sp->Dump(s, indent, target_has_loaded_sections ? target : nullptr,
590  depth);
591 }
592 
593 size_t SectionList::Slide(addr_t slide_amount, bool slide_children) {
594  size_t count = 0;
595  const_iterator pos, end = m_sections.end();
596  for (pos = m_sections.begin(); pos != end; ++pos) {
597  if ((*pos)->Slide(slide_amount, slide_children))
598  ++count;
599  }
600  return count;
601 }
lldb_private::SectionList::ReplaceSection
bool ReplaceSection(lldb::user_id_t sect_id, const lldb::SectionSP &section_sp, uint32_t depth=UINT32_MAX)
Definition: Section.cpp:447
lldb::eSectionTypeDWARFDebugLoc
@ eSectionTypeDWARFDebugLoc
Definition: lldb-enumerations.h:669
lldb_private::SectionList::FindSectionContainingFileAddress
lldb::SectionSP FindSectionContainingFileAddress(lldb::addr_t addr, uint32_t depth=UINT32_MAX) const
Definition: Section.cpp:543
lldb::eSectionTypeData8
@ eSectionTypeData8
Definition: lldb-enumerations.h:654
lldb::eSectionTypeDWARFDebugRngListsDwo
@ eSectionTypeDWARFDebugRngListsDwo
Definition: lldb-enumerations.h:705
lldb_private::SectionList::FindSectionByName
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition: Section.cpp:484
lldb::eSectionTypeDWARFAppleNamespaces
@ eSectionTypeDWARFAppleNamespaces
Definition: lldb-enumerations.h:679
lldb::eSectionTypeDWARFAppleObjC
@ eSectionTypeDWARFAppleObjC
Definition: lldb-enumerations.h:680
lldb::eSectionTypeDebug
@ eSectionTypeDebug
Definition: lldb-enumerations.h:657
lldb_private::SectionList::begin
const_iterator begin() const
Definition: Section.h:40
lldb_private::ObjectFile::GetFileSpec
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
Definition: ObjectFile.h:290
lldb_private::ModuleChild
Definition: ModuleChild.h:19
lldb_private::SectionList::Dump
void Dump(llvm::raw_ostream &s, unsigned indent, Target *target, bool show_header, uint32_t depth) const
Definition: Section.cpp:570
lldb_private::Section::m_name
ConstString m_name
Definition: Section.h:244
lldb::eSectionTypeData16
@ eSectionTypeData16
Definition: lldb-enumerations.h:655
lldb::eSectionTypeDataCStringPointers
@ eSectionTypeDataCStringPointers
Pointers to C string data.
Definition: lldb-enumerations.h:651
lldb::eSectionTypeDataPointers
@ eSectionTypeDataPointers
Definition: lldb-enumerations.h:656
lldb_private::Section::m_executable
bool m_executable
Definition: Section.h:265
lldb::eSectionTypeDWARFDebugAranges
@ eSectionTypeDWARFDebugAranges
Definition: lldb-enumerations.h:664
lldb_private::UserID
Definition: UserID.h:31
lldb_private::SectionList::GetSize
size_t GetSize() const
Definition: Section.h:74
lldb::eSectionTypeELFSymbolTable
@ eSectionTypeELFSymbolTable
Elf SHT_SYMTAB section.
Definition: lldb-enumerations.h:681
lldb::eSectionTypeDWARFDebugStrOffsetsDwo
@ eSectionTypeDWARFDebugStrOffsetsDwo
Definition: lldb-enumerations.h:703
lldb::eSectionTypeDWARFDebugRanges
@ eSectionTypeDWARFDebugRanges
Definition: lldb-enumerations.h:674
lldb::eSectionTypeDWARFDebugMacro
@ eSectionTypeDWARFDebugMacro
Definition: lldb-enumerations.h:671
lldb::eSectionTypeDWARFDebugInfoDwo
@ eSectionTypeDWARFDebugInfoDwo
Definition: lldb-enumerations.h:701
lldb::eSectionTypeDWARFDebugFrame
@ eSectionTypeDWARFDebugFrame
Definition: lldb-enumerations.h:666
Module.h
lldb_private::SectionList::ContainsSection
bool ContainsSection(lldb::user_id_t sect_id) const
Definition: Section.cpp:566
lldb::eSectionTypeDWARFDebugLine
@ eSectionTypeDWARFDebugLine
Definition: lldb-enumerations.h:668
lldb::eSectionTypeDWARFDebugAbbrevDwo
@ eSectionTypeDWARFDebugAbbrevDwo
Definition: lldb-enumerations.h:700
lldb_private::Flags
Definition: Flags.h:22
lldb_private::SectionList::Slide
size_t Slide(lldb::addr_t slide_amount, bool slide_children)
Definition: Section.cpp:593
lldb_private::ObjectFile::ReadSectionData
virtual size_t ReadSectionData(Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len)
Definition: ObjectFile.cpp:471
lldb::eSectionTypeDWARFDebugAddr
@ eSectionTypeDWARFDebugAddr
Definition: lldb-enumerations.h:663
SectionLoadList.h
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
lldb_private::Section::Dump
void Dump(llvm::raw_ostream &s, unsigned indent, Target *target, uint32_t depth) const
Definition: Section.cpp:285
lldb_private::SectionList
Definition: Section.h:34
lldb_private::Section::m_file_offset
lldb::offset_t m_file_offset
Definition: Section.h:250
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Section::IsDescendant
bool IsDescendant(const Section *section)
Definition: Section.cpp:343
lldb_private::Section::DumpName
void DumpName(llvm::raw_ostream &s) const
Definition: Section.cpp:321
lldb::eSectionTypeDWARFDebugStrOffsets
@ eSectionTypeDWARFDebugStrOffsets
Definition: lldb-enumerations.h:676
lldb_private::SectionList::GetNumSections
size_t GetNumSections(uint32_t depth) const
Definition: Section.cpp:465
lldb_private::Target
Definition: Target.h:445
Section.h
lldb_private::Section::GetParent
lldb::SectionSP GetParent() const
Definition: Section.h:178
lldb_private::Section::m_file_size
lldb::offset_t m_file_size
Definition: Section.h:251
lldb_private::Section::m_file_addr
lldb::addr_t m_file_addr
Definition: Section.h:245
lldb_private::Section::GetTypeAsCString
const char * GetTypeAsCString() const
Definition: Section.cpp:28
Target.h
lldb_private::SectionList::AddSection
size_t AddSection(const lldb::SectionSP &section_sp)
Definition: Section.cpp:407
lldb_private::SectionList::end
const_iterator end() const
Definition: Section.h:41
lldb_private::Section::GetFileAddress
lldb::addr_t GetFileAddress() const
Definition: Section.cpp:203
lldb::eSectionTypeELFRelocationEntries
@ eSectionTypeELFRelocationEntries
Elf SHT_REL or SHT_REL section.
Definition: lldb-enumerations.h:683
lldb::eSectionTypeDWARFDebugLocDwo
@ eSectionTypeDWARFDebugLocDwo
Definition: lldb-enumerations.h:706
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::Section::m_obj_file
ObjectFile * m_obj_file
Definition: Section.h:240
lldb::eSectionTypeDataObjCMessageRefs
@ eSectionTypeDataObjCMessageRefs
Pointer to function pointer + selector.
Definition: lldb-enumerations.h:659
lldb_private::SectionLoadList::GetSectionLoadAddress
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp) const
Definition: SectionLoadList.cpp:49
lldb::eSectionTypeDWARFDebugLocListsDwo
@ eSectionTypeDWARFDebugLocListsDwo
Definition: lldb-enumerations.h:707
lldb_private::SectionList::operator=
SectionList & operator=(const SectionList &rhs)
Definition: Section.cpp:401
lldb_private::Section::SetFileAddress
bool SetFileAddress(lldb::addr_t file_addr)
Definition: Section.cpp:215
lldb::eSectionTypeDWARFDebugAbbrev
@ eSectionTypeDWARFDebugAbbrev
Definition: lldb-enumerations.h:662
lldb::eSectionTypeCompactUnwind
@ eSectionTypeCompactUnwind
compact unwind section in Mach-O, __TEXT,__unwind_info
Definition: lldb-enumerations.h:688
lldb_private::VMRange::Dump
void Dump(llvm::raw_ostream &s, lldb::addr_t base_addr=0, uint32_t addr_width=8) const
Definition: VMRange.cpp:38
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::Section::Section
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, uint32_t target_byte_size=1)
lldb::eSectionTypeDataSymbolAddress
@ eSectionTypeDataSymbolAddress
Address of a symbol in the symbol table.
Definition: lldb-enumerations.h:652
lldb::eSectionTypeDataObjCCFStrings
@ eSectionTypeDataObjCCFStrings
Objective-C const CFString/NSString objects.
Definition: lldb-enumerations.h:660
lldb::eSectionTypeDWARFDebugStr
@ eSectionTypeDWARFDebugStr
Definition: lldb-enumerations.h:675
lldb_private::Address::SetSection
void SetSection(const lldb::SectionSP &section_sp)
Set accessor for the section.
Definition: Address.h:450
lldb_private::Section::GetChildren
SectionList & GetChildren()
Definition: Section.h:126
lldb_private::Section::Slide
bool Slide(lldb::addr_t slide_amount, bool slide_children)
Definition: Section.cpp:352
lldb_private::Section::IsThreadSpecific
bool IsThreadSpecific() const
Definition: Section.h:180
lldb_private::SectionList::FindSectionIndex
size_t FindSectionIndex(const Section *sect)
Definition: Section.cpp:426
lldb_private::Section::m_writable
bool m_writable
Definition: Section.h:264
lldb_private::Section::IsFake
bool IsFake() const
Definition: Section.h:160
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::Section::GetName
ConstString GetName() const
Definition: Section.h:170
lldb::eSectionTypeDWARFDebugInfo
@ eSectionTypeDWARFDebugInfo
Definition: lldb-enumerations.h:667
lldb_private::Section::GetOffset
lldb::addr_t GetOffset() const
Definition: Section.cpp:228
lldb::eSectionTypeDWARFDebugTypes
@ eSectionTypeDWARFDebugTypes
DWARF .debug_types section.
Definition: lldb-enumerations.h:694
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:476
lldb::eSectionTypeZeroFill
@ eSectionTypeZeroFill
Definition: lldb-enumerations.h:658
lldb::eSectionTypeDWARFAppleTypes
@ eSectionTypeDWARFAppleTypes
Definition: lldb-enumerations.h:678
lldb::eSectionTypeDWARFAppleNames
@ eSectionTypeDWARFAppleNames
Definition: lldb-enumerations.h:677
lldb::eSectionTypeDWARFGNUDebugAltLink
@ eSectionTypeDWARFGNUDebugAltLink
Definition: lldb-enumerations.h:693
lldb::eSectionTypeELFDynamicSymbols
@ eSectionTypeELFDynamicSymbols
Elf SHT_DYNSYM section.
Definition: lldb-enumerations.h:682
lldb_private::Section::GetLoadBaseAddress
lldb::addr_t GetLoadBaseAddress(Target *target) const
Definition: Section.cpp:238
lldb_private::Section::SetPermissions
void SetPermissions(uint32_t permissions)
Set the permissions using bits OR'ed from lldb::Permissions.
Definition: Section.cpp:380
lldb::eSectionTypeAbsoluteAddress
@ eSectionTypeAbsoluteAddress
Dummy section for symbols with absolute address.
Definition: lldb-enumerations.h:691
Address.h
lldb::eSectionTypeDWARFDebugCuIndex
@ eSectionTypeDWARFDebugCuIndex
Definition: lldb-enumerations.h:665
lldb_private::SectionList::DeleteSection
bool DeleteSection(size_t idx)
Definition: Section.cpp:418
lldb_private::Section::m_byte_size
lldb::addr_t m_byte_size
Definition: Section.h:248
lldb_private::Section::m_parent_wp
lldb::SectionWP m_parent_wp
Definition: Section.h:243
lldb::eSectionTypeData
@ eSectionTypeData
Definition: lldb-enumerations.h:649
ObjectFile.h
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::Section
Definition: Section.h:96
lldb::eSectionTypeDWARFDebugTuIndex
@ eSectionTypeDWARFDebugTuIndex
Definition: lldb-enumerations.h:708
lldb::eSectionTypeData4
@ eSectionTypeData4
Definition: lldb-enumerations.h:653
lldb::eSectionTypeOther
@ eSectionTypeOther
Definition: lldb-enumerations.h:696
lldb::eSectionTypeCode
@ eSectionTypeCode
Definition: lldb-enumerations.h:647
lldb_private::SectionLoadList::IsEmpty
bool IsEmpty() const
Definition: SectionLoadList.cpp:37
lldb_private::SectionList::FindSectionByType
lldb::SectionSP FindSectionByType(lldb::SectionType sect_type, bool check_children, size_t start_idx=0) const
Definition: Section.cpp:524
lldb_private::Section::GetByteSize
lldb::addr_t GetByteSize() const
Definition: Section.h:156
lldb::eSectionTypeContainer
@ eSectionTypeContainer
The section contains child sections.
Definition: lldb-enumerations.h:648
lldb::eSectionTypeEHFrame
@ eSectionTypeEHFrame
Definition: lldb-enumerations.h:685
lldb::eSectionTypeELFDynamicLinkInfo
@ eSectionTypeELFDynamicLinkInfo
Elf SHT_DYNAMIC section.
Definition: lldb-enumerations.h:684
uint32_t
lldb_private::Section::m_children
SectionList m_children
Definition: Section.h:255
lldb::SectionType
SectionType
Definition: lldb-enumerations.h:645
lldb_private::Flags::Get
ValueType Get() const
Get accessor for all flags.
Definition: Flags.h:40
lldb::eSectionTypeDWARFDebugStrDwo
@ eSectionTypeDWARFDebugStrDwo
Definition: lldb-enumerations.h:702
lldb_private::Address
Definition: Address.h:59
lldb_private::Section::m_target_byte_size
uint32_t m_target_byte_size
Definition: Section.h:267
lldb::eSectionTypeDWARFDebugPubTypes
@ eSectionTypeDWARFDebugPubTypes
Definition: lldb-enumerations.h:673
lldb::eSectionTypeDWARFDebugNames
@ eSectionTypeDWARFDebugNames
DWARF v5 .debug_names.
Definition: lldb-enumerations.h:695
lldb_private::SectionList::const_iterator
collection::const_iterator const_iterator
Definition: Section.h:38
lldb_private::Section::~Section
~Section()
Definition: Section.cpp:199
VMRange.h
lldb::eSectionTypeARMextab
@ eSectionTypeARMextab
Definition: lldb-enumerations.h:687
lldb::eSectionTypeDWARFDebugPubNames
@ eSectionTypeDWARFDebugPubNames
Definition: lldb-enumerations.h:672
lldb::eSectionTypeInvalid
@ eSectionTypeInvalid
Definition: lldb-enumerations.h:646
lldb::eSectionTypeDataCString
@ eSectionTypeDataCString
Inlined C string data.
Definition: lldb-enumerations.h:650
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::ModuleChild::GetModule
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
lldb_private::SectionList::m_sections
collection m_sections
Definition: Section.h:93
lldb::eSectionTypeDWARFDebugLineStr
@ eSectionTypeDWARFDebugLineStr
DWARF v5 .debug_line_str.
Definition: lldb-enumerations.h:697
lldb_private::Address::SetOffset
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Definition: Address.h:425
lldb_private::Target::GetSectionLoadList
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1034
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Section::ResolveContainedAddress
bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr, bool allow_section_end=false) const
Definition: Section.cpp:253
FileSpec.h
lldb::eSectionTypeDWARFDebugMacInfo
@ eSectionTypeDWARFDebugMacInfo
Definition: lldb-enumerations.h:670
lldb_private::SectionList::AddUniqueSection
size_t AddUniqueSection(const lldb::SectionSP &section_sp)
Definition: Section.cpp:439
lldb::eSectionTypeARMexidx
@ eSectionTypeARMexidx
Definition: lldb-enumerations.h:686
lldb_private::Section::ContainsFileAddress
bool ContainsFileAddress(lldb::addr_t vm_addr) const
Definition: Section.cpp:274
lldb::eSectionTypeDWARFDebugTypesDwo
@ eSectionTypeDWARFDebugTypesDwo
Definition: lldb-enumerations.h:704
lldb_private::SectionList::iterator
collection::iterator iterator
Definition: Section.h:37
lldb
Definition: SBAddress.h:15
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:341
lldb::eSectionTypeDWARFDebugLocLists
@ eSectionTypeDWARFDebugLocLists
DWARF v5 .debug_loclists.
Definition: lldb-enumerations.h:699
lldb::eSectionTypeGoSymtab
@ eSectionTypeGoSymtab
Definition: lldb-enumerations.h:690
lldb_private::Section::m_readable
bool m_readable
Definition: Section.h:263
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb_private::Section::GetSectionData
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:386
lldb_private::SectionList::FindSectionByID
lldb::SectionSP FindSectionByID(lldb::user_id_t sect_id) const
Definition: Section.cpp:506
lldb_private::Section::GetPermissions
uint32_t GetPermissions() const
Get the permissions as OR'ed bits from lldb::Permissions.
Definition: Section.cpp:368
lldb_private::VMRange
Definition: VMRange.h:23
lldb::eSectionTypeDWARFDebugRngLists
@ eSectionTypeDWARFDebugRngLists
DWARF v5 .debug_rnglists.
Definition: lldb-enumerations.h:698