GTIRB  v2.1.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>;
1098  using const_block_subrange = boost::iterator_range<MergeSortedIterator<
1099  Section::const_block_subrange::iterator, BlockAddressLess>>;
1100 
1103  return block_iterator(
1104  boost::make_transform_iterator(this->sections_begin(),
1105  NodeToBlockRange<Section>()),
1106  boost::make_transform_iterator(this->sections_end(),
1107  NodeToBlockRange<Section>()));
1108  }
1109 
1112 
1115  return boost::make_iterator_range(blocks_begin(), blocks_end());
1116  }
1117 
1120  return const_block_iterator(
1121  boost::make_transform_iterator(this->sections_begin(),
1122  NodeToBlockRange<const Section>()),
1123  boost::make_transform_iterator(this->sections_end(),
1124  NodeToBlockRange<const Section>()));
1125  }
1126 
1129 
1132  return boost::make_iterator_range(blocks_begin(), blocks_end());
1133  }
1134 
1143  section_subrange SectionRange = findSectionsOn(A);
1144  return block_subrange(
1145  block_subrange::iterator(
1146  boost::make_transform_iterator(SectionRange.begin(),
1147  FindBlocksIn<Section>(A)),
1148  boost::make_transform_iterator(SectionRange.end(),
1149  FindBlocksIn<Section>(A))),
1150  block_subrange::iterator());
1151  }
1152 
1161  const_section_subrange SectionRange = findSectionsOn(A);
1162  return const_block_subrange(
1163  const_block_subrange::iterator(
1164  boost::make_transform_iterator(SectionRange.begin(),
1165  FindBlocksIn<const Section>(A)),
1166  boost::make_transform_iterator(SectionRange.end(),
1167  FindBlocksIn<const Section>(A))),
1168  const_block_subrange::iterator());
1169  }
1170 
1178  section_subrange SectionRange = findSectionsOn(A);
1179  return block_range(block_range::iterator(
1180  boost::make_transform_iterator(
1181  SectionRange.begin(), FindBlocksAt<Section>(A)),
1182  boost::make_transform_iterator(
1183  SectionRange.end(), FindBlocksAt<Section>(A))),
1184  block_range::iterator());
1185  }
1186 
1195  std::vector<Section::block_range> Ranges;
1196  for (Section& S : findSectionsOn(Low))
1197  Ranges.push_back(S.findBlocksAt(Low, High));
1198  for (Section& S : findSectionsAt(Low + 1, High))
1199  Ranges.push_back(S.findBlocksAt(Low, High));
1200  return block_range(block_iterator(Ranges), block_iterator());
1201  }
1202 
1210  const_section_subrange SectionRange = findSectionsOn(A);
1211  return const_block_range(
1212  const_block_range::iterator(
1213  boost::make_transform_iterator(SectionRange.begin(),
1214  FindBlocksAt<const Section>(A)),
1215  boost::make_transform_iterator(SectionRange.end(),
1216  FindBlocksAt<const Section>(A))),
1217  const_block_range::iterator());
1218  }
1219 
1228  std::vector<Section::const_block_range> Ranges;
1229  for (const Section& S : findSectionsOn(Low))
1230  Ranges.push_back(S.findBlocksAt(Low, High));
1231  for (const Section& S : findSectionsAt(Low + 1, High))
1232  Ranges.push_back(S.findBlocksAt(Low, High));
1233  return const_block_range(const_block_iterator(Ranges),
1235  }
1237  // (end group of Block-related types and functions)
1238 
1241 
1246  using code_block_iterator =
1247  MergeSortedIterator<Section::code_block_iterator, AddressLess>;
1252  using code_block_range = boost::iterator_range<code_block_iterator>;
1258  using code_block_subrange = boost::iterator_range<
1259  MergeSortedIterator<Section::code_block_subrange::iterator, AddressLess>>;
1265  MergeSortedIterator<Section::const_code_block_iterator, AddressLess>;
1270  using const_code_block_range =
1271  boost::iterator_range<const_code_block_iterator>;
1277  using const_code_block_subrange = boost::iterator_range<MergeSortedIterator<
1278  Section::const_code_block_subrange::iterator, AddressLess>>;
1279 
1280 private:
1281  code_block_range makeCodeBlockRange(SectionSet::iterator Begin,
1282  SectionSet::iterator End) {
1283  NodeToCodeBlockRange<Section> Transformer;
1284  return boost::make_iterator_range(
1286  boost::make_transform_iterator(section_iterator(Begin),
1287  Transformer),
1288  boost::make_transform_iterator(section_iterator(End), Transformer)),
1290  }
1291 
1292 public:
1295  return code_block_iterator(
1296  boost::make_transform_iterator(this->sections_begin(),
1297  NodeToCodeBlockRange<Section>()),
1298  boost::make_transform_iterator(this->sections_end(),
1299  NodeToCodeBlockRange<Section>()));
1300  }
1301 
1305 
1308  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1309  }
1310 
1314  boost::make_transform_iterator(this->sections_begin(),
1315  NodeToCodeBlockRange<const Section>()),
1316  boost::make_transform_iterator(this->sections_end(),
1317  NodeToCodeBlockRange<const Section>()));
1318  }
1319 
1323  return const_code_block_iterator();
1324  }
1325 
1328  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1329  }
1330 
1338  section_subrange Range = findSectionsOn(A);
1339  return code_block_subrange(
1340  code_block_subrange::iterator(
1341  boost::make_transform_iterator(Range.begin(),
1342  FindCodeBlocksIn<Section>(A)),
1343  boost::make_transform_iterator(Range.end(),
1344  FindCodeBlocksIn<Section>(A))),
1345  code_block_subrange::iterator());
1346  }
1347 
1355  const_section_subrange Range = findSectionsOn(A);
1357  const_code_block_subrange::iterator(
1358  boost::make_transform_iterator(Range.begin(),
1359  FindCodeBlocksIn<const Section>(A)),
1360  boost::make_transform_iterator(Range.end(),
1361  FindCodeBlocksIn<const Section>(A))),
1362  const_code_block_subrange::iterator());
1363  }
1364 
1371  section_subrange Range = findSectionsOn(A);
1372  return code_block_range(
1373  code_block_range::iterator(
1374  boost::make_transform_iterator(Range.begin(),
1375  FindCodeBlocksAt<Section>(A)),
1376  boost::make_transform_iterator(Range.end(),
1377  FindCodeBlocksAt<Section>(A))),
1378  code_block_range::iterator());
1379  }
1380 
1388  std::vector<Section::code_block_range> Ranges;
1389  for (Section& S : findSectionsOn(Low))
1390  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1391  for (Section& S : findSectionsAt(Low + 1, High))
1392  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1394  }
1395 
1402  const_section_subrange Range = findSectionsOn(A);
1403  return const_code_block_range(
1404  const_code_block_range::iterator(
1405  boost::make_transform_iterator(Range.begin(),
1406  FindCodeBlocksAt<const Section>(A)),
1407  boost::make_transform_iterator(Range.end(),
1408  FindCodeBlocksAt<const Section>(A))),
1409  const_code_block_range::iterator());
1410  }
1411 
1419  std::vector<Section::const_code_block_range> Ranges;
1420  for (const Section& S : findSectionsOn(Low))
1421  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1422  for (const Section& S : findSectionsAt(Low + 1, High))
1423  Ranges.push_back(S.findCodeBlocksAt(Low, High));
1426  }
1428  // (end group of CodeBlock-related types and functions)
1429 
1432 
1437  using data_block_iterator =
1438  MergeSortedIterator<Section::data_block_iterator, AddressLess>;
1443  using data_block_range = boost::iterator_range<data_block_iterator>;
1449  using data_block_subrange = boost::iterator_range<
1450  MergeSortedIterator<Section::data_block_subrange::iterator, AddressLess>>;
1456  MergeSortedIterator<Section::const_data_block_iterator, AddressLess>;
1461  using const_data_block_range =
1462  boost::iterator_range<const_data_block_iterator>;
1468  using const_data_block_subrange = boost::iterator_range<MergeSortedIterator<
1469  Section::const_data_block_subrange::iterator, AddressLess>>;
1470 
1473  return data_block_iterator(
1474  boost::make_transform_iterator(this->sections_begin(),
1475  NodeToDataBlockRange<Section>()),
1476  boost::make_transform_iterator(this->sections_end(),
1477  NodeToDataBlockRange<Section>()));
1478  }
1479 
1483 
1486  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1487  }
1488 
1492  boost::make_transform_iterator(this->sections_begin(),
1493  NodeToDataBlockRange<const Section>()),
1494  boost::make_transform_iterator(this->sections_end(),
1495  NodeToDataBlockRange<const Section>()));
1496  }
1497 
1501  return const_data_block_iterator();
1502  }
1503 
1506  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1507  }
1508 
1516  section_subrange Range = findSectionsOn(A);
1517  return data_block_subrange(
1518  data_block_subrange::iterator(
1519  boost::make_transform_iterator(Range.begin(),
1520  FindDataBlocksIn<Section>(A)),
1521  boost::make_transform_iterator(Range.end(),
1522  FindDataBlocksIn<Section>(A))),
1523  data_block_subrange::iterator());
1524  }
1525 
1533  const_section_subrange Range = findSectionsOn(A);
1535  const_data_block_subrange::iterator(
1536  boost::make_transform_iterator(Range.begin(),
1537  FindDataBlocksIn<const Section>(A)),
1538  boost::make_transform_iterator(Range.end(),
1539  FindDataBlocksIn<const Section>(A))),
1540  const_data_block_subrange::iterator());
1541  }
1542 
1549  section_subrange Range = findSectionsOn(A);
1550  return data_block_range(
1551  data_block_range::iterator(
1552  boost::make_transform_iterator(Range.begin(),
1553  FindDataBlocksAt<Section>(A)),
1554  boost::make_transform_iterator(Range.end(),
1555  FindDataBlocksAt<Section>(A))),
1556  data_block_range::iterator());
1557  }
1558 
1566  std::vector<Section::data_block_range> Ranges;
1567  for (Section& S : findSectionsOn(Low))
1568  Ranges.push_back(S.findDataBlocksAt(Low, High));
1569  for (Section& S : findSectionsAt(Low + 1, High))
1570  Ranges.push_back(S.findDataBlocksAt(Low, High));
1572  }
1573 
1580  const_section_subrange Range = findSectionsOn(A);
1581  return const_data_block_range(
1582  const_data_block_range::iterator(
1583  boost::make_transform_iterator(Range.begin(),
1584  FindDataBlocksAt<const Section>(A)),
1585  boost::make_transform_iterator(Range.end(),
1586  FindDataBlocksAt<const Section>(A))),
1587  const_data_block_range::iterator());
1588  }
1589 
1597  std::vector<Section::const_data_block_range> Ranges;
1598  for (const Section& S : findSectionsOn(Low))
1599  Ranges.push_back(S.findDataBlocksAt(Low, High));
1600  for (const Section& S : findSectionsAt(Low + 1, High))
1601  Ranges.push_back(S.findDataBlocksAt(Low, High));
1604  }
1606  // (end group of DataBlock-related types and functions)
1607 
1610 
1614  using symbolic_expression_iterator =
1615  MergeSortedIterator<Section::symbolic_expression_iterator,
1621  boost::iterator_range<symbolic_expression_iterator>;
1625  using const_symbolic_expression_iterator = MergeSortedIterator<
1632  boost::iterator_range<const_symbolic_expression_iterator>;
1633 
1637  boost::make_transform_iterator(
1638  this->sections_begin(), NodeToSymbolicExpressionRange<Section>()),
1639  boost::make_transform_iterator(
1640  this->sections_end(), NodeToSymbolicExpressionRange<Section>()));
1641  }
1642 
1647  }
1648 
1651  return boost::make_iterator_range(symbolic_expressions_begin(),
1652  symbolic_expressions_end());
1653  }
1654 
1658  boost::make_transform_iterator(
1659  this->sections_begin(),
1660  NodeToSymbolicExpressionRange<const Section>()),
1661  boost::make_transform_iterator(
1662  this->sections_end(),
1663  NodeToSymbolicExpressionRange<const Section>()));
1664  }
1665 
1670  }
1671 
1674  return boost::make_iterator_range(symbolic_expressions_begin(),
1675  symbolic_expressions_end());
1676  }
1677 
1686  symbolic_expression_range::iterator(
1687  boost::make_transform_iterator(this->sections_begin(),
1688  FindSymExprsAt<Section>(A)),
1689  boost::make_transform_iterator(this->sections_end(),
1690  FindSymExprsAt<Section>(A))),
1691  symbolic_expression_range::iterator());
1692  }
1693 
1704  symbolic_expression_range::iterator(
1705  boost::make_transform_iterator(
1706  this->sections_begin(),
1707  FindSymExprsBetween<Section>(Low, High)),
1708  boost::make_transform_iterator(
1709  this->sections_end(), FindSymExprsBetween<Section>(Low, High))),
1710  symbolic_expression_range::iterator());
1711  }
1712 
1721  const_symbolic_expression_range::iterator(
1722  boost::make_transform_iterator(this->sections_begin(),
1723  FindSymExprsAt<const Section>(A)),
1724  boost::make_transform_iterator(this->sections_end(),
1725  FindSymExprsAt<const Section>(A))),
1726  const_symbolic_expression_range::iterator());
1727  }
1728 
1738  Addr High) const {
1740  const_symbolic_expression_range::iterator(
1741  boost::make_transform_iterator(
1742  this->sections_begin(),
1743  FindSymExprsBetween<const Section>(Low, High)),
1744  boost::make_transform_iterator(
1745  this->sections_end(),
1746  FindSymExprsBetween<const Section>(Low, High))),
1747  const_symbolic_expression_range::iterator());
1748  }
1750  // (end group of SymbolicExpression-related types and functions)
1751 
1753  static bool classof(const Node* N) { return N->getKind() == Kind::Module; }
1755 
1756 private:
1758  using MessageType = proto::Module;
1759 
1761  void removeSectionAddrs(Section* S);
1762 
1767  void insertSectionAddrs(Section* S);
1768 
1774  void toProtobuf(MessageType* Message) const;
1775 
1782  static ErrorOr<Module*> fromProtobuf(Context& C, const MessageType& Message);
1783 
1784  // Present for testing purposes only.
1785  void save(std::ostream& Out) const;
1786 
1787  // Present for testing purposes only.
1788  static Module* load(Context& C, std::istream& In);
1789 
1790  void setParent(IR* I, ModuleObserver* O) {
1791  Parent = I;
1792  Observer = O;
1793  }
1794 
1795  IR* Parent{nullptr};
1796  ModuleObserver* Observer{nullptr};
1797  std::string BinaryPath;
1798  Addr PreferredAddr;
1799  int64_t RebaseDelta{0};
1803  std::string Name;
1804  CodeBlock* EntryPoint{nullptr};
1805  ProxyBlockSet ProxyBlocks;
1806  SectionSet Sections;
1807  SectionIntMap SectionAddrs;
1808  SymbolSet Symbols;
1809 
1810  std::unique_ptr<SectionObserver> SecObs;
1811  std::unique_ptr<SymbolObserver> SymObs;
1812 
1813  friend class Context; // Allow Context to construct new Modules.
1814  friend class IR; // Allow IRs to call setIR, Create, etc.
1815  // Allow serialization from IR via containerToProtobuf.
1816  template <typename T> friend typename T::MessageType toProtobuf(const T&);
1817  friend class SerializationTestHarness; // Testing support.
1818 };
1819 
1824 
1826 public:
1827  virtual ~ModuleObserver() = default;
1828 
1836  virtual ChangeStatus nameChange(Module* M, const std::string& OldName,
1837  const std::string& NewName) = 0;
1838 
1845  virtual ChangeStatus addProxyBlocks(Module* M,
1846  Module::proxy_block_range Blocks) = 0;
1847 
1854  virtual ChangeStatus removeProxyBlocks(Module* M,
1855  Module::proxy_block_range Blocks) = 0;
1856 
1863  virtual ChangeStatus addCodeBlocks(Module* M,
1864  Module::code_block_range Blocks) = 0;
1865 
1872  virtual ChangeStatus removeCodeBlocks(Module* M,
1873  Module::code_block_range Blocks) = 0;
1874 };
1875 
1876 inline void Module::setName(const std::string& X) {
1877  if (Observer) {
1878  std::string OldName = X;
1879  std::swap(Name, OldName);
1880  [[maybe_unused]] ChangeStatus status =
1881  Observer->nameChange(this, OldName, Name);
1882  // The known observers do not reject insertions. If that changes, this
1883  // method must be updated.
1884  assert(status != ChangeStatus::Rejected &&
1885  "recovering from rejected name change is unimplemented");
1886  } else {
1887  Name = X;
1888  }
1889 }
1890 } // namespace gtirb
1891 
1892 #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:1119
gtirb::CodeBlock
A basic block.
Definition: CodeBlock.hpp:54
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:1294
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:1616
gtirb::Module::symbolic_expressions
const_symbolic_expression_range symbolic_expressions() const
Return a range of all the SymbolicExpression objects.
Definition: Module.hpp:1673
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:1387
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:1668
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:1418
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:1304
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:1876
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:1252
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:1160
gtirb::Module::const_symbolic_expression_range
boost::iterator_range< const_symbolic_expression_iterator > const_symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: Module.hpp:1632
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:1450
gtirb::Module::data_blocks
data_block_range data_blocks()
Return a range of all the DataBlock objects.
Definition: Module.hpp:1485
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:1627
gtirb::Module::const_code_block_iterator
MergeSortedIterator< Section::const_code_block_iterator, AddressLess > const_code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1265
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:1370
gtirb::SymAttribute::S
@ S
gtirb::Module::blocks_begin
block_iterator blocks_begin()
Return an iterator to the first block.
Definition: Module.hpp:1102
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:1621
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:1645
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:1490
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:1565
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:1650
gtirb::Module::blocks
block_range blocks()
Return a range of all the blocks.
Definition: Module.hpp:1114
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:1579
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:1099
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:1090
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:1209
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:1825
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:1515
gtirb::Module::code_block_iterator
MergeSortedIterator< Section::code_block_iterator, AddressLess > code_block_iterator
Iterator over CodeBlock objects.
Definition: Module.hpp:1247
gtirb::Module::data_block_iterator
MergeSortedIterator< Section::data_block_iterator, AddressLess > data_block_iterator
Iterator over DataBlock objects.
Definition: Module.hpp:1438
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:1532
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:1456
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:1505
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:1142
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:1322
gtirb::Module::blocks_end
const_block_iterator blocks_end() const
Return an iterator to the element following the last block.
Definition: Module.hpp:1128
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:1227
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:1177
gtirb::Module::const_code_block_range
boost::iterator_range< const_code_block_iterator > const_code_block_range
Range of CodeBlock objects.
Definition: Module.hpp:1271
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:1401
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:1596
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:1635
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:1656
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:1327
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:1278
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:1312
gtirb::Module::data_block_range
boost::iterator_range< data_block_iterator > data_block_range
Range of DataBlock objects.
Definition: Module.hpp:1443
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:1500
gtirb::Module::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr A)
Find all the symbolic expressions that start at an address.
Definition: Module.hpp:1684
gtirb::Module::blocks
const_block_range blocks() const
Return a range of all the blocks.
Definition: Module.hpp:1131
gtirb::Module::findDataBlocksAt
data_block_range findDataBlocksAt(Addr A)
Find all the data blocks that start at an address.
Definition: Module.hpp:1548
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:1194
gtirb::Module::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1307
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:1469
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:1337
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:1111
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:1354
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:1737
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:1702
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:1472
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:1719
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:1462
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:1259
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:1482
gtirb::FileFormat::XCOFF
@ XCOFF
Non-COFF (files start with ANON_OBJECT_HEADER*)