ROSE 0.11.145.147
SgAsmGenericFile.h
1
2#ifndef ROSE_SgAsmGenericFile_H
3#define ROSE_SgAsmGenericFile_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmExecutableFileFormat.h>
7
8
9
10/* #line 1 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
11
12// WARNING -- GENERATED CODE -- DO NOT MODIFY THIS CODE -- WARNING!
13// This code is automatically generated for each
14// terminal and non-terminal within the defined
15// grammar. There is a simple way to change the
16// code to fix bugs etc. See the ROSE README file
17// for directions.
18
19// tps: (02/22/2010): Adding DLL export requirements
20#include "rosedll.h"
21
22// predeclarations for SgAsmGenericFile
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
25/* #line 15303 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/MemoryMap.h>
28#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
29
30#include "DataConversion.h"
31#include "StatSerializer.h" // non-intrusive serialization of struct stat
32
33#ifdef ROSE_SgAsmGenericFile_IMPL
34#include <SgAsmDwarfCompilationUnitList.h>
35#include <SgAsmGenericSectionList.h>
36#include <SgAsmGenericHeaderList.h>
37#endif
38
39
40/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
41
42/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
43
44#if !defined(DOCUMENTATION)
45// Class Definition for SgAsmGenericFile
46class ROSE_DLL_API SgAsmGenericFile : public SgAsmExecutableFileFormat
47 {
48 public:
49
50
51/* #line 52 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
52
53 virtual SgNode* copy ( SgCopyHelp& help) const override;
54// Start of memberFunctionString
55/* #line 15389 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
56
57
58 //----------------------- Boost serialization for SgAsmGenericFile -----------------------
59#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
60private:
61 friend class boost::serialization::access;
62
63 template<class S>
64 void serialize(S &s, const unsigned /*version*/) {
65 debugSerializationBegin("SgAsmGenericFile");
66 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
67 s & BOOST_SERIALIZATION_NVP(p_dwarfInfo);
68 s & BOOST_SERIALIZATION_NVP(p_name);
69 s & BOOST_SERIALIZATION_NVP(p_sb);
70 s & BOOST_SERIALIZATION_NVP(p_data);
71 s & BOOST_SERIALIZATION_NVP(p_headers);
72 s & BOOST_SERIALIZATION_NVP(p_holes);
73 s & BOOST_SERIALIZATION_NVP(p_truncateZeros);
74 s & BOOST_SERIALIZATION_NVP(p_trackingReferences);
75 s & BOOST_SERIALIZATION_NVP(p_referencedExtents);
76 s & BOOST_SERIALIZATION_NVP(p_neuter);
77 debugSerializationEnd("SgAsmGenericFile");
78 }
79#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
81 // Local types
83public:
85 enum AddressSpace {
86 ADDRSP_MEMORY = 0x0001,
87 ADDRSP_FILE = 0x0002,
88 ADDRSP_ALL = 0x0003
89 };
90
92 enum Elasticity {
93 ELASTIC_NONE = 0,
94 ELASTIC_UNREF = 1,
95 ELASTIC_HOLE = 2
96 };
97
99 // Properties
101public:
102public:
106 SgAsmDwarfCompilationUnitList* const& get_dwarfInfo() const;
107 void set_dwarfInfo(SgAsmDwarfCompilationUnitList* const&);
110public:
114 std::string const& get_name() const;
115 void set_name(std::string const&);
118public:
124 int const& get_fd() const;
125 void set_fd(int const&);
128public:
129 struct stat const& get_sb() const;
130
131public:
135 SgFileContentList const& get_data() const;
136 void set_data(SgFileContentList const&);
139public:
145 SgAsmGenericHeaderList* const& get_headers() const;
146 void set_headers(SgAsmGenericHeaderList* const&);
149public:
156 SgAsmGenericSectionList* const& get_holes() const;
157 void set_holes(SgAsmGenericSectionList* const&);
160public:
164 bool const& get_truncateZeros() const;
165 void set_truncateZeros(bool const&);
168public:
172 bool const& get_trackingReferences() const;
173 void set_trackingReferences(bool const&);
176public:
180 Rose::BinaryAnalysis::AddressIntervalSet const& get_referencedExtents() const;
181 void set_referencedExtents(Rose::BinaryAnalysis::AddressIntervalSet const&);
184public:
188 bool const& get_neuter() const;
189 void set_neuter(bool const&);
192 // Non-property data members
194private:
195 mutable Rose::BinaryAnalysis::AddressIntervalSet *p_unreferenced_cache = nullptr;
196 DataConverter *p_data_converter = nullptr;
197
199 // Functions
201public:
203 SgAsmGenericFile* parse(std::string file_name);
204
205 void reallocate();
206
213 void unparse(std::ostream&) const;
214
216 void extendToEof(std::ostream&) const;
217
219 void dump(FILE*) const;
220
227 void dumpAll(bool in_cwd=true, const char *ext=NULL);
228
230 void dumpAll(const std::string& dumpname);
231
233 const Rose::BinaryAnalysis::AddressIntervalSet& get_unreferencedExtents() const;
234
236 void markReferencedExtent(rose_addr_t start_rva, rose_addr_t size);
237
243 DataConverter* get_dataConverter() const;
244 void set_dataConverter(DataConverter*);
248 rose_addr_t get_currentSize() const;
249
251 rose_addr_t get_originalSize() const;
252
260 size_t readContent(rose_addr_t offset, void *dst_buf, rose_addr_t size, bool strict=true);
261
268 size_t readContent(const Rose::BinaryAnalysis::MemoryMap::Ptr&, rose_addr_t va, void *dst_buf,
269 rose_addr_t size, bool strict=true);
270
278 std::string readContentString(const Rose::BinaryAnalysis::MemoryMap::Ptr&, rose_addr_t va, bool strict=true);
279
287 std::string readContentString(rose_addr_t abs_offset, bool strict=true);
288
290 const SgFileContentList& content() { return p_data; }
291
298 SgFileContentList content(rose_addr_t offset, rose_addr_t size);
299
301 SgAsmGenericSectionPtrList get_mappedSections() const;
302
304 SgAsmGenericSectionPtrList get_sections(bool include_holes=true) const;
305
307 SgAsmGenericSectionPtrList get_sectionsById(int id) const;
308
310 SgAsmGenericSectionPtrList get_sectionsByName(std::string, char sep='\0') const;
311
316 SgAsmGenericSectionPtrList get_sectionsByOffset(rose_addr_t offset, rose_addr_t size) const;
317
322 SgAsmGenericSectionPtrList get_sectionsByRva(rose_addr_t rva) const;
323
328 SgAsmGenericSectionPtrList get_sectionsByVa(rose_addr_t va) const;
329
334 SgAsmGenericSection *get_sectionById(int id, size_t *nfound=0) const;
335
341 SgAsmGenericSection *get_sectionByName(const std::string&, char sep=0, size_t *nfound=0) const;
342
347 SgAsmGenericSection *get_sectionByOffset(rose_addr_t offset, rose_addr_t size, size_t *nfound=0) const;
348
353 SgAsmGenericSection *get_sectionByRva(rose_addr_t rva, size_t *nfound=0) const;
354
359 SgAsmGenericSection *get_sectionByVa(rose_addr_t va, size_t *nfound=0) const;
360
366 SgAsmGenericSection *get_bestSectionByVa(rose_addr_t va, size_t *nfound=0) const;
367
378 static SgAsmGenericSection *bestSectionByVa(const SgAsmGenericSectionPtrList &sections, rose_addr_t va);
379
419 void shiftExtend(SgAsmGenericSection*, rose_addr_t sa, rose_addr_t sn, AddressSpace, Elasticity);
420 void shiftExtend(SgAsmGenericSection *s, rose_addr_t sa, rose_addr_t sn);
427 rose_addr_t get_nextSectionOffset(rose_addr_t offset);
428
432 void addHole(SgAsmGenericSection*);
433
435 void removeHole(SgAsmGenericSection*);
436
442 void fillHoles();
443
447 void unfillHoles();
448
452 void addHeader(SgAsmGenericHeader*);
453
455 void removeHeader(SgAsmGenericHeader*);
456
459
464 const char *formatName() const;
465
466protected:
467 // Some extra clean-up actions on destruction
468 virtual void destructorHelper() override;
469
471 // Deprecated 2023-11
473public:
474 SgAsmDwarfCompilationUnitList* get_dwarf_info() const ROSE_DEPRECATED("use get_dwarfInfo");
475 void set_dwarf_info(SgAsmDwarfCompilationUnitList*) ROSE_DEPRECATED("use set_dwarfInfo");
476 bool get_truncate_zeros() const ROSE_DEPRECATED("use get_truncateZeros");
477 void set_truncate_zeros(bool) ROSE_DEPRECATED("use set_truncateZeros");
478 bool get_tracking_references() const ROSE_DEPRECATED("use get_trackingReferences");
479 void set_tracking_references(bool) ROSE_DEPRECATED("use set_trackingReferences");
480 const Rose::BinaryAnalysis::AddressIntervalSet& get_referenced_extents() const ROSE_DEPRECATED("use get_referencedExtents");
481 void set_referenced_extents(const Rose::BinaryAnalysis::AddressIntervalSet&) ROSE_DEPRECATED("use set_referencedExtents");
482 void extend_to_eof(std::ostream&) const ROSE_DEPRECATED("use extendToEof");
483 void dump_all(bool in_cwd=true, const char *ext=NULL) ROSE_DEPRECATED("use dumpAll");
484 void dump_all(const std::string& dumpname) ROSE_DEPRECATED("use dumpAll");
485 const Rose::BinaryAnalysis::AddressIntervalSet& get_unreferenced_extents() const ROSE_DEPRECATED("use get_unreferencedExtents");
486 void mark_referenced_extent(rose_addr_t, rose_addr_t) ROSE_DEPRECATED("use markReferencedExtent");
487 DataConverter* get_data_converter() const ROSE_DEPRECATED("use get_dataConverter");
488 void set_data_converter(DataConverter*) ROSE_DEPRECATED("use set_dataConverter");
489 rose_addr_t get_current_size() const ROSE_DEPRECATED("use get_currentSize");
490 rose_addr_t get_orig_size() const ROSE_DEPRECATED("use get_originalSize");
491 size_t read_content(rose_addr_t, void*, rose_addr_t, bool=true) ROSE_DEPRECATED("use readContent");
492 size_t read_content(const Rose::BinaryAnalysis::MemoryMap::Ptr&, rose_addr_t, void*, rose_addr_t, bool=true)
493 ROSE_DEPRECATED("use readContent");
494 std::string read_content_str(const Rose::BinaryAnalysis::MemoryMap::Ptr&, rose_addr_t, bool=true)
495 ROSE_DEPRECATED("use readContentString");
496 std::string read_content_str(rose_addr_t, bool=true) ROSE_DEPRECATED("use readContentString");
497 SgAsmGenericSectionPtrList get_mapped_sections() const ROSE_DEPRECATED("use get_mappedSections");
498 SgAsmGenericSectionPtrList get_sections_by_id(int id) const ROSE_DEPRECATED("use get_sectionById");
499 SgAsmGenericSectionPtrList get_sections_by_name(std::string, char='\0') const ROSE_DEPRECATED("use get_sectionsByName");
500 SgAsmGenericSectionPtrList get_sections_by_offset(rose_addr_t, rose_addr_t) const ROSE_DEPRECATED("use get_sectionsByOffset");
501 SgAsmGenericSectionPtrList get_sections_by_rva(rose_addr_t) const ROSE_DEPRECATED("use get_sectionsByRva");
502 SgAsmGenericSectionPtrList get_sections_by_va(rose_addr_t) const ROSE_DEPRECATED("use get_sectionsByVa");
503 SgAsmGenericSection *get_section_by_id(int, size_t* = nullptr) const ROSE_DEPRECATED("use get_sectionById");
504 SgAsmGenericSection *get_section_by_name(const std::string&, char=0, size_t* = nullptr) const
505 ROSE_DEPRECATED("use get_sectionByName");
506 SgAsmGenericSection *get_section_by_offset(rose_addr_t, rose_addr_t, size_t* = nullptr) const
507 ROSE_DEPRECATED("use get_sectionByOffset");
508 SgAsmGenericSection *get_section_by_rva(rose_addr_t, size_t* = nullptr) const ROSE_DEPRECATED("use get_sectionByRva");
509 SgAsmGenericSection *get_section_by_va(rose_addr_t, size_t* = nullptr) const ROSE_DEPRECATED("use get_sectionByVa");
510 SgAsmGenericSection *get_best_section_by_va(rose_addr_t, size_t* = nullptr) const ROSE_DEPRECATED("use get_bestSectionByVa");
511 static SgAsmGenericSection *best_section_by_va(const SgAsmGenericSectionPtrList&, rose_addr_t)
512 ROSE_DEPRECATED("use bestSectionByVa");
513 void shift_extend(SgAsmGenericSection*, rose_addr_t, rose_addr_t, AddressSpace, Elasticity) ROSE_DEPRECATED("use shiftExtend");
514 void shift_extend(SgAsmGenericSection*, rose_addr_t, rose_addr_t) ROSE_DEPRECATED("use shiftExtend");
515 rose_addr_t get_next_section_offset(rose_addr_t) ROSE_DEPRECATED("use get_nextSectionOffset");
516 void add_hole(SgAsmGenericSection*) ROSE_DEPRECATED("use addHole");
517 void remove_hole(SgAsmGenericSection*) ROSE_DEPRECATED("use remoeHole");
518 void fill_holes() ROSE_DEPRECATED("use fillHoles");
519 void unfill_holes() ROSE_DEPRECATED("use unfillHoles");
520 void add_header(SgAsmGenericHeader*) ROSE_DEPRECATED("use addHeader");
521 void remove_header(SgAsmGenericHeader*) ROSE_DEPRECATED("use removeHeader");
522 const char *format_name() const ROSE_DEPRECATED("use formatName");
523public:
525 virtual ~SgAsmGenericFile();
526
527public:
530
531protected:
538 void initializeProperties();
539
540
541// End of memberFunctionString
542// Start of memberFunctionString
543/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
544
545// *** COMMON CODE SECTION BEGINS HERE ***
546
547 public:
548
549 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
550 // and not required which is required to match the other aspects of the copy mechanism code generation.
551 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
552 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
553 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
554 // virtual SgNode* copy ( const SgCopyHelp & help) const;
555
557 virtual std::string class_name() const override;
558
560 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
561
563 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
564 // static const VariantT static_variant = V_SgAsmGenericFile;
565 enum { static_variant = V_SgAsmGenericFile };
566
567 /* the generated cast function */
569 ROSE_DLL_API friend SgAsmGenericFile* isSgAsmGenericFile( SgNode * s );
570
572 ROSE_DLL_API friend const SgAsmGenericFile* isSgAsmGenericFile( const SgNode * s );
573
574 // ******************************************
575 // * Memory Pool / New / Delete
576 // ******************************************
577
578 public:
580 static const unsigned pool_size; //
582 static std::vector<unsigned char *> pools; //
584 static SgAsmGenericFile * next_node; //
585
587 static unsigned long initializeStorageClassArray(SgAsmGenericFileStorageClass *); //
588
590 static void clearMemoryPool(); //
591 static void deleteMemoryPool(); //
592
594 static void extendMemoryPoolForFileIO(); //
595
597 static SgAsmGenericFile * getPointerFromGlobalIndex(unsigned long); //
599 static SgAsmGenericFile * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
600
602 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
604 static void resetValidFreepointers(); //
606 static unsigned long getNumberOfLastValidPointer(); //
607
608
609#if defined(INLINE_FUNCTIONS)
611 inline void *operator new (size_t size);
612#else
614 void *operator new (size_t size);
615#endif
617 void operator delete (void* pointer, size_t size);
618
619 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
620 void operator delete (void* pointer)
621 {
622 // This is the generated delete operator...
623 SgAsmGenericFile::operator delete (pointer,sizeof(SgAsmGenericFile));
624 }
625
627 static size_t numberOfNodes();
628
630 static size_t memoryUsage();
631
632 // End of scope which started in IR nodes specific code
633 /* */
634
635 /* name Internal Functions
636 \brief Internal functions ... incomplete-documentation
637
638 These functions have been made public as part of the design, but they are suggested for internal use
639 or by particularly knowledgeable users for specialized tools or applications.
640
641 \internal We could not make these private because they are required by user for special purposes. And
642 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
643
644 */
645
646 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
647 // overridden in every class by *generated* implementation
649 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
650 // MS: 06/28/02 container of names of variables or container indices
651 // used used in the traversal to access AST successor nodes
652 // overridden in every class by *generated* implementation
655 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
656
657 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
658 // than all the vector copies. The implementation for these functions is generated for each class.
660 virtual size_t get_numberOfTraversalSuccessors() override;
662 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
664 virtual size_t get_childIndex(SgNode *child) override;
665
666#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
667 // MS: 08/16/2002 method for generating RTI information
669 virtual RTIReturnType roseRTI() override;
670#endif
671 /* */
672
673
674
675 /* name Deprecated Functions
676 \brief Deprecated functions ... incomplete-documentation
677
678 These functions have been deprecated from use.
679 */
680 /* */
681
683 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
684
685 // JJW (10/16/2008): Changed to a single function in Node.code, and put
686 // getVariant() in #if 0 block to prevent confusing Doxygen
687#if 0
689 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
691 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
692#endif
693 /* */
694
695
696
697
698 public:
699 /* name Traversal Support Functions
700 \brief Traversal support functions ... incomplete-documentation
701
702 These functions have been made public as part of the design, but they are suggested for internal use
703 or by particularly knowledgable users for specialized tools or applications.
704 */
705 /* */
706
707 // DQ (11/26/2005): Support for visitor pattern mechanims
708 // (inferior to ROSE traversal mechanism, experimental).
712
713 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
715 virtual void accept (ROSE_VisitorPattern & visitor) override;
716
717 // DQ (12/26/2005): Support for traversal based on the memory pool
720 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
721
725
726 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
727 // This traversal helps support internal tools that call static member functions.
728 // note: this function operates on the memory pools.
731 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
732 /* */
733
734 public:
735 /* NodeId support functions */
737 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
740 static SgAsmGenericFile* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
743 static std::string getNodeIdString(SgAsmGenericFile* sgnode);
744 static std::string getNodeIdStringInternal(SgAsmGenericFile* sgnode);
745
746 public:
747 /* name Memory Allocation Functions
748 \brief Memory allocations functions ... incomplete-documentation
749
750 These functions have been made public as part of the design, but they are suggested for internal use
751 or by particularly knowledgable users for specialized tools or applications.
752 */
753 /* */
754
765 virtual bool isInMemoryPool() override;
766
777 virtual void checkDataMemberPointersIfInMemoryPool() override;
778
779 // DQ (4/30/2006): Modified to be a const function.
794 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
795
806
818 virtual long getChildIndex( SgNode* childNode ) const override;
819
820 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
821 // comment here (changed to be a C style comment and not be a doxygen comment).
822 /* \brief Constructor for use by AST File I/O Mechanism
823
824 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
825 which obtained via fast binary file I/O from disk.
826 */
827 // SgAsmGenericFile( SgAsmGenericFileStorageClass& source );
828
829
830
831
832
833 // JH (10/24/2005): methods added to support the ast file IO
834 private:
835
836 /* name AST Memory Allocation Support Functions
837 \brief Memory allocations support....
838
839 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
840 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
841 and support the AST File I/O Mechanism.
842 */
843 /* */
844
845 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
846 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
847 that I use the same type everywhere, if any changes are made. THe second one declares the type
848 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
849 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
850 a correspinding one in the AST_FILE_IO class!
851 */
852 // DQ (9/2/2015): This typedef is no longer used, we can't define the
853 // comment here (changed to be a C style comment and not be a doxygen comment).
854 /* \brief Typedef used for low level memory access.
855 */
856 // typedef unsigned char* TestType;
857
858 // DQ (9/2/2015): This typedef is no longer used, we can't define the
859 // comment here (changed to be a C style comment and not be a doxygen comment).
860 /* \brief Typedef used to hold memory addresses as values.
861 */
862 // typedef unsigned long AddressType;
863
864
865
866 // necessary, to have direct access to the p_freepointer and the private methods !
868 friend class AST_FILE_IO;
869
871 friend class SgAsmGenericFileStorageClass;
872
874 friend class AstSpecificDataManagingClass;
875
877 friend class AstSpecificDataManagingClassStorageClass;
878 public:
880 SgAsmGenericFile( const SgAsmGenericFileStorageClass& source );
881
882 // private: // JJW hack
883 /*
884 name AST Memory Allocation Support Variables
885 Memory allocations support variables
886
887 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
888 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
889 and support the AST File I/O Mechanism.
890 */
891 /* */
892
893 public:
894
895 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
896 // to current node (so that it will work cleanly with build functions to specify patterns).
897 // virtual SgNode* addRegExpAttribute();
904
905#ifndef _MSC_VER
906// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
907// and likely never fully implemented nor tested. Files remain in the src tree but are no
908// longer built.
909#define BUILD_ATERM_SUPPORT 0
910 #if BUILD_ATERM_SUPPORT
911 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
912 // DQ (10/4/2014): Adding ATerm support to ROSE.
922 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
923 virtual ATerm generate_ATerm() override;
924
926 virtual void generate_ATerm_Annotation(ATerm & term) override;
927 #endif
928 #endif // BUILD_ATERM_SUPPORT
929#endif
930 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
931 // virtual generate_AST(ATerm & term);
932 // virtual void read_ATerm_Annotation(ATerm & term);
933
934// *** COMMON CODE SECTION ENDS HERE ***
935
936
937// End of memberFunctionString
938// Start of memberFunctionString
939/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
940
941 // the generated cast function
942 // friend ROSE_DLL_API SgAsmGenericFile* isSgAsmGenericFile ( SgNode* s );
943
944 typedef SgAsmExecutableFileFormat base_node_type;
945
946
947// End of memberFunctionString
948
949
950
951
952
953
954
955
956
957
958
959
960 protected:
961// Start of memberFunctionString
963
964// End of memberFunctionString
965// Start of memberFunctionString
966std::string p_name;
967
968// End of memberFunctionString
969// Start of memberFunctionString
970int p_fd;
971
972// End of memberFunctionString
973// Start of memberFunctionString
974struct stat p_sb;
975
976// End of memberFunctionString
977// Start of memberFunctionString
978SgFileContentList p_data;
979
980// End of memberFunctionString
981// Start of memberFunctionString
982SgAsmGenericHeaderList* p_headers;
983
984// End of memberFunctionString
985// Start of memberFunctionString
987
988// End of memberFunctionString
989// Start of memberFunctionString
990bool p_truncateZeros;
991
992// End of memberFunctionString
993// Start of memberFunctionString
994bool p_trackingReferences;
995
996// End of memberFunctionString
997// Start of memberFunctionString
999
1000// End of memberFunctionString
1001// Start of memberFunctionString
1002bool p_neuter;
1003
1004// End of memberFunctionString
1005
1008 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, std::string,&SgAsmGenericFile::p_name>;
1009 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, int,&SgAsmGenericFile::p_fd>;
1010 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, struct stat,&SgAsmGenericFile::p_sb>;
1011 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgFileContentList,&SgAsmGenericFile::p_data>;
1012 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgAsmGenericHeaderList*,&SgAsmGenericFile::p_headers>;
1013 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgAsmGenericSectionList*,&SgAsmGenericFile::p_holes>;
1014 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_truncateZeros>;
1015 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_trackingReferences>;
1016 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, Rose::BinaryAnalysis::AddressIntervalSet,&SgAsmGenericFile::p_referencedExtents>;
1017 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_neuter>;
1018
1019/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1020
1021
1022 };
1023#endif
1024
1025// postdeclarations for SgAsmGenericFile
1026
1027/* #line 1028 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
1028
1029/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
1030
1031/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1032
1033
1034/* #line 1035 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
1035
1036#endif // ROSE_SgAsmGenericFile_H
1037
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Encodes and decodes a buffer using an algorithm defined in subclasses.
Base class for many binary analysis nodes.
Base class for binary files.
List of generic file headers.
Base class for container file headers.
List of pointers to file sections.
Contiguous region of a file.
Supporting class from copy mechanism within ROSE.
Definition sageCopy.h:26
This class represents the base class for all IR nodes within Sage III.
virtual size_t get_numberOfTraversalSuccessors()
return number of children in the traversal successor list
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual std::vector< std::string > get_traversalSuccessorNamesContainer()
container of names of variables or container indices used used in the traversal to access AST success...
virtual void debugSerializationEnd(const char *className)
Called by generated serializers.
static std::string getNodeIdString(SgNode *sgnode)
compute the NodeId for a particular SgNode*.
virtual bool isInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
int variant() const
Older version function returns enum value "NODE".
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler *)
FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
virtual long getChildIndex(SgNode *childNode) const
FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR no...
virtual size_t get_childIndex(SgNode *child)
index-based access to traversal successors by child node
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
static void visitRepresentativeNode(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for type-based traversal.
virtual void checkDataMemberPointersIfInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
static size_t numberOfNodes()
Returns the total number of IR nodes of this type.
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
virtual SgNode * get_traversalSuccessorByIndex(size_t idx)
index-based access to traversal successors by index number
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
void executeVisitorMemberFunction(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
static SgNode * getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx)
Find a node by its variant type, pool index, and item index.
static size_t memoryUsage()
Returns the size in bytes of the total memory allocated for all IR nodes of this type.
static void traverseMemoryPoolNodes(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
virtual const char * sage_class_name() const
generates string representing the class name: (e.g. for SgNode returns "SgNode").
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers() const
FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools
static SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
virtual void destructorHelper()
This gets called by all Rosebud-generated destructors.
void parse(SgAsmGenericFile *)
Main function to parse DWARF information.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
The ROSE library.
ROSE_DLL_API int set_name(SgInitializedName *initializedNameNode, SgName new_name)
set_name of symbol in symbol table.
std::string get_name(const SgNode *node)
Generate a useful name to describe the SgNode.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * Elasticity(int64_t)
Convert SgAsmGenericFile::Elasticity enum constant to a string.
const char * AddressSpace(int64_t)
Convert SgAsmGenericFile::AddressSpace enum constant to a string.