[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- SBSection.cpp -----------------------------------------------------===//
|
2011-09-24 08:52:29 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-09-24 08:52:29 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBSection.h"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2011-09-24 08:52:29 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2012-06-28 06:22:28 +08:00
|
|
|
#include "lldb/API/SBTarget.h"
|
2011-09-24 08:52:29 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
2011-09-24 13:04:40 +08:00
|
|
|
#include "lldb/Core/Section.h"
|
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
2012-08-30 05:13:06 +08:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
2017-03-04 09:30:05 +08:00
|
|
|
#include "lldb/Utility/DataBuffer.h"
|
|
|
|
#include "lldb/Utility/DataExtractor.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2011-09-24 08:52:29 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBSection::SBSection() : m_opaque_wp() {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBSection);
|
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBSection::SBSection(const SBSection &rhs) : m_opaque_wp(rhs.m_opaque_wp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBSection, (const lldb::SBSection &), rhs);
|
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SBSection::SBSection(const lldb::SectionSP §ion_sp)
|
|
|
|
: m_opaque_wp() // Don't init with section_sp otherwise this will throw if
|
|
|
|
// section_sp doesn't contain a valid Section *
|
2011-09-24 08:52:29 +08:00
|
|
|
{
|
2012-02-24 09:59:29 +08:00
|
|
|
if (section_sp)
|
|
|
|
m_opaque_wp = section_sp;
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const SBSection &SBSection::operator=(const SBSection &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBSection &,
|
|
|
|
SBSection, operator=,(const lldb::SBSection &), rhs);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBSection::~SBSection() = default;
|
2011-09-24 08:52:29 +08:00
|
|
|
|
|
|
|
bool SBSection::IsValid() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSection, IsValid);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBSection::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSection, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
return section_sp && section_sp->GetModule().get() != nullptr;
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
2011-09-24 09:37:21 +08:00
|
|
|
const char *SBSection::GetName() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBSection, GetName);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
return section_sp->GetName().GetCString();
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
return nullptr;
|
2011-09-24 09:37:21 +08:00
|
|
|
}
|
2013-06-14 05:23:23 +08:00
|
|
|
|
|
|
|
lldb::SBSection SBSection::GetParent() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBSection, SBSection, GetParent);
|
|
|
|
|
2013-06-14 05:23:23 +08:00
|
|
|
lldb::SBSection sb_section;
|
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp) {
|
|
|
|
SectionSP parent_section_sp(section_sp->GetParent());
|
|
|
|
if (parent_section_sp)
|
|
|
|
sb_section.SetSP(parent_section_sp);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_section);
|
2013-06-14 05:23:23 +08:00
|
|
|
}
|
2011-09-24 09:37:21 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::SBSection SBSection::FindSubSection(const char *sect_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSection, SBSection, FindSubSection, (const char *),
|
|
|
|
sect_name);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::SBSection sb_section;
|
2012-02-24 09:59:29 +08:00
|
|
|
if (sect_name) {
|
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp) {
|
|
|
|
ConstString const_sect_name(sect_name);
|
|
|
|
sb_section.SetSP(
|
|
|
|
section_sp->GetChildren().FindSectionByName(const_sect_name));
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_section);
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
size_t SBSection::GetNumSubSections() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBSection, GetNumSubSections);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
return section_sp->GetChildren().GetSize();
|
2011-09-24 08:52:29 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
lldb::SBSection SBSection::GetSubSectionAtIndex(size_t idx) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSection, SBSection, GetSubSectionAtIndex, (size_t),
|
|
|
|
idx);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
lldb::SBSection sb_section;
|
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
sb_section.SetSP(section_sp->GetChildren().GetSectionAtIndex(idx));
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_section);
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
lldb::SectionSP SBSection::GetSP() const { return m_opaque_wp.lock(); }
|
2011-09-24 08:52:29 +08:00
|
|
|
|
2012-06-28 06:22:28 +08:00
|
|
|
void SBSection::SetSP(const lldb::SectionSP §ion_sp) {
|
|
|
|
m_opaque_wp = section_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::addr_t SBSection::GetFileAddress() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBSection, GetFileAddress);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::addr_t file_addr = LLDB_INVALID_ADDRESS;
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
return section_sp->GetFileAddress();
|
2011-09-24 08:52:29 +08:00
|
|
|
return file_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::addr_t SBSection::GetLoadAddress(lldb::SBTarget &sb_target) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::addr_t, SBSection, GetLoadAddress,
|
|
|
|
(lldb::SBTarget &), sb_target);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
TargetSP target_sp(sb_target.GetSP());
|
|
|
|
if (target_sp) {
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
2012-06-28 06:22:28 +08:00
|
|
|
return section_sp->GetLoadBaseAddress(target_sp.get());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-06-28 06:22:28 +08:00
|
|
|
return LLDB_INVALID_ADDRESS;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::addr_t SBSection::GetByteSize() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBSection, GetByteSize);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
2014-10-22 15:22:56 +08:00
|
|
|
return section_sp->GetByteSize();
|
2011-09-24 08:52:29 +08:00
|
|
|
return 0;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-02-07 01:22:03 +08:00
|
|
|
uint64_t SBSection::GetFileOffset() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint64_t, SBSection, GetFileOffset);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp) {
|
|
|
|
ModuleSP module_sp(section_sp->GetModule());
|
|
|
|
if (module_sp) {
|
|
|
|
ObjectFile *objfile = module_sp->GetObjectFile();
|
|
|
|
if (objfile)
|
2013-02-07 01:22:03 +08:00
|
|
|
return objfile->GetFileOffset() + section_sp->GetFileOffset();
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-02-24 09:59:29 +08:00
|
|
|
return UINT64_MAX;
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
uint64_t SBSection::GetFileByteSize() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint64_t, SBSection, GetFileByteSize);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
return section_sp->GetFileSize();
|
2011-09-24 08:52:29 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBData SBSection::GetSectionData() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBData, SBSection, GetSectionData);
|
|
|
|
|
|
|
|
return LLDB_RECORD_RESULT(GetSectionData(0, UINT64_MAX));
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBData SBSection::GetSectionData(uint64_t offset, uint64_t size) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBData, SBSection, GetSectionData,
|
|
|
|
(uint64_t, uint64_t), offset, size);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBData sb_data;
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp) {
|
|
|
|
const uint64_t sect_file_size = section_sp->GetFileSize();
|
|
|
|
if (sect_file_size > 0) {
|
|
|
|
ModuleSP module_sp(section_sp->GetModule());
|
|
|
|
if (module_sp) {
|
|
|
|
ObjectFile *objfile = module_sp->GetObjectFile();
|
|
|
|
if (objfile) {
|
2013-02-07 01:22:03 +08:00
|
|
|
const uint64_t sect_file_offset =
|
|
|
|
objfile->GetFileOffset() + section_sp->GetFileOffset();
|
2012-02-24 09:59:29 +08:00
|
|
|
const uint64_t file_offset = sect_file_offset + offset;
|
|
|
|
uint64_t file_size = size;
|
|
|
|
if (file_size == UINT64_MAX) {
|
|
|
|
file_size = section_sp->GetByteSize();
|
|
|
|
if (file_size > offset)
|
|
|
|
file_size -= offset;
|
|
|
|
else
|
|
|
|
file_size = 0;
|
|
|
|
}
|
2018-11-13 05:24:50 +08:00
|
|
|
auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer(
|
2017-03-07 07:42:14 +08:00
|
|
|
objfile->GetFileSpec().GetPath(), file_size, file_offset);
|
2012-02-24 09:59:29 +08:00
|
|
|
if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) {
|
|
|
|
DataExtractorSP data_extractor_sp(
|
|
|
|
new DataExtractor(data_buffer_sp, objfile->GetByteOrder(),
|
|
|
|
objfile->GetAddressByteSize()));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
sb_data.SetOpaque(data_extractor_sp);
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_data);
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SectionType SBSection::GetSectionType() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SectionType, SBSection, GetSectionType);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp.get())
|
|
|
|
return section_sp->GetType();
|
2011-09-24 08:52:29 +08:00
|
|
|
return eSectionTypeInvalid;
|
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
uint32_t SBSection::GetPermissions() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBSection, GetPermissions);
|
|
|
|
|
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp)
|
|
|
|
return section_sp->GetPermissions();
|
|
|
|
return 0;
|
2016-09-08 20:22:56 +08:00
|
|
|
}
|
|
|
|
|
2014-10-22 15:22:56 +08:00
|
|
|
uint32_t SBSection::GetTargetByteSize() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBSection, GetTargetByteSize);
|
|
|
|
|
2014-10-22 15:22:56 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp.get())
|
|
|
|
return section_sp->GetTargetByteSize();
|
|
|
|
return 0;
|
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
|
|
|
|
bool SBSection::operator==(const SBSection &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBSection, operator==,(const lldb::SBSection &),
|
|
|
|
rhs);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP lhs_section_sp(GetSP());
|
|
|
|
SectionSP rhs_section_sp(rhs.GetSP());
|
|
|
|
if (lhs_section_sp && rhs_section_sp)
|
|
|
|
return lhs_section_sp == rhs_section_sp;
|
2011-09-24 08:52:29 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBSection::operator!=(const SBSection &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBSection, operator!=,(const lldb::SBSection &),
|
|
|
|
rhs);
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP lhs_section_sp(GetSP());
|
|
|
|
SectionSP rhs_section_sp(rhs.GetSP());
|
|
|
|
return lhs_section_sp != rhs_section_sp;
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBSection::GetDescription(SBStream &description) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBSection, GetDescription, (lldb::SBStream &),
|
|
|
|
description);
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
|
|
|
|
2012-02-24 09:59:29 +08:00
|
|
|
SectionSP section_sp(GetSP());
|
|
|
|
if (section_sp) {
|
|
|
|
const addr_t file_addr = section_sp->GetFileAddress();
|
2012-11-30 05:49:15 +08:00
|
|
|
strm.Printf("[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") ", file_addr,
|
|
|
|
file_addr + section_sp->GetByteSize());
|
2012-02-24 09:59:29 +08:00
|
|
|
section_sp->DumpName(&strm);
|
2011-09-24 08:52:29 +08:00
|
|
|
} else {
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.PutCString("No value");
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBSection>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBSection, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBSection, (const lldb::SBSection &));
|
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBSection &,
|
|
|
|
SBSection, operator=,(const lldb::SBSection &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBSection, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBSection, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBSection, GetName, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, GetParent, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, FindSubSection,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(size_t, SBSection, GetNumSubSections, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, GetSubSectionAtIndex,
|
|
|
|
(size_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetFileAddress, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetLoadAddress,
|
|
|
|
(lldb::SBTarget &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetByteSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint64_t, SBSection, GetFileOffset, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint64_t, SBSection, GetFileByteSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBData, SBSection, GetSectionData, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBData, SBSection, GetSectionData,
|
|
|
|
(uint64_t, uint64_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SectionType, SBSection, GetSectionType, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBSection, GetPermissions, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBSection, GetTargetByteSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBSection, operator==,(const lldb::SBSection &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBSection, operator!=,(const lldb::SBSection &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBSection, GetDescription, (lldb::SBStream &));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|