ROSE 0.11.145.247
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 15524 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28#include <Rose/BinaryAnalysis/MemoryMap.h>
29#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
30
31#include "DataConversion.h"
32#include "StatSerializer.h" // non-intrusive serialization of struct stat
33
34#ifdef ROSE_SgAsmGenericFile_IMPL
35#include <SgAsmDwarfCompilationUnitList.h>
36#include <SgAsmGenericSectionList.h>
37#include <SgAsmGenericHeaderList.h>
38#endif
39
40#include <sys/stat.h>
41
42
43/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
44
45/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
46
47#if !defined(DOCUMENTATION)
48// Class Definition for SgAsmGenericFile
49class ROSE_DLL_API SgAsmGenericFile : public SgAsmExecutableFileFormat
50 {
51 public:
52
53
54/* #line 55 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
55
56 virtual SgNode* copy ( SgCopyHelp& help) const override;
57// Start of memberFunctionString
58/* #line 15613 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
59
60
61 //----------------------- Boost serialization for SgAsmGenericFile -----------------------
62#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
63private:
64 friend class boost::serialization::access;
65
66 template<class S>
67 void serialize(S &s, const unsigned /*version*/) {
68 debugSerializationBegin("SgAsmGenericFile");
69 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
70 s & BOOST_SERIALIZATION_NVP(p_dwarfInfo);
71 s & BOOST_SERIALIZATION_NVP(p_name);
72 s & BOOST_SERIALIZATION_NVP(p_sb);
73 s & BOOST_SERIALIZATION_NVP(p_data);
74 s & BOOST_SERIALIZATION_NVP(p_headers);
75 s & BOOST_SERIALIZATION_NVP(p_holes);
76 s & BOOST_SERIALIZATION_NVP(p_truncateZeros);
77 s & BOOST_SERIALIZATION_NVP(p_trackingReferences);
78 s & BOOST_SERIALIZATION_NVP(p_referencedExtents);
79 s & BOOST_SERIALIZATION_NVP(p_neuter);
80 debugSerializationEnd("SgAsmGenericFile");
81 }
82#endif // ROSE_ENABLE_BOOST_SERIALIZATION
84 // Local types
86public:
88 enum AddressSpace {
89 ADDRSP_MEMORY = 0x0001,
90 ADDRSP_FILE = 0x0002,
91 ADDRSP_ALL = 0x0003
92 };
93
95 enum Elasticity {
96 ELASTIC_NONE = 0,
97 ELASTIC_UNREF = 1,
98 ELASTIC_HOLE = 2
99 };
100
102 // Properties
104public:
105public:
109 SgAsmDwarfCompilationUnitList* const& get_dwarfInfo() const;
110 void set_dwarfInfo(SgAsmDwarfCompilationUnitList* const&);
113public:
117 std::string const& get_name() const;
118 void set_name(std::string const&);
121public:
127 int const& get_fd() const;
128 void set_fd(int const&);
131public:
132 struct stat const& get_sb() const;
133
134public:
138 SgFileContentList const& get_data() const;
139 void set_data(SgFileContentList const&);
142public:
148 SgAsmGenericHeaderList* const& get_headers() const;
149 void set_headers(SgAsmGenericHeaderList* const&);
152public:
159 SgAsmGenericSectionList* const& get_holes() const;
160 void set_holes(SgAsmGenericSectionList* const&);
163public:
167 bool const& get_truncateZeros() const;
168 void set_truncateZeros(bool const&);
171public:
175 bool const& get_trackingReferences() const;
176 void set_trackingReferences(bool const&);
179public:
183 Rose::BinaryAnalysis::AddressIntervalSet const& get_referencedExtents() const;
184 void set_referencedExtents(Rose::BinaryAnalysis::AddressIntervalSet const&);
187public:
191 bool const& get_neuter() const;
192 void set_neuter(bool const&);
195 // Non-property data members
197private:
198 mutable Rose::BinaryAnalysis::AddressIntervalSet *p_unreferenced_cache = nullptr;
199 DataConverter *p_data_converter = nullptr;
200
202 // Functions
204public:
206 SgAsmGenericFile* parse(std::string file_name);
207
208 void reallocate();
209
216 void unparse(std::ostream&) const;
217
219 void extendToEof(std::ostream&) const;
220
222 void dump(FILE*) const;
223
230 void dumpAll(bool in_cwd=true, const char *ext=NULL);
231
233 void dumpAll(const std::string& dumpname);
234
236 const Rose::BinaryAnalysis::AddressIntervalSet& get_unreferencedExtents() const;
237
239 void markReferencedExtent(Rose::BinaryAnalysis::Address start_rva, Rose::BinaryAnalysis::Address size);
240
246 DataConverter* get_dataConverter() const;
247 void set_dataConverter(DataConverter*);
251 Rose::BinaryAnalysis::Address get_currentSize() const;
252
254 Rose::BinaryAnalysis::Address get_originalSize() const;
255
263 size_t readContent(Rose::BinaryAnalysis::Address offset, void *dst_buf, Rose::BinaryAnalysis::Address size, bool strict=true);
264
271 size_t readContent(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address va, void *dst_buf,
272 Rose::BinaryAnalysis::Address size, bool strict=true);
273
281 std::string readContentString(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address va, bool strict=true);
282
290 std::string readContentString(Rose::BinaryAnalysis::Address abs_offset, bool strict=true);
291
293 const SgFileContentList& content() { return p_data; }
294
302
304 SgAsmGenericSectionPtrList get_mappedSections() const;
305
307 SgAsmGenericSectionPtrList get_sections(bool include_holes=true) const;
308
310 SgAsmGenericSectionPtrList get_sectionsById(int id) const;
311
313 SgAsmGenericSectionPtrList get_sectionsByName(std::string, char sep='\0') const;
314
319 SgAsmGenericSectionPtrList get_sectionsByOffset(Rose::BinaryAnalysis::Address offset, Rose::BinaryAnalysis::Address size) const;
320
325 SgAsmGenericSectionPtrList get_sectionsByRva(Rose::BinaryAnalysis::Address rva) const;
326
331 SgAsmGenericSectionPtrList get_sectionsByVa(Rose::BinaryAnalysis::Address va) const;
332
337 SgAsmGenericSection *get_sectionById(int id, size_t *nfound=0) const;
338
344 SgAsmGenericSection *get_sectionByName(const std::string&, char sep=0, size_t *nfound=0) const;
345
351 get_sectionByOffset(Rose::BinaryAnalysis::Address offset, Rose::BinaryAnalysis::Address size, size_t *nfound=0) const;
352
357 SgAsmGenericSection *get_sectionByRva(Rose::BinaryAnalysis::Address rva, size_t *nfound=0) const;
358
363 SgAsmGenericSection *get_sectionByVa(Rose::BinaryAnalysis::Address va, size_t *nfound=0) const;
364
370 SgAsmGenericSection *get_bestSectionByVa(Rose::BinaryAnalysis::Address va, size_t *nfound=0) const;
371
382 static SgAsmGenericSection *bestSectionByVa(const SgAsmGenericSectionPtrList &sections, Rose::BinaryAnalysis::Address va);
383
424 Elasticity);
433
437 void addHole(SgAsmGenericSection*);
438
440 void removeHole(SgAsmGenericSection*);
441
447 void fillHoles();
448
452 void unfillHoles();
453
457 void addHeader(SgAsmGenericHeader*);
458
460 void removeHeader(SgAsmGenericHeader*);
461
464
469 const char *formatName() const;
470
471protected:
472 // Some extra clean-up actions on destruction
473 virtual void destructorHelper() override;
474
476 // Deprecated 2023-11
478public:
479 SgAsmDwarfCompilationUnitList* get_dwarf_info() const ROSE_DEPRECATED("use get_dwarfInfo");
480 void set_dwarf_info(SgAsmDwarfCompilationUnitList*) ROSE_DEPRECATED("use set_dwarfInfo");
481 bool get_truncate_zeros() const ROSE_DEPRECATED("use get_truncateZeros");
482 void set_truncate_zeros(bool) ROSE_DEPRECATED("use set_truncateZeros");
483 bool get_tracking_references() const ROSE_DEPRECATED("use get_trackingReferences");
484 void set_tracking_references(bool) ROSE_DEPRECATED("use set_trackingReferences");
485 const Rose::BinaryAnalysis::AddressIntervalSet& get_referenced_extents() const ROSE_DEPRECATED("use get_referencedExtents");
486 void set_referenced_extents(const Rose::BinaryAnalysis::AddressIntervalSet&) ROSE_DEPRECATED("use set_referencedExtents");
487 void extend_to_eof(std::ostream&) const ROSE_DEPRECATED("use extendToEof");
488 void dump_all(bool in_cwd=true, const char *ext=NULL) ROSE_DEPRECATED("use dumpAll");
489 void dump_all(const std::string& dumpname) ROSE_DEPRECATED("use dumpAll");
490 const Rose::BinaryAnalysis::AddressIntervalSet& get_unreferenced_extents() const
491 ROSE_DEPRECATED("use get_unreferencedExtents");
492 void mark_referenced_extent(Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address)
493 ROSE_DEPRECATED("use markReferencedExtent");
494 DataConverter* get_data_converter() const ROSE_DEPRECATED("use get_dataConverter");
495 void set_data_converter(DataConverter*) ROSE_DEPRECATED("use set_dataConverter");
496 Rose::BinaryAnalysis::Address get_current_size() const ROSE_DEPRECATED("use get_currentSize");
497 Rose::BinaryAnalysis::Address get_orig_size() const ROSE_DEPRECATED("use get_originalSize");
498 size_t read_content(Rose::BinaryAnalysis::Address, void*, Rose::BinaryAnalysis::Address, bool=true)
499 ROSE_DEPRECATED("use readContent");
500 size_t read_content(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address, void*,
501 Rose::BinaryAnalysis::Address, bool=true) ROSE_DEPRECATED("use readContent");
502 std::string read_content_str(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address, bool=true)
503 ROSE_DEPRECATED("use readContentString");
504 std::string read_content_str(Rose::BinaryAnalysis::Address, bool=true) ROSE_DEPRECATED("use readContentString");
505 SgAsmGenericSectionPtrList get_mapped_sections() const ROSE_DEPRECATED("use get_mappedSections");
506 SgAsmGenericSectionPtrList get_sections_by_id(int id) const ROSE_DEPRECATED("use get_sectionById");
507 SgAsmGenericSectionPtrList get_sections_by_name(std::string, char='\0') const ROSE_DEPRECATED("use get_sectionsByName");
508 SgAsmGenericSectionPtrList get_sections_by_offset(Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address) const
509 ROSE_DEPRECATED("use get_sectionsByOffset");
510 SgAsmGenericSectionPtrList get_sections_by_rva(Rose::BinaryAnalysis::Address) const ROSE_DEPRECATED("use get_sectionsByRva");
511 SgAsmGenericSectionPtrList get_sections_by_va(Rose::BinaryAnalysis::Address) const ROSE_DEPRECATED("use get_sectionsByVa");
512 SgAsmGenericSection *get_section_by_id(int, size_t* = nullptr) const ROSE_DEPRECATED("use get_sectionById");
513 SgAsmGenericSection *get_section_by_name(const std::string&, char=0, size_t* = nullptr) const
514 ROSE_DEPRECATED("use get_sectionByName");
515 SgAsmGenericSection*get_section_by_offset(Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address, size_t* = nullptr) const
516 ROSE_DEPRECATED("use get_sectionByOffset");
517 SgAsmGenericSection *get_section_by_rva(Rose::BinaryAnalysis::Address, size_t* = nullptr) const
518 ROSE_DEPRECATED("use get_sectionByRva");
519 SgAsmGenericSection *get_section_by_va(Rose::BinaryAnalysis::Address, size_t* = nullptr) const
520 ROSE_DEPRECATED("use get_sectionByVa");
521 SgAsmGenericSection *get_best_section_by_va(Rose::BinaryAnalysis::Address, size_t* = nullptr) const
522 ROSE_DEPRECATED("use get_bestSectionByVa");
523 static SgAsmGenericSection *best_section_by_va(const SgAsmGenericSectionPtrList&, Rose::BinaryAnalysis::Address)
524 ROSE_DEPRECATED("use bestSectionByVa");
525 void shift_extend(SgAsmGenericSection*, Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address, AddressSpace, Elasticity)
526 ROSE_DEPRECATED("use shiftExtend");
527 void shift_extend(SgAsmGenericSection*, Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address)
528 ROSE_DEPRECATED("use shiftExtend");
529 Rose::BinaryAnalysis::Address get_next_section_offset(Rose::BinaryAnalysis::Address)
530 ROSE_DEPRECATED("use get_nextSectionOffset");
531 void add_hole(SgAsmGenericSection*) ROSE_DEPRECATED("use addHole");
532 void remove_hole(SgAsmGenericSection*) ROSE_DEPRECATED("use remoeHole");
533 void fill_holes() ROSE_DEPRECATED("use fillHoles");
534 void unfill_holes() ROSE_DEPRECATED("use unfillHoles");
535 void add_header(SgAsmGenericHeader*) ROSE_DEPRECATED("use addHeader");
536 void remove_header(SgAsmGenericHeader*) ROSE_DEPRECATED("use removeHeader");
537 const char *format_name() const ROSE_DEPRECATED("use formatName");
538public:
540 virtual ~SgAsmGenericFile();
541
542public:
545
546protected:
553 void initializeProperties();
554
555
556// End of memberFunctionString
557// Start of memberFunctionString
558/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
559
560// *** COMMON CODE SECTION BEGINS HERE ***
561
562 public:
563
564 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
565 // and not required which is required to match the other aspects of the copy mechanism code generation.
566 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
567 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
568 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
569 // virtual SgNode* copy ( const SgCopyHelp & help) const;
570
572 virtual std::string class_name() const override;
573
575 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
576
578 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
579 // static const VariantT static_variant = V_SgAsmGenericFile;
580 enum { static_variant = V_SgAsmGenericFile };
581
582 /* the generated cast function */
584 ROSE_DLL_API friend SgAsmGenericFile* isSgAsmGenericFile( SgNode * s );
585
587 ROSE_DLL_API friend const SgAsmGenericFile* isSgAsmGenericFile( const SgNode * s );
588
589 // ******************************************
590 // * Memory Pool / New / Delete
591 // ******************************************
592
593 public:
595 static const unsigned pool_size; //
597 static std::vector<unsigned char *> pools; //
599 static SgAsmGenericFile * next_node; //
600
602 static unsigned long initializeStorageClassArray(SgAsmGenericFileStorageClass *); //
603
605 static void clearMemoryPool(); //
606 static void deleteMemoryPool(); //
607
609 static void extendMemoryPoolForFileIO(); //
610
612 static SgAsmGenericFile * getPointerFromGlobalIndex(unsigned long); //
614 static SgAsmGenericFile * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
615
617 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
619 static void resetValidFreepointers(); //
621 static unsigned long getNumberOfLastValidPointer(); //
622
623
624#if defined(INLINE_FUNCTIONS)
626 inline void *operator new (size_t size);
627#else
629 void *operator new (size_t size);
630#endif
632 void operator delete (void* pointer, size_t size);
633
634 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
635 void operator delete (void* pointer)
636 {
637 // This is the generated delete operator...
638 SgAsmGenericFile::operator delete (pointer,sizeof(SgAsmGenericFile));
639 }
640
642 static size_t numberOfNodes();
643
645 static size_t memoryUsage();
646
647 // End of scope which started in IR nodes specific code
648 /* */
649
650 /* name Internal Functions
651 \brief Internal functions ... incomplete-documentation
652
653 These functions have been made public as part of the design, but they are suggested for internal use
654 or by particularly knowledgeable users for specialized tools or applications.
655
656 \internal We could not make these private because they are required by user for special purposes. And
657 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
658
659 */
660
661 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
662 // overridden in every class by *generated* implementation
664 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override;
665 // MS: 06/28/02 container of names of variables or container indices
666 // used used in the traversal to access AST successor nodes
667 // overridden in every class by *generated* implementation
670 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override;
671
672 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
673 // than all the vector copies. The implementation for these functions is generated for each class.
675 virtual size_t get_numberOfTraversalSuccessors() const override;
677 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const override;
679 virtual size_t get_childIndex(SgNode *child) const override;
680
681#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
682 // MS: 08/16/2002 method for generating RTI information
684 virtual RTIReturnType roseRTI() override;
685#endif
686 /* */
687
688
689
690 /* name Deprecated Functions
691 \brief Deprecated functions ... incomplete-documentation
692
693 These functions have been deprecated from use.
694 */
695 /* */
696
698 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
699
700 // JJW (10/16/2008): Changed to a single function in Node.code, and put
701 // getVariant() in #if 0 block to prevent confusing Doxygen
702#if 0
704 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
706 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
707#endif
708 /* */
709
710
711
712
713 public:
714 /* name Traversal Support Functions
715 \brief Traversal support functions ... incomplete-documentation
716
717 These functions have been made public as part of the design, but they are suggested for internal use
718 or by particularly knowledgable users for specialized tools or applications.
719 */
720 /* */
721
722 // DQ (11/26/2005): Support for visitor pattern mechanims
723 // (inferior to ROSE traversal mechanism, experimental).
727
728 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
730 virtual void accept (ROSE_VisitorPattern & visitor) override;
731
732 // DQ (12/26/2005): Support for traversal based on the memory pool
735 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
736
740
741 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
742 // This traversal helps support internal tools that call static member functions.
743 // note: this function operates on the memory pools.
746 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
747 /* */
748
749 public:
750 /* NodeId support functions */
752 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
755 static SgAsmGenericFile* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
758 static std::string getNodeIdString(SgAsmGenericFile* sgnode);
759 static std::string getNodeIdStringInternal(SgAsmGenericFile* sgnode);
760
761 public:
762 /* name Memory Allocation Functions
763 \brief Memory allocations functions ... incomplete-documentation
764
765 These functions have been made public as part of the design, but they are suggested for internal use
766 or by particularly knowledgable users for specialized tools or applications.
767 */
768 /* */
769
780 virtual bool isInMemoryPool() override;
781
792 virtual void checkDataMemberPointersIfInMemoryPool() override;
793
794 // DQ (4/30/2006): Modified to be a const function.
809 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
810
821
833 virtual long getChildIndex( SgNode* childNode ) const override;
834
835 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
836 // comment here (changed to be a C style comment and not be a doxygen comment).
837 /* \brief Constructor for use by AST File I/O Mechanism
838
839 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
840 which obtained via fast binary file I/O from disk.
841 */
842 // SgAsmGenericFile( SgAsmGenericFileStorageClass& source );
843
844
845
846
847
848 // JH (10/24/2005): methods added to support the ast file IO
849 private:
850
851 /* name AST Memory Allocation Support Functions
852 \brief Memory allocations support....
853
854 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
855 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
856 and support the AST File I/O Mechanism.
857 */
858 /* */
859
860 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
861 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
862 that I use the same type everywhere, if any changes are made. THe second one declares the type
863 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
864 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
865 a correspinding one in the AST_FILE_IO class!
866 */
867 // DQ (9/2/2015): This typedef is no longer used, we can't define the
868 // comment here (changed to be a C style comment and not be a doxygen comment).
869 /* \brief Typedef used for low level memory access.
870 */
871 // typedef unsigned char* TestType;
872
873 // DQ (9/2/2015): This typedef is no longer used, we can't define the
874 // comment here (changed to be a C style comment and not be a doxygen comment).
875 /* \brief Typedef used to hold memory addresses as values.
876 */
877 // typedef unsigned long AddressType;
878
879
880
881 // necessary, to have direct access to the p_freepointer and the private methods !
883 friend class AST_FILE_IO;
884
886 friend class SgAsmGenericFileStorageClass;
887
889 friend class AstSpecificDataManagingClass;
890
892 friend class AstSpecificDataManagingClassStorageClass;
893 public:
895 SgAsmGenericFile( const SgAsmGenericFileStorageClass& source );
896
897 // private: // JJW hack
898 /*
899 name AST Memory Allocation Support Variables
900 Memory allocations support variables
901
902 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
903 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
904 and support the AST File I/O Mechanism.
905 */
906 /* */
907
908 public:
909
910 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
911 // to current node (so that it will work cleanly with build functions to specify patterns).
912 // virtual SgNode* addRegExpAttribute();
919
920#ifndef _MSC_VER
921// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
922// and likely never fully implemented nor tested. Files remain in the src tree but are no
923// longer built.
924#define BUILD_ATERM_SUPPORT 0
925 #if BUILD_ATERM_SUPPORT
926 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
927 // DQ (10/4/2014): Adding ATerm support to ROSE.
937 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
938 virtual ATerm generate_ATerm() override;
939
941 virtual void generate_ATerm_Annotation(ATerm & term) override;
942 #endif
943 #endif // BUILD_ATERM_SUPPORT
944#endif
945 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
946 // virtual generate_AST(ATerm & term);
947 // virtual void read_ATerm_Annotation(ATerm & term);
948
949// *** COMMON CODE SECTION ENDS HERE ***
950
951
952// End of memberFunctionString
953// Start of memberFunctionString
954/* #line 710 "/workspace/src/ROSETTA/Grammar/Node.code" */
955
956 // the generated cast function
957 // friend ROSE_DLL_API SgAsmGenericFile* isSgAsmGenericFile ( SgNode* s );
958
959 typedef SgAsmExecutableFileFormat base_node_type;
960
961
962// End of memberFunctionString
963
964
965
966
967
968
969
970
971
972
973
974
975 protected:
976// Start of memberFunctionString
978
979// End of memberFunctionString
980// Start of memberFunctionString
981std::string p_name;
982
983// End of memberFunctionString
984// Start of memberFunctionString
985int p_fd;
986
987// End of memberFunctionString
988// Start of memberFunctionString
989struct stat p_sb;
990
991// End of memberFunctionString
992// Start of memberFunctionString
993SgFileContentList p_data;
994
995// End of memberFunctionString
996// Start of memberFunctionString
997SgAsmGenericHeaderList* p_headers;
998
999// End of memberFunctionString
1000// Start of memberFunctionString
1002
1003// End of memberFunctionString
1004// Start of memberFunctionString
1005bool p_truncateZeros;
1006
1007// End of memberFunctionString
1008// Start of memberFunctionString
1009bool p_trackingReferences;
1010
1011// End of memberFunctionString
1012// Start of memberFunctionString
1014
1015// End of memberFunctionString
1016// Start of memberFunctionString
1017bool p_neuter;
1018
1019// End of memberFunctionString
1020
1023 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, std::string,&SgAsmGenericFile::p_name>;
1024 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, int,&SgAsmGenericFile::p_fd>;
1025 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, struct stat,&SgAsmGenericFile::p_sb>;
1026 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgFileContentList,&SgAsmGenericFile::p_data>;
1027 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgAsmGenericHeaderList*,&SgAsmGenericFile::p_headers>;
1028 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, SgAsmGenericSectionList*,&SgAsmGenericFile::p_holes>;
1029 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_truncateZeros>;
1030 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_trackingReferences>;
1031 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, Rose::BinaryAnalysis::AddressIntervalSet,&SgAsmGenericFile::p_referencedExtents>;
1032 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFile, bool,&SgAsmGenericFile::p_neuter>;
1033
1034/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1035
1036
1037 };
1038#endif
1039
1040// postdeclarations for SgAsmGenericFile
1041
1042/* #line 1043 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
1043
1044/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
1045
1046/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1047
1048
1049/* #line 1050 "../../../src/frontend/SageIII//SgAsmGenericFile.h" */
1050
1051#endif // ROSE_SgAsmGenericFile_H
1052
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 RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual size_t get_numberOfTraversalSuccessors() const
return number of children in the traversal successor list
virtual std::vector< std::string > get_traversalSuccessorNamesContainer() const
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 size_t get_childIndex(SgNode *child) const
index-based access to traversal successors by child node
virtual std::vector< SgNode * > get_traversalSuccessorContainer() const
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
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 void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual SgNode * get_traversalSuccessorByIndex(size_t idx) const
index-based access to traversal successors by index number
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
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.
std::uint64_t Address
Address.
Definition Address.h:11
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.