Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 1 | //===-- SBSection.cpp -------------------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "lldb/API/SBSection.h" |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 10 | #include "SBReproducerPrivate.h" |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 11 | #include "lldb/API/SBStream.h" |
Greg Clayton | fed39aa | 2012-06-27 22:22:28 +0000 | [diff] [blame] | 12 | #include "lldb/API/SBTarget.h" |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 13 | #include "lldb/Core/Module.h" |
Greg Clayton | d9dc52d | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 14 | #include "lldb/Core/Section.h" |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 +0000 | [diff] [blame] | 15 | #include "lldb/Symbol/ObjectFile.h" |
Zachary Turner | 666cc0b | 2017-03-04 01:30:05 +0000 | [diff] [blame] | 16 | #include "lldb/Utility/DataBuffer.h" |
| 17 | #include "lldb/Utility/DataExtractor.h" |
Zachary Turner | bf9a773 | 2017-02-02 21:39:50 +0000 | [diff] [blame] | 18 | #include "lldb/Utility/StreamString.h" |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 19 | |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 20 | using namespace lldb; |
| 21 | using namespace lldb_private; |
| 22 | |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 23 | SBSection::SBSection() : m_opaque_wp() { |
| 24 | LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBSection); |
| 25 | } |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 26 | |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 27 | SBSection::SBSection(const SBSection &rhs) : m_opaque_wp(rhs.m_opaque_wp) { |
| 28 | LLDB_RECORD_CONSTRUCTOR(SBSection, (const lldb::SBSection &), rhs); |
| 29 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 30 | |
| 31 | SBSection::SBSection(const lldb::SectionSP §ion_sp) |
| 32 | : m_opaque_wp() // Don't init with section_sp otherwise this will throw if |
| 33 | // section_sp doesn't contain a valid Section * |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 34 | { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 35 | if (section_sp) |
Greg Clayton | e72dfb3 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 36 | m_opaque_wp = section_sp; |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 39 | const SBSection &SBSection::operator=(const SBSection &rhs) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 40 | LLDB_RECORD_METHOD(const lldb::SBSection &, |
| 41 | SBSection, operator=,(const lldb::SBSection &), rhs); |
| 42 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 43 | m_opaque_wp = rhs.m_opaque_wp; |
Jonas Devlieghere | 306809f | 2019-04-03 21:31:22 +0000 | [diff] [blame] | 44 | return LLDB_RECORD_RESULT(*this); |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 45 | } |
| 46 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 47 | SBSection::~SBSection() {} |
| 48 | |
| 49 | bool SBSection::IsValid() const { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 50 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSection, IsValid); |
Pavel Labath | 7f5237b | 2019-03-11 13:58:46 +0000 | [diff] [blame] | 51 | return this->operator bool(); |
| 52 | } |
| 53 | SBSection::operator bool() const { |
| 54 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSection, operator bool); |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 55 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 56 | SectionSP section_sp(GetSP()); |
Konrad Kleine | 248a130 | 2019-05-23 11:14:47 +0000 | [diff] [blame] | 57 | return section_sp && section_sp->GetModule().get() != nullptr; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | const char *SBSection::GetName() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 61 | LLDB_RECORD_METHOD_NO_ARGS(const char *, SBSection, GetName); |
| 62 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 63 | SectionSP section_sp(GetSP()); |
| 64 | if (section_sp) |
| 65 | return section_sp->GetName().GetCString(); |
Konrad Kleine | 248a130 | 2019-05-23 11:14:47 +0000 | [diff] [blame] | 66 | return nullptr; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | lldb::SBSection SBSection::GetParent() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 70 | LLDB_RECORD_METHOD_NO_ARGS(lldb::SBSection, SBSection, GetParent); |
| 71 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 72 | lldb::SBSection sb_section; |
| 73 | SectionSP section_sp(GetSP()); |
| 74 | if (section_sp) { |
| 75 | SectionSP parent_section_sp(section_sp->GetParent()); |
| 76 | if (parent_section_sp) |
| 77 | sb_section.SetSP(parent_section_sp); |
| 78 | } |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 79 | return LLDB_RECORD_RESULT(sb_section); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | lldb::SBSection SBSection::FindSubSection(const char *sect_name) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 83 | LLDB_RECORD_METHOD(lldb::SBSection, SBSection, FindSubSection, (const char *), |
| 84 | sect_name); |
| 85 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 86 | lldb::SBSection sb_section; |
| 87 | if (sect_name) { |
| 88 | SectionSP section_sp(GetSP()); |
| 89 | if (section_sp) { |
| 90 | ConstString const_sect_name(sect_name); |
| 91 | sb_section.SetSP( |
| 92 | section_sp->GetChildren().FindSectionByName(const_sect_name)); |
Greg Clayton | fed39aa | 2012-06-27 22:22:28 +0000 | [diff] [blame] | 93 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 94 | } |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 95 | return LLDB_RECORD_RESULT(sb_section); |
Greg Clayton | fed39aa | 2012-06-27 22:22:28 +0000 | [diff] [blame] | 96 | } |
| 97 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 98 | size_t SBSection::GetNumSubSections() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 99 | LLDB_RECORD_METHOD_NO_ARGS(size_t, SBSection, GetNumSubSections); |
| 100 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 101 | SectionSP section_sp(GetSP()); |
| 102 | if (section_sp) |
| 103 | return section_sp->GetChildren().GetSize(); |
| 104 | return 0; |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 105 | } |
| 106 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 107 | lldb::SBSection SBSection::GetSubSectionAtIndex(size_t idx) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 108 | LLDB_RECORD_METHOD(lldb::SBSection, SBSection, GetSubSectionAtIndex, (size_t), |
| 109 | idx); |
| 110 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 111 | lldb::SBSection sb_section; |
| 112 | SectionSP section_sp(GetSP()); |
| 113 | if (section_sp) |
| 114 | sb_section.SetSP(section_sp->GetChildren().GetSectionAtIndex(idx)); |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 115 | return LLDB_RECORD_RESULT(sb_section); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | lldb::SectionSP SBSection::GetSP() const { return m_opaque_wp.lock(); } |
| 119 | |
| 120 | void SBSection::SetSP(const lldb::SectionSP §ion_sp) { |
| 121 | m_opaque_wp = section_sp; |
| 122 | } |
| 123 | |
| 124 | lldb::addr_t SBSection::GetFileAddress() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 125 | LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBSection, GetFileAddress); |
| 126 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 127 | lldb::addr_t file_addr = LLDB_INVALID_ADDRESS; |
| 128 | SectionSP section_sp(GetSP()); |
| 129 | if (section_sp) |
| 130 | return section_sp->GetFileAddress(); |
| 131 | return file_addr; |
| 132 | } |
| 133 | |
| 134 | lldb::addr_t SBSection::GetLoadAddress(lldb::SBTarget &sb_target) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 135 | LLDB_RECORD_METHOD(lldb::addr_t, SBSection, GetLoadAddress, |
| 136 | (lldb::SBTarget &), sb_target); |
| 137 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 138 | TargetSP target_sp(sb_target.GetSP()); |
| 139 | if (target_sp) { |
| 140 | SectionSP section_sp(GetSP()); |
Greg Clayton | e72dfb3 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 141 | if (section_sp) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 142 | return section_sp->GetLoadBaseAddress(target_sp.get()); |
| 143 | } |
| 144 | return LLDB_INVALID_ADDRESS; |
| 145 | } |
| 146 | |
| 147 | lldb::addr_t SBSection::GetByteSize() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 148 | LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBSection, GetByteSize); |
| 149 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 150 | SectionSP section_sp(GetSP()); |
| 151 | if (section_sp) |
| 152 | return section_sp->GetByteSize(); |
| 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | uint64_t SBSection::GetFileOffset() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 157 | LLDB_RECORD_METHOD_NO_ARGS(uint64_t, SBSection, GetFileOffset); |
| 158 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 159 | SectionSP section_sp(GetSP()); |
| 160 | if (section_sp) { |
| 161 | ModuleSP module_sp(section_sp->GetModule()); |
| 162 | if (module_sp) { |
| 163 | ObjectFile *objfile = module_sp->GetObjectFile(); |
| 164 | if (objfile) |
| 165 | return objfile->GetFileOffset() + section_sp->GetFileOffset(); |
| 166 | } |
| 167 | } |
| 168 | return UINT64_MAX; |
| 169 | } |
| 170 | |
| 171 | uint64_t SBSection::GetFileByteSize() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 172 | LLDB_RECORD_METHOD_NO_ARGS(uint64_t, SBSection, GetFileByteSize); |
| 173 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 174 | SectionSP section_sp(GetSP()); |
| 175 | if (section_sp) |
| 176 | return section_sp->GetFileSize(); |
| 177 | return 0; |
| 178 | } |
| 179 | |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 180 | SBData SBSection::GetSectionData() { |
| 181 | LLDB_RECORD_METHOD_NO_ARGS(lldb::SBData, SBSection, GetSectionData); |
| 182 | |
| 183 | return LLDB_RECORD_RESULT(GetSectionData(0, UINT64_MAX)); |
| 184 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 185 | |
| 186 | SBData SBSection::GetSectionData(uint64_t offset, uint64_t size) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 187 | LLDB_RECORD_METHOD(lldb::SBData, SBSection, GetSectionData, |
| 188 | (uint64_t, uint64_t), offset, size); |
| 189 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 190 | SBData sb_data; |
| 191 | SectionSP section_sp(GetSP()); |
| 192 | if (section_sp) { |
| 193 | const uint64_t sect_file_size = section_sp->GetFileSize(); |
| 194 | if (sect_file_size > 0) { |
| 195 | ModuleSP module_sp(section_sp->GetModule()); |
| 196 | if (module_sp) { |
| 197 | ObjectFile *objfile = module_sp->GetObjectFile(); |
| 198 | if (objfile) { |
| 199 | const uint64_t sect_file_offset = |
| 200 | objfile->GetFileOffset() + section_sp->GetFileOffset(); |
| 201 | const uint64_t file_offset = sect_file_offset + offset; |
| 202 | uint64_t file_size = size; |
| 203 | if (file_size == UINT64_MAX) { |
| 204 | file_size = section_sp->GetByteSize(); |
| 205 | if (file_size > offset) |
| 206 | file_size -= offset; |
| 207 | else |
| 208 | file_size = 0; |
| 209 | } |
Jonas Devlieghere | 87e403a | 2018-11-12 21:24:50 +0000 | [diff] [blame] | 210 | auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer( |
Zachary Turner | 7f6a7a3 | 2017-03-06 23:42:14 +0000 | [diff] [blame] | 211 | objfile->GetFileSpec().GetPath(), file_size, file_offset); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 212 | if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) { |
| 213 | DataExtractorSP data_extractor_sp( |
| 214 | new DataExtractor(data_buffer_sp, objfile->GetByteOrder(), |
| 215 | objfile->GetAddressByteSize())); |
| 216 | |
| 217 | sb_data.SetOpaque(data_extractor_sp); |
| 218 | } |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 219 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 220 | } |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 221 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 222 | } |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 223 | return LLDB_RECORD_RESULT(sb_data); |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 224 | } |
| 225 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 226 | SectionType SBSection::GetSectionType() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 227 | LLDB_RECORD_METHOD_NO_ARGS(lldb::SectionType, SBSection, GetSectionType); |
| 228 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 229 | SectionSP section_sp(GetSP()); |
| 230 | if (section_sp.get()) |
| 231 | return section_sp->GetType(); |
| 232 | return eSectionTypeInvalid; |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 235 | uint32_t SBSection::GetPermissions() const { |
| 236 | LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBSection, GetPermissions); |
| 237 | |
| 238 | SectionSP section_sp(GetSP()); |
| 239 | if (section_sp) |
| 240 | return section_sp->GetPermissions(); |
| 241 | return 0; |
Abhishek Aggarwal | 3c7f070 | 2016-09-08 12:22:56 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 244 | uint32_t SBSection::GetTargetByteSize() { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 245 | LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBSection, GetTargetByteSize); |
| 246 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 247 | SectionSP section_sp(GetSP()); |
| 248 | if (section_sp.get()) |
| 249 | return section_sp->GetTargetByteSize(); |
| 250 | return 0; |
Greg Clayton | d9dc52d | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 251 | } |
| 252 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 253 | bool SBSection::operator==(const SBSection &rhs) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 254 | LLDB_RECORD_METHOD(bool, SBSection, operator==,(const lldb::SBSection &), |
| 255 | rhs); |
| 256 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 257 | SectionSP lhs_section_sp(GetSP()); |
| 258 | SectionSP rhs_section_sp(rhs.GetSP()); |
| 259 | if (lhs_section_sp && rhs_section_sp) |
| 260 | return lhs_section_sp == rhs_section_sp; |
| 261 | return false; |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 262 | } |
| 263 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 264 | bool SBSection::operator!=(const SBSection &rhs) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 265 | LLDB_RECORD_METHOD(bool, SBSection, operator!=,(const lldb::SBSection &), |
| 266 | rhs); |
| 267 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 268 | SectionSP lhs_section_sp(GetSP()); |
| 269 | SectionSP rhs_section_sp(rhs.GetSP()); |
| 270 | return lhs_section_sp != rhs_section_sp; |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 271 | } |
| 272 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 273 | bool SBSection::GetDescription(SBStream &description) { |
Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 274 | LLDB_RECORD_METHOD(bool, SBSection, GetDescription, (lldb::SBStream &), |
| 275 | description); |
| 276 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 277 | Stream &strm = description.ref(); |
| 278 | |
| 279 | SectionSP section_sp(GetSP()); |
| 280 | if (section_sp) { |
| 281 | const addr_t file_addr = section_sp->GetFileAddress(); |
| 282 | strm.Printf("[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") ", file_addr, |
| 283 | file_addr + section_sp->GetByteSize()); |
| 284 | section_sp->DumpName(&strm); |
| 285 | } else { |
| 286 | strm.PutCString("No value"); |
| 287 | } |
| 288 | |
| 289 | return true; |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 290 | } |
Michal Gorny | ae211ec | 2019-03-19 17:13:13 +0000 | [diff] [blame] | 291 | |
| 292 | namespace lldb_private { |
| 293 | namespace repro { |
| 294 | |
| 295 | template <> |
| 296 | void RegisterMethods<SBSection>(Registry &R) { |
| 297 | LLDB_REGISTER_CONSTRUCTOR(SBSection, ()); |
| 298 | LLDB_REGISTER_CONSTRUCTOR(SBSection, (const lldb::SBSection &)); |
| 299 | LLDB_REGISTER_METHOD(const lldb::SBSection &, |
| 300 | SBSection, operator=,(const lldb::SBSection &)); |
| 301 | LLDB_REGISTER_METHOD_CONST(bool, SBSection, IsValid, ()); |
| 302 | LLDB_REGISTER_METHOD_CONST(bool, SBSection, operator bool, ()); |
| 303 | LLDB_REGISTER_METHOD(const char *, SBSection, GetName, ()); |
| 304 | LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, GetParent, ()); |
| 305 | LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, FindSubSection, |
| 306 | (const char *)); |
| 307 | LLDB_REGISTER_METHOD(size_t, SBSection, GetNumSubSections, ()); |
| 308 | LLDB_REGISTER_METHOD(lldb::SBSection, SBSection, GetSubSectionAtIndex, |
| 309 | (size_t)); |
| 310 | LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetFileAddress, ()); |
| 311 | LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetLoadAddress, |
| 312 | (lldb::SBTarget &)); |
| 313 | LLDB_REGISTER_METHOD(lldb::addr_t, SBSection, GetByteSize, ()); |
| 314 | LLDB_REGISTER_METHOD(uint64_t, SBSection, GetFileOffset, ()); |
| 315 | LLDB_REGISTER_METHOD(uint64_t, SBSection, GetFileByteSize, ()); |
| 316 | LLDB_REGISTER_METHOD(lldb::SBData, SBSection, GetSectionData, ()); |
| 317 | LLDB_REGISTER_METHOD(lldb::SBData, SBSection, GetSectionData, |
| 318 | (uint64_t, uint64_t)); |
| 319 | LLDB_REGISTER_METHOD(lldb::SectionType, SBSection, GetSectionType, ()); |
| 320 | LLDB_REGISTER_METHOD_CONST(uint32_t, SBSection, GetPermissions, ()); |
| 321 | LLDB_REGISTER_METHOD(uint32_t, SBSection, GetTargetByteSize, ()); |
| 322 | LLDB_REGISTER_METHOD(bool, SBSection, operator==,(const lldb::SBSection &)); |
| 323 | LLDB_REGISTER_METHOD(bool, SBSection, operator!=,(const lldb::SBSection &)); |
| 324 | LLDB_REGISTER_METHOD(bool, SBSection, GetDescription, (lldb::SBStream &)); |
| 325 | } |
| 326 | |
| 327 | } |
| 328 | } |