GTIRB  v2.2.0
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 };
96 
97 enum class ByteOrder : uint8_t {
98  Undefined = proto::ByteOrder_Undefined,
99  Big = proto::BigEndian,
101  Little = proto::LittleEndian,
102 };
103 
108  struct by_address {};
109  struct by_name {};
110  struct by_pointer {};
111  struct by_referent {};
112 
113  // Helper function for extracting the referent of a Symbol.
114  static const Node* get_symbol_referent(const Symbol& S) {
115  if (std::optional<const Node*> Res =
116  S.visit([](const Node* N) { return N; })) {
117  return *Res;
118  }
119  return nullptr;
120  }
121 
122  using ProxyBlockSet = std::unordered_set<ProxyBlock*>;
123 
124  using SectionSet = boost::multi_index::multi_index_container<
125  Section*, boost::multi_index::indexed_by<
126  boost::multi_index::ordered_non_unique<
127  boost::multi_index::tag<by_address>,
128  boost::multi_index::identity<Section*>, AddressLess>,
129  boost::multi_index::ordered_non_unique<
130  boost::multi_index::tag<by_name>,
131  boost::multi_index::const_mem_fun<
132  Section, const std::string&, &Section::getName>>,
133  boost::multi_index::hashed_unique<
134  boost::multi_index::tag<by_pointer>,
135  boost::multi_index::identity<Section*>>>>;
136  using SectionIntMap =
137  boost::icl::interval_map<Addr, std::set<Section*, AddressLess>>;
138 
139  using SymbolSet = boost::multi_index::multi_index_container<
140  Symbol*,
141  boost::multi_index::indexed_by<
142  boost::multi_index::ordered_non_unique<
143  boost::multi_index::tag<by_address>,
144  boost::multi_index::const_mem_fun<Symbol, std::optional<Addr>,
146  boost::multi_index::ordered_non_unique<
147  boost::multi_index::tag<by_name>,
148  boost::multi_index::const_mem_fun<Symbol, const std::string&,
149  &Symbol::getName>>,
150  boost::multi_index::hashed_unique<
151  boost::multi_index::tag<by_pointer>,
152  boost::multi_index::identity<Symbol*>>,
153  boost::multi_index::hashed_non_unique<
154  boost::multi_index::tag<by_referent>,
155  boost::multi_index::global_fun<const Symbol&, const Node*,
156  &get_symbol_referent>>>>;
157 
158  class SectionObserverImpl;
159  class SymbolObserverImpl;
160 
161  Module(Context& C, const std::string& N);
162  Module(Context& C, const std::string& N, const UUID& U);
163 
164  static Module* Create(Context& C, const std::string& N, const UUID& U) {
165  return C.Create<Module>(C, N, U);
166  }
167 
168 public:
175  static Module* Create(Context& C, const std::string& Name) {
176  return C.Create<Module>(C, Name);
177  }
178 
180  const IR* getIR() const { return Parent; }
182  IR* getIR() { return Parent; }
183 
190  void setBinaryPath(const std::string& X) { BinaryPath = X; }
191 
195  const std::string& getBinaryPath() const { return BinaryPath; }
196 
202 
207  gtirb::FileFormat getFileFormat() const { return this->FileFormat; }
208 
216  void setRebaseDelta(int64_t X) { RebaseDelta = X; }
217 
223  int64_t getRebaseDelta() const { return RebaseDelta; }
224 
231  void setPreferredAddr(gtirb::Addr X) { PreferredAddr = X; }
232 
237  gtirb::Addr getPreferredAddr() const { return PreferredAddr; }
238 
247  bool isRelocated() const { return RebaseDelta != 0; }
248 
252  void setISA(gtirb::ISA X) { Isa = X; }
253 
257  gtirb::ISA getISA() const { return Isa; }
258 
263 
268 
270  const CodeBlock* getEntryPoint() const { return EntryPoint; }
272  CodeBlock* getEntryPoint() { return EntryPoint; }
273 
277  void setEntryPoint(CodeBlock* CB) { EntryPoint = CB; }
278 
281 
283  using proxy_block_iterator =
284  boost::indirect_iterator<ProxyBlockSet::iterator>;
286  using proxy_block_range = boost::iterator_range<proxy_block_iterator>;
289  boost::indirect_iterator<ProxyBlockSet::const_iterator, const ProxyBlock>;
292  boost::iterator_range<const_proxy_block_iterator>;
293 
296  return proxy_block_iterator(ProxyBlocks.begin());
297  }
300  return const_proxy_block_iterator(ProxyBlocks.begin());
301  }
304  return proxy_block_iterator(ProxyBlocks.end());
305  }
309  return const_proxy_block_iterator(ProxyBlocks.end());
310  }
313  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
314  }
317  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
318  }
319 
328  ChangeStatus removeProxyBlock(ProxyBlock* B);
329 
337  ChangeStatus addProxyBlock(ProxyBlock* PB);
338 
346  template <typename... Args>
347  ProxyBlock* addProxyBlock(Context& C, Args&&... A) {
348  ProxyBlock* PB = ProxyBlock::Create(C, std::forward<Args>(A)...);
349  [[maybe_unused]] ChangeStatus status = addProxyBlock(PB);
350  // addProxyBlock(ProxyBlock*) does not currently reject any changes and,
351  // because we just created the ProxyBlock to add, it cannot result in
352  // NoChange.
353  assert(status == ChangeStatus::Accepted &&
354  "unexpected result when inserting ProxyBlock");
355  return PB;
356  }
357 
359  // (end of ProxyBlock-Related Public Types and Functions)
360 
363 
367  using symbol_iterator =
368  boost::indirect_iterator<SymbolSet::index<by_pointer>::type::iterator>;
372  using symbol_range = boost::iterator_range<symbol_iterator>;
376  using const_symbol_iterator = boost::indirect_iterator<
377  SymbolSet::index<by_pointer>::type::const_iterator, const Symbol>;
381  using const_symbol_range = boost::iterator_range<const_symbol_iterator>;
382 
387  using symbol_name_iterator =
388  boost::indirect_iterator<SymbolSet::index<by_name>::type::iterator>;
393  using symbol_name_range = boost::iterator_range<symbol_name_iterator>;
399  boost::indirect_iterator<SymbolSet::index<by_name>::type::const_iterator,
400  const Symbol>;
406  boost::iterator_range<const_symbol_name_iterator>;
407 
412  using symbol_addr_iterator =
413  boost::indirect_iterator<SymbolSet::index<by_address>::type::iterator>;
418  using symbol_addr_range = boost::iterator_range<symbol_addr_iterator>;
423  using const_symbol_addr_iterator = boost::indirect_iterator<
424  SymbolSet::index<by_address>::type::const_iterator, const Symbol>;
430  boost::iterator_range<const_symbol_addr_iterator>;
431 
435  using symbol_ref_iterator =
436  boost::indirect_iterator<SymbolSet::index<by_referent>::type::iterator>;
440  using symbol_ref_range = boost::iterator_range<symbol_ref_iterator>;
444  using const_symbol_ref_iterator = boost::indirect_iterator<
445  SymbolSet::index<by_referent>::type::const_iterator, const Symbol>;
449  using const_symbol_ref_range =
450  boost::iterator_range<const_symbol_ref_iterator>;
451 
454  return symbol_iterator(Symbols.get<by_pointer>().begin());
455  }
458  return const_symbol_iterator(Symbols.get<by_pointer>().begin());
459  }
462  return symbol_iterator(Symbols.get<by_pointer>().end());
463  }
467  return const_symbol_iterator(Symbols.get<by_pointer>().end());
468  }
471  return boost::make_iterator_range(symbols_begin(), symbols_end());
472  }
475  return boost::make_iterator_range(symbols_begin(), symbols_end());
476  }
477 
480  return symbol_name_iterator(Symbols.get<by_name>().begin());
481  }
484  return const_symbol_name_iterator(Symbols.get<by_name>().begin());
485  }
489  return symbol_name_iterator(Symbols.get<by_name>().end());
490  }
494  return const_symbol_name_iterator(Symbols.get<by_name>().end());
495  }
498  return boost::make_iterator_range(symbols_by_name_begin(),
499  symbols_by_name_end());
500  }
504  return boost::make_iterator_range(symbols_by_name_begin(),
505  symbols_by_name_end());
506  }
507 
510  return symbol_addr_iterator(Symbols.get<by_address>().begin());
511  }
514  return const_symbol_addr_iterator(Symbols.get<by_address>().begin());
515  }
519  return symbol_addr_iterator(Symbols.get<by_address>().end());
520  }
524  return const_symbol_addr_iterator(Symbols.get<by_address>().end());
525  }
528  return boost::make_iterator_range(symbols_by_addr_begin(),
529  symbols_by_addr_end());
530  }
534  return boost::make_iterator_range(symbols_by_addr_begin(),
535  symbols_by_addr_end());
536  }
537 
545  bool removeSymbol(Symbol* S) {
546  auto& Index = Symbols.get<by_pointer>();
547  if (auto Iter = Index.find(S); Iter != Index.end()) {
548  Index.erase(Iter);
549  S->setParent(nullptr, nullptr);
550  return true;
551  }
552  return false;
553  }
554 
559  if (S->getModule()) {
560  S->getModule()->removeSymbol(S);
561  }
562  Symbols.emplace(S);
563  S->setParent(this, SymObs.get());
564  return S;
565  }
566 
572  template <typename... Args> Symbol* addSymbol(Context& C, Args... A) {
573  return addSymbol(Symbol::Create(C, A...));
574  }
575 
582  symbol_name_range findSymbols(const std::string& N) {
583  auto Found = Symbols.get<by_name>().equal_range(N);
584  return boost::make_iterator_range(Found.first, Found.second);
585  }
586 
593  const_symbol_name_range findSymbols(const std::string& N) const {
594  auto Found = Symbols.get<by_name>().equal_range(N);
595  return boost::make_iterator_range(Found.first, Found.second);
596  }
597 
605  auto Found = Symbols.get<by_address>().equal_range(X);
606  return boost::make_iterator_range(Found.first, Found.second);
607  }
608 
616  auto Found = Symbols.get<by_address>().equal_range(X);
617  return boost::make_iterator_range(Found.first, Found.second);
618  }
619 
628  auto& Index = Symbols.get<by_address>();
629  return boost::make_iterator_range(Index.lower_bound(Lower),
630  Index.lower_bound(Upper));
631  }
632 
641  auto& Index = Symbols.get<by_address>();
642  return boost::make_iterator_range(Index.lower_bound(Lower),
643  Index.lower_bound(Upper));
644  }
645 
652  symbol_ref_range findSymbols(const Node& Referent) {
653  return Symbols.get<by_referent>().equal_range(&Referent);
654  }
655 
662  const_symbol_ref_range findSymbols(const Node& Referent) const {
663  return Symbols.get<by_referent>().equal_range(&Referent);
664  }
665 
667  // (end group of symbol-related type aliases and functions)
668 
672  const std::string& getName() const { return Name; }
673 
675  void setName(const std::string& X);
676 
679 
681  using section_iterator = boost::indirect_iterator<SectionSet::iterator>;
683  using section_range = boost::iterator_range<section_iterator>;
685  using section_subrange = boost::iterator_range<
686  boost::indirect_iterator<SectionIntMap::codomain_type::iterator>>;
691  using section_name_iterator =
692  boost::indirect_iterator<SectionSet::index<by_name>::type::iterator>;
697  using section_name_range = boost::iterator_range<section_name_iterator>;
703  using const_section_iterator =
704  boost::indirect_iterator<SectionSet::const_iterator, const Section&>;
710  using const_section_range = boost::iterator_range<const_section_iterator>;
712  using const_section_subrange = boost::iterator_range<boost::indirect_iterator<
713  SectionIntMap::codomain_type::const_iterator, const Section&>>;
719  boost::indirect_iterator<SectionSet::index<by_name>::type::const_iterator,
720  const Section&>;
726  boost::iterator_range<const_section_name_iterator>;
727 
729  section_iterator sections_begin() { return Sections.begin(); }
731  const_section_iterator sections_begin() const { return Sections.begin(); }
734  return Sections.get<by_name>().begin();
735  }
738  return Sections.get<by_name>().begin();
739  }
741  section_iterator sections_end() { return Sections.end(); }
744  const_section_iterator sections_end() const { return Sections.end(); }
747  return Sections.get<by_name>().end();
748  }
752  return Sections.get<by_name>().end();
753  }
756  return boost::make_iterator_range(sections_begin(), sections_end());
757  }
760  return boost::make_iterator_range(sections_begin(), sections_end());
761  }
762 
771  ChangeStatus removeSection(Section* S);
772 
779  // Section (\c NoChange), or could not be completed (\c Rejected).
780  ChangeStatus addSection(Section* S);
781 
789  template <typename... Args> Section* addSection(Context& C, Args&&... A) {
790  Section* S = Section::Create(C, std::forward<Args>(A)...);
791  [[maybe_unused]] ChangeStatus status = addSection(S);
792  // addSection(Section*) does not currently reject any changes and, because
793  // we just created the Section to add, it cannot result in NoChange.
794  assert(status == ChangeStatus::Accepted &&
795  "unexpected result when inserting Section");
796  return S;
797  }
798 
805  if (auto It = SectionAddrs.find(X); It != SectionAddrs.end()) {
806  return boost::make_iterator_range(It->second.begin(), It->second.end());
807  }
808  return {};
809  }
810 
817  if (auto It = SectionAddrs.find(X); It != SectionAddrs.end()) {
818  return boost::make_iterator_range(It->second.begin(), It->second.end());
819  }
820  return {};
821  }
822 
829  auto Pair = Sections.get<by_address>().equal_range(A);
830  return boost::make_iterator_range(section_iterator(Pair.first),
831  section_iterator(Pair.second));
832  }
833 
841  auto& Index = Sections.get<by_address>();
842  return boost::make_iterator_range(
843  section_iterator(Index.lower_bound(Low)),
844  section_iterator(Index.lower_bound(High)));
845  }
846 
853  auto Pair = Sections.get<by_address>().equal_range(A);
854  return boost::make_iterator_range(const_section_iterator(Pair.first),
855  const_section_iterator(Pair.second));
856  }
857 
865  auto& Index = Sections.get<by_address>();
866  return boost::make_iterator_range(
867  const_section_iterator(Index.lower_bound(Low)),
868  const_section_iterator(Index.lower_bound(High)));
869  }
870 
876 
877  section_name_range findSections(const std::string& X) {
878  auto Pair = Sections.get<by_name>().equal_range(X);
879  return boost::make_iterator_range(section_name_iterator(Pair.first),
880  section_name_iterator(Pair.second));
881  }
882 
888  const_section_name_range findSections(const std::string& X) const {
889  auto Pair = Sections.get<by_name>().equal_range(X);
890  return boost::make_iterator_range(const_section_name_iterator(Pair.first),
891  const_section_name_iterator(Pair.second));
892  }
893 
895  // (end group of Section-related types and functions)
896 
899 
901  using byte_interval_iterator =
902  MergeSortedIterator<Section::byte_interval_iterator, AddressLess>;
904  using byte_interval_range = boost::iterator_range<byte_interval_iterator>;
906  using byte_interval_subrange = boost::iterator_range<MergeSortedIterator<
907  Section::byte_interval_subrange::iterator, AddressLess>>;
910  MergeSortedIterator<Section::const_byte_interval_iterator, AddressLess>;
913  boost::iterator_range<const_byte_interval_iterator>;
916  boost::iterator_range<MergeSortedIterator<
917  Section::const_byte_interval_subrange::iterator, AddressLess>>;
918 
921  return byte_interval_iterator(
922  boost::make_transform_iterator(this->sections_begin(),
923  NodeToByteIntervalRange<Section>()),
924  boost::make_transform_iterator(this->sections_end(),
925  NodeToByteIntervalRange<Section>()));
926  }
927 
931  return byte_interval_iterator();
932  }
933 
936  return boost::make_iterator_range(byte_intervals_begin(),
937  byte_intervals_end());
938  }
939 
943  boost::make_transform_iterator(
944  this->sections_begin(), NodeToByteIntervalRange<const Section>()),
945  boost::make_transform_iterator(
946  this->sections_end(), NodeToByteIntervalRange<const Section>()));
947  }
948 
953  }
954 
957  return boost::make_iterator_range(byte_intervals_begin(),
958  byte_intervals_end());
959  }
960 
968  section_subrange Range = findSectionsOn(A);
969  return byte_interval_subrange(
970  byte_interval_subrange::iterator(
971  boost::make_transform_iterator(Range.begin(),
972  FindByteIntervalsIn<Section>(A)),
973  boost::make_transform_iterator(Range.end(),
974  FindByteIntervalsIn<Section>(A))),
975  byte_interval_subrange::iterator());
976  }
977 
985  const_section_subrange Range = findSectionsOn(A);
987  const_byte_interval_subrange::iterator(
988  boost::make_transform_iterator(
989  Range.begin(), FindByteIntervalsIn<const Section>(A)),
990  boost::make_transform_iterator(
991  Range.end(), FindByteIntervalsIn<const Section>(A))),
992  const_byte_interval_subrange::iterator());
993  }
994 
1001  section_subrange Range = findSectionsOn(A);
1002  return byte_interval_range(
1003  byte_interval_range::iterator(
1004  boost::make_transform_iterator(Range.begin(),
1005  FindByteIntervalsAt<Section>(A)),
1006  boost::make_transform_iterator(Range.end(),
1007  FindByteIntervalsAt<Section>(A))),
1008  byte_interval_range::iterator());
1009  }
1010 
1019  std::vector<Section::byte_interval_range> Ranges;
1020  for (Section& S : findSectionsOn(Low))
1021  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1022  for (Section& S : findSectionsAt(Low + 1, High))
1023  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1026  }
1027 
1034  const_section_subrange Range = findSectionsOn(A);
1036  const_byte_interval_range::iterator(
1037  boost::make_transform_iterator(
1038  Range.begin(), FindByteIntervalsAt<const Section>(A)),
1039  boost::make_transform_iterator(
1040  Range.end(), FindByteIntervalsAt<const Section>(A))),
1041  const_byte_interval_range::iterator());
1042  }
1043 
1052  std::vector<Section::const_byte_interval_range> Ranges;
1053  for (const Section& S : findSectionsOn(Low))
1054  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1055  for (const Section& S : findSectionsAt(Low + 1, High))
1056  Ranges.push_back(S.findByteIntervalsAt(Low, High));
1059  }
1061  // (end group of ByteInterval-related types and functions)
1062 
1065 
1070  using block_iterator =
1071  MergeSortedIterator<Section::block_iterator, BlockAddressLess>;
1076  using block_range = boost::iterator_range<block_iterator>;
1081  using block_subrange = boost::iterator_range<
1082  MergeSortedIterator<Section::block_subrange::iterator, BlockAddressLess>>;
1087  using const_block_iterator =
1088  MergeSortedIterator<Section::const_block_iterator, BlockAddressLess>;
1093  using const_block_range = boost::iterator_range<const_block_iterator>;
1097  using const_block_subrange = boost::iterator_range<MergeSortedIterator<
1098  Section::const_block_subrange::iterator, BlockAddressLess>>;
1099 
1102  return block_iterator(
1103  boost::make_transform_iterator(this->sections_begin(),
1104  NodeToBlockRange<Section>()),
1105  boost::make_transform_iterator(this->sections_end(),
1106  NodeToBlockRange<Section>()));
1107  }
1108 
1111 
1114  return boost::make_iterator_range(blocks_begin(), blocks_end());
1115  }
1116 
1119  return const_block_iterator(
1120  boost::make_transform_iterator(this->sections_begin(),
1121  NodeToBlockRange<const Section>()),
1122  boost::make_transform_iterator(this->sections_end(),
1123  NodeToBlockRange<const Section>()));
1124  }
1125 
1128 
1131  return boost::make_iterator_range(blocks_begin(), blocks_end());
1132  }
1133 
1142  section_subrange SectionRange = findSectionsOn(A);
1143  return block_subrange(
1144  block_subrange::iterator(
1145  boost::make_transform_iterator(SectionRange.begin(),
1146  FindBlocksIn<Section>(A)),
1147  boost::make_transform_iterator(SectionRange.end(),
1148  FindBlocksIn<Section>(A))),
1149  block_subrange::iterator());
1150  }
1151 
1160  const_section_subrange SectionRange = findSectionsOn(A);
1161  return const_block_subrange(
1162  const_block_subrange::iterator(
1163  boost::make_transform_iterator(SectionRange.begin(),
1164  FindBlocksIn<const Section>(A)),
1165  boost::make_transform_iterator(SectionRange.end(),
1166  FindBlocksIn<const Section>(A))),
1167  const_block_subrange::iterator());
1168  }
1169 
1177  section_subrange SectionRange = findSectionsOn(A);
1178  return block_range(block_range::iterator(
1179  boost::make_transform_iterator(
1180  SectionRange.begin(), FindBlocksAt<Section>(A)),
1181  boost::make_transform_iterator(
1182  SectionRange.end(), FindBlocksAt<Section>(A))),
1183  block_range::iterator());
1184  }
1185 
1194  std::vector<Section::block_range> Ranges;
1195  for (Section& S : findSectionsOn(Low))
1196  Ranges.push_back(S.findBlocksAt(Low, High));
1197  for (Section& S : findSectionsAt(Low + 1, High))
1198  Ranges.push_back(S.findBlocksAt(Low, High));
1199  return block_range(block_iterator(Ranges), block_iterator());
1200  }
1201 
1209  const_section_subrange SectionRange = findSectionsOn(A);
1210  return const_block_range(
1211  const_block_range::iterator(
1212  boost::make_transform_iterator(SectionRange.begin(),
1213  FindBlocksAt<const Section>(A)),
1214  boost::make_transform_iterator(SectionRange.end(),
1215  FindBlocksAt<const Section>(A))),
1216  const_block_range::iterator());
1217  }
1218 
1227  std::vector<Section::const_block_range> Ranges;
1228  for (const Section& S : findSectionsOn(Low))
1229  Ranges.push_back(S.findBlocksAt(Low, High));
1230  for (const Section& S : findSectionsAt(Low + 1, High))
1231  Ranges.push_back(S.findBlocksAt(Low, High));
1232  return const_block_range(const_block_iterator(Ranges),
1234  }
1236  // (end group of Block-related types and functions)
1237 
1240 
1245  using code_block_iterator =
1246  MergeSortedIterator<Section::code_block_iterator, AddressLess>;
1251  using code_block_range = boost::iterator_range<code_block_iterator>;
1257  using code_block_subrange = boost::iterator_range<
1258  MergeSortedIterator<Section::code_block_subrange::iterator, AddressLess>>;
1264  MergeSortedIterator<Section::const_code_block_iterator, AddressLess>;
1269  using const_code_block_range =
1270  boost::iterator_range<const_code_block_iterator>;
1276  using const_code_block_subrange = boost::iterator_range<MergeSortedIterator<
1277  Section::const_code_block_subrange::iterator, AddressLess>>;
1278 
1279 private:
1280  code_block_range makeCodeBlockRange(SectionSet::iterator Begin,
1281  SectionSet::iterator End) {
1282  NodeToCodeBlockRange<Section> Transformer;
1283  return boost::make_iterator_range(
1285  boost::make_transform_iterator(section_iterator(Begin),
1286  Transformer),
1287  boost::make_transform_iterator(section_iterator(End), Transformer)),
1289  }
1290 
1291 public:
1294  return code_block_iterator(
1295  boost::make_transform_iterator(this->sections_begin(),
1296  NodeToCodeBlockRange<Section>()),
1297  boost::make_transform_iterator(this->sections_end(),
1298  NodeToCodeBlockRange<Section>()));
1299  }
1300 
1304 
1307  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1308  }
1309 
1313  boost::make_transform_iterator(this->sections_begin(),
1314  NodeToCodeBlockRange<const Section>()),
1315  boost::make_transform_iterator(this->sections_end(),
1316  NodeToCodeBlockRange<const Section>()));
1317  }
1318 
1322  return const_code_block_iterator();
1323  }
1324 
1327  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1328  }
1329 
1337  section_subrange Range = findSectionsOn(A);
1338  return code_block_subrange(
1339  code_block_subrange::iterator(
1340  boost::make_transform_iterator(Range.begin(),
1341  FindCodeBlocksIn<Section>(A)),
1342  boost::make_transform_iterator(Range.end(),
1343  FindCodeBlocksIn<Section>(A))),
1344  code_block_subrange::iterator());
1345  }
1346 
1354  const_section_subrange Range = findSectionsOn(A);
1356  const_code_block_subrange::iterator(
1357  boost::make_transform_iterator(Range.begin(),
1358  FindCodeBlocksIn<const Section>(A)),
1359  boost::make_transform_iterator(Range.end(),
1360  FindCodeBlocksIn<const Section>(A))),
1361  const_code_block_subrange::iterator());
1362  }
1363 
1370  section_subrange Range = findSectionsOn(A);
1371  return code_block_range(
1372  code_block_range::iterator(
1373  boost::make_transform_iterator(Range.begin(),
1374  FindCodeBlocksAt<Section>(A)),
1375  boost::make_transform_iterator(Range.end(),
1376  FindCodeBlocksAt<Section>(A))),
1377  code_block_range::iterator());
1378  }
1379 
1387  std::vector<Section::code_block_range> Ranges;
1388  for (Section& S : findSectionsOn(Low))
1389  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1390  for (Section& S : findSectionsAt(Low + 1, High))
1391  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1393  }
1394 
1401  const_section_subrange Range = findSectionsOn(A);
1402  return const_code_block_range(
1403  const_code_block_range::iterator(
1404  boost::make_transform_iterator(Range.begin(),
1405  FindCodeBlocksAt<const Section>(A)),
1406  boost::make_transform_iterator(Range.end(),
1407  FindCodeBlocksAt<const Section>(A))),
1408  const_code_block_range::iterator());
1409  }
1410 
1418  std::vector<Section::const_code_block_range> Ranges;
1419  for (const Section& S : findSectionsOn(Low))
1420  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1421  for (const Section& S : findSectionsAt(Low + 1, High))
1422  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1425  }
1427  // (end group of CodeBlock-related types and functions)
1428 
1431 
1436  using data_block_iterator =
1437  MergeSortedIterator<Section::data_block_iterator, AddressLess>;
1442  using data_block_range = boost::iterator_range<data_block_iterator>;
1448  using data_block_subrange = boost::iterator_range<
1449  MergeSortedIterator<Section::data_block_subrange::iterator, AddressLess>>;
1455  MergeSortedIterator<Section::const_data_block_iterator, AddressLess>;
1460  using const_data_block_range =
1461  boost::iterator_range<const_data_block_iterator>;
1467  using const_data_block_subrange = boost::iterator_range<MergeSortedIterator<
1468  Section::const_data_block_subrange::iterator, AddressLess>>;
1469 
1472  return data_block_iterator(
1473  boost::make_transform_iterator(this->sections_begin(),
1474  NodeToDataBlockRange<Section>()),
1475  boost::make_transform_iterator(this->sections_end(),
1476  NodeToDataBlockRange<Section>()));
1477  }
1478 
1482 
1485  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1486  }
1487 
1491  boost::make_transform_iterator(this->sections_begin(),
1492  NodeToDataBlockRange<const Section>()),
1493  boost::make_transform_iterator(this->sections_end(),
1494  NodeToDataBlockRange<const Section>()));
1495  }
1496 
1500  return const_data_block_iterator();
1501  }
1502 
1505  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1506  }
1507 
1515  section_subrange Range = findSectionsOn(A);
1516  return data_block_subrange(
1517  data_block_subrange::iterator(
1518  boost::make_transform_iterator(Range.begin(),
1519  FindDataBlocksIn<Section>(A)),
1520  boost::make_transform_iterator(Range.end(),
1521  FindDataBlocksIn<Section>(A))),
1522  data_block_subrange::iterator());
1523  }
1524 
1532  const_section_subrange Range = findSectionsOn(A);
1534  const_data_block_subrange::iterator(
1535  boost::make_transform_iterator(Range.begin(),
1536  FindDataBlocksIn<const Section>(A)),
1537  boost::make_transform_iterator(Range.end(),
1538  FindDataBlocksIn<const Section>(A))),
1539  const_data_block_subrange::iterator());
1540  }
1541 
1548  section_subrange Range = findSectionsOn(A);
1549  return data_block_range(
1550  data_block_range::iterator(
1551  boost::make_transform_iterator(Range.begin(),
1552  FindDataBlocksAt<Section>(A)),
1553  boost::make_transform_iterator(Range.end(),
1554  FindDataBlocksAt<Section>(A))),
1555  data_block_range::iterator());
1556  }
1557 
1565  std::vector<Section::data_block_range> Ranges;
1566  for (Section& S : findSectionsOn(Low))
1567  Ranges.push_back(S.findDataBlocksAt(Low, High));
1568  for (Section& S : findSectionsAt(Low + 1, High))
1569  Ranges.push_back(S.findDataBlocksAt(Low, High));
1571  }
1572 
1579  const_section_subrange Range = findSectionsOn(A);
1580  return const_data_block_range(
1581  const_data_block_range::iterator(
1582  boost::make_transform_iterator(Range.begin(),
1583  FindDataBlocksAt<const Section>(A)),
1584  boost::make_transform_iterator(Range.end(),
1585  FindDataBlocksAt<const Section>(A))),
1586  const_data_block_range::iterator());
1587  }
1588 
1596  std::vector<Section::const_data_block_range> Ranges;
1597  for (const Section& S : findSectionsOn(Low))
1598  Ranges.push_back(S.findDataBlocksAt(Low, High));
1599  for (const Section& S : findSectionsAt(Low + 1, High))
1600  Ranges.push_back(S.findDataBlocksAt(Low, High));
1603  }
1605  // (end group of DataBlock-related types and functions)
1606 
1609 
1613  using symbolic_expression_iterator =
1614  MergeSortedIterator<Section::symbolic_expression_iterator,
1620  boost::iterator_range<symbolic_expression_iterator>;
1624  using const_symbolic_expression_iterator = MergeSortedIterator<
1631  boost::iterator_range<const_symbolic_expression_iterator>;
1632 
1636  boost::make_transform_iterator(
1637  this->sections_begin(), NodeToSymbolicExpressionRange<Section>()),
1638  boost::make_transform_iterator(
1639  this->sections_end(), NodeToSymbolicExpressionRange<Section>()));
1640  }
1641 
1646  }
1647 
1650  return boost::make_iterator_range(symbolic_expressions_begin(),
1651  symbolic_expressions_end());
1652  }
1653 
1657  boost::make_transform_iterator(
1658  this->sections_begin(),
1659  NodeToSymbolicExpressionRange<const Section>()),
1660  boost::make_transform_iterator(
1661  this->sections_end(),
1662  NodeToSymbolicExpressionRange<const Section>()));
1663  }
1664 
1669  }
1670 
1673  return boost::make_iterator_range(symbolic_expressions_begin(),
1674  symbolic_expressions_end());
1675  }
1676 
1685  symbolic_expression_range::iterator(
1686  boost::make_transform_iterator(this->sections_begin(),
1687  FindSymExprsAt<Section>(A)),
1688  boost::make_transform_iterator(this->sections_end(),
1689  FindSymExprsAt<Section>(A))),
1690  symbolic_expression_range::iterator());
1691  }
1692 
1703  symbolic_expression_range::iterator(
1704  boost::make_transform_iterator(
1705  this->sections_begin(),
1706  FindSymExprsBetween<Section>(Low, High)),
1707  boost::make_transform_iterator(
1708  this->sections_end(), FindSymExprsBetween<Section>(Low, High))),
1709  symbolic_expression_range::iterator());
1710  }
1711 
1720  const_symbolic_expression_range::iterator(
1721  boost::make_transform_iterator(this->sections_begin(),
1722  FindSymExprsAt<const Section>(A)),
1723  boost::make_transform_iterator(this->sections_end(),
1724  FindSymExprsAt<const Section>(A))),
1725  const_symbolic_expression_range::iterator());
1726  }
1727 
1737  Addr High) const {
1739  const_symbolic_expression_range::iterator(
1740  boost::make_transform_iterator(
1741  this->sections_begin(),
1742  FindSymExprsBetween<const Section>(Low, High)),
1743  boost::make_transform_iterator(
1744  this->sections_end(),
1745  FindSymExprsBetween<const Section>(Low, High))),
1746  const_symbolic_expression_range::iterator());
1747  }
1749  // (end group of SymbolicExpression-related types and functions)
1750 
1752  static bool classof(const Node* N) { return N->getKind() == Kind::Module; }
1754 
1755 private:
1757  using MessageType = proto::Module;
1758 
1760  void removeSectionAddrs(Section* S);
1761 
1766  void insertSectionAddrs(Section* S);
1767 
1773  void toProtobuf(MessageType* Message) const;
1774 
1781  static ErrorOr<Module*> fromProtobuf(Context& C, const MessageType& Message);
1782 
1783  // Present for testing purposes only.
1784  void save(std::ostream& Out) const;
1785 
1786  // Present for testing purposes only.
1787  static Module* load(Context& C, std::istream& In);
1788 
1789  void setParent(IR* I, ModuleObserver* O) {
1790  Parent = I;
1791  Observer = O;
1792  }
1793 
1794  IR* Parent{nullptr};
1795  ModuleObserver* Observer{nullptr};
1796  std::string BinaryPath;
1797  Addr PreferredAddr;
1798  int64_t RebaseDelta{0};
1802  std::string Name;
1803  CodeBlock* EntryPoint{nullptr};
1804  ProxyBlockSet ProxyBlocks;
1805  SectionSet Sections;
1806  SectionIntMap SectionAddrs;
1807  SymbolSet Symbols;
1808 
1809  std::unique_ptr<SectionObserver> SecObs;
1810  std::unique_ptr<SymbolObserver> SymObs;
1811 
1812  friend class Context; // Allow Context to construct new Modules.
1813  friend class IR; // Allow IRs to call setIR, Create, etc.
1814  // Allow serialization from IR via containerToProtobuf.
1815  template <typename T> friend typename T::MessageType toProtobuf(const T&);
1816  friend class SerializationTestHarness; // Testing support.
1817 };
1818 
1823 
1825 public:
1826  virtual ~ModuleObserver() = default;
1827 
1835  virtual ChangeStatus nameChange(Module* M, const std::string& OldName,
1836  const std::string& NewName) = 0;
1837 
1844  virtual ChangeStatus addProxyBlocks(Module* M,
1845  Module::proxy_block_range Blocks) = 0;
1846 
1853  virtual ChangeStatus removeProxyBlocks(Module* M,
1854  Module::proxy_block_range Blocks) = 0;
1855 
1862  virtual ChangeStatus addCodeBlocks(Module* M,
1863  Module::code_block_range Blocks) = 0;
1864 
1871  virtual ChangeStatus removeCodeBlocks(Module* M,
1872  Module::code_block_range Blocks) = 0;
1873 };
1874 
1875 inline void Module::setName(const std::string& X) {
1876  if (Observer) {
1877  std::string OldName = X;
1878  std::swap(Name, OldName);
1879  [[maybe_unused]] ChangeStatus status =
1880  Observer->nameChange(this, OldName, Name);
1881  // The known observers do not reject insertions. If that changes, this
1882  // method must be updated.
1883  assert(status != ChangeStatus::Rejected &&
1884  "recovering from rejected name change is unimplemented");
1885  } else {
1886  Name = X;
1887  }
1888 }
1889 } // namespace gtirb
1890 
1891 #endif // GTIRB_MODULE_H
gtirb::Module::addSection
Section * addSection(Context &C, Args &&... A)
Creates a new Section in this module.
Definition: Module.hpp:789
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:1051
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:424
gtirb::Module::getName
const std::string & getName() const
Get the module name.
Definition: Module.hpp:672
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:207
gtirb::Module::proxy_blocks_begin
const_proxy_block_iterator proxy_blocks_begin() const
Return a constant iterator to the first ProxyBlock.
Definition: Module.hpp:299
gtirb::Module::sections
const_section_range sections() const
Return a constant range of the sections (Section).
Definition: Module.hpp:759
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:400
gtirb::Module::blocks_begin
const_block_iterator blocks_begin() const
Return an iterator to the first block.
Definition: Module.hpp:1118
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:289
gtirb::Context::Create
NodeTy * Create(Args &&... TheArgs)
Create an object of type T.
Definition: Context.hpp:126
gtirb::Module::code_blocks_begin
code_block_iterator code_blocks_begin()
Return an iterator to the first CodeBlock.
Definition: Module.hpp:1293
gtirb::Module::findSymbols
const_symbol_ref_range findSymbols(const Node &Referent) const
Find symbols by their referent object.
Definition: Module.hpp:662
gtirb::Module::addSymbol
Symbol * addSymbol(Symbol *S)
Move a Symbol object to be located in this module.
Definition: Module.hpp:558
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:615
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:746
gtirb::Module::findSectionsOn
section_subrange findSectionsOn(Addr X)
Find a Section containing an address.
Definition: Module.hpp:804
gtirb::Module::symbol_ref_iterator
boost::indirect_iterator< SymbolSet::index< by_referent >::type::iterator > symbol_ref_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:436
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:720
gtirb::Module::symbolic_expression_iterator
MergeSortedIterator< Section::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Module.hpp:1615
gtirb::Module::symbolic_expressions
const_symbolic_expression_range symbolic_expressions() const
Return a range of all the SymbolicExpression objects.
Definition: Module.hpp:1672
gtirb::Module::byte_intervals_begin
byte_interval_iterator byte_intervals_begin()
Return an iterator to the first ByteInterval.
Definition: Module.hpp:920
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:1386
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:910
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:36
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:1667
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:445
gtirb::Module::addSymbol
Symbol * addSymbol(Context &C, Args... A)
Creates a new Symbol in this module.
Definition: Module.hpp:572
gtirb::Module::const_section_range
boost::iterator_range< const_section_iterator > const_section_range
Constant range of sections (Section).
Definition: Module.hpp:710
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:913
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:272
gtirb::Module::section_range
boost::iterator_range< section_iterator > section_range
Range of sections (Section).
Definition: Module.hpp:683
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:518
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:1417
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:470
gtirb::Module::findSectionsAt
section_range findSectionsAt(Addr A)
Find all the sections that start at an address.
Definition: Module.hpp:828
gtirb::Module::code_blocks_end
code_block_iterator code_blocks_end()
Return an iterator to the element following the last CodeBlock.
Definition: Module.hpp:1303
gtirb::Module::byte_interval_range
boost::iterator_range< byte_interval_iterator > byte_interval_range
Range of ByteInterval objects.
Definition: Module.hpp:904
gtirb::Context
The context under which GTIRB operations occur.
Definition: Context.hpp:63
gtirb::Module::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr A)
Find all the intervals that start at an address.
Definition: Module.hpp:1000
Node.hpp
Class gtirb::Node.
gtirb::Module::setName
void setName(const std::string &X)
Set the module name.
Definition: Module.hpp:1875
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:216
gtirb::Module::getEntryPoint
const CodeBlock * getEntryPoint() const
Get the entry point of this module, or null if not present.
Definition: Module.hpp:270
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:816
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:377
gtirb::Module::symbols_end
const_symbol_iterator symbols_end() const
Return a constant iterator to the element following the last Symbol.
Definition: Module.hpp:466
gtirb::Module::setISA
void setISA(gtirb::ISA X)
Set the ISA of the instructions in this Module.
Definition: Module.hpp:252
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:907
gtirb::Module::code_block_range
boost::iterator_range< code_block_iterator > code_block_range
Range of CodeBlock objects.
Definition: Module.hpp:1251
gtirb::Module::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr A) const
Find all the intervals that start at an address.
Definition: Module.hpp:1033
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:697
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:1159
gtirb::Module::const_symbolic_expression_range
boost::iterator_range< const_symbolic_expression_iterator > const_symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: Module.hpp:1631
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:984
gtirb::Module::byte_intervals
byte_interval_range byte_intervals()
Return a range of all the ByteInterval objects.
Definition: Module.hpp:935
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:430
gtirb::Module::symbols_begin
symbol_iterator symbols_begin()
Return an iterator to the first Symbol.
Definition: Module.hpp:453
gtirb::Module::section_iterator
boost::indirect_iterator< SectionSet::iterator > section_iterator
Iterator over sections (Section).
Definition: Module.hpp:681
gtirb::Module::findByteIntervalsOn
byte_interval_subrange findByteIntervalsOn(Addr A)
Find all the intervals that contain the address specified.
Definition: Module.hpp:967
gtirb::Module::symbol_addr_iterator
boost::indirect_iterator< SymbolSet::index< by_address >::type::iterator > symbol_addr_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:413
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:1449
gtirb::Module::data_blocks
data_block_range data_blocks()
Return a range of all the DataBlock objects.
Definition: Module.hpp:1484
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:493
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:388
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:1626
gtirb::Module::const_code_block_iterator
MergeSortedIterator< Section::const_code_block_iterator, AddressLess > const_code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1264
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:593
gtirb::Module::symbols_by_addr
symbol_addr_range symbols_by_addr()
Return a range of the symbols (Symbol), ordered by address.
Definition: Module.hpp:527
gtirb::Module::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr A)
Find all the code blocks that start at an address.
Definition: Module.hpp:1369
gtirb::SymAttribute::S
@ S
gtirb::Module::blocks_begin
block_iterator blocks_begin()
Return an iterator to the first block.
Definition: Module.hpp:1101
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:1620
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:223
gtirb::Module::symbol_addr_range
boost::iterator_range< symbol_addr_iterator > symbol_addr_range
Range of symbols (Symbol).
Definition: Module.hpp:418
gtirb::Module::symbolic_expressions_end
symbolic_expression_iterator symbolic_expressions_end()
Return an iterator to the element following the last SymbolicExpression.
Definition: Module.hpp:1644
gtirb::Module::proxy_blocks
const_proxy_block_range proxy_blocks() const
Return a constant range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:316
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:303
gtirb::Module::block_range
boost::iterator_range< block_iterator > block_range
Range of blocks.
Definition: Module.hpp:1076
gtirb::Module::setPreferredAddr
void setPreferredAddr(gtirb::Addr X)
Set the preferred address for loading this module.
Definition: Module.hpp:231
gtirb::Module::findSections
section_name_range findSections(const std::string &X)
Find a Section by name.
Definition: Module.hpp:877
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:1489
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:941
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:686
gtirb::Module::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:312
gtirb::Module::const_block_range
boost::iterator_range< const_block_iterator > const_block_range
Range of blocks.
Definition: Module.hpp:1093
gtirb::Module::findSymbols
symbol_addr_range findSymbols(Addr Lower, Addr Upper)
Find symbols by a range of addresses.
Definition: Module.hpp:627
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:1564
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:726
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:902
gtirb::Module::symbolic_expressions
symbolic_expression_range symbolic_expressions()
Return a range of all the SymbolicExpression objects.
Definition: Module.hpp:1649
gtirb::Module::blocks
block_range blocks()
Return a range of all the blocks.
Definition: Module.hpp:1113
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:713
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:1578
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:1098
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:545
gtirb::ISA::PPC64
@ PPC64
gtirb::Module::findSymbols
symbol_ref_range findSymbols(const Node &Referent)
Find symbols by their referent object.
Definition: Module.hpp:652
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:888
gtirb::Module::proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::iterator > proxy_block_iterator
Iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:284
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:1208
gtirb::Module::getIR
const IR * getIR() const
Get the IR this module belongs to.
Definition: Module.hpp:180
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:1018
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:704
gtirb::Module::setBinaryPath
void setBinaryPath(const std::string &X)
Set the location of the corresponding binary on disk.
Definition: Module.hpp:190
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:840
gtirb::Module::getIR
IR * getIR()
Get the IR this module belongs to.
Definition: Module.hpp:182
gtirb::Module::byte_intervals
const_byte_interval_range byte_intervals() const
Return a range of all the ByteInterval objects.
Definition: Module.hpp:956
gtirb::Module::getISA
gtirb::ISA getISA() const
Get the ISA of the instructions in this Module.
Definition: Module.hpp:257
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:503
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:533
gtirb::Module::sections_end
section_iterator sections_end()
Return an iterator to the element following the last Section.
Definition: Module.hpp:741
gtirb::ModuleObserver
Interface for notifying observers when the Module is updated.
Definition: Module.hpp:1824
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:1514
gtirb::Module::code_block_iterator
MergeSortedIterator< Section::code_block_iterator, AddressLess > code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1246
gtirb::Module::data_block_iterator
MergeSortedIterator< Section::data_block_iterator, AddressLess > data_block_iterator
Iterator over DataBlock objects.
Definition: Module.hpp:1437
gtirb::Module::Create
static Module * Create(Context &C, const std::string &Name)
Create a Module object.
Definition: Module.hpp:175
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:737
gtirb::Module::proxy_blocks_begin
proxy_block_iterator proxy_blocks_begin()
Return an iterator to the first ProxyBlock.
Definition: Module.hpp:295
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:1531
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:292
gtirb::Module::const_data_block_iterator
MergeSortedIterator< Section::const_data_block_iterator, AddressLess > const_data_block_iterator
Iterator over DataBlock objects.
Definition: Module.hpp:1455
gtirb::Module::block_iterator
MergeSortedIterator< Section::block_iterator, BlockAddressLess > block_iterator
Iterator over blocks.
Definition: Module.hpp:1071
gtirb::Module::findSectionsAt
const_section_range findSectionsAt(Addr A) const
Find all the sections that start at an address.
Definition: Module.hpp:852
gtirb::Module::data_blocks
const_data_block_range data_blocks() const
Return a range of all the DataBlock objects.
Definition: Module.hpp:1504
gtirb::Module::symbols_by_name
symbol_name_range symbols_by_name()
Return a range of the symbols (Symbol), ordered by name.
Definition: Module.hpp:497
gtirb::Module::findSymbols
symbol_addr_range findSymbols(Addr X)
Find symbols by address.
Definition: Module.hpp:604
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:1141
gtirb::Module::byte_intervals_end
byte_interval_iterator byte_intervals_end()
Return an iterator to the element following the last ByteInterval.
Definition: Module.hpp:930
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:1321
gtirb::Module::blocks_end
const_block_iterator blocks_end() const
Return an iterator to the element following the last block.
Definition: Module.hpp:1127
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:1226
gtirb::Module::setByteOrder
void setByteOrder(gtirb::ByteOrder X)
Set the endianness of the instructions in this Module.
Definition: Module.hpp:262
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:406
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:513
gtirb::Module::findBlocksAt
block_range findBlocksAt(Addr A)
Find all the blocks that start at an address.
Definition: Module.hpp:1176
gtirb::Module::const_code_block_range
boost::iterator_range< const_code_block_iterator > const_code_block_range
Range of CodeBlock objects.
Definition: Module.hpp:1270
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:744
gtirb::Module::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr A) const
Find all the code blocks that start at an address.
Definition: Module.hpp:1400
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:1595
gtirb::FileFormat::Undefined
@ Undefined
gtirb::Module::symbol_range
boost::iterator_range< symbol_iterator > symbol_range
Range of symbols (Symbol).
Definition: Module.hpp:372
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:381
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:864
gtirb::Module::symbol_ref_range
boost::iterator_range< symbol_ref_iterator > symbol_ref_range
Range of symbols (Symbol).
Definition: Module.hpp:440
gtirb::ISA::MIPS32
@ MIPS32
gtirb::Module::getBinaryPath
const std::string & getBinaryPath() const
Get the location of the corresponding binary on disk.
Definition: Module.hpp:195
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:1634
gtirb::Module::sections_begin
section_iterator sections_begin()
Return an iterator to the first Section.
Definition: Module.hpp:729
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:751
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:1655
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:951
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:308
gtirb::Module::getPreferredAddr
gtirb::Addr getPreferredAddr() const
Get the preferred address for loading this module.
Definition: Module.hpp:237
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:1082
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:523
gtirb::Module::code_blocks
const_code_block_range code_blocks() const
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1326
gtirb::Module
Represents a single binary (library or executable).
Definition: Module.hpp:107
gtirb::Module::symbols_end
symbol_iterator symbols_end()
Return an iterator to the element following the last Symbol.
Definition: Module.hpp:461
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:1277
gtirb::Module::section_name_iterator
boost::indirect_iterator< SectionSet::index< by_name >::type::iterator > section_name_iterator
Iterator over sections (Section).
Definition: Module.hpp:692
gtirb::Module::code_blocks_begin
const_code_block_iterator code_blocks_begin() const
Return an iterator to the first CodeBlock.
Definition: Module.hpp:1311
gtirb::Module::data_block_range
boost::iterator_range< data_block_iterator > data_block_range
Range of DataBlock objects.
Definition: Module.hpp:1442
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:1499
gtirb::Module::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr A)
Find all the symbolic expressions that start at an address.
Definition: Module.hpp:1683
gtirb::Module::blocks
const_block_range blocks() const
Return a range of all the blocks.
Definition: Module.hpp:1130
gtirb::Module::findDataBlocksAt
data_block_range findDataBlocksAt(Addr A)
Find all the data blocks that start at an address.
Definition: Module.hpp:1547
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:731
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:488
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:483
gtirb::Module::findBlocksAt
block_range findBlocksAt(Addr Low, Addr High)
Find all the blocks that start between a range of addresses.
Definition: Module.hpp:1193
gtirb::Module::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1306
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:479
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:1468
gtirb::Module::sections_by_name_begin
section_name_iterator sections_by_name_begin()
Return an iterator to the first Section.
Definition: Module.hpp:733
gtirb::Module::symbol_iterator
boost::indirect_iterator< SymbolSet::index< by_pointer >::type::iterator > symbol_iterator
Iterator over symbols (Symbol).
Definition: Module.hpp:368
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:1336
gtirb::ISA
ISA
Definition: Module.hpp:75
gtirb::Module::setEntryPoint
void setEntryPoint(CodeBlock *CB)
Set the entry point of this module.
Definition: Module.hpp:277
gtirb::Module::blocks_end
block_iterator blocks_end()
Return an iterator to the element following the last block.
Definition: Module.hpp:1110
gtirb::Module::symbols_begin
const_symbol_iterator symbols_begin() const
Return a constant iterator to the first Symbol.
Definition: Module.hpp:457
gtirb::Module::addProxyBlock
ProxyBlock * addProxyBlock(Context &C, Args &&... A)
Creates a new ProxyBlock in this module.
Definition: Module.hpp:347
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:1353
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:1736
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:1701
gtirb::Module::findSymbols
symbol_name_range findSymbols(const std::string &N)
Find symbols by name.
Definition: Module.hpp:582
gtirb::Module::sections
section_range sections()
Return a range of the sections (Section).
Definition: Module.hpp:755
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:393
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:201
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:509
gtirb::Module::const_block_iterator
MergeSortedIterator< Section::const_block_iterator, BlockAddressLess > const_block_iterator
Iterator over blocks.
Definition: Module.hpp:1088
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:1471
gtirb::Module::proxy_block_range
boost::iterator_range< proxy_block_iterator > proxy_block_range
Range of proxy_blocks (ProxyBlock).
Definition: Module.hpp:286
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:267
gtirb::ByteOrder
ByteOrder
Definition: Module.hpp:97
gtirb::Module::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr A) const
Find all the symbolic expressions that start at an address.
Definition: Module.hpp:1718
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:1461
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::Module::findSymbols
const_symbol_addr_range findSymbols(Addr Lower, Addr Upper) const
Find symbols by a range of addresses.
Definition: Module.hpp:640
gtirb::Module::isRelocated
bool isRelocated() const
Has the image been loaded somewhere other than its preferred address?
Definition: Module.hpp:247
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:917
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:1258
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:450
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:474
gtirb::Module::data_blocks_end
data_block_iterator data_blocks_end()
Return an iterator to the element following the last DataBlock.
Definition: Module.hpp:1481
gtirb::FileFormat::XCOFF
@ XCOFF
Non-COFF (files start with ANON_OBJECT_HEADER*)