GTIRB  v2.1.0
GrammaTech Intermediate Representation for Binaries: C++ API
IR.hpp
Go to the documentation of this file.
1 //===- IR.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_IR_H
16 #define GTIRB_IR_H
17 
18 #include <gtirb/Addr.hpp>
19 #include <gtirb/AuxData.hpp>
21 #include <gtirb/CFG.hpp>
22 #include <gtirb/ErrorOr.hpp>
23 #include <gtirb/Module.hpp>
24 #include <gtirb/Node.hpp>
25 #include <gtirb/Observer.hpp>
26 #include <gtirb/Utility.hpp>
27 #include <gtirb/version.h>
28 #include <boost/iterator/indirect_iterator.hpp>
29 #include <boost/multi_index_container.hpp>
30 #include <boost/range/iterator_range.hpp>
31 #include <map>
32 #include <string>
33 #include <vector>
34 
37 
38 namespace gtirb {
39 namespace proto {
40 class IR;
41 }
75 
77  IR(Context& C);
78  IR(Context& C, const UUID& U);
79 
80  static IR* Create(Context& C, const UUID& U) { return C.Create<IR>(C, U); }
81 
82  struct by_name {};
83  struct by_pointer {};
84 
85  using ModuleSet = boost::multi_index::multi_index_container<
86  Module*, boost::multi_index::indexed_by<
87  boost::multi_index::ordered_non_unique<
88  boost::multi_index::tag<by_name>,
89  boost::multi_index::const_mem_fun<
90  Module, const std::string&, &Module::getName>>,
91  boost::multi_index::hashed_unique<
92  boost::multi_index::tag<by_pointer>,
93  boost::multi_index::identity<Module*>>>>;
94 
95  class ModuleObserverImpl;
96 
97 public:
103  static IR* Create(Context& C) { return C.Create<IR>(C); }
104 
108  const CFG& getCFG() const { return Cfg; }
109 
114  CFG& getCFG() { return Cfg; }
115 
122  using module_iterator = boost::indirect_iterator<ModuleSet::iterator>;
127  using const_module_iterator =
128  boost::indirect_iterator<ModuleSet::const_iterator, const Module>;
129 
131  module_iterator modules_begin() { return Modules.begin(); }
133  module_iterator modules_end() { return Modules.end(); }
135  const_module_iterator modules_begin() const { return Modules.begin(); }
138  const_module_iterator modules_end() const { return Modules.end(); }
139 
144  using module_range = boost::iterator_range<module_iterator>;
149  using const_module_range = boost::iterator_range<const_module_iterator>;
150 
153  return boost::make_iterator_range(modules_begin(), modules_end());
154  }
157  return boost::make_iterator_range(modules_begin(), modules_end());
158  }
159 
164  using module_name_iterator =
165  boost::indirect_iterator<ModuleSet::index<by_name>::type::iterator>;
170  using module_name_range = boost::iterator_range<module_name_iterator>;
176  boost::indirect_iterator<ModuleSet::index<by_name>::type::const_iterator,
177  const Module>;
183  boost::iterator_range<const_module_name_iterator>;
184 
192  bool removeModule(Module* M) {
193  auto& Index = Modules.get<by_pointer>();
194  if (auto Iter = Index.find(M); Iter != Index.end()) {
195  MO->removeProxyBlocks(M, M->proxy_blocks());
196  MO->removeCodeBlocks(M, M->code_blocks());
197  Index.erase(Iter);
198  M->setParent(nullptr, nullptr);
199  return true;
200  }
201  return false;
202  }
203 
208  if (M->getIR()) {
209  M->getIR()->removeModule(M);
210  }
211 
212  MO->addProxyBlocks(M, M->proxy_blocks());
213  MO->addCodeBlocks(M, M->code_blocks());
214  Modules.emplace(M);
215  M->setParent(this, MO.get());
216  return M;
217  }
218 
222  // FIXME: this API may wind up getting removed because we perhaps want to
223  // support creating a Module that is not hooked up to any IR object and then
224  // set the parent on the module later. Personally, I think that is a
225  // dangerous design choice, but we can argue the merits of both approaches in
226  // a code review.
227  template <typename... Args> Module* addModule(Context& C, Args... A) {
228  return addModule(Module::Create(C, A...));
229  }
230 
237  module_name_range findModules(const std::string& N) {
238  auto Found = Modules.get<by_name>().equal_range(N);
239  return boost::make_iterator_range(Found.first, Found.second);
240  }
241 
248  const_module_name_range findModules(const std::string& N) const {
249  auto Found = Modules.get<by_name>().equal_range(N);
250  return boost::make_iterator_range(Found.first, Found.second);
251  }
252 
254  // (end Module-Related Public Types and Functions)
255 
261  void save(std::ostream& Out) const;
262 
268  void saveJSON(std::ostream& Out) const;
269 
273  enum class load_error {
274  IncorrectVersion = 1,
275  CorruptFile,
276  CorruptModule,
277  CorruptSection,
278  CorruptByteInterval,
279  CorruptCFG,
280  BadUUID,
281  MissingUUID,
282  NotGTIRB,
283  };
284 
291  static ErrorOr<IR*> load(Context& C, std::istream& In);
292 
299  static ErrorOr<IR*> loadJSON(Context& C, std::istream& In);
300 
303 
305  using proxy_block_iterator = MergeSortedIterator<Module::proxy_block_iterator,
306  ArbitraryLess<ProxyBlock>>;
308  using proxy_block_range = boost::iterator_range<proxy_block_iterator>;
311  MergeSortedIterator<Module::const_proxy_block_iterator,
312  ArbitraryLess<ProxyBlock>>;
315  boost::iterator_range<const_proxy_block_iterator>;
316 
319  return proxy_block_iterator(
320  boost::make_transform_iterator(this->modules_begin(),
321  NodeToProxyBlockRange<Module>()),
322  boost::make_transform_iterator(this->modules_end(),
323  NodeToProxyBlockRange<Module>()));
324  }
325 
329 
332  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
333  }
334 
338  boost::make_transform_iterator(this->modules_begin(),
339  NodeToProxyBlockRange<const Module>()),
340  boost::make_transform_iterator(this->modules_end(),
341  NodeToProxyBlockRange<const Module>()));
342  }
343 
348  }
349 
352  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
353  }
355  // (end ProxyBlock-Related Public Types and Functions)
356 
359 
363  using symbol_iterator =
364  MergeSortedIterator<Module::symbol_iterator, ArbitraryLess<Symbol>>;
368  using symbol_range = boost::iterator_range<symbol_iterator>;
372  using const_symbol_iterator =
373  MergeSortedIterator<Module::const_symbol_iterator, ArbitraryLess<Symbol>>;
377  using const_symbol_range = boost::iterator_range<const_symbol_iterator>;
378 
381  return symbol_iterator(
382  boost::make_transform_iterator(this->modules_begin(),
383  NodeToSymbolRange<Module>()),
384  boost::make_transform_iterator(this->modules_end(),
385  NodeToSymbolRange<Module>()));
386  }
387 
390 
393  return boost::make_iterator_range(symbols_begin(), symbols_end());
394  }
395 
398  return const_symbol_iterator(
399  boost::make_transform_iterator(this->modules_begin(),
400  NodeToSymbolRange<const Module>()),
401  boost::make_transform_iterator(this->modules_end(),
402  NodeToSymbolRange<const Module>()));
403  }
404 
407 
410  return boost::make_iterator_range(symbols_begin(), symbols_end());
411  }
413  // (end Symbol-Related Public Types and Functions)
414 
417 
419  using section_iterator =
420  MergeSortedIterator<Module::section_iterator, AddressLess>;
422  using section_range = boost::iterator_range<section_iterator>;
424  using section_subrange = boost::iterator_range<
425  MergeSortedIterator<Module::section_subrange::iterator, AddressLess>>;
427  using const_section_iterator =
428  MergeSortedIterator<Module::const_section_iterator, AddressLess>;
430  using const_section_range = boost::iterator_range<const_section_iterator>;
432  using const_section_subrange = boost::iterator_range<MergeSortedIterator<
433  Module::const_section_subrange::iterator, AddressLess>>;
435  using section_name_iterator =
436  MergeSortedIterator<Module::section_name_iterator, AddressLess>;
438  using section_name_range = boost::iterator_range<section_name_iterator>;
441  MergeSortedIterator<Module::const_section_name_iterator, AddressLess>;
444  boost::iterator_range<const_section_name_iterator>;
445 
448  return section_iterator(
449  boost::make_transform_iterator(this->modules_begin(),
450  NodeToSectionRange<Module>()),
451  boost::make_transform_iterator(this->modules_end(),
452  NodeToSectionRange<Module>()));
453  }
454 
457 
460  return boost::make_iterator_range(sections_begin(), sections_end());
461  }
462 
465  return const_section_iterator(
466  boost::make_transform_iterator(this->modules_begin(),
467  NodeToSectionRange<const Module>()),
468  boost::make_transform_iterator(this->modules_end(),
469  NodeToSectionRange<const Module>()));
470  }
471 
474  return const_section_iterator();
475  }
476 
479  return boost::make_iterator_range(sections_begin(), sections_end());
480  }
481 
488  return section_subrange(
489  section_subrange::iterator(
490  boost::make_transform_iterator(this->modules_begin(),
491  FindSectionsIn<Module>(A)),
492  boost::make_transform_iterator(this->modules_end(),
493  FindSectionsIn<Module>(A))),
494  section_subrange::iterator());
495  }
496 
503  return const_section_subrange(
504  const_section_subrange::iterator(
505  boost::make_transform_iterator(this->modules_begin(),
506  FindSectionsIn<const Module>(A)),
507  boost::make_transform_iterator(this->modules_end(),
508  FindSectionsIn<const Module>(A))),
509  const_section_subrange::iterator());
510  }
511 
518  return section_range(
519  section_range::iterator(
520  boost::make_transform_iterator(this->modules_begin(),
521  FindSectionsAt<Module>(A)),
522  boost::make_transform_iterator(this->modules_end(),
523  FindSectionsAt<Module>(A))),
524  section_range::iterator());
525  }
526 
534  return section_range(
535  section_range::iterator(
536  boost::make_transform_iterator(
537  this->modules_begin(), FindSectionsBetween<Module>(Low, High)),
538  boost::make_transform_iterator(
539  this->modules_end(), FindSectionsBetween<Module>(Low, High))),
540  section_range::iterator());
541  }
542 
549  return const_section_range(
550  const_section_range::iterator(
551  boost::make_transform_iterator(this->modules_begin(),
552  FindSectionsAt<const Module>(A)),
553  boost::make_transform_iterator(this->modules_end(),
554  FindSectionsAt<const Module>(A))),
555  const_section_range::iterator());
556  }
557 
565  return const_section_range(
566  const_section_range::iterator(
567  boost::make_transform_iterator(
568  this->modules_begin(),
569  FindSectionsBetween<const Module>(Low, High)),
570  boost::make_transform_iterator(
571  this->modules_end(),
572  FindSectionsBetween<const Module>(Low, High))),
573  const_section_range::iterator());
574  }
580  section_name_range findSections(const std::string& X) {
581  return section_name_range(
582  section_name_range::iterator(
583  boost::make_transform_iterator(this->modules_begin(),
584  FindSections<Module>(X)),
585  boost::make_transform_iterator(this->modules_end(),
586  FindSections<Module>(X))),
587  section_name_range::iterator());
588  }
589 
595  const_section_name_range findSections(const std::string& X) const {
597  const_section_name_range::iterator(
598  boost::make_transform_iterator(this->modules_begin(),
599  FindSections<const Module>(X)),
600  boost::make_transform_iterator(this->modules_end(),
601  FindSections<const Module>(X))),
602  const_section_name_range::iterator());
603  }
605  // (end Section-Related Public Types and Functions)
606 
609 
611  using byte_interval_iterator =
612  MergeSortedIterator<Module::byte_interval_iterator, AddressLess>;
614  using byte_interval_range = boost::iterator_range<byte_interval_iterator>;
616  using byte_interval_subrange = boost::iterator_range<MergeSortedIterator<
617  Module::byte_interval_subrange::iterator, AddressLess>>;
620  MergeSortedIterator<Module::const_byte_interval_iterator, AddressLess>;
623  boost::iterator_range<const_byte_interval_iterator>;
626  boost::iterator_range<MergeSortedIterator<
627  Module::const_byte_interval_subrange::iterator, AddressLess>>;
628 
631  return byte_interval_iterator(
632  boost::make_transform_iterator(this->modules_begin(),
633  NodeToByteIntervalRange<Module>()),
634  boost::make_transform_iterator(this->modules_end(),
635  NodeToByteIntervalRange<Module>()));
636  }
637 
641  return byte_interval_iterator();
642  }
643 
646  return boost::make_iterator_range(byte_intervals_begin(),
647  byte_intervals_end());
648  }
649 
653  boost::make_transform_iterator(this->modules_begin(),
654  NodeToByteIntervalRange<const Module>()),
655  boost::make_transform_iterator(
656  this->modules_end(), NodeToByteIntervalRange<const Module>()));
657  }
658 
663  }
664 
667  return boost::make_iterator_range(byte_intervals_begin(),
668  byte_intervals_end());
669  }
670 
679  return byte_interval_subrange(
680  byte_interval_subrange::iterator(
681  boost::make_transform_iterator(this->modules_begin(),
682  FindByteIntervalsIn<Module>(A)),
683  boost::make_transform_iterator(this->modules_end(),
684  FindByteIntervalsIn<Module>(A))),
685  byte_interval_subrange::iterator());
686  }
687 
697  const_byte_interval_subrange::iterator(
698  boost::make_transform_iterator(
699  this->modules_begin(), FindByteIntervalsIn<const Module>(A)),
700  boost::make_transform_iterator(
701  this->modules_end(), FindByteIntervalsIn<const Module>(A))),
702  const_byte_interval_subrange::iterator());
703  }
704 
711  return byte_interval_range(
712  byte_interval_range::iterator(
713  boost::make_transform_iterator(this->modules_begin(),
714  FindByteIntervalsAt<Module>(A)),
715  boost::make_transform_iterator(this->modules_end(),
716  FindByteIntervalsAt<Module>(A))),
717  byte_interval_range::iterator());
718  }
719 
728  return byte_interval_range(
729  byte_interval_range::iterator(
730  boost::make_transform_iterator(
731  this->modules_begin(),
732  FindByteIntervalsBetween<Module>(Low, High)),
733  boost::make_transform_iterator(
734  this->modules_end(),
735  FindByteIntervalsBetween<Module>(Low, High))),
736  byte_interval_range::iterator());
737  }
738 
746  const_byte_interval_range::iterator(
747  boost::make_transform_iterator(
748  this->modules_begin(), FindByteIntervalsAt<const Module>(A)),
749  boost::make_transform_iterator(
750  this->modules_end(), FindByteIntervalsAt<const Module>(A))),
751  const_byte_interval_range::iterator());
752  }
753 
763  const_byte_interval_range::iterator(
764  boost::make_transform_iterator(
765  this->modules_begin(),
766  FindByteIntervalsBetween<const Module>(Low, High)),
767  boost::make_transform_iterator(
768  this->modules_end(),
769  FindByteIntervalsBetween<const Module>(Low, High))),
770  const_byte_interval_range::iterator());
771  }
773  // (end group of ByteInterval-related types and functions)
774 
777 
782  using block_iterator =
783  MergeSortedIterator<Module::block_iterator, BlockAddressLess>;
788  using block_range = boost::iterator_range<block_iterator>;
793  using block_subrange = boost::iterator_range<
794  MergeSortedIterator<Module::block_subrange::iterator, BlockAddressLess>>;
799  using const_block_iterator =
800  MergeSortedIterator<Module::const_block_iterator, BlockAddressLess>;
805  using const_block_range = boost::iterator_range<const_block_iterator>;
810  using const_block_subrange = boost::iterator_range<MergeSortedIterator<
811  Module::const_block_subrange::iterator, BlockAddressLess>>;
812 
815  return block_iterator(
816  boost::make_transform_iterator(this->modules_begin(),
817  NodeToBlockRange<Module>()),
818  boost::make_transform_iterator(this->modules_end(),
819  NodeToBlockRange<Module>()));
820  }
821 
824 
827  return boost::make_iterator_range(blocks_begin(), blocks_end());
828  }
829 
832  return const_block_iterator(
833  boost::make_transform_iterator(this->modules_begin(),
834  NodeToBlockRange<const Module>()),
835  boost::make_transform_iterator(this->modules_end(),
836  NodeToBlockRange<const Module>()));
837  }
838 
841 
844  return boost::make_iterator_range(blocks_begin(), blocks_end());
845  }
846 
855  return block_subrange(
856  block_subrange::iterator(
857  boost::make_transform_iterator(this->modules_begin(),
858  FindBlocksIn<Module>(A)),
859  boost::make_transform_iterator(this->modules_end(),
860  FindBlocksIn<Module>(A))),
861  block_subrange::iterator());
862  }
863 
872  return const_block_subrange(
873  const_block_subrange::iterator(
874  boost::make_transform_iterator(this->modules_begin(),
875  FindBlocksIn<const Module>(A)),
876  boost::make_transform_iterator(this->modules_end(),
877  FindBlocksIn<const Module>(A))),
878  const_block_subrange::iterator());
879  }
880 
888  return block_range(block_range::iterator(
889  boost::make_transform_iterator(
890  this->modules_begin(), FindBlocksAt<Module>(A)),
891  boost::make_transform_iterator(
892  this->modules_end(), FindBlocksAt<Module>(A))),
893  block_range::iterator());
894  }
895 
904  return block_range(
905  block_range::iterator(
906  boost::make_transform_iterator(
907  this->modules_begin(), FindBlocksBetween<Module>(Low, High)),
908  boost::make_transform_iterator(
909  this->modules_end(), FindBlocksBetween<Module>(Low, High))),
910  block_range::iterator());
911  }
912 
920  return const_block_range(
921  const_block_range::iterator(
922  boost::make_transform_iterator(this->modules_begin(),
923  FindBlocksAt<const Module>(A)),
924  boost::make_transform_iterator(this->modules_end(),
925  FindBlocksAt<const Module>(A))),
926  const_block_range::iterator());
927  }
928 
937  return const_block_range(
938  const_block_range::iterator(
939  boost::make_transform_iterator(
940  this->modules_begin(),
941  FindBlocksBetween<const Module>(Low, High)),
942  boost::make_transform_iterator(
943  this->modules_end(),
944  FindBlocksBetween<const Module>(Low, High))),
945  const_block_range::iterator());
946  }
948  // (end group of Block-related types and functions)
949 
952 
957  using code_block_iterator =
958  MergeSortedIterator<Module::code_block_iterator, AddressLess>;
963  using code_block_range = boost::iterator_range<code_block_iterator>;
969  using code_block_subrange = boost::iterator_range<
970  MergeSortedIterator<Module::code_block_subrange::iterator, AddressLess>>;
976  MergeSortedIterator<Module::const_code_block_iterator, AddressLess>;
981  using const_code_block_range =
982  boost::iterator_range<const_code_block_iterator>;
988  using const_code_block_subrange = boost::iterator_range<MergeSortedIterator<
989  Module::const_code_block_subrange::iterator, AddressLess>>;
990 
993  return code_block_iterator(
994  boost::make_transform_iterator(this->modules_begin(),
995  NodeToCodeBlockRange<Module>()),
996  boost::make_transform_iterator(this->modules_end(),
997  NodeToCodeBlockRange<Module>()));
998  }
999 
1003 
1006  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1007  }
1008 
1012  boost::make_transform_iterator(this->modules_begin(),
1013  NodeToCodeBlockRange<const Module>()),
1014  boost::make_transform_iterator(this->modules_end(),
1015  NodeToCodeBlockRange<const Module>()));
1016  }
1017 
1021  return const_code_block_iterator();
1022  }
1023 
1026  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1027  }
1028 
1036  return code_block_subrange(
1037  code_block_subrange::iterator(
1038  boost::make_transform_iterator(this->modules_begin(),
1039  FindCodeBlocksIn<Module>(A)),
1040  boost::make_transform_iterator(this->modules_end(),
1041  FindCodeBlocksIn<Module>(A))),
1042  code_block_subrange::iterator());
1043  }
1044 
1053  const_code_block_subrange::iterator(
1054  boost::make_transform_iterator(this->modules_begin(),
1055  FindCodeBlocksIn<const Module>(A)),
1056  boost::make_transform_iterator(this->modules_end(),
1057  FindCodeBlocksIn<const Module>(A))),
1058  const_code_block_subrange::iterator());
1059  }
1060 
1067  return code_block_range(
1068  code_block_range::iterator(
1069  boost::make_transform_iterator(this->modules_begin(),
1070  FindCodeBlocksAt<Module>(A)),
1071  boost::make_transform_iterator(this->modules_end(),
1072  FindCodeBlocksAt<Module>(A))),
1073  code_block_range::iterator());
1074  }
1075 
1083  return code_block_range(
1084  code_block_range::iterator(
1085  boost::make_transform_iterator(
1086  this->modules_begin(),
1087  FindCodeBlocksBetween<Module>(Low, High)),
1088  boost::make_transform_iterator(
1089  this->modules_end(), FindCodeBlocksBetween<Module>(Low, High))),
1090  code_block_range::iterator());
1091  }
1092 
1099  return const_code_block_range(
1100  const_code_block_range::iterator(
1101  boost::make_transform_iterator(this->modules_begin(),
1102  FindCodeBlocksAt<const Module>(A)),
1103  boost::make_transform_iterator(this->modules_end(),
1104  FindCodeBlocksAt<const Module>(A))),
1105  const_code_block_range::iterator());
1106  }
1107 
1115  return const_code_block_range(
1116  const_code_block_range::iterator(
1117  boost::make_transform_iterator(
1118  this->modules_begin(),
1119  FindCodeBlocksBetween<const Module>(Low, High)),
1120  boost::make_transform_iterator(
1121  this->modules_end(),
1122  FindCodeBlocksBetween<const Module>(Low, High))),
1123  const_code_block_range::iterator());
1124  }
1126  // (end group of CodeBlock-related types and functions)
1127 
1130 
1135  using data_block_iterator =
1136  MergeSortedIterator<Module::data_block_iterator, AddressLess>;
1141  using data_block_range = boost::iterator_range<data_block_iterator>;
1147  using data_block_subrange = boost::iterator_range<
1148  MergeSortedIterator<Module::data_block_subrange::iterator, AddressLess>>;
1154  MergeSortedIterator<Module::const_data_block_iterator, AddressLess>;
1159  using const_data_block_range =
1160  boost::iterator_range<const_data_block_iterator>;
1166  using const_data_block_subrange = boost::iterator_range<MergeSortedIterator<
1167  Module::const_data_block_subrange::iterator, AddressLess>>;
1168 
1171  return data_block_iterator(
1172  boost::make_transform_iterator(this->modules_begin(),
1173  NodeToDataBlockRange<Module>()),
1174  boost::make_transform_iterator(this->modules_end(),
1175  NodeToDataBlockRange<Module>()));
1176  }
1177 
1181 
1184  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1185  }
1186 
1190  boost::make_transform_iterator(this->modules_begin(),
1191  NodeToDataBlockRange<const Module>()),
1192  boost::make_transform_iterator(this->modules_end(),
1193  NodeToDataBlockRange<const Module>()));
1194  }
1195 
1199  return const_data_block_iterator();
1200  }
1201 
1204  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1205  }
1206 
1214  return data_block_subrange(
1215  data_block_subrange::iterator(
1216  boost::make_transform_iterator(this->modules_begin(),
1217  FindDataBlocksIn<Module>(A)),
1218  boost::make_transform_iterator(this->modules_end(),
1219  FindDataBlocksIn<Module>(A))),
1220  data_block_subrange::iterator());
1221  }
1222 
1231  const_data_block_subrange::iterator(
1232  boost::make_transform_iterator(this->modules_begin(),
1233  FindDataBlocksIn<const Module>(A)),
1234  boost::make_transform_iterator(this->modules_end(),
1235  FindDataBlocksIn<const Module>(A))),
1236  const_data_block_subrange::iterator());
1237  }
1238 
1245  return data_block_range(
1246  data_block_range::iterator(
1247  boost::make_transform_iterator(this->modules_begin(),
1248  FindDataBlocksAt<Module>(A)),
1249  boost::make_transform_iterator(this->modules_end(),
1250  FindDataBlocksAt<Module>(A))),
1251  data_block_range::iterator());
1252  }
1253 
1261  return data_block_range(
1262  data_block_range::iterator(
1263  boost::make_transform_iterator(
1264  this->modules_begin(),
1265  FindDataBlocksBetween<Module>(Low, High)),
1266  boost::make_transform_iterator(
1267  this->modules_end(), FindDataBlocksBetween<Module>(Low, High))),
1268  data_block_range::iterator());
1269  }
1270 
1277  return const_data_block_range(
1278  const_data_block_range::iterator(
1279  boost::make_transform_iterator(this->modules_begin(),
1280  FindDataBlocksAt<const Module>(A)),
1281  boost::make_transform_iterator(this->modules_end(),
1282  FindDataBlocksAt<const Module>(A))),
1283  const_data_block_range::iterator());
1284  }
1285 
1293  return const_data_block_range(
1294  const_data_block_range::iterator(
1295  boost::make_transform_iterator(
1296  this->modules_begin(),
1297  FindDataBlocksBetween<const Module>(Low, High)),
1298  boost::make_transform_iterator(
1299  this->modules_end(),
1300  FindDataBlocksBetween<const Module>(Low, High))),
1301  const_data_block_range::iterator());
1302  }
1304  // (end group of DataBlock-related types and functions)
1305 
1308 
1312  using symbolic_expression_iterator =
1313  MergeSortedIterator<Module::symbolic_expression_iterator,
1319  boost::iterator_range<symbolic_expression_iterator>;
1323  using const_symbolic_expression_iterator = MergeSortedIterator<
1330  boost::iterator_range<const_symbolic_expression_iterator>;
1331 
1335  boost::make_transform_iterator(this->modules_begin(),
1336  NodeToSymbolicExpressionRange<Module>()),
1337  boost::make_transform_iterator(
1338  this->modules_end(), NodeToSymbolicExpressionRange<Module>()));
1339  }
1340 
1345  }
1346 
1349  return boost::make_iterator_range(symbolic_expressions_begin(),
1350  symbolic_expressions_end());
1351  }
1352 
1356  boost::make_transform_iterator(
1357  this->modules_begin(),
1358  NodeToSymbolicExpressionRange<const Module>()),
1359  boost::make_transform_iterator(
1360  this->modules_end(),
1361  NodeToSymbolicExpressionRange<const Module>()));
1362  }
1363 
1368  }
1369 
1372  return boost::make_iterator_range(symbolic_expressions_begin(),
1373  symbolic_expressions_end());
1374  }
1375 
1384  symbolic_expression_range::iterator(
1385  boost::make_transform_iterator(this->modules_begin(),
1386  FindSymExprsAt<Module>(A)),
1387  boost::make_transform_iterator(this->modules_end(),
1388  FindSymExprsAt<Module>(A))),
1389  symbolic_expression_range::iterator());
1390  }
1391 
1402  symbolic_expression_range::iterator(
1403  boost::make_transform_iterator(
1404  this->modules_begin(), FindSymExprsBetween<Module>(Low, High)),
1405  boost::make_transform_iterator(
1406  this->modules_end(), FindSymExprsBetween<Module>(Low, High))),
1407  symbolic_expression_range::iterator());
1408  }
1409 
1418  const_symbolic_expression_range::iterator(
1419  boost::make_transform_iterator(this->modules_begin(),
1420  FindSymExprsAt<const Module>(A)),
1421  boost::make_transform_iterator(this->modules_end(),
1422  FindSymExprsAt<const Module>(A))),
1423  const_symbolic_expression_range::iterator());
1424  }
1425 
1435  Addr High) const {
1437  const_symbolic_expression_range::iterator(
1438  boost::make_transform_iterator(
1439  this->modules_begin(),
1440  FindSymExprsBetween<const Module>(Low, High)),
1441  boost::make_transform_iterator(
1442  this->modules_end(),
1443  FindSymExprsBetween<const Module>(Low, High))),
1444  const_symbolic_expression_range::iterator());
1445  }
1447  // (end group of SymbolicExpression-related types and functions)
1448 
1450  static bool classof(const Node* N) { return N->getKind() == Kind::IR; }
1452 
1457  uint32_t getVersion() const { return Version; }
1458 
1465  void setVersion(uint32_t V) { Version = V; }
1466 
1467 private:
1470  using MessageType = proto::IR;
1471 
1477  void toProtobuf(MessageType* Message) const;
1478 
1485  static ErrorOr<IR*> fromProtobuf(Context& C, const MessageType& Message);
1487 
1488  ModuleSet Modules;
1489  uint32_t Version{GTIRB_PROTOBUF_VERSION};
1490  CFG Cfg;
1491 
1492  std::unique_ptr<ModuleObserver> MO;
1493 
1494  friend class Context; // Allow Context to construct new IRs.
1495 };
1496 
1499 GTIRB_EXPORT_API const std::error_category& loadErrorCategory();
1500 
1504 inline std::error_code make_error_code(gtirb::IR::load_error e) {
1505  return std::error_code(static_cast<int>(e), loadErrorCategory());
1506 }
1507 
1508 } // namespace gtirb
1509 
1510 namespace std {
1511 template <>
1512 struct is_error_code_enum<gtirb::IR::load_error> : std::true_type {};
1513 } // namespace std
1514 
1515 #endif // GTIRB_IR_H
gtirb::IR::const_section_range
boost::iterator_range< const_section_iterator > const_section_range
Range of Section objects.
Definition: IR.hpp:430
gtirb::IR::addModule
Module * addModule(Module *M)
Move a Module object to be located in this IR.
Definition: IR.hpp:207
gtirb::IR::data_blocks_end
const_data_block_iterator data_blocks_end() const
Return an iterator to the element following the last DataBlock.
Definition: IR.hpp:1198
gtirb::IR::symbolic_expressions_end
symbolic_expression_iterator symbolic_expressions_end()
Return an iterator to the element following the last SymbolicExpression.
Definition: IR.hpp:1343
gtirb::Module::getName
const std::string & getName() const
Get the module name.
Definition: Module.hpp:672
gtirb::IR::const_symbol_range
boost::iterator_range< const_symbol_iterator > const_symbol_range
Range of Symbol objects.
Definition: IR.hpp:377
gtirb::IR::const_symbolic_expression_range
boost::iterator_range< const_symbolic_expression_iterator > const_symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: IR.hpp:1330
gtirb::IR::byte_intervals_begin
byte_interval_iterator byte_intervals_begin()
Return an iterator to the first ByteInterval.
Definition: IR.hpp:630
gtirb::IR::const_code_block_iterator
MergeSortedIterator< Module::const_code_block_iterator, AddressLess > const_code_block_iterator
Iterator over CodeBlock objects.
Definition: IR.hpp:976
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::IR::findDataBlocksOn
const_data_block_subrange findDataBlocksOn(Addr A) const
Find all the data blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1229
gtirb::IR::findBlocksAt
const_block_range findBlocksAt(Addr A) const
Find all the blocks that start at an address.
Definition: IR.hpp:919
gtirb::Context::Create
NodeTy * Create(Args &&... TheArgs)
Create an object of type T.
Definition: Context.hpp:126
gtirb::IR::symbolic_expressions_end
const_symbolic_expression_iterator symbolic_expressions_end() const
Return an iterator to the element following the last SymbolicExpression.
Definition: IR.hpp:1366
gtirb::IR::findBlocksOn
const_block_subrange findBlocksOn(Addr A) const
Find all the blocks that have bytes that lie within the address specified.
Definition: IR.hpp:871
gtirb::IR::modules
module_range modules()
Returns a range of the Modules.
Definition: IR.hpp:152
gtirb::Node
Represents the base of the Node class hierarchy.
Definition: Node.hpp:39
gtirb::IR::const_code_block_range
boost::iterator_range< const_code_block_iterator > const_code_block_range
Range of CodeBlock objects.
Definition: IR.hpp:982
gtirb::IR::const_section_subrange
boost::iterator_range< MergeSortedIterator< Module::const_section_subrange::iterator, AddressLess > > const_section_subrange
Sub-range of Section objects overlapping an address.
Definition: IR.hpp:433
gtirb::IR::modules_begin
const_module_iterator modules_begin() const
Returns a constant iterator to the first Module.
Definition: IR.hpp:135
gtirb::IR::sections_end
const_section_iterator sections_end() const
Return an iterator to the element following the last Section.
Definition: IR.hpp:473
gtirb::IR::sections_begin
const_section_iterator sections_begin() const
Return an iterator to the first Section.
Definition: IR.hpp:464
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::IR::data_blocks
data_block_range data_blocks()
Return a range of all the DataBlock objects.
Definition: IR.hpp:1183
gtirb::IR::data_block_iterator
MergeSortedIterator< Module::data_block_iterator, AddressLess > data_block_iterator
Iterator over DataBlock objects.
Definition: IR.hpp:1136
CFG.hpp
Types and operations for interprocedural control flow graphs (CFGs).
ErrorOr.hpp
gtirb::IR::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr Low, Addr High) const
Find all the intervals that start between a range of addresses.
Definition: IR.hpp:761
gtirb::IR::getCFG
const CFG & getCFG() const
Get the associated Control Flow Graph (CFG).
Definition: IR.hpp:108
gtirb::UUID
boost::uuids::uuid UUID
Represents a universally unique identifier used to identify Node objects across serialization boundar...
Definition: Context.hpp:36
gtirb::IR::block_subrange
boost::iterator_range< MergeSortedIterator< Module::block_subrange::iterator, BlockAddressLess > > block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: IR.hpp:794
gtirb::IR::findModules
const_module_name_range findModules(const std::string &N) const
Find modules by name.
Definition: IR.hpp:248
gtirb::Addr
A special class to store an Effective Address.
Definition: Addr.hpp:37
gtirb::const_block_iterator
cfg_node_cast_iter< const CodeBlock > const_block_iterator
Constant iterator over blocks (Block).
Definition: CFG.hpp:198
gtirb::IR::findSections
const_section_name_range findSections(const std::string &X) const
Find all the sections containing a name.
Definition: IR.hpp:595
gtirb::IR::findByteIntervalsOn
const_byte_interval_subrange findByteIntervalsOn(Addr A) const
Find all the intervals that have bytes that lie within the address specified.
Definition: IR.hpp:695
gtirb::IR::const_data_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_data_block_subrange::iterator, AddressLess > > const_data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:1167
gtirb::IR::code_blocks_end
code_block_iterator code_blocks_end()
Return an iterator to the element following the last CodeBlock.
Definition: IR.hpp:1002
gtirb::IR::byte_intervals_begin
const_byte_interval_iterator byte_intervals_begin() const
Return an iterator to the first ByteInterval.
Definition: IR.hpp:651
gtirb::IR::symbols
symbol_range symbols()
Return a range of the Symbol objects.
Definition: IR.hpp:392
gtirb::IR::const_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_block_subrange::iterator, BlockAddressLess > > const_block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: IR.hpp:811
gtirb::IR::symbolic_expression_iterator
MergeSortedIterator< Module::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: IR.hpp:1314
gtirb::Context
The context under which GTIRB operations occur.
Definition: Context.hpp:63
gtirb::IR::code_blocks_end
const_code_block_iterator code_blocks_end() const
Return an iterator to the element following the last CodeBlock.
Definition: IR.hpp:1020
gtirb::IR::findCodeBlocksOn
code_block_subrange findCodeBlocksOn(Addr A)
Find all the code blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1035
Node.hpp
Class gtirb::Node.
gtirb::IR::code_blocks_begin
const_code_block_iterator code_blocks_begin() const
Return an iterator to the first CodeBlock.
Definition: IR.hpp:1010
gtirb::IR::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr A)
Find all the code blocks that start at an address.
Definition: IR.hpp:1066
gtirb::IR::const_module_iterator
boost::indirect_iterator< ModuleSet::const_iterator, const Module > const_module_iterator
Constant iterator over Modules.
Definition: IR.hpp:128
gtirb::IR::removeModule
bool removeModule(Module *M)
Remove a Module object located in this IR.
Definition: IR.hpp:192
gtirb::IR::section_subrange
boost::iterator_range< MergeSortedIterator< Module::section_subrange::iterator, AddressLess > > section_subrange
Sub-range of Section objects overlapping an address.
Definition: IR.hpp:425
gtirb::IR::modules_end
const_module_iterator modules_end() const
Returns a constant iterator to the element following the last Module.
Definition: IR.hpp:138
gtirb::IR::symbolic_expression_range
boost::iterator_range< symbolic_expression_iterator > symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: IR.hpp:1319
gtirb::IR::symbolic_expressions_begin
const_symbolic_expression_iterator symbolic_expressions_begin() const
Return an iterator to the first SymbolicExpression.
Definition: IR.hpp:1354
gtirb::IR::sections
section_range sections()
Return a range of all the Section objects.
Definition: IR.hpp:459
gtirb::IR::byte_intervals
const_byte_interval_range byte_intervals() const
Return a range of all the ByteInterval objects.
Definition: IR.hpp:666
gtirb::IR::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr A)
Find all the intervals that start at an address.
Definition: IR.hpp:710
gtirb::IR::proxy_blocks_end
const_proxy_block_iterator proxy_blocks_end() const
Return an iterator to the element following the last ProxyBlock.
Definition: IR.hpp:346
gtirb::IR::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High) const
Find all the symbolic expressions that start between a range of addresses.
Definition: IR.hpp:1434
gtirb::IR::block_range
boost::iterator_range< block_iterator > block_range
Range of blocks.
Definition: IR.hpp:788
gtirb::IR::findSectionsOn
section_subrange findSectionsOn(Addr A)
Find a Section containing an address.
Definition: IR.hpp:487
gtirb::IR::data_blocks
const_data_block_range data_blocks() const
Return a range of all the DataBlock objects.
Definition: IR.hpp:1203
gtirb::IR::symbols_end
symbol_iterator symbols_end()
Return an iterator to the element following the last Symbol.
Definition: IR.hpp:389
gtirb::IR::code_blocks_begin
code_block_iterator code_blocks_begin()
Return an iterator to the first CodeBlock.
Definition: IR.hpp:992
version.h
Holds the version macros. Read from version.txt.
gtirb::IR::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr A) const
Find all the code blocks that start at an address.
Definition: IR.hpp:1098
gtirb::IR::byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Module::byte_interval_subrange::iterator, AddressLess > > byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: IR.hpp:617
gtirb::IR::blocks_end
block_iterator blocks_end()
Return an iterator to the element following the last block.
Definition: IR.hpp:823
gtirb::IR::setVersion
void setVersion(uint32_t V)
Set the version of the Protobuf used when creating this IR.
Definition: IR.hpp:1465
gtirb::IR::blocks_begin
block_iterator blocks_begin()
Return an iterator to the first block.
Definition: IR.hpp:814
gtirb::IR::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of all the ProxyBlock objects.
Definition: IR.hpp:331
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::IR::const_block_range
boost::iterator_range< const_block_iterator > const_block_range
Range of blocks.
Definition: IR.hpp:805
gtirb::IR::const_section_name_iterator
MergeSortedIterator< Module::const_section_name_iterator, AddressLess > const_section_name_iterator
Iterator over Section objects.
Definition: IR.hpp:441
gtirb::IR::code_block_subrange
boost::iterator_range< MergeSortedIterator< Module::code_block_subrange::iterator, AddressLess > > code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:970
gtirb::IR::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr A) const
Find all the data blocks that start at an address.
Definition: IR.hpp:1276
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::IR::const_module_range
boost::iterator_range< const_module_iterator > const_module_range
Constant range of Modules.
Definition: IR.hpp:149
gtirb::IR::const_byte_interval_range
boost::iterator_range< const_byte_interval_iterator > const_byte_interval_range
Const range of ByteInterval objects.
Definition: IR.hpp:623
gtirb::IR::findCodeBlocksOn
const_code_block_subrange findCodeBlocksOn(Addr A) const
Find all the code blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1051
gtirb::IR::symbolic_expressions
symbolic_expression_range symbolic_expressions()
Return a range of all the SymbolicExpression objects.
Definition: IR.hpp:1348
gtirb::IR::getCFG
CFG & getCFG()
Get a const reference to the associated Control Flow Graph (CFG).
Definition: IR.hpp:114
gtirb
Main namespace for the GTIRB API.
Definition: Addr.hpp:28
gtirb::IR::findByteIntervalsOn
byte_interval_subrange findByteIntervalsOn(Addr A)
Find all the intervals that have bytes that lie within the address specified.
Definition: IR.hpp:678
gtirb::IR::findModules
module_name_range findModules(const std::string &N)
Find modules by name.
Definition: IR.hpp:237
gtirb::IR::const_proxy_block_iterator
MergeSortedIterator< Module::const_proxy_block_iterator, ArbitraryLess< ProxyBlock > > const_proxy_block_iterator
Iterator over ProxyBlock objects.
Definition: IR.hpp:312
gtirb::loadErrorCategory
const GTIRB_EXPORT_API std::error_category & loadErrorCategory()
The error category used to represent load failures.
gtirb::Module::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:312
gtirb::IR::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr Low, Addr High) const
Find all the data blocks that start between a range of addresses.
Definition: IR.hpp:1292
gtirb::IR::sections_begin
section_iterator sections_begin()
Return an iterator to the first Section.
Definition: IR.hpp:447
gtirb::block_iterator
cfg_node_cast_iter< CodeBlock > block_iterator
Iterator over blocks (Block).
Definition: CFG.hpp:194
gtirb::IR::modules_begin
module_iterator modules_begin()
Returns an iterator to the first Module.
Definition: IR.hpp:131
gtirb::IR::section_name_range
boost::iterator_range< section_name_iterator > section_name_range
Range of Section objects.
Definition: IR.hpp:438
gtirb::IR::code_block_range
boost::iterator_range< code_block_iterator > code_block_range
Range of CodeBlock objects.
Definition: IR.hpp:963
gtirb::IR::blocks_end
const_block_iterator blocks_end() const
Return an iterator to the element following the last block.
Definition: IR.hpp:840
gtirb::IR::sections
const_section_range sections() const
Return a range of all the Section objects.
Definition: IR.hpp:478
gtirb::IR::data_block_subrange
boost::iterator_range< MergeSortedIterator< Module::data_block_subrange::iterator, AddressLess > > data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:1148
gtirb::IR
A complete internal representation consisting of Modules (Module).
Definition: IR.hpp:76
gtirb::IR::findSectionsAt
section_range findSectionsAt(Addr Low, Addr High)
Find all the sections that start between a range of addresses.
Definition: IR.hpp:533
gtirb::IR::Create
static IR * Create(Context &C)
Create an IR object in its default state.
Definition: IR.hpp:103
gtirb::IR::const_module_name_range
boost::iterator_range< const_module_name_iterator > const_module_name_range
Constant range of modules Modules.
Definition: IR.hpp:183
gtirb::IR::symbolic_expressions_begin
symbolic_expression_iterator symbolic_expressions_begin()
Return an iterator to the first SymbolicExpression.
Definition: IR.hpp:1333
gtirb::IR::proxy_blocks
const_proxy_block_range proxy_blocks() const
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:351
gtirb::IR::findDataBlocksOn
data_block_subrange findDataBlocksOn(Addr A)
Find all the data blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1213
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::IR::const_data_block_range
boost::iterator_range< const_data_block_iterator > const_data_block_range
Range of DataBlock objects.
Definition: IR.hpp:1160
gtirb::Module::proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::iterator > proxy_block_iterator
Iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:284
gtirb::IR::symbol_range
boost::iterator_range< symbol_iterator > symbol_range
Range of Symbol objects.
Definition: IR.hpp:368
gtirb::IR::byte_interval_iterator
MergeSortedIterator< Module::byte_interval_iterator, AddressLess > byte_interval_iterator
Iterator over ByteInterval objects.
Definition: IR.hpp:612
gtirb::IR::const_section_iterator
MergeSortedIterator< Module::const_section_iterator, AddressLess > const_section_iterator
Iterator over Section objects.
Definition: IR.hpp:428
gtirb::IR::findSectionsAt
const_section_range findSectionsAt(Addr A) const
Find all the sections that start at an address.
Definition: IR.hpp:548
gtirb::IR::module_range
boost::iterator_range< module_iterator > module_range
Range of Modules.
Definition: IR.hpp:144
gtirb::Module::getIR
const IR * getIR() const
Get the IR this module belongs to.
Definition: Module.hpp:180
gtirb::IR::const_byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Module::const_byte_interval_subrange::iterator, AddressLess > > const_byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: IR.hpp:627
gtirb::IR::proxy_blocks_end
proxy_block_iterator proxy_blocks_end()
Return an iterator to the element following the last ProxyBlock.
Definition: IR.hpp:328
gtirb::IR::data_block_range
boost::iterator_range< data_block_iterator > data_block_range
Range of DataBlock objects.
Definition: IR.hpp:1141
gtirb::IR::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr A) const
Find all the symbolic expressions that start at an address.
Definition: IR.hpp:1416
gtirb::IR::const_symbolic_expression_iterator
MergeSortedIterator< Module::const_symbolic_expression_iterator, ByteInterval::ConstSymbolicExpressionElement::AddressLess > const_symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: IR.hpp:1325
AuxDataContainer.hpp
Class gtirb::AuxDataContainer.
gtirb::IR::findBlocksAt
block_range findBlocksAt(Addr A)
Find all the blocks that start at an address.
Definition: IR.hpp:887
gtirb::IR::blocks
const_block_range blocks() const
Return a range of all the blocks.
Definition: IR.hpp:843
gtirb::IR::section_iterator
MergeSortedIterator< Module::section_iterator, AddressLess > section_iterator
Iterator over Section objects.
Definition: IR.hpp:420
gtirb::IR::proxy_blocks_begin
proxy_block_iterator proxy_blocks_begin()
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:318
gtirb::IR::findBlocksOn
block_subrange findBlocksOn(Addr A)
Find all the blocks that have bytes that lie within the address specified.
Definition: IR.hpp:854
gtirb::IR::getVersion
uint32_t getVersion() const
Get the version of the Protobuf used when creating this IR.
Definition: IR.hpp:1457
gtirb::IR::modules
const_module_range modules() const
Returns a constant range of the Modules.
Definition: IR.hpp:156
gtirb::IR::findBlocksAt
block_range findBlocksAt(Addr Low, Addr High)
Find all the blocks that start between a range of addresses.
Definition: IR.hpp:903
gtirb::IR::const_byte_interval_iterator
MergeSortedIterator< Module::const_byte_interval_iterator, AddressLess > const_byte_interval_iterator
Const iterator over ByteInterval objects.
Definition: IR.hpp:620
gtirb::IR::const_module_name_iterator
boost::indirect_iterator< ModuleSet::index< by_name >::type::const_iterator, const Module > const_module_name_iterator
Constant iterator over modules Modules.
Definition: IR.hpp:177
gtirb::IR::findSectionsAt
section_range findSectionsAt(Addr A)
Find all the sections that start at an address.
Definition: IR.hpp:517
gtirb::IR::symbols
const_symbol_range symbols() const
Return a range of the Symbol objects.
Definition: IR.hpp:409
gtirb::IR::blocks_begin
const_block_iterator blocks_begin() const
Return an iterator to the first block.
Definition: IR.hpp:831
gtirb::IR::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr A)
Find all the symbolic expressions that start at an address.
Definition: IR.hpp:1382
gtirb::IR::load_error
load_error
Specifies various failure modes when loading an IR.
Definition: IR.hpp:273
gtirb::IR::findBlocksAt
const_block_range findBlocksAt(Addr Low, Addr High) const
Find all the blocks that start between a range of addresses.
Definition: IR.hpp:936
gtirb::IR::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr Low, Addr High) const
Find all the code blocks that start between a range of addresses.
Definition: IR.hpp:1114
gtirb::IR::symbols_end
const_symbol_iterator symbols_end() const
Return an iterator to the element following the last Symbol.
Definition: IR.hpp:406
gtirb::IR::const_symbol_iterator
MergeSortedIterator< Module::const_symbol_iterator, ArbitraryLess< Symbol > > const_symbol_iterator
Iterator over Symbol objects.
Definition: IR.hpp:373
gtirb::AuxDataContainer
Contains the AuxData Tables and serves as a base class.
Definition: AuxDataContainer.hpp:56
std
Definition: Addr.hpp:359
gtirb::IR::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr Low, Addr High)
Find all the code blocks that start between a range of addresses.
Definition: IR.hpp:1082
gtirb::IR::const_code_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_code_block_subrange::iterator, AddressLess > > const_code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:989
gtirb::IR::proxy_block_range
boost::iterator_range< proxy_block_iterator > proxy_block_range
Range over ProxyBlock objects.
Definition: IR.hpp:308
gtirb::IR::const_data_block_iterator
MergeSortedIterator< Module::const_data_block_iterator, AddressLess > const_data_block_iterator
Iterator over DataBlock objects.
Definition: IR.hpp:1154
gtirb::Module
Represents a single binary (library or executable).
Definition: Module.hpp:107
gtirb::IR::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr A) const
Find all the intervals that start at an address.
Definition: IR.hpp:744
gtirb::IR::const_block_iterator
MergeSortedIterator< Module::const_block_iterator, BlockAddressLess > const_block_iterator
Iterator over blocks.
Definition: IR.hpp:800
gtirb::IR::data_blocks_begin
data_block_iterator data_blocks_begin()
Return an iterator to the first DataBlock.
Definition: IR.hpp:1170
GTIRB_PROTOBUF_VERSION
#define GTIRB_PROTOBUF_VERSION
Definition: version.h:46
gtirb::IR::findSections
section_name_range findSections(const std::string &X)
Find all the sections containing a name.
Definition: IR.hpp:580
gtirb::IR::modules_end
module_iterator modules_end()
Returns an iterator to the element following the last Module.
Definition: IR.hpp:133
gtirb::Module::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1307
Observer.hpp
gtirb::IR::code_blocks
const_code_block_range code_blocks() const
Return a range of all the CodeBlock objects.
Definition: IR.hpp:1025
gtirb::IR::addModule
Module * addModule(Context &C, Args... A)
Creates a new Module in this IR.
Definition: IR.hpp:227
gtirb::make_error_code
std::error_code make_error_code(gtirb::IR::load_error e)
Makes an std::error_code object from an IR::load_error object.
Definition: IR.hpp:1504
gtirb::IR::findSectionsAt
const_section_range findSectionsAt(Addr Low, Addr High) const
Find all the sections that start between a range of addresses.
Definition: IR.hpp:564
gtirb::IR::byte_intervals_end
byte_interval_iterator byte_intervals_end()
Return an iterator to the element following the last ByteInterval.
Definition: IR.hpp:640
gtirb::IR::section_range
boost::iterator_range< section_iterator > section_range
Range of Section objects.
Definition: IR.hpp:422
Module.hpp
Class gtirb::Module and related functions and types.
gtirb::IR::proxy_blocks_begin
const_proxy_block_iterator proxy_blocks_begin() const
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:336
gtirb::IR::module_iterator
boost::indirect_iterator< ModuleSet::iterator > module_iterator
Definition: IR.hpp:122
gtirb::IR::symbol_iterator
MergeSortedIterator< Module::symbol_iterator, ArbitraryLess< Symbol > > symbol_iterator
Iterator over Symbol objects.
Definition: IR.hpp:364
gtirb::IR::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High)
Find all the symbolic expressions that start between a range of addresses.
Definition: IR.hpp:1400
gtirb::IR::section_name_iterator
MergeSortedIterator< Module::section_name_iterator, AddressLess > section_name_iterator
Iterator over Section objects.
Definition: IR.hpp:436
AuxData.hpp
Types and operations for auxiliary data.
gtirb::IR::byte_interval_range
boost::iterator_range< byte_interval_iterator > byte_interval_range
Range of ByteInterval objects.
Definition: IR.hpp:614
gtirb::IR::findDataBlocksAt
data_block_range findDataBlocksAt(Addr Low, Addr High)
Find all the data blocks that start between a range of addresses.
Definition: IR.hpp:1260
gtirb::IR::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr Low, Addr High)
Find all the intervals that start between a range of addresses.
Definition: IR.hpp:727
gtirb::IR::const_proxy_block_range
boost::iterator_range< const_proxy_block_iterator > const_proxy_block_range
Range over ProxyBlock objects.
Definition: IR.hpp:315
gtirb::IR::data_blocks_end
data_block_iterator data_blocks_end()
Return an iterator to the element following the last DataBlock.
Definition: IR.hpp:1180
Addr.hpp
Class gtirb::Addr and related functions.
gtirb::IR::module_name_range
boost::iterator_range< module_name_iterator > module_name_range
Range of modules Modules.
Definition: IR.hpp:170
gtirb::IR::symbols_begin
symbol_iterator symbols_begin()
Return an iterator to the first Symbol.
Definition: IR.hpp:380
gtirb::IR::const_section_name_range
boost::iterator_range< const_section_name_iterator > const_section_name_range
Range of Section objects.
Definition: IR.hpp:444
gtirb::IR::symbols_begin
const_symbol_iterator symbols_begin() const
Return an iterator to the first Symbol.
Definition: IR.hpp:397
gtirb::ErrorOr
Definition: ByteInterval.hpp:59
gtirb::IR::byte_intervals_end
const_byte_interval_iterator byte_intervals_end() const
Return an iterator to the element following the last ByteInterval.
Definition: IR.hpp:661
gtirb::IR::code_block_iterator
MergeSortedIterator< Module::code_block_iterator, AddressLess > code_block_iterator
Iterator over CodeBlock objects.
Definition: IR.hpp:958
gtirb::CFG
CfgBuilder< boost::listS, boost::listS, boost::bidirectionalS >::type CFG
Interprocedural control flow graph, with vertices of type Block.
Definition: CFG.hpp:105
gtirb::IR::blocks
block_range blocks()
Return a range of all the blocks.
Definition: IR.hpp:826
gtirb::IR::findSectionsOn
const_section_subrange findSectionsOn(Addr A) const
Find a Section containing an address.
Definition: IR.hpp:502
gtirb::IR::data_blocks_begin
const_data_block_iterator data_blocks_begin() const
Return an iterator to the first DataBlock.
Definition: IR.hpp:1188
Utility.hpp
gtirb::IR::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: IR.hpp:1005
gtirb::IR::sections_end
section_iterator sections_end()
Return an iterator to the element following the last Section.
Definition: IR.hpp:456
gtirb::IR::proxy_block_iterator
MergeSortedIterator< Module::proxy_block_iterator, ArbitraryLess< ProxyBlock > > proxy_block_iterator
Iterator over ProxyBlock objects.
Definition: IR.hpp:306
gtirb::IR::findDataBlocksAt
data_block_range findDataBlocksAt(Addr A)
Find all the data blocks that start at an address.
Definition: IR.hpp:1244
gtirb::IR::byte_intervals
byte_interval_range byte_intervals()
Return a range of all the ByteInterval objects.
Definition: IR.hpp:645
gtirb::IR::block_iterator
MergeSortedIterator< Module::block_iterator, BlockAddressLess > block_iterator
Iterator over blocks.
Definition: IR.hpp:783
gtirb::IR::symbolic_expressions
const_symbolic_expression_range symbolic_expressions() const
Return a range of all the SymbolicExpression objects.
Definition: IR.hpp:1371