GTIRB  v2.3.2
GrammaTech Intermediate Representation for Binaries: C++ API
Module.hpp
Go to the documentation of this file.
1 //===- Module.hpp -----------------------------------------------*- C++ -*-===//
2 //
3 // Copyright (C) 2021 GrammaTech, Inc.
4 //
5 // This code is licensed under the MIT license. See the LICENSE file in the
6 // project root for license terms.
7 //
8 // This project is sponsored by the Office of Naval Research, One Liberty
9 // Center, 875 N. Randolph Street, Arlington, VA 22203 under contract #
10 // N68335-17-C-0700. The content of the information does not necessarily
11 // reflect the position or policy of the Government and no official
12 // endorsement should be inferred.
13 //
14 //===----------------------------------------------------------------------===//
15 #ifndef GTIRB_MODULE_H
16 #define GTIRB_MODULE_H
17 
18 #include <gtirb/Addr.hpp>
20 #include <gtirb/DataBlock.hpp>
21 #include <gtirb/Export.hpp>
22 #include <gtirb/Node.hpp>
23 #include <gtirb/Observer.hpp>
24 #include <gtirb/Section.hpp>
25 #include <gtirb/Symbol.hpp>
27 #include <gtirb/Utility.hpp>
28 #include <gtirb/proto/Module.pb.h>
29 #include <algorithm>
30 #include <boost/icl/interval_map.hpp>
31 #include <boost/iterator/indirect_iterator.hpp>
32 #include <boost/iterator/iterator_traits.hpp>
33 #include <boost/iterator/transform_iterator.hpp>
34 #include <boost/multi_index/hashed_index.hpp>
35 #include <boost/multi_index/key_extractors.hpp>
36 #include <boost/multi_index/mem_fun.hpp>
37 #include <boost/multi_index/ordered_index.hpp>
38 #include <boost/multi_index_container.hpp>
39 #include <boost/range/iterator_range.hpp>
40 #include <cstdint>
41 #include <functional>
42 #include <optional>
43 #include <string>
44 
47 
48 namespace gtirb {
49 class ByteInterval;
50 class IR;
51 class ModuleObserver;
52 
53 template <class T> class ErrorOr;
54 
58 enum class FileFormat : uint8_t {
59  Undefined = proto::Format_Undefined,
60  COFF = proto::COFF,
62  ELF = proto::ELF,
63  PE = proto::PE,
65  IdaProDb32 = proto::IdaProDb32,
66  IdaProDb64 = proto::IdaProDb64,
67  XCOFF = proto::XCOFF,
68  MACHO = proto::MACHO,
69  RAW = proto::RAW
70 };
71 
75 enum class ISA : uint8_t {
76  Undefined = proto::ISA_Undefined,
77  IA32 = proto::IA32,
79  PPC32 = proto::PPC32,
80  X64 = proto::X64,
82  ARM = proto::ARM,
85  ValidButUnsupported = proto::ValidButUnsupported,
87  PPC64 = proto::PPC64,
88  ARM64 = proto::ARM64,
90  MIPS32 = proto::MIPS32,
92  MIPS64 = proto::MIPS64,
94  RISCV32 = proto::RISCV32,
96  RISCV64 = proto::RISCV64
97 };
98 
99 enum class ByteOrder : uint8_t {
100  Undefined = proto::ByteOrder_Undefined,
101  Big = proto::BigEndian,
103  Little = proto::LittleEndian,
104 };
105 
110  struct by_address {};
111  struct by_name {};
112  struct by_pointer {};
113  struct by_referent {};
114 
115  // Helper function for extracting the referent of a Symbol.
116  static const Node* get_symbol_referent(const Symbol& S) {
117  if (std::optional<const Node*> Res =
118  S.visit([](const Node* N) { return N; })) {
119  return *Res;
120  }
121  return nullptr;
122  }
123 
124  using ProxyBlockSet = std::unordered_set<ProxyBlock*>;
125 
126  using SectionSet = boost::multi_index::multi_index_container<
127  Section*, boost::multi_index::indexed_by<
128  boost::multi_index::ordered_non_unique<
129  boost::multi_index::tag<by_address>,
130  boost::multi_index::identity<Section*>, AddressLess>,
131  boost::multi_index::ordered_non_unique<
132  boost::multi_index::tag<by_name>,
133  boost::multi_index::const_mem_fun<
134  Section, const std::string&, &Section::getName>>,
135  boost::multi_index::hashed_unique<
136  boost::multi_index::tag<by_pointer>,
137  boost::multi_index::identity<Section*>>>>;
138  using SectionIntMap =
139  boost::icl::interval_map<Addr, std::set<Section*, AddressLess>>;
140 
141  using SymbolSet = boost::multi_index::multi_index_container<
142  Symbol*,
143  boost::multi_index::indexed_by<
144  boost::multi_index::ordered_non_unique<
145  boost::multi_index::tag<by_address>,
146  boost::multi_index::const_mem_fun<Symbol, std::optional<Addr>,
148  boost::multi_index::ordered_non_unique<
149  boost::multi_index::tag<by_name>,
150  boost::multi_index::const_mem_fun<Symbol, const std::string&,
151  &Symbol::getName>>,
152  boost::multi_index::hashed_unique<
153  boost::multi_index::tag<by_pointer>,
154  boost::multi_index::identity<Symbol*>>,
155  boost::multi_index::hashed_non_unique<
156  boost::multi_index::tag<by_referent>,
157  boost::multi_index::global_fun<const Symbol&, const Node*,
158  &get_symbol_referent>>>>;
159 
160  class SectionObserverImpl;
161  class SymbolObserverImpl;
162 
163  Module(Context& C, const std::string& N);
164  Module(Context& C, const std::string& N, const UUID& U);
165 
166  static Module* Create(Context& C, const std::string& N, const UUID& U) {
167  return C.Create<Module>(C, N, U);
168  }
169 
170 public:
177  static Module* Create(Context& C, const std::string& Name) {
178  return C.Create<Module>(C, Name);
179  }
180 
182  const IR* getIR() const { return Parent; }
184  IR* getIR() { return Parent; }
185 
192  void setBinaryPath(const std::string& X) { BinaryPath = X; }
193 
197  const std::string& getBinaryPath() const { return BinaryPath; }
198 
204 
209  gtirb::FileFormat getFileFormat() const { return this->FileFormat; }
210 
218  void setRebaseDelta(int64_t X) { RebaseDelta = X; }
219 
225  int64_t getRebaseDelta() const { return RebaseDelta; }
226 
233  void setPreferredAddr(gtirb::Addr X) { PreferredAddr = X; }
234 
239  gtirb::Addr getPreferredAddr() const { return PreferredAddr; }
240 
249  bool isRelocated() const { return RebaseDelta != 0; }
250 
254  void setISA(gtirb::ISA X) { Isa = X; }
255 
259  gtirb::ISA getISA() const { return Isa; }
260 
265 
270 
272  const CodeBlock* getEntryPoint() const { return EntryPoint; }
274  CodeBlock* getEntryPoint() { return EntryPoint; }
275 
279  void setEntryPoint(CodeBlock* CB) { EntryPoint = CB; }
280 
283 
285  using proxy_block_iterator =
286  boost::indirect_iterator<ProxyBlockSet::iterator>;
288  using proxy_block_range = boost::iterator_range<proxy_block_iterator>;
291  boost::indirect_iterator<ProxyBlockSet::const_iterator, const ProxyBlock>;
294  boost::iterator_range<const_proxy_block_iterator>;
295 
298  return proxy_block_iterator(ProxyBlocks.begin());
299  }
302  return const_proxy_block_iterator(ProxyBlocks.begin());
303  }
306  return proxy_block_iterator(ProxyBlocks.end());
307  }
311  return const_proxy_block_iterator(ProxyBlocks.end());
312  }
315  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
316  }
319  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
320  }
321 
330  ChangeStatus removeProxyBlock(ProxyBlock* B);
331 
339  ChangeStatus addProxyBlock(ProxyBlock* PB);
340 
348  template <typename... Args>
349  ProxyBlock* addProxyBlock(Context& C, Args&&... A) {
350  ProxyBlock* PB = ProxyBlock::Create(C, std::forward<Args>(A)...);
351  [[maybe_unused]] ChangeStatus status = addProxyBlock(PB);
352  // addProxyBlock(ProxyBlock*) does not currently reject any changes and,
353  // because we just created the ProxyBlock to add, it cannot result in
354  // NoChange.
355  assert(status == ChangeStatus::Accepted &&
356  "unexpected result when inserting ProxyBlock");
357  return PB;
358  }
359 
361  // (end of ProxyBlock-Related Public Types and Functions)
362 
365 
369  using symbol_iterator =
370  boost::indirect_iterator<SymbolSet::index<by_pointer>::type::iterator>;
374  using symbol_range = boost::iterator_range<symbol_iterator>;
378  using const_symbol_iterator = boost::indirect_iterator<
379  SymbolSet::index<by_pointer>::type::const_iterator, const Symbol>;
383  using const_symbol_range = boost::iterator_range<const_symbol_iterator>;
384 
389  using symbol_name_iterator =
390  boost::indirect_iterator<SymbolSet::index<by_name>::type::iterator>;
395  using symbol_name_range = boost::iterator_range<symbol_name_iterator>;
401  boost::indirect_iterator<SymbolSet::index<by_name>::type::const_iterator,
402  const Symbol>;
408  boost::iterator_range<const_symbol_name_iterator>;
409 
414  using symbol_addr_iterator =
415  boost::indirect_iterator<SymbolSet::index<by_address>::type::iterator>;
420  using symbol_addr_range = boost::iterator_range<symbol_addr_iterator>;
425  using const_symbol_addr_iterator = boost::indirect_iterator<
426  SymbolSet::index<by_address>::type::const_iterator, const Symbol>;
432  boost::iterator_range<const_symbol_addr_iterator>;
433 
437  using symbol_ref_iterator =
438  boost::indirect_iterator<SymbolSet::index<by_referent>::type::iterator>;
442  using symbol_ref_range = boost::iterator_range<symbol_ref_iterator>;
446  using const_symbol_ref_iterator = boost::indirect_iterator<
447  SymbolSet::index<by_referent>::type::const_iterator, const Symbol>;
451  using const_symbol_ref_range =
452  boost::iterator_range<const_symbol_ref_iterator>;
453 
456  return symbol_iterator(Symbols.get<by_pointer>().begin());
457  }
460  return const_symbol_iterator(Symbols.get<by_pointer>().begin());
461  }
464  return symbol_iterator(Symbols.get<by_pointer>().end());
465  }
469  return const_symbol_iterator(Symbols.get<by_pointer>().end());
470  }
473  return boost::make_iterator_range(symbols_begin(), symbols_end());
474  }
477  return boost::make_iterator_range(symbols_begin(), symbols_end());
478  }
479 
482  return symbol_name_iterator(Symbols.get<by_name>().begin());
483  }
486  return const_symbol_name_iterator(Symbols.get<by_name>().begin());
487  }
491  return symbol_name_iterator(Symbols.get<by_name>().end());
492  }
496  return const_symbol_name_iterator(Symbols.get<by_name>().end());
497  }
500  return boost::make_iterator_range(symbols_by_name_begin(),
501  symbols_by_name_end());
502  }
506  return boost::make_iterator_range(symbols_by_name_begin(),
507  symbols_by_name_end());
508  }
509 
512  return symbol_addr_iterator(Symbols.get<by_address>().begin());
513  }
516  return const_symbol_addr_iterator(Symbols.get<by_address>().begin());
517  }
521  return symbol_addr_iterator(Symbols.get<by_address>().end());
522  }
526  return const_symbol_addr_iterator(Symbols.get<by_address>().end());
527  }
530  return boost::make_iterator_range(symbols_by_addr_begin(),
531  symbols_by_addr_end());
532  }
536  return boost::make_iterator_range(symbols_by_addr_begin(),
537  symbols_by_addr_end());
538  }
539 
547  bool removeSymbol(Symbol* S) {
548  auto& Index = Symbols.get<by_pointer>();
549  if (auto Iter = Index.find(S); Iter != Index.end()) {
550  Index.erase(Iter);
551  S->setParent(nullptr, nullptr);
552  return true;
553  }
554  return false;
555  }
556 
561  if (S->getModule()) {
562  S->getModule()->removeSymbol(S);
563  }
564  Symbols.emplace(S);
565  S->setParent(this, SymObs.get());
566  return S;
567  }
568 
574  template <typename... Args> Symbol* addSymbol(Context& C, Args... A) {
575  return addSymbol(Symbol::Create(C, A...));
576  }
577 
584  symbol_name_range findSymbols(const std::string& N) {
585  auto Found = Symbols.get<by_name>().equal_range(N);
586  return boost::make_iterator_range(Found.first, Found.second);
587  }
588 
595  const_symbol_name_range findSymbols(const std::string& N) const {
596  auto Found = Symbols.get<by_name>().equal_range(N);
597  return boost::make_iterator_range(Found.first, Found.second);
598  }
599 
607  auto Found = Symbols.get<by_address>().equal_range(X);
608  return boost::make_iterator_range(Found.first, Found.second);
609  }
610 
618  auto Found = Symbols.get<by_address>().equal_range(X);
619  return boost::make_iterator_range(Found.first, Found.second);
620  }
621 
630  auto& Index = Symbols.get<by_address>();
631  return boost::make_iterator_range(Index.lower_bound(Lower),
632  Index.lower_bound(Upper));
633  }
634 
643  auto& Index = Symbols.get<by_address>();
644  return boost::make_iterator_range(Index.lower_bound(Lower),
645  Index.lower_bound(Upper));
646  }
647 
654  symbol_ref_range findSymbols(const Node& Referent) {
655  return Symbols.get<by_referent>().equal_range(&Referent);
656  }
657 
664  const_symbol_ref_range findSymbols(const Node& Referent) const {
665  return Symbols.get<by_referent>().equal_range(&Referent);
666  }
667 
669  // (end group of symbol-related type aliases and functions)
670 
674  const std::string& getName() const { return Name; }
675 
677  void setName(const std::string& X);
678 
681 
683  using section_iterator = boost::indirect_iterator<SectionSet::iterator>;
685  using section_range = boost::iterator_range<section_iterator>;
687  using section_subrange = boost::iterator_range<
688  boost::indirect_iterator<SectionIntMap::codomain_type::iterator>>;
693  using section_name_iterator =
694  boost::indirect_iterator<SectionSet::index<by_name>::type::iterator>;
699  using section_name_range = boost::iterator_range<section_name_iterator>;
705  using const_section_iterator =
706  boost::indirect_iterator<SectionSet::const_iterator, const Section&>;
712  using const_section_range = boost::iterator_range<const_section_iterator>;
714  using const_section_subrange = boost::iterator_range<boost::indirect_iterator<
715  SectionIntMap::codomain_type::const_iterator, const Section&>>;
721  boost::indirect_iterator<SectionSet::index<by_name>::type::const_iterator,
722  const Section&>;
728  boost::iterator_range<const_section_name_iterator>;
729 
731  section_iterator sections_begin() { return Sections.begin(); }
733  const_section_iterator sections_begin() const { return Sections.begin(); }
736  return Sections.get<by_name>().begin();
737  }
740  return Sections.get<by_name>().begin();
741  }
743  section_iterator sections_end() { return Sections.end(); }
746  const_section_iterator sections_end() const { return Sections.end(); }
749  return Sections.get<by_name>().end();
750  }
754  return Sections.get<by_name>().end();
755  }
758  return boost::make_iterator_range(sections_begin(), sections_end());
759  }
762  return boost::make_iterator_range(sections_begin(), sections_end());
763  }
764 
773  ChangeStatus removeSection(Section* S);
774 
781  // Section (\c NoChange), or could not be completed (\c Rejected).
782  ChangeStatus addSection(Section* S);
783 
791  template <typename... Args> Section* addSection(Context& C, Args&&... A) {
792  Section* S = Section::Create(C, std::forward<Args>(A)...);
793  [[maybe_unused]] ChangeStatus status = addSection(S);
794  // addSection(Section*) does not currently reject any changes and, because
795  // we just created the Section to add, it cannot result in NoChange.
796  assert(status == ChangeStatus::Accepted &&
797  "unexpected result when inserting Section");
798  return S;
799  }
800 
807  if (auto It = SectionAddrs.find(X); It != SectionAddrs.end()) {
808  return boost::make_iterator_range(It->second.begin(), It->second.end());
809  }
810  return {};
811  }
812 
819  if (auto It = SectionAddrs.find(X); It != SectionAddrs.end()) {
820  return boost::make_iterator_range(It->second.begin(), It->second.end());
821  }
822  return {};
823  }
824 
831  auto Pair = Sections.get<by_address>().equal_range(A);
832  return boost::make_iterator_range(section_iterator(Pair.first),
833  section_iterator(Pair.second));
834  }
835 
843  auto& Index = Sections.get<by_address>();
844  return boost::make_iterator_range(
845  section_iterator(Index.lower_bound(Low)),
846  section_iterator(Index.lower_bound(High)));
847  }
848 
855  auto Pair = Sections.get<by_address>().equal_range(A);
856  return boost::make_iterator_range(const_section_iterator(Pair.first),
857  const_section_iterator(Pair.second));
858  }
859 
867  auto& Index = Sections.get<by_address>();
868  return boost::make_iterator_range(
869  const_section_iterator(Index.lower_bound(Low)),
870  const_section_iterator(Index.lower_bound(High)));
871  }
872 
878 
879  section_name_range findSections(const std::string& X) {
880  auto Pair = Sections.get<by_name>().equal_range(X);
881  return boost::make_iterator_range(section_name_iterator(Pair.first),
882  section_name_iterator(Pair.second));
883  }
884 
890  const_section_name_range findSections(const std::string& X) const {
891  auto Pair = Sections.get<by_name>().equal_range(X);
892  return boost::make_iterator_range(const_section_name_iterator(Pair.first),
893  const_section_name_iterator(Pair.second));
894  }
895 
897  // (end group of Section-related types and functions)
898 
901 
903  using byte_interval_iterator =
904  MergeSortedIterator<Section::byte_interval_iterator, AddressLess>;
906  using byte_interval_range = boost::iterator_range<byte_interval_iterator>;
908  using byte_interval_subrange = boost::iterator_range<MergeSortedIterator<
909  Section::byte_interval_subrange::iterator, AddressLess>>;
912  MergeSortedIterator<Section::const_byte_interval_iterator, AddressLess>;
915  boost::iterator_range<const_byte_interval_iterator>;
918  boost::iterator_range<MergeSortedIterator<
919  Section::const_byte_interval_subrange::iterator, AddressLess>>;
920 
923  return byte_interval_iterator(
924  boost::make_transform_iterator(this->sections_begin(),
925  NodeToByteIntervalRange<Section>()),
926  boost::make_transform_iterator(this->sections_end(),
927  NodeToByteIntervalRange<Section>()));
928  }
929 
933  return byte_interval_iterator();
934  }
935 
938  return boost::make_iterator_range(byte_intervals_begin(),
939  byte_intervals_end());
940  }
941 
945  boost::make_transform_iterator(
946  this->sections_begin(), NodeToByteIntervalRange<const Section>()),
947  boost::make_transform_iterator(
948  this->sections_end(), NodeToByteIntervalRange<const Section>()));
949  }
950 
955  }
956 
959  return boost::make_iterator_range(byte_intervals_begin(),
960  byte_intervals_end());
961  }
962 
970  section_subrange Range = findSectionsOn(A);
971  return byte_interval_subrange(
972  byte_interval_subrange::iterator(
973  boost::make_transform_iterator(Range.begin(),
974  FindByteIntervalsIn<Section>(A)),
975  boost::make_transform_iterator(Range.end(),
976  FindByteIntervalsIn<Section>(A))),
977  byte_interval_subrange::iterator());
978  }
979 
987  const_section_subrange Range = findSectionsOn(A);
989  const_byte_interval_subrange::iterator(
990  boost::make_transform_iterator(
991  Range.begin(), FindByteIntervalsIn<const Section>(A)),
992  boost::make_transform_iterator(
993  Range.end(), FindByteIntervalsIn<const Section>(A))),
994  const_byte_interval_subrange::iterator());
995  }
996 
1003  section_subrange Range = findSectionsOn(A);
1004  return byte_interval_range(
1005  byte_interval_range::iterator(
1006  boost::make_transform_iterator(Range.begin(),
1007  FindByteIntervalsAt<Section>(A)),
1008  boost::make_transform_iterator(Range.end(),
1009  FindByteIntervalsAt<Section>(A))),
1010  byte_interval_range::iterator());
1011  }
1012 
1021  std::vector<Section::byte_interval_range> Ranges;
1022  for (Section& S : findSectionsOn(Low))
1023  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1024  for (Section& S : findSectionsAt(Low + 1, High))
1025  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1028  }
1029 
1036  const_section_subrange Range = findSectionsOn(A);
1038  const_byte_interval_range::iterator(
1039  boost::make_transform_iterator(
1040  Range.begin(), FindByteIntervalsAt<const Section>(A)),
1041  boost::make_transform_iterator(
1042  Range.end(), FindByteIntervalsAt<const Section>(A))),
1043  const_byte_interval_range::iterator());
1044  }
1045 
1054  std::vector<Section::const_byte_interval_range> Ranges;
1055  for (const Section& S : findSectionsOn(Low))
1056  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1057  for (const Section& S : findSectionsAt(Low + 1, High))
1058  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1061  }
1063  // (end group of ByteInterval-related types and functions)
1064 
1067 
1072  using block_iterator =
1073  MergeSortedIterator<Section::block_iterator, BlockAddressLess>;
1078  using block_range = boost::iterator_range<block_iterator>;
1083  using block_subrange = boost::iterator_range<
1084  MergeSortedIterator<Section::block_subrange::iterator, BlockAddressLess>>;
1089  using const_block_iterator =
1090  MergeSortedIterator<Section::const_block_iterator, BlockAddressLess>;
1095  using const_block_range = boost::iterator_range<const_block_iterator>;
1099  using const_block_subrange = boost::iterator_range<MergeSortedIterator<
1100  Section::const_block_subrange::iterator, BlockAddressLess>>;
1101 
1104  return block_iterator(
1105  boost::make_transform_iterator(this->sections_begin(),
1106  NodeToBlockRange<Section>()),
1107  boost::make_transform_iterator(this->sections_end(),
1108  NodeToBlockRange<Section>()));
1109  }
1110 
1113 
1116  return boost::make_iterator_range(blocks_begin(), blocks_end());
1117  }
1118 
1121  return const_block_iterator(
1122  boost::make_transform_iterator(this->sections_begin(),
1123  NodeToBlockRange<const Section>()),
1124  boost::make_transform_iterator(this->sections_end(),
1125  NodeToBlockRange<const Section>()));
1126  }
1127 
1130 
1133  return boost::make_iterator_range(blocks_begin(), blocks_end());
1134  }
1135 
1144  section_subrange SectionRange = findSectionsOn(A);
1145  return block_subrange(
1146  block_subrange::iterator(
1147  boost::make_transform_iterator(SectionRange.begin(),
1148  FindBlocksIn<Section>(A)),
1149  boost::make_transform_iterator(SectionRange.end(),
1150  FindBlocksIn<Section>(A))),
1151  block_subrange::iterator());
1152  }
1153 
1162  const_section_subrange SectionRange = findSectionsOn(A);
1163  return const_block_subrange(
1164  const_block_subrange::iterator(
1165  boost::make_transform_iterator(SectionRange.begin(),
1166  FindBlocksIn<const Section>(A)),
1167  boost::make_transform_iterator(SectionRange.end(),
1168  FindBlocksIn<const Section>(A))),
1169  const_block_subrange::iterator());
1170  }
1171 
1179  section_subrange SectionRange = findSectionsOn(A);
1180  return block_range(block_range::iterator(
1181  boost::make_transform_iterator(
1182  SectionRange.begin(), FindBlocksAt<Section>(A)),
1183  boost::make_transform_iterator(
1184  SectionRange.end(), FindBlocksAt<Section>(A))),
1185  block_range::iterator());
1186  }
1187 
1196  std::vector<Section::block_range> Ranges;
1197  for (Section& S : findSectionsOn(Low))
1198  Ranges.push_back(S.findBlocksAt(Low, High));
1199  for (Section& S : findSectionsAt(Low + 1, High))
1200  Ranges.push_back(S.findBlocksAt(Low, High));
1201  return block_range(block_iterator(Ranges), block_iterator());
1202  }
1203 
1211  const_section_subrange SectionRange = findSectionsOn(A);
1212  return const_block_range(
1213  const_block_range::iterator(
1214  boost::make_transform_iterator(SectionRange.begin(),
1215  FindBlocksAt<const Section>(A)),
1216  boost::make_transform_iterator(SectionRange.end(),
1217  FindBlocksAt<const Section>(A))),
1218  const_block_range::iterator());
1219  }
1220 
1229  std::vector<Section::const_block_range> Ranges;
1230  for (const Section& S : findSectionsOn(Low))
1231  Ranges.push_back(S.findBlocksAt(Low, High));
1232  for (const Section& S : findSectionsAt(Low + 1, High))
1233  Ranges.push_back(S.findBlocksAt(Low, High));
1234  return const_block_range(const_block_iterator(Ranges),
1236  }
1238  // (end group of Block-related types and functions)
1239 
1242 
1247  using code_block_iterator =
1248  MergeSortedIterator<Section::code_block_iterator, AddressLess>;
1253  using code_block_range = boost::iterator_range<code_block_iterator>;
1259  using code_block_subrange = boost::iterator_range<
1260  MergeSortedIterator<Section::code_block_subrange::iterator, AddressLess>>;
1266  MergeSortedIterator<Section::const_code_block_iterator, AddressLess>;
1271  using const_code_block_range =
1272  boost::iterator_range<const_code_block_iterator>;
1278  using const_code_block_subrange = boost::iterator_range<MergeSortedIterator<
1279  Section::const_code_block_subrange::iterator, AddressLess>>;
1280 
1281 private:
1282  code_block_range makeCodeBlockRange(SectionSet::iterator Begin,
1283  SectionSet::iterator End) {
1284  NodeToCodeBlockRange<Section> Transformer;
1285  return boost::make_iterator_range(
1287  boost::make_transform_iterator(section_iterator(Begin),
1288  Transformer),
1289  boost::make_transform_iterator(section_iterator(End), Transformer)),
1291  }
1292 
1293 public:
1296  return code_block_iterator(
1297  boost::make_transform_iterator(this->sections_begin(),
1298  NodeToCodeBlockRange<Section>()),
1299  boost::make_transform_iterator(this->sections_end(),
1300  NodeToCodeBlockRange<Section>()));
1301  }
1302 
1306 
1309  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1310  }
1311 
1315  boost::make_transform_iterator(this->sections_begin(),
1316  NodeToCodeBlockRange<const Section>()),
1317  boost::make_transform_iterator(this->sections_end(),
1318  NodeToCodeBlockRange<const Section>()));
1319  }
1320 
1324  return const_code_block_iterator();
1325  }
1326 
1329  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1330  }
1331 
1339  section_subrange Range = findSectionsOn(A);
1340  return code_block_subrange(
1341  code_block_subrange::iterator(
1342  boost::make_transform_iterator(Range.begin(),
1343  FindCodeBlocksIn<Section>(A)),
1344  boost::make_transform_iterator(Range.end(),
1345  FindCodeBlocksIn<Section>(A))),
1346  code_block_subrange::iterator());
1347  }
1348 
1356  const_section_subrange Range = findSectionsOn(A);
1358  const_code_block_subrange::iterator(
1359  boost::make_transform_iterator(Range.begin(),
1360  FindCodeBlocksIn<const Section>(A)),
1361  boost::make_transform_iterator(Range.end(),
1362  FindCodeBlocksIn<const Section>(A))),
1363  const_code_block_subrange::iterator());
1364  }
1365 
1372  section_subrange Range = findSectionsOn(A);
1373  return code_block_range(
1374  code_block_range::iterator(
1375  boost::make_transform_iterator(Range.begin(),
1376  FindCodeBlocksAt<Section>(A)),
1377  boost::make_transform_iterator(Range.end(),
1378  FindCodeBlocksAt<Section>(A))),
1379  code_block_range::iterator());
1380  }
1381 
1389  std::vector<Section::code_block_range> Ranges;
1390  for (Section& S : findSectionsOn(Low))
1391  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1392  for (Section& S : findSectionsAt(Low + 1, High))
1393  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1395  }
1396 
1403  const_section_subrange Range = findSectionsOn(A);
1404  return const_code_block_range(
1405  const_code_block_range::iterator(
1406  boost::make_transform_iterator(Range.begin(),
1407  FindCodeBlocksAt<const Section>(A)),
1408  boost::make_transform_iterator(Range.end(),
1409  FindCodeBlocksAt<const Section>(A))),
1410  const_code_block_range::iterator());
1411  }
1412 
1420  std::vector<Section::const_code_block_range> Ranges;
1421  for (const Section& S : findSectionsOn(Low))
1422  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1423  for (const Section& S : findSectionsAt(Low + 1, High))
1424  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1427  }
1429  // (end group of CodeBlock-related types and functions)
1430 
1433 
1438  using data_block_iterator =
1439  MergeSortedIterator<Section::data_block_iterator, AddressLess>;
1444  using data_block_range = boost::iterator_range<data_block_iterator>;
1450  using data_block_subrange = boost::iterator_range<
1451  MergeSortedIterator<Section::data_block_subrange::iterator, AddressLess>>;
1457  MergeSortedIterator<Section::const_data_block_iterator, AddressLess>;
1462  using const_data_block_range =
1463  boost::iterator_range<const_data_block_iterator>;
1469  using const_data_block_subrange = boost::iterator_range<MergeSortedIterator<
1470  Section::const_data_block_subrange::iterator, AddressLess>>;
1471 
1474  return data_block_iterator(
1475  boost::make_transform_iterator(this->sections_begin(),
1476  NodeToDataBlockRange<Section>()),
1477  boost::make_transform_iterator(this->sections_end(),
1478  NodeToDataBlockRange<Section>()));
1479  }
1480 
1484 
1487  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1488  }
1489 
1493  boost::make_transform_iterator(this->sections_begin(),
1494  NodeToDataBlockRange<const Section>()),
1495  boost::make_transform_iterator(this->sections_end(),
1496  NodeToDataBlockRange<const Section>()));
1497  }
1498 
1502  return const_data_block_iterator();
1503  }
1504 
1507  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1508  }
1509 
1517  section_subrange Range = findSectionsOn(A);
1518  return data_block_subrange(
1519  data_block_subrange::iterator(
1520  boost::make_transform_iterator(Range.begin(),
1521  FindDataBlocksIn<Section>(A)),
1522  boost::make_transform_iterator(Range.end(),
1523  FindDataBlocksIn<Section>(A))),
1524  data_block_subrange::iterator());
1525  }
1526 
1534  const_section_subrange Range = findSectionsOn(A);
1536  const_data_block_subrange::iterator(
1537  boost::make_transform_iterator(Range.begin(),
1538  FindDataBlocksIn<const Section>(A)),
1539  boost::make_transform_iterator(Range.end(),
1540  FindDataBlocksIn<const Section>(A))),
1541  const_data_block_subrange::iterator());
1542  }
1543 
1550  section_subrange Range = findSectionsOn(A);
1551  return data_block_range(
1552  data_block_range::iterator(
1553  boost::make_transform_iterator(Range.begin(),
1554  FindDataBlocksAt<Section>(A)),
1555  boost::make_transform_iterator(Range.end(),
1556  FindDataBlocksAt<Section>(A))),
1557  data_block_range::iterator());
1558  }
1559 
1567  std::vector<Section::data_block_range> Ranges;
1568  for (Section& S : findSectionsOn(Low))
1569  Ranges.push_back(S.findDataBlocksAt(Low, High));
1570  for (Section& S : findSectionsAt(Low + 1, High))
1571  Ranges.push_back(S.findDataBlocksAt(Low, High));
1573  }
1574 
1581  const_section_subrange Range = findSectionsOn(A);
1582  return const_data_block_range(
1583  const_data_block_range::iterator(
1584  boost::make_transform_iterator(Range.begin(),
1585  FindDataBlocksAt<const Section>(A)),
1586  boost::make_transform_iterator(Range.end(),
1587  FindDataBlocksAt<const Section>(A))),
1588  const_data_block_range::iterator());
1589  }
1590 
1598  std::vector<Section::const_data_block_range> Ranges;
1599  for (const Section& S : findSectionsOn(Low))
1600  Ranges.push_back(S.findDataBlocksAt(Low, High));
1601  for (const Section& S : findSectionsAt(Low + 1, High))
1602  Ranges.push_back(S.findDataBlocksAt(Low, High));
1605  }
1607  // (end group of DataBlock-related types and functions)
1608 
1611 
1615  using symbolic_expression_iterator =
1616  MergeSortedIterator<Section::symbolic_expression_iterator,
1622  boost::iterator_range<symbolic_expression_iterator>;
1626  using const_symbolic_expression_iterator = MergeSortedIterator<
1633  boost::iterator_range<const_symbolic_expression_iterator>;
1634 
1638  boost::make_transform_iterator(
1639  this->sections_begin(), NodeToSymbolicExpressionRange<Section>()),
1640  boost::make_transform_iterator(
1641  this->sections_end(), NodeToSymbolicExpressionRange<Section>()));
1642  }
1643 
1648  }
1649 
1652  return boost::make_iterator_range(symbolic_expressions_begin(),
1653  symbolic_expressions_end());
1654  }
1655 
1659  boost::make_transform_iterator(
1660  this->sections_begin(),
1661  NodeToSymbolicExpressionRange<const Section>()),
1662  boost::make_transform_iterator(
1663  this->sections_end(),
1664  NodeToSymbolicExpressionRange<const Section>()));
1665  }
1666 
1671  }
1672 
1675  return boost::make_iterator_range(symbolic_expressions_begin(),
1676  symbolic_expressions_end());
1677  }
1678 
1687  symbolic_expression_range::iterator(
1688  boost::make_transform_iterator(this->sections_begin(),
1689  FindSymExprsAt<Section>(A)),
1690  boost::make_transform_iterator(this->sections_end(),
1691  FindSymExprsAt<Section>(A))),
1692  symbolic_expression_range::iterator());
1693  }
1694 
1705  symbolic_expression_range::iterator(
1706  boost::make_transform_iterator(
1707  this->sections_begin(),
1708  FindSymExprsBetween<Section>(Low, High)),
1709  boost::make_transform_iterator(
1710  this->sections_end(), FindSymExprsBetween<Section>(Low, High))),
1711  symbolic_expression_range::iterator());
1712  }
1713 
1722  const_symbolic_expression_range::iterator(
1723  boost::make_transform_iterator(this->sections_begin(),
1724  FindSymExprsAt<const Section>(A)),
1725  boost::make_transform_iterator(this->sections_end(),
1726  FindSymExprsAt<const Section>(A))),
1727  const_symbolic_expression_range::iterator());
1728  }
1729 
1739  Addr High) const {
1741  const_symbolic_expression_range::iterator(
1742  boost::make_transform_iterator(
1743  this->sections_begin(),
1744  FindSymExprsBetween<const Section>(Low, High)),
1745  boost::make_transform_iterator(
1746  this->sections_end(),
1747  FindSymExprsBetween<const Section>(Low, High))),
1748  const_symbolic_expression_range::iterator());
1749  }
1751  // (end group of SymbolicExpression-related types and functions)
1752 
1754  static bool classof(const Node* N) { return N->getKind() == Kind::Module; }
1756 
1757 private:
1759  using MessageType = proto::Module;
1760 
1762  void removeSectionAddrs(Section* S);
1763 
1768  void insertSectionAddrs(Section* S);
1769 
1775  void toProtobuf(MessageType* Message) const;
1776 
1783  static ErrorOr<Module*> fromProtobuf(Context& C, const MessageType& Message);
1784 
1785  // Present for testing purposes only.
1786  void save(std::ostream& Out) const;
1787 
1788  // Present for testing purposes only.
1789  static Module* load(Context& C, std::istream& In);
1790 
1791  void setParent(IR* I, ModuleObserver* O) {
1792  Parent = I;
1793  Observer = O;
1794  }
1795 
1796  IR* Parent{nullptr};
1797  ModuleObserver* Observer{nullptr};
1798  std::string BinaryPath;
1799  Addr PreferredAddr;
1800  int64_t RebaseDelta{0};
1804  std::string Name;
1805  CodeBlock* EntryPoint{nullptr};
1806  ProxyBlockSet ProxyBlocks;
1807  SectionSet Sections;
1808  SectionIntMap SectionAddrs;
1809  SymbolSet Symbols;
1810 
1811  std::unique_ptr<SectionObserver> SecObs;
1812  std::unique_ptr<SymbolObserver> SymObs;
1813 
1814  friend class Context; // Allow Context to construct new Modules.
1815  friend class IR; // Allow IRs to call setIR, Create, etc.
1816  // Allow serialization from IR via containerToProtobuf.
1817  template <typename T> friend typename T::MessageType toProtobuf(const T&);
1818  friend class SerializationTestHarness; // Testing support.
1819 };
1820 
1825 
1827 public:
1828  virtual ~ModuleObserver() = default;
1829 
1837  virtual ChangeStatus nameChange(Module* M, const std::string& OldName,
1838  const std::string& NewName) = 0;
1839 
1846  virtual ChangeStatus addProxyBlocks(Module* M,
1847  Module::proxy_block_range Blocks) = 0;
1848 
1855  virtual ChangeStatus removeProxyBlocks(Module* M,
1856  Module::proxy_block_range Blocks) = 0;
1857 
1864  virtual ChangeStatus addCodeBlocks(Module* M,
1865  Module::code_block_range Blocks) = 0;
1866 
1873  virtual ChangeStatus removeCodeBlocks(Module* M,
1874  Module::code_block_range Blocks) = 0;
1875 };
1876 
1877 inline void Module::setName(const std::string& X) {
1878  if (Observer) {
1879  std::string OldName = X;
1880  std::swap(Name, OldName);
1881  [[maybe_unused]] ChangeStatus status =
1882  Observer->nameChange(this, OldName, Name);
1883  // The known observers do not reject insertions. If that changes, this
1884  // method must be updated.
1885  assert(status != ChangeStatus::Rejected &&
1886  "recovering from rejected name change is unimplemented");
1887  } else {
1888  Name = X;
1889  }
1890 }
1891 } // namespace gtirb
1892 
1893 #endif // GTIRB_MODULE_H
gtirb::Module::addSection
Section * addSection(Context &C, Args &&... A)
Creates a new Section in this module.
Definition: Module.hpp:791
gtirb::Module::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr Low, Addr High) const
Find all the intervals that start between a range of addresses.
Definition: Module.hpp:1053
gtirb::Module::const_symbol_addr_iterator
boost::indirect_iterator< SymbolSet::index< by_address >::type::const_iterator, const Symbol > const_symbol_addr_iterator
Constant iterator over symbols (Symbol).
Definition: Module.hpp:426
gtirb::Module::getName
const std::string & getName() const
Get the module name.
Definition: Module.hpp:674
gtirb::Section::getName
const std::string & getName() const
Get the name of a Section.
Definition: Section.hpp:122
gtirb::Module::getFileFormat
gtirb::FileFormat getFileFormat() const
Get the format of the binary pointed to by getBinaryPath().
Definition: Module.hpp:209
gtirb::Module::proxy_blocks_begin
const_proxy_block_iterator proxy_blocks_begin() const
Return a constant iterator to the first ProxyBlock.
Definition: Module.hpp:301
gtirb::Module::sections
const_section_range sections() const
Return a constant range of the sections (Section).
Definition: Module.hpp:761
gtirb::Module::const_symbol_name_iterator
boost::indirect_iterator< SymbolSet::index< by_name >::type::const_iterator, const Symbol > const_symbol_name_iterator
Constant iterator over symbols (Symbol).
Definition: Module.hpp:402
gtirb::Module::blocks_begin
const_block_iterator blocks_begin() const
Return an iterator to the first block.
Definition: Module.hpp:1120
gtirb::CodeBlock
A basic block.
Definition: CodeBlock.hpp:47
gtirb::Module::const_proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::const_iterator, const ProxyBlock > const_proxy_block_iterator
Constant iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:291
gtirb::Context::Create
NodeTy * Create(Args &&... TheArgs)
Create an object of type T.
Definition: Context.hpp:127
gtirb::Module::code_blocks_begin
code_block_iterator code_blocks_begin()
Return an iterator to the first CodeBlock.
Definition: Module.hpp:1295
gtirb::Module::findSymbols
const_symbol_ref_range findSymbols(const Node &Referent) const
Find symbols by their referent object.
Definition: Module.hpp:664
gtirb::Module::addSymbol
Symbol * addSymbol(Symbol *S)
Move a Symbol object to be located in this module.
Definition: Module.hpp:560
gtirb::Node
Represents the base of the Node class hierarchy.
Definition: Node.hpp:39
gtirb::Module::findSymbols
const_symbol_addr_range findSymbols(Addr X) const
Find symbols by address.
Definition: Module.hpp:617
gtirb::Module::sections_by_name_end
section_name_iterator sections_by_name_end()
Return an iterator to the element following the last Section.
Definition: Module.hpp:748
gtirb::Module::findSectionsOn
section_subrange findSectionsOn(Addr X)
Find a Section containing an address.
Definition: Module.hpp:806
gtirb::Module::symbol_ref_iterator
boost::indirect_iterator< SymbolSet::index< by_referent >::type::iterator > symbol_ref_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:438
gtirb::Module::const_section_name_iterator
boost::indirect_iterator< SectionSet::index< by_name >::type::const_iterator, const Section & > const_section_name_iterator
Constant iterator over sections (Section).
Definition: Module.hpp:722
gtirb::Module::symbolic_expression_iterator
MergeSortedIterator< Section::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Module.hpp:1617
gtirb::Module::symbolic_expressions
const_symbolic_expression_range symbolic_expressions() const
Return a range of all the SymbolicExpression objects.
Definition: Module.hpp:1674
gtirb::Module::byte_intervals_begin
byte_interval_iterator byte_intervals_begin()
Return an iterator to the first ByteInterval.
Definition: Module.hpp:922
gtirb::Module::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr Low, Addr High)
Find all the code blocks that start between a range of addresses.
Definition: Module.hpp:1388
gtirb::Module::const_byte_interval_iterator
MergeSortedIterator< Section::const_byte_interval_iterator, AddressLess > const_byte_interval_iterator
Const iterator over ByteInterval objects.
Definition: Module.hpp:912
gtirb::ISA::ARM64
@ ARM64
gtirb::UUID
boost::uuids::uuid UUID
Represents a universally unique identifier used to identify Node objects across serialization boundar...
Definition: Context.hpp:37
gtirb::Module::symbolic_expressions_end
const_symbolic_expression_iterator symbolic_expressions_end() const
Return an iterator to the element following the last SymbolicExpression.
Definition: Module.hpp:1669
gtirb::Module::const_symbol_ref_iterator
boost::indirect_iterator< SymbolSet::index< by_referent >::type::const_iterator, const Symbol > const_symbol_ref_iterator
Constant iterator over symbols (Symbol).
Definition: Module.hpp:447
gtirb::Module::addSymbol
Symbol * addSymbol(Context &C, Args... A)
Creates a new Symbol in this module.
Definition: Module.hpp:574
gtirb::Module::const_section_range
boost::iterator_range< const_section_iterator > const_section_range
Constant range of sections (Section).
Definition: Module.hpp:712
gtirb::Module::const_byte_interval_range
boost::iterator_range< const_byte_interval_iterator > const_byte_interval_range
Const range of ByteInterval objects.
Definition: Module.hpp:915
gtirb::Addr
A special class to store an Effective Address.
Definition: Addr.hpp:37
gtirb::ChangeStatus::Rejected
@ Rejected
gtirb::Module::getEntryPoint
CodeBlock * getEntryPoint()
Get the entry point of this module, or null if not present.
Definition: Module.hpp:274
gtirb::Module::section_range
boost::iterator_range< section_iterator > section_range
Range of sections (Section).
Definition: Module.hpp:685
gtirb::Module::symbols_by_addr_end
symbol_addr_iterator symbols_by_addr_end()
Return an iterator to the element following the last Symbol, ordered by address.
Definition: Module.hpp:520
gtirb::Module::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr Low, Addr High) const
Find all the code blocks that start between a range of addresses.
Definition: Module.hpp:1419
gtirb::const_block_iterator
cfg_node_cast_iter< const CodeBlock > const_block_iterator
Constant iterator over blocks (Block).
Definition: CFG.hpp:198
gtirb::Module::symbols
symbol_range symbols()
Return a range of the symbols (Symbol).
Definition: Module.hpp:472
gtirb::ISA::RISCV32
@ RISCV32
Reduced Instruction Set Computer V, 32-bit.
gtirb::Module::findSectionsAt
section_range findSectionsAt(Addr A)
Find all the sections that start at an address.
Definition: Module.hpp:830
gtirb::Module::code_blocks_end
code_block_iterator code_blocks_end()
Return an iterator to the element following the last CodeBlock.
Definition: Module.hpp:1305
gtirb::Module::byte_interval_range
boost::iterator_range< byte_interval_iterator > byte_interval_range
Range of ByteInterval objects.
Definition: Module.hpp:906
gtirb::Context
The context under which GTIRB operations occur.
Definition: Context.hpp:64
gtirb::Module::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr A)
Find all the intervals that start at an address.
Definition: Module.hpp:1002
Node.hpp
Class gtirb::Node.
gtirb::Module::setName
void setName(const std::string &X)
Set the module name.
Definition: Module.hpp:1877
gtirb::Module::setRebaseDelta
void setRebaseDelta(int64_t X)
Set the difference between this module's preferred address and the address where it was actually load...
Definition: Module.hpp:218
gtirb::Module::getEntryPoint
const CodeBlock * getEntryPoint() const
Get the entry point of this module, or null if not present.
Definition: Module.hpp:272
gtirb::Section::const_symbolic_expression_iterator
MergeSortedIterator< ByteInterval::const_symbolic_expression_iterator, ByteInterval::ConstSymbolicExpressionElement::AddressLess > const_symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Section.hpp:919
gtirb::Module::findSectionsOn
const_section_subrange findSectionsOn(Addr X) const
Find a Section containing an address.
Definition: Module.hpp:818
gtirb::Module::const_symbol_iterator
boost::indirect_iterator< SymbolSet::index< by_pointer >::type::const_iterator, const Symbol > const_symbol_iterator
Constant iterator over symbols (Symbol).
Definition: Module.hpp:379
gtirb::Module::symbols_end
const_symbol_iterator symbols_end() const
Return a constant iterator to the element following the last Symbol.
Definition: Module.hpp:468
gtirb::Module::setISA
void setISA(gtirb::ISA X)
Set the ISA of the instructions in this Module.
Definition: Module.hpp:254
gtirb::ByteOrder::Undefined
@ Undefined
gtirb::Module::byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Section::byte_interval_subrange::iterator, AddressLess > > byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: Module.hpp:909
gtirb::Module::code_block_range
boost::iterator_range< code_block_iterator > code_block_range
Range of CodeBlock objects.
Definition: Module.hpp:1253
gtirb::Module::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr A) const
Find all the intervals that start at an address.
Definition: Module.hpp:1035
gtirb::Section
Represents a named section of the binary.
Definition: Section.hpp:66
gtirb::Module::section_name_range
boost::iterator_range< section_name_iterator > section_name_range
Range of sections (Section).
Definition: Module.hpp:699
gtirb::Module::findBlocksOn
const_block_subrange findBlocksOn(Addr A) const
Find all the blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1161
gtirb::Module::const_symbolic_expression_range
boost::iterator_range< const_symbolic_expression_iterator > const_symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: Module.hpp:1633
gtirb::Symbol::getAddress
std::optional< Addr > getAddress() const
Get the effective address.
gtirb::Module::findByteIntervalsOn
const_byte_interval_subrange findByteIntervalsOn(Addr A) const
Find all the intervals that contain the address specified.
Definition: Module.hpp:986
gtirb::Module::byte_intervals
byte_interval_range byte_intervals()
Return a range of all the ByteInterval objects.
Definition: Module.hpp:937
gtirb::Module::const_symbol_addr_range
boost::iterator_range< const_symbol_addr_iterator > const_symbol_addr_range
Constant range of symbols (Symbol).
Definition: Module.hpp:432
gtirb::Module::symbols_begin
symbol_iterator symbols_begin()
Return an iterator to the first Symbol.
Definition: Module.hpp:455
gtirb::Module::section_iterator
boost::indirect_iterator< SectionSet::iterator > section_iterator
Iterator over sections (Section).
Definition: Module.hpp:683
gtirb::Module::findByteIntervalsOn
byte_interval_subrange findByteIntervalsOn(Addr A)
Find all the intervals that contain the address specified.
Definition: Module.hpp:969
gtirb::Module::symbol_addr_iterator
boost::indirect_iterator< SymbolSet::index< by_address >::type::iterator > symbol_addr_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:415
gtirb::Module::data_block_subrange
boost::iterator_range< MergeSortedIterator< Section::data_block_subrange::iterator, AddressLess > > data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: Module.hpp:1451
gtirb::Module::data_blocks
data_block_range data_blocks()
Return a range of all the DataBlock objects.
Definition: Module.hpp:1486
gtirb::Module::symbols_by_name_end
const_symbol_name_iterator symbols_by_name_end() const
Return a constant iterator to the element following the last Symbol, ordered by name.
Definition: Module.hpp:495
DataBlock.hpp
Class gtirb::DataBlock.
gtirb::Module::symbol_name_iterator
boost::indirect_iterator< SymbolSet::index< by_name >::type::iterator > symbol_name_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:390
gtirb::Module::const_symbolic_expression_iterator
MergeSortedIterator< Section::const_symbolic_expression_iterator, ByteInterval::ConstSymbolicExpressionElement::AddressLess > const_symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Module.hpp:1628
gtirb::Module::const_code_block_iterator
MergeSortedIterator< Section::const_code_block_iterator, AddressLess > const_code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1266
gtirb::FileFormat::IdaProDb32
@ IdaProDb32
IDA Pro database file.
gtirb::Module::findSymbols
const_symbol_name_range findSymbols(const std::string &N) const
Find symbols by name.
Definition: Module.hpp:595
gtirb::Module::symbols_by_addr
symbol_addr_range symbols_by_addr()
Return a range of the symbols (Symbol), ordered by address.
Definition: Module.hpp:529
gtirb::Module::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr A)
Find all the code blocks that start at an address.
Definition: Module.hpp:1371
gtirb::SymAttribute::S
@ S
gtirb::Module::blocks_begin
block_iterator blocks_begin()
Return an iterator to the first block.
Definition: Module.hpp:1103
GTIRB_EXPORT_API
#define GTIRB_EXPORT_API
This macro controls the visibility of exported symbols (i.e. classes) in shared libraries....
Definition: Export.hpp:52
gtirb::Module::symbolic_expression_range
boost::iterator_range< symbolic_expression_iterator > symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: Module.hpp:1622
gtirb::Module::getRebaseDelta
int64_t getRebaseDelta() const
Get the difference between this module's preferred address and the address where it was actually load...
Definition: Module.hpp:225
gtirb::Module::symbol_addr_range
boost::iterator_range< symbol_addr_iterator > symbol_addr_range
Range of symbols (Symbol).
Definition: Module.hpp:420
gtirb::Module::symbolic_expressions_end
symbolic_expression_iterator symbolic_expressions_end()
Return an iterator to the element following the last SymbolicExpression.
Definition: Module.hpp:1646
gtirb::Module::proxy_blocks
const_proxy_block_range proxy_blocks() const
Return a constant range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:318
gtirb
Main namespace for the GTIRB API.
Definition: Addr.hpp:28
gtirb::Module::proxy_blocks_end
proxy_block_iterator proxy_blocks_end()
Return an iterator to the element following the last ProxyBlock.
Definition: Module.hpp:305
gtirb::Module::block_range
boost::iterator_range< block_iterator > block_range
Range of blocks.
Definition: Module.hpp:1078
gtirb::Module::setPreferredAddr
void setPreferredAddr(gtirb::Addr X)
Set the preferred address for loading this module.
Definition: Module.hpp:233
gtirb::Module::findSections
section_name_range findSections(const std::string &X)
Find a Section by name.
Definition: Module.hpp:879
gtirb::FileFormat::RAW
@ RAW
Raw binary file (no format)
Export.hpp
gtirb::Module::data_blocks_begin
const_data_block_iterator data_blocks_begin() const
Return an iterator to the first DataBlock.
Definition: Module.hpp:1491
gtirb::Symbol::Create
static Symbol * Create(Context &C)
Create an unitialized Symbol object.
Definition: Symbol.hpp:221
gtirb::Module::byte_intervals_begin
const_byte_interval_iterator byte_intervals_begin() const
Return an iterator to the first ByteInterval.
Definition: Module.hpp:943
gtirb::Module::section_subrange
boost::iterator_range< boost::indirect_iterator< SectionIntMap::codomain_type::iterator > > section_subrange
Sub-range of sections overlapping an address (Section).
Definition: Module.hpp:688
gtirb::Module::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:314
gtirb::Module::const_block_range
boost::iterator_range< const_block_iterator > const_block_range
Range of blocks.
Definition: Module.hpp:1095
gtirb::Module::findSymbols
symbol_addr_range findSymbols(Addr Lower, Addr Upper)
Find symbols by a range of addresses.
Definition: Module.hpp:629
gtirb::FileFormat::COFF
@ COFF
Common Object File Format (COFF)
gtirb::Module::findDataBlocksAt
data_block_range findDataBlocksAt(Addr Low, Addr High)
Find all the data blocks that start between a range of addresses.
Definition: Module.hpp:1566
gtirb::Module::const_section_name_range
boost::iterator_range< const_section_name_iterator > const_section_name_range
Constant range of sections (Section).
Definition: Module.hpp:728
gtirb::ISA::ValidButUnsupported
@ ValidButUnsupported
gtirb::Module::byte_interval_iterator
MergeSortedIterator< Section::byte_interval_iterator, AddressLess > byte_interval_iterator
Iterator over ByteInterval objects.
Definition: Module.hpp:904
gtirb::Module::symbolic_expressions
symbolic_expression_range symbolic_expressions()
Return a range of all the SymbolicExpression objects.
Definition: Module.hpp:1651
gtirb::Module::blocks
block_range blocks()
Return a range of all the blocks.
Definition: Module.hpp:1115
gtirb::ProxyBlock
A placeholder that serves as the endpoint (source or target) of a CFG edge.
Definition: ProxyBlock.hpp:49
gtirb::block_iterator
cfg_node_cast_iter< CodeBlock > block_iterator
Iterator over blocks (Block).
Definition: CFG.hpp:194
gtirb::ISA::PPC32
@ PPC32
gtirb::Module::const_section_subrange
boost::iterator_range< boost::indirect_iterator< SectionIntMap::codomain_type::const_iterator, const Section & > > const_section_subrange
Sub-range of sections overlapping an address (Section).
Definition: Module.hpp:715
gtirb::ByteOrder::Little
@ Little
Little endian.
gtirb::Module::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr A) const
Find all the data blocks that start at an address.
Definition: Module.hpp:1580
gtirb::Module::const_block_subrange
boost::iterator_range< MergeSortedIterator< Section::const_block_subrange::iterator, BlockAddressLess > > const_block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: Module.hpp:1100
gtirb::IR
A complete internal representation consisting of Modules (Module).
Definition: IR.hpp:76
gtirb::Symbol::getName
const std::string & getName() const
Get the name.
Definition: Symbol.hpp:279
gtirb::Module::removeSymbol
bool removeSymbol(Symbol *S)
Remove a Symbol object located in this module.
Definition: Module.hpp:547
gtirb::ISA::PPC64
@ PPC64
gtirb::Module::findSymbols
symbol_ref_range findSymbols(const Node &Referent)
Find symbols by their referent object.
Definition: Module.hpp:654
gtirb::ByteInterval::SymbolicExpressionElementBase::AddressLess
A comparison function object to order symbolic expression elements by the address in which they occur...
Definition: ByteInterval.hpp:1138
gtirb::ProxyBlock::Create
static ProxyBlock * Create(Context &C)
Create an unitialized ProxyBlock object.
Definition: ProxyBlock.hpp:54
gtirb::Module::findSections
const_section_name_range findSections(const std::string &X) const
Find a Section by name.
Definition: Module.hpp:890
gtirb::Module::proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::iterator > proxy_block_iterator
Iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:286
gtirb::ChangeStatus::Accepted
@ Accepted
gtirb::Module::findBlocksAt
const_block_range findBlocksAt(Addr A) const
Find all the blocks that start at an address.
Definition: Module.hpp:1210
gtirb::Module::getIR
const IR * getIR() const
Get the IR this module belongs to.
Definition: Module.hpp:182
gtirb::Module::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr Low, Addr High)
Find all the intervals that start between a range of addresses.
Definition: Module.hpp:1020
gtirb::ByteOrder::Big
@ Big
Big endian.
gtirb::Module::const_section_iterator
boost::indirect_iterator< SectionSet::const_iterator, const Section & > const_section_iterator
Constant iterator over sections (Section).
Definition: Module.hpp:706
gtirb::Module::setBinaryPath
void setBinaryPath(const std::string &X)
Set the location of the corresponding binary on disk.
Definition: Module.hpp:192
AuxDataContainer.hpp
Class gtirb::AuxDataContainer.
gtirb::Module::findSectionsAt
section_range findSectionsAt(Addr Low, Addr High)
Find all the sections that start between a range of addresses.
Definition: Module.hpp:842
gtirb::Module::getIR
IR * getIR()
Get the IR this module belongs to.
Definition: Module.hpp:184
gtirb::Module::byte_intervals
const_byte_interval_range byte_intervals() const
Return a range of all the ByteInterval objects.
Definition: Module.hpp:958
gtirb::Module::getISA
gtirb::ISA getISA() const
Get the ISA of the instructions in this Module.
Definition: Module.hpp:259
gtirb::Module::symbols_by_name
const_symbol_name_range symbols_by_name() const
Return a constant range of the symbols (Symbol), ordered by name.
Definition: Module.hpp:505
gtirb::Module::symbols_by_addr
const_symbol_addr_range symbols_by_addr() const
Return a constant range of the symbols (Symbol), ordered by address.
Definition: Module.hpp:535
gtirb::Module::sections_end
section_iterator sections_end()
Return an iterator to the element following the last Section.
Definition: Module.hpp:743
gtirb::ModuleObserver
Interface for notifying observers when the Module is updated.
Definition: Module.hpp:1826
gtirb::Module::findDataBlocksOn
data_block_subrange findDataBlocksOn(Addr A)
Find all the data blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1516
gtirb::Module::code_block_iterator
MergeSortedIterator< Section::code_block_iterator, AddressLess > code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1248
gtirb::Module::data_block_iterator
MergeSortedIterator< Section::data_block_iterator, AddressLess > data_block_iterator
Iterator over DataBlock objects.
Definition: Module.hpp:1439
gtirb::Module::Create
static Module * Create(Context &C, const std::string &Name)
Create a Module object.
Definition: Module.hpp:177
gtirb::Module::sections_by_name_begin
const_section_name_iterator sections_by_name_begin() const
Return a constant iterator to the first Section.
Definition: Module.hpp:739
gtirb::Module::proxy_blocks_begin
proxy_block_iterator proxy_blocks_begin()
Return an iterator to the first ProxyBlock.
Definition: Module.hpp:297
gtirb::Module::findDataBlocksOn
const_data_block_subrange findDataBlocksOn(Addr A) const
Find all the data blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1533
gtirb::Module::const_proxy_block_range
boost::iterator_range< const_proxy_block_iterator > const_proxy_block_range
Constant range of proxy_blocks (ProxyBlock).
Definition: Module.hpp:294
gtirb::Module::const_data_block_iterator
MergeSortedIterator< Section::const_data_block_iterator, AddressLess > const_data_block_iterator
Iterator over DataBlock objects.
Definition: Module.hpp:1457
gtirb::Module::block_iterator
MergeSortedIterator< Section::block_iterator, BlockAddressLess > block_iterator
Iterator over blocks.
Definition: Module.hpp:1073
gtirb::Module::findSectionsAt
const_section_range findSectionsAt(Addr A) const
Find all the sections that start at an address.
Definition: Module.hpp:854
gtirb::Module::data_blocks
const_data_block_range data_blocks() const
Return a range of all the DataBlock objects.
Definition: Module.hpp:1506
gtirb::Module::symbols_by_name
symbol_name_range symbols_by_name()
Return a range of the symbols (Symbol), ordered by name.
Definition: Module.hpp:499
gtirb::Module::findSymbols
symbol_addr_range findSymbols(Addr X)
Find symbols by address.
Definition: Module.hpp:606
Symbol.hpp
Class gtirb::Symbol.
gtirb::Module::findBlocksOn
block_subrange findBlocksOn(Addr A)
Find all the blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1143
gtirb::Module::byte_intervals_end
byte_interval_iterator byte_intervals_end()
Return an iterator to the element following the last ByteInterval.
Definition: Module.hpp:932
gtirb::Module::code_blocks_end
const_code_block_iterator code_blocks_end() const
Return an iterator to the element following the last CodeBlock.
Definition: Module.hpp:1323
gtirb::Module::blocks_end
const_block_iterator blocks_end() const
Return an iterator to the element following the last block.
Definition: Module.hpp:1129
gtirb::Module::findBlocksAt
const_block_range findBlocksAt(Addr Low, Addr High) const
Find all the blocks that start between a range of addresses.
Definition: Module.hpp:1228
gtirb::Module::setByteOrder
void setByteOrder(gtirb::ByteOrder X)
Set the endianness of the instructions in this Module.
Definition: Module.hpp:264
gtirb::Module::const_symbol_name_range
boost::iterator_range< const_symbol_name_iterator > const_symbol_name_range
Constant range of symbols (Symbol).
Definition: Module.hpp:408
gtirb::Module::symbols_by_addr_begin
const_symbol_addr_iterator symbols_by_addr_begin() const
Return a constant iterator to the first Symbol, ordered by address.
Definition: Module.hpp:515
gtirb::Module::findBlocksAt
block_range findBlocksAt(Addr A)
Find all the blocks that start at an address.
Definition: Module.hpp:1178
gtirb::Module::const_code_block_range
boost::iterator_range< const_code_block_iterator > const_code_block_range
Range of CodeBlock objects.
Definition: Module.hpp:1272
gtirb::FileFormat::PE
@ PE
Microsoft Portable Executable (PE) format.
gtirb::Module::sections_end
const_section_iterator sections_end() const
Return a constant iterator to the element following the last Section.
Definition: Module.hpp:746
gtirb::Module::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr A) const
Find all the code blocks that start at an address.
Definition: Module.hpp:1402
gtirb::Module::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr Low, Addr High) const
Find all the data blocks that start between a range of addresses.
Definition: Module.hpp:1597
gtirb::FileFormat::Undefined
@ Undefined
gtirb::Module::symbol_range
boost::iterator_range< symbol_iterator > symbol_range
Range of symbols (Symbol).
Definition: Module.hpp:374
gtirb::ISA::Undefined
@ Undefined
gtirb::Module::const_symbol_range
boost::iterator_range< const_symbol_iterator > const_symbol_range
Constant range of symbols (Symbol).
Definition: Module.hpp:383
gtirb::Module::findSectionsAt
const_section_range findSectionsAt(Addr Low, Addr High) const
Find all the sections that start between a range of addresses.
Definition: Module.hpp:866
gtirb::Module::symbol_ref_range
boost::iterator_range< symbol_ref_iterator > symbol_ref_range
Range of symbols (Symbol).
Definition: Module.hpp:442
gtirb::ISA::MIPS32
@ MIPS32
gtirb::Module::getBinaryPath
const std::string & getBinaryPath() const
Get the location of the corresponding binary on disk.
Definition: Module.hpp:197
gtirb::ModuleObserver::nameChange
virtual ChangeStatus nameChange(Module *M, const std::string &OldName, const std::string &NewName)=0
Notify the parent when this Module's name changes.
gtirb::Module::symbolic_expressions_begin
symbolic_expression_iterator symbolic_expressions_begin()
Return an iterator to the first SymbolicExpression.
Definition: Module.hpp:1636
gtirb::Module::sections_begin
section_iterator sections_begin()
Return an iterator to the first Section.
Definition: Module.hpp:731
gtirb::Module::sections_by_name_end
const_section_name_iterator sections_by_name_end() const
Return a constant iterator to the element following the last Section.
Definition: Module.hpp:753
gtirb::AuxDataContainer
Contains the AuxData Tables and serves as a base class.
Definition: AuxDataContainer.hpp:56
gtirb::Module::symbolic_expressions_begin
const_symbolic_expression_iterator symbolic_expressions_begin() const
Return an iterator to the first SymbolicExpression.
Definition: Module.hpp:1657
gtirb::Module::byte_intervals_end
const_byte_interval_iterator byte_intervals_end() const
Return an iterator to the element following the last ByteInterval.
Definition: Module.hpp:953
gtirb::Module::proxy_blocks_end
const_proxy_block_iterator proxy_blocks_end() const
Return a constant iterator to the element following the last ProxyBlock.
Definition: Module.hpp:310
gtirb::Module::getPreferredAddr
gtirb::Addr getPreferredAddr() const
Get the preferred address for loading this module.
Definition: Module.hpp:239
Section.hpp
Class gtirb::Section.
gtirb::Module::block_subrange
boost::iterator_range< MergeSortedIterator< Section::block_subrange::iterator, BlockAddressLess > > block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: Module.hpp:1084
gtirb::Module::symbols_by_addr_end
const_symbol_addr_iterator symbols_by_addr_end() const
Return a constant iterator to the element following the last Symbol, ordered by address.
Definition: Module.hpp:525
gtirb::Module::code_blocks
const_code_block_range code_blocks() const
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1328
gtirb::Module
Represents a single binary (library or executable).
Definition: Module.hpp:109
gtirb::Module::symbols_end
symbol_iterator symbols_end()
Return an iterator to the element following the last Symbol.
Definition: Module.hpp:463
gtirb::Module::const_code_block_subrange
boost::iterator_range< MergeSortedIterator< Section::const_code_block_subrange::iterator, AddressLess > > const_code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: Module.hpp:1279
gtirb::Module::section_name_iterator
boost::indirect_iterator< SectionSet::index< by_name >::type::iterator > section_name_iterator
Iterator over sections (Section).
Definition: Module.hpp:694
gtirb::Module::code_blocks_begin
const_code_block_iterator code_blocks_begin() const
Return an iterator to the first CodeBlock.
Definition: Module.hpp:1313
gtirb::Module::data_block_range
boost::iterator_range< data_block_iterator > data_block_range
Range of DataBlock objects.
Definition: Module.hpp:1444
gtirb::ISA::MIPS64
@ MIPS64
gtirb::Module::data_blocks_end
const_data_block_iterator data_blocks_end() const
Return an iterator to the element following the last DataBlock.
Definition: Module.hpp:1501
gtirb::Module::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr A)
Find all the symbolic expressions that start at an address.
Definition: Module.hpp:1685
gtirb::Module::blocks
const_block_range blocks() const
Return a range of all the blocks.
Definition: Module.hpp:1132
gtirb::Module::findDataBlocksAt
data_block_range findDataBlocksAt(Addr A)
Find all the data blocks that start at an address.
Definition: Module.hpp:1549
gtirb::ISA::IA32
@ IA32
Intel Architecture, 32-bit. Also known as i386.
gtirb::Module::sections_begin
const_section_iterator sections_begin() const
Return a constant iterator to the first Section.
Definition: Module.hpp:733
gtirb::ISA::X64
@ X64
gtirb::Module::symbols_by_name_end
symbol_name_iterator symbols_by_name_end()
Return an iterator to the element following the last Symbol, ordered by name.
Definition: Module.hpp:490
gtirb::Module::symbols_by_name_begin
const_symbol_name_iterator symbols_by_name_begin() const
Return a constant iterator to the first Symbol, ordered by name.
Definition: Module.hpp:485
gtirb::Module::findBlocksAt
block_range findBlocksAt(Addr Low, Addr High)
Find all the blocks that start between a range of addresses.
Definition: Module.hpp:1195
gtirb::Module::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1308
gtirb::Module::symbols_by_name_begin
symbol_name_iterator symbols_by_name_begin()
Return an iterator to the first Symbol, ordered by name.
Definition: Module.hpp:481
gtirb::Module::const_data_block_subrange
boost::iterator_range< MergeSortedIterator< Section::const_data_block_subrange::iterator, AddressLess > > const_data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: Module.hpp:1470
gtirb::Module::sections_by_name_begin
section_name_iterator sections_by_name_begin()
Return an iterator to the first Section.
Definition: Module.hpp:735
gtirb::Module::symbol_iterator
boost::indirect_iterator< SymbolSet::index< by_pointer >::type::iterator > symbol_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:370
Observer.hpp
gtirb::Module::findCodeBlocksOn
code_block_subrange findCodeBlocksOn(Addr A)
Find all the code blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1338
gtirb::ISA
ISA
Definition: Module.hpp:75
gtirb::Module::setEntryPoint
void setEntryPoint(CodeBlock *CB)
Set the entry point of this module.
Definition: Module.hpp:279
gtirb::Module::blocks_end
block_iterator blocks_end()
Return an iterator to the element following the last block.
Definition: Module.hpp:1112
gtirb::Module::symbols_begin
const_symbol_iterator symbols_begin() const
Return a constant iterator to the first Symbol.
Definition: Module.hpp:459
gtirb::Module::addProxyBlock
ProxyBlock * addProxyBlock(Context &C, Args &&... A)
Creates a new ProxyBlock in this module.
Definition: Module.hpp:349
gtirb::Module::findCodeBlocksOn
const_code_block_subrange findCodeBlocksOn(Addr A) const
Find all the code blocks that have bytes that lie within the address specified.
Definition: Module.hpp:1355
gtirb::Module::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High) const
Find all the symbolic expressions that start between a range of addresses.
Definition: Module.hpp:1738
gtirb::Module::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High)
Find all the symbolic expressions that start between a range of addresses.
Definition: Module.hpp:1703
gtirb::Module::findSymbols
symbol_name_range findSymbols(const std::string &N)
Find symbols by name.
Definition: Module.hpp:584
gtirb::Module::sections
section_range sections()
Return a range of the sections (Section).
Definition: Module.hpp:757
SymbolicExpression.hpp
Types and operations for symbolic expressions.
gtirb::Module::symbol_name_range
boost::iterator_range< symbol_name_iterator > symbol_name_range
Range of symbols (Symbol).
Definition: Module.hpp:395
Addr.hpp
Class gtirb::Addr and related functions.
gtirb::Module::setFileFormat
void setFileFormat(gtirb::FileFormat X)
Set the format of the binary pointed to by getBinaryPath().
Definition: Module.hpp:203
gtirb::Module::symbols_by_addr_begin
symbol_addr_iterator symbols_by_addr_begin()
Return an iterator to the first Symbol, ordered by address.
Definition: Module.hpp:511
gtirb::Module::const_block_iterator
MergeSortedIterator< Section::const_block_iterator, BlockAddressLess > const_block_iterator
Iterator over blocks.
Definition: Module.hpp:1090
gtirb::FileFormat::MACHO
@ MACHO
Mach object file format.
gtirb::Module::data_blocks_begin
data_block_iterator data_blocks_begin()
Return an iterator to the first DataBlock.
Definition: Module.hpp:1473
gtirb::Module::proxy_block_range
boost::iterator_range< proxy_block_iterator > proxy_block_range
Range of proxy_blocks (ProxyBlock).
Definition: Module.hpp:288
gtirb::ChangeStatus
ChangeStatus
Definition: Observer.hpp:19
gtirb::Module::getByteOrder
gtirb::ByteOrder getByteOrder() const
Get the endianness of the instructions in this Module.
Definition: Module.hpp:269
gtirb::ByteOrder
ByteOrder
Definition: Module.hpp:99
gtirb::Module::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr A) const
Find all the symbolic expressions that start at an address.
Definition: Module.hpp:1720
gtirb::FileFormat::IdaProDb64
@ IdaProDb64
IDA Pro database file.
gtirb::Module::const_data_block_range
boost::iterator_range< const_data_block_iterator > const_data_block_range
Range of DataBlock objects.
Definition: Module.hpp:1463
gtirb::Section::symbolic_expression_iterator
MergeSortedIterator< ByteInterval::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Section.hpp:908
gtirb::ISA::RISCV64
@ RISCV64
Reduced Instruction Set Computer V, 64-bit.
gtirb::Module::findSymbols
const_symbol_addr_range findSymbols(Addr Lower, Addr Upper) const
Find symbols by a range of addresses.
Definition: Module.hpp:642
gtirb::Module::isRelocated
bool isRelocated() const
Has the image been loaded somewhere other than its preferred address?
Definition: Module.hpp:249
Utility.hpp
gtirb::Module::const_byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Section::const_byte_interval_subrange::iterator, AddressLess > > const_byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: Module.hpp:919
gtirb::Module::code_block_subrange
boost::iterator_range< MergeSortedIterator< Section::code_block_subrange::iterator, AddressLess > > code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: Module.hpp:1260
gtirb::ISA::ARM
@ ARM
gtirb::Module::const_symbol_ref_range
boost::iterator_range< const_symbol_ref_iterator > const_symbol_ref_range
Constant range of symbols (Symbol).
Definition: Module.hpp:452
gtirb::Symbol
Represents a Symbol, which maps a name to an object in the IR.
Definition: Symbol.hpp:43
gtirb::FileFormat::ELF
@ ELF
gtirb::FileFormat
FileFormat
Identifies an exectuable file format.
Definition: Module.hpp:58
gtirb::Module::symbols
const_symbol_range symbols() const
Return a constant range of the symbols (Symbol).
Definition: Module.hpp:476
gtirb::Module::data_blocks_end
data_block_iterator data_blocks_end()
Return an iterator to the element following the last DataBlock.
Definition: Module.hpp:1483
gtirb::FileFormat::XCOFF
@ XCOFF
Non-COFF (files start with ANON_OBJECT_HEADER*)