ROSE 0.11.145.247
SgAsmGenericSection.h
1
2#ifndef ROSE_SgAsmGenericSection_H
3#define ROSE_SgAsmGenericSection_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 SgAsmGenericSection
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmGenericSection.h" */
25/* #line 31262 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
29#include <Rose/BinaryAnalysis/MemoryMap.h>
30#include <Rose/BinaryAnalysis/RelativeVirtualAddress.h>
31#include <sageContainer.h>
32
33#ifdef ROSE_SgAsmGenericSection_IMPL
34#include <SgAsmBasicString.h>
35#endif
36
37
38/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
39
40/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
41
42#if !defined(DOCUMENTATION)
43// Class Definition for SgAsmGenericSection
44class ROSE_DLL_API SgAsmGenericSection : public SgAsmExecutableFileFormat
45 {
46 public:
47
48
49/* #line 50 "../../../src/frontend/SageIII//SgAsmGenericSection.h" */
50
51 virtual SgNode* copy ( SgCopyHelp& help) const override;
52// Start of memberFunctionString
53/* #line 31397 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
54
55
56 //----------------------- Boost serialization for SgAsmGenericSection -----------------------
57#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
58private:
59 friend class boost::serialization::access;
60
61 template<class S>
62 void serialize(S &s, const unsigned /*version*/) {
63 debugSerializationBegin("SgAsmGenericSection");
64 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
65 s & BOOST_SERIALIZATION_NVP(p_file);
66 s & BOOST_SERIALIZATION_NVP(p_header);
67 s & BOOST_SERIALIZATION_NVP(p_size);
68 s & BOOST_SERIALIZATION_NVP(p_offset);
69 s & BOOST_SERIALIZATION_NVP(p_fileAlignment);
70 s & BOOST_SERIALIZATION_NVP(p_data);
71 s & BOOST_SERIALIZATION_NVP(p_purpose);
72 s & BOOST_SERIALIZATION_NVP(p_synthesized);
73 s & BOOST_SERIALIZATION_NVP(p_id);
74 s & BOOST_SERIALIZATION_NVP(p_name);
75 s & BOOST_SERIALIZATION_NVP(p_shortName);
76 s & BOOST_SERIALIZATION_NVP(p_mappedPreferredRva);
77 s & BOOST_SERIALIZATION_NVP(p_mappedSize);
78 s & BOOST_SERIALIZATION_NVP(p_mappedAlignment);
79 s & BOOST_SERIALIZATION_NVP(p_mappedReadPermission);
80 s & BOOST_SERIALIZATION_NVP(p_mappedWritePermission);
81 s & BOOST_SERIALIZATION_NVP(p_mappedExecutePermission);
82 s & BOOST_SERIALIZATION_NVP(p_containsCode);
83 s & BOOST_SERIALIZATION_NVP(p_mappedActualVa);
84 debugSerializationEnd("SgAsmGenericSection");
85 }
86#endif // ROSE_ENABLE_BOOST_SERIALIZATION
88 // Local types
90public:
95 enum SectionPurpose {
96 SP_UNSPECIFIED,
97 SP_PROGRAM,
98 SP_HEADER,
99 SP_SYMTAB,
100 SP_OTHER
101 };
102
104 // Properties
106public:
107public:
111 SgAsmGenericFile* const& get_file() const;
112 void set_file(SgAsmGenericFile* const&);
115public:
119 SgAsmGenericHeader* const& get_header() const;
120 void set_header(SgAsmGenericHeader* const&);
123public:
134 Rose::BinaryAnalysis::Address get_size() const;
135 virtual void set_size(Rose::BinaryAnalysis::Address);
137public:
145 // Starting file offset of the section
146
147 Rose::BinaryAnalysis::Address get_offset() const;
148 virtual void set_offset(Rose::BinaryAnalysis::Address);
150public:
156 Rose::BinaryAnalysis::Address const& get_fileAlignment() const;
157 void set_fileAlignment(Rose::BinaryAnalysis::Address const&);
160public:
166 SgFileContentList const& get_data() const;
167 void set_data(SgFileContentList const&);
170public:
174 SgAsmGenericSection::SectionPurpose const& get_purpose() const;
175 void set_purpose(SgAsmGenericSection::SectionPurpose const&);
178public:
184 bool const& get_synthesized() const;
185 void set_synthesized(bool const&);
188public:
194 int const& get_id() const;
195 void set_id(int const&);
198public:
206 SgAsmGenericString* const& get_name() const;
209public:
217 void set_shortName(std::string const&);
218 std::string get_shortName() const;
220public:
230 Rose::BinaryAnalysis::Address const& get_mappedPreferredRva() const;
231 virtual void set_mappedPreferredRva(Rose::BinaryAnalysis::Address);
233public:
239 Rose::BinaryAnalysis::Address const& get_mappedSize() const;
240 virtual void set_mappedSize(Rose::BinaryAnalysis::Address);
242public:
246 Rose::BinaryAnalysis::Address const& get_mappedAlignment() const;
247 void set_mappedAlignment(Rose::BinaryAnalysis::Address const&);
250public:
254 bool const& get_mappedReadPermission() const;
255 void set_mappedReadPermission(bool const&);
258public:
262 bool const& get_mappedWritePermission() const;
263 void set_mappedWritePermission(bool const&);
266public:
270 bool const& get_mappedExecutePermission() const;
271 void set_mappedExecutePermission(bool const&);
274public:
284 bool const& get_containsCode() const;
285 void set_containsCode(bool const&);
288public:
302 Rose::BinaryAnalysis::Address const& get_mappedActualVa() const;
303 void set_mappedActualVa(Rose::BinaryAnalysis::Address const&);
306 // Non-property data members
308private:
309protected: // Allows local_data_pool to be initialized by subclasses. Note, destruction is problematic, freeing non-allocated ptr.
310 // Set breakpoint in malloc_error_break to debug [Rasmussen, 2024.03.02]
311 /* This is an optional local, writable pool for the p_data member. Normally a section will point into the pool
312 * for its SgAsmGenericFile which is memory-mapped (read-only) from the actual file being parsed. The default
313 * unparsing action is to write the original data back to the file. By allowing a section to allocate its own
314 * pool for `data` we create a very easy way to get data into the unparsed file (the alternative is to derive
315 * a new class and override the unparse() method). */
316 unsigned char *local_data_pool;
317
319 // Functions
321public:
329
331 static void dumpContainingSections(FILE*, const std::string &prefix, Rose::BinaryAnalysis::RelativeVirtualAddress,
332 const SgAsmGenericSectionPtrList&);
333
338 void grabContent();
339
343 virtual SgAsmGenericSection* parse();
344
346 virtual void dump(FILE*, const char *prefix, ssize_t idx) const;
347
349 virtual bool reallocate() { return false; }
350
354 virtual void unparse(std::ostream&) const;
355
357 void unparse(std::ostream&, const ExtentMap&) const;
358
360 void unparseHoles(std::ostream&) const;
361
366 SgAsmGenericHeader *isFileHeader();
367
369 Rose::BinaryAnalysis::Address get_endOffset() const;
370
377 void extend(Rose::BinaryAnalysis::Address nbytes);
378
392 Rose::BinaryAnalysis::Address write(std::ostream&, Rose::BinaryAnalysis::Address offset, size_t bufsize, const void *buf) const;
393 Rose::BinaryAnalysis::Address write(std::ostream&, Rose::BinaryAnalysis::Address offset, const std::string &str) const;
394 Rose::BinaryAnalysis::Address write(std::ostream&, Rose::BinaryAnalysis::Address offset, char c) const;
395 Rose::BinaryAnalysis::Address write(std::ostream&, Rose::BinaryAnalysis::Address offset, const SgFileContentList &buf) const;
396 Rose::BinaryAnalysis::Address write(std::ostream&, Rose::BinaryAnalysis::Address offset, const SgUnsignedCharList &buf) const;
402 Rose::BinaryAnalysis::Address writeUleb128(unsigned char*, Rose::BinaryAnalysis::Address offset, uint64_t) const;
403
407 Rose::BinaryAnalysis::Address writeSleb128(unsigned char*, Rose::BinaryAnalysis::Address offset, int64_t) const;
408
416 size_t readContent(Rose::BinaryAnalysis::Address abs_offset, void *dst_buf, Rose::BinaryAnalysis::Address size, bool strict=true);
417
429 size_t readContent(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address start, void *dst_buf,
430 Rose::BinaryAnalysis::Address size, bool strict=true);
432 void *dst_buf, Rose::BinaryAnalysis::Address size, bool strict=true);
441 size_t readContentLocal(Rose::BinaryAnalysis::Address rel_offset, void *dst_buf, Rose::BinaryAnalysis::Address size,
442 bool strict=true);
443
450 std::string readContentString(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address va, bool strict=true);
451
459 std::string readContentString(Rose::BinaryAnalysis::Address abs_offset, bool strict=true);
461 bool strict=true);
469 std::string readContentLocalString(Rose::BinaryAnalysis::Address rel_offset, bool strict=true);
470
475 SgUnsignedCharList readContentLocalUcl(Rose::BinaryAnalysis::Address rel_offset, Rose::BinaryAnalysis::Address size);
476
482 int64_t readContentLocalSleb128(Rose::BinaryAnalysis::Address *rel_offset, bool strict=true);
483
489 uint64_t readContentLocalUleb128(Rose::BinaryAnalysis::Address *rel_offset, bool strict=true);
490
498 unsigned char *writableContent(size_t nbytes);
499
505 Rose::BinaryAnalysis::AddressIntervalSet get_referencedExtents() const;
506
512 Rose::BinaryAnalysis::AddressIntervalSet get_unreferencedExtents() const;
513
517 bool isMapped() const;
518
522 void clearMapped();
523
528 Rose::BinaryAnalysis::Address get_baseVa() const;
529
533 Rose::BinaryAnalysis::Address get_mappedPreferredVa() const;
534
540
546
550 Extent get_fileExtent() const;
551
556 Extent get_mappedPreferredExtent() const;
557
571 bool align();
572
573protected:
574 virtual void destructorHelper() override;
575
577 // Deprecated 2023-11
579public:
580 Rose::BinaryAnalysis::Address get_file_alignment() const ROSE_DEPRECATED("use get_fileAlignment");
581 void set_file_alignment(Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_fileAlignment");
582 std::string get_short_name() const ROSE_DEPRECATED("use get_shortName");
583 void set_short_name(const std::string&) ROSE_DEPRECATED("use set_shortName");
584 Rose::BinaryAnalysis::Address get_mapped_preferred_rva() const ROSE_DEPRECATED("use get_mappedPreferredRva");
585 void set_mapped_preferred_rva(Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_mappedPreferredRva");
586 Rose::BinaryAnalysis::Address get_mapped_size() const ROSE_DEPRECATED("use get_mappedSize");
587 void set_mapped_size(Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_mappedSize");
588 Rose::BinaryAnalysis::Address get_mapped_alignment() const ROSE_DEPRECATED("use get_mappedAlignment");
589 void set_mapped_alignment(Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_mappedAlignment");
590 bool get_mapped_rperm() const ROSE_DEPRECATED("use get_mappedReadPermission");
591 void set_mapped_rperm(bool) ROSE_DEPRECATED("use set_mappedReadPermission");
592 bool get_mapped_wperm() const ROSE_DEPRECATED("use get_mappedWritePermission");
593 void set_mapped_wperm(bool) ROSE_DEPRECATED("use set_mappedWritePermission");
594 bool get_mapped_xperm() const ROSE_DEPRECATED("use get_mappedExecutePermission");
595 void set_mapped_xperm(bool) ROSE_DEPRECATED("use set_mappedExecutePermission");
596 bool get_contains_code() const ROSE_DEPRECATED("use get_containsCode");
597 void set_contains_code(bool) ROSE_DEPRECATED("use set_containsCode");
598 Rose::BinaryAnalysis::Address get_mapped_actual_va() const ROSE_DEPRECATED("use get_mappedActualVa");
599 void set_mapped_actual_va(Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_mappedActualVa");
600 static void dump_containing_sections(FILE*, const std::string&, Rose::BinaryAnalysis::RelativeVirtualAddress,
601 const SgAsmGenericSectionPtrList&)
602 ROSE_DEPRECATED("use dumpContainingSections");
603 void grab_content() ROSE_DEPRECATED("use grabContent");
604 void unparse_holes(std::ostream&) const ROSE_DEPRECATED("use unparseHoles");
605 SgAsmGenericHeader *is_file_header() ROSE_DEPRECATED("use isFileHeader");
606 Rose::BinaryAnalysis::Address get_end_offset() const ROSE_DEPRECATED("use get_endOffset");
607 Rose::BinaryAnalysis::Address write_uleb128(unsigned char*, Rose::BinaryAnalysis::Address, uint64_t) const
608 ROSE_DEPRECATED("use writeUleb128");
609 Rose::BinaryAnalysis::Address write_sleb128(unsigned char*, Rose::BinaryAnalysis::Address, int64_t) const
610 ROSE_DEPRECATED("use writeSleb128");
611 size_t read_content(Rose::BinaryAnalysis::Address, void*, Rose::BinaryAnalysis::Address, bool=true)
612 ROSE_DEPRECATED("use readContent");
613 size_t read_content(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address, void*,
614 Rose::BinaryAnalysis::Address, bool=true) ROSE_DEPRECATED("use readContent");
615 size_t read_content(const Rose::BinaryAnalysis::MemoryMap::Ptr&, const Rose::BinaryAnalysis::RelativeVirtualAddress&, void*,
616 Rose::BinaryAnalysis::Address, bool=true)
617 ROSE_DEPRECATED("use readContent");
618 size_t read_content_local(Rose::BinaryAnalysis::Address, void*, Rose::BinaryAnalysis::Address, bool=true)
619 ROSE_DEPRECATED("use readContentLocal");
620 std::string read_content_str(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::Address, bool=true)
621 ROSE_DEPRECATED("use readContentString");
622 std::string read_content_str(Rose::BinaryAnalysis::Address, bool=true) ROSE_DEPRECATED("use readContentString");
623 std::string read_content_str(const Rose::BinaryAnalysis::MemoryMap::Ptr&, Rose::BinaryAnalysis::RelativeVirtualAddress,
624 bool=true)
625 ROSE_DEPRECATED("use readContentString");
626 std::string read_content_local_str(Rose::BinaryAnalysis::Address, bool=true) ROSE_DEPRECATED("use readContentLocalString");
627 SgUnsignedCharList read_content_local_ucl(Rose::BinaryAnalysis::Address, Rose::BinaryAnalysis::Address)
628 ROSE_DEPRECATED("use readContentLocalUcl");
629 int64_t read_content_local_sleb128(Rose::BinaryAnalysis::Address*, bool=true) ROSE_DEPRECATED("use readContentLocalSleb128");
630 uint64_t read_content_local_uleb128(Rose::BinaryAnalysis::Address*, bool=true) ROSE_DEPRECATED("use readContentLocalUleb128");
631 unsigned char *writable_content(size_t) ROSE_DEPRECATED("use writableContent");
632 Rose::BinaryAnalysis::AddressIntervalSet get_referenced_extents() const ROSE_DEPRECATED("use get_referencedExtents");
633 Rose::BinaryAnalysis::AddressIntervalSet get_unreferenced_extents() const ROSE_DEPRECATED("use get_unreferencedExtents");
634 bool is_mapped() const ROSE_DEPRECATED("use isMapped");
635 void clear_mapped() ROSE_DEPRECATED("use clearMapped");
636 Rose::BinaryAnalysis::Address get_base_va() const ROSE_DEPRECATED("use get_baseVa");
637 Rose::BinaryAnalysis::Address get_mapped_preferred_va() const ROSE_DEPRECATED("use get_mappedPreferredVa");
638 Rose::BinaryAnalysis::Address get_va_offset(Rose::BinaryAnalysis::Address) const ROSE_DEPRECATED("use get_vaOffset");
639 Rose::BinaryAnalysis::Address get_rva_offset(Rose::BinaryAnalysis::Address) const ROSE_DEPRECATED("use get_rvaOffset");
640 Extent get_file_extent() const ROSE_DEPRECATED("use get_fileExtent");
641 Extent get_mapped_preferred_extent() const ROSE_DEPRECATED("use get_mappedPreferredExtent");
642public:
644 virtual ~SgAsmGenericSection();
645
646public:
649
650protected:
657 void initializeProperties();
658
659
660// End of memberFunctionString
661// Start of memberFunctionString
662/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
663
664// *** COMMON CODE SECTION BEGINS HERE ***
665
666 public:
667
668 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
669 // and not required which is required to match the other aspects of the copy mechanism code generation.
670 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
671 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
672 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
673 // virtual SgNode* copy ( const SgCopyHelp & help) const;
674
676 virtual std::string class_name() const override;
677
679 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
680
682 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
683 // static const VariantT static_variant = V_SgAsmGenericSection;
684 enum { static_variant = V_SgAsmGenericSection };
685
686 /* the generated cast function */
688 ROSE_DLL_API friend SgAsmGenericSection* isSgAsmGenericSection( SgNode * s );
689
691 ROSE_DLL_API friend const SgAsmGenericSection* isSgAsmGenericSection( const SgNode * s );
692
693 // ******************************************
694 // * Memory Pool / New / Delete
695 // ******************************************
696
697 public:
699 static const unsigned pool_size; //
701 static std::vector<unsigned char *> pools; //
703 static SgAsmGenericSection * next_node; //
704
706 static unsigned long initializeStorageClassArray(SgAsmGenericSectionStorageClass *); //
707
709 static void clearMemoryPool(); //
710 static void deleteMemoryPool(); //
711
713 static void extendMemoryPoolForFileIO(); //
714
716 static SgAsmGenericSection * getPointerFromGlobalIndex(unsigned long); //
718 static SgAsmGenericSection * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
719
721 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
723 static void resetValidFreepointers(); //
725 static unsigned long getNumberOfLastValidPointer(); //
726
727
728#if defined(INLINE_FUNCTIONS)
730 inline void *operator new (size_t size);
731#else
733 void *operator new (size_t size);
734#endif
736 void operator delete (void* pointer, size_t size);
737
738 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
739 void operator delete (void* pointer)
740 {
741 // This is the generated delete operator...
742 SgAsmGenericSection::operator delete (pointer,sizeof(SgAsmGenericSection));
743 }
744
746 static size_t numberOfNodes();
747
749 static size_t memoryUsage();
750
751 // End of scope which started in IR nodes specific code
752 /* */
753
754 /* name Internal Functions
755 \brief Internal functions ... incomplete-documentation
756
757 These functions have been made public as part of the design, but they are suggested for internal use
758 or by particularly knowledgeable users for specialized tools or applications.
759
760 \internal We could not make these private because they are required by user for special purposes. And
761 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
762
763 */
764
765 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
766 // overridden in every class by *generated* implementation
768 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override;
769 // MS: 06/28/02 container of names of variables or container indices
770 // used used in the traversal to access AST successor nodes
771 // overridden in every class by *generated* implementation
774 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override;
775
776 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
777 // than all the vector copies. The implementation for these functions is generated for each class.
779 virtual size_t get_numberOfTraversalSuccessors() const override;
781 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const override;
783 virtual size_t get_childIndex(SgNode *child) const override;
784
785#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
786 // MS: 08/16/2002 method for generating RTI information
788 virtual RTIReturnType roseRTI() override;
789#endif
790 /* */
791
792
793
794 /* name Deprecated Functions
795 \brief Deprecated functions ... incomplete-documentation
796
797 These functions have been deprecated from use.
798 */
799 /* */
800
802 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
803
804 // JJW (10/16/2008): Changed to a single function in Node.code, and put
805 // getVariant() in #if 0 block to prevent confusing Doxygen
806#if 0
808 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
810 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
811#endif
812 /* */
813
814
815
816
817 public:
818 /* name Traversal Support Functions
819 \brief Traversal support functions ... incomplete-documentation
820
821 These functions have been made public as part of the design, but they are suggested for internal use
822 or by particularly knowledgable users for specialized tools or applications.
823 */
824 /* */
825
826 // DQ (11/26/2005): Support for visitor pattern mechanims
827 // (inferior to ROSE traversal mechanism, experimental).
831
832 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
834 virtual void accept (ROSE_VisitorPattern & visitor) override;
835
836 // DQ (12/26/2005): Support for traversal based on the memory pool
839 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
840
844
845 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
846 // This traversal helps support internal tools that call static member functions.
847 // note: this function operates on the memory pools.
850 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
851 /* */
852
853 public:
854 /* NodeId support functions */
856 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
859 static SgAsmGenericSection* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
862 static std::string getNodeIdString(SgAsmGenericSection* sgnode);
863 static std::string getNodeIdStringInternal(SgAsmGenericSection* sgnode);
864
865 public:
866 /* name Memory Allocation Functions
867 \brief Memory allocations functions ... incomplete-documentation
868
869 These functions have been made public as part of the design, but they are suggested for internal use
870 or by particularly knowledgable users for specialized tools or applications.
871 */
872 /* */
873
884 virtual bool isInMemoryPool() override;
885
896 virtual void checkDataMemberPointersIfInMemoryPool() override;
897
898 // DQ (4/30/2006): Modified to be a const function.
913 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
914
925
937 virtual long getChildIndex( SgNode* childNode ) const override;
938
939 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
940 // comment here (changed to be a C style comment and not be a doxygen comment).
941 /* \brief Constructor for use by AST File I/O Mechanism
942
943 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
944 which obtained via fast binary file I/O from disk.
945 */
946 // SgAsmGenericSection( SgAsmGenericSectionStorageClass& source );
947
948
949
950
951
952 // JH (10/24/2005): methods added to support the ast file IO
953 private:
954
955 /* name AST Memory Allocation Support Functions
956 \brief Memory allocations support....
957
958 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
959 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
960 and support the AST File I/O Mechanism.
961 */
962 /* */
963
964 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
965 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
966 that I use the same type everywhere, if any changes are made. THe second one declares the type
967 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
968 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
969 a correspinding one in the AST_FILE_IO class!
970 */
971 // DQ (9/2/2015): This typedef is no longer used, we can't define the
972 // comment here (changed to be a C style comment and not be a doxygen comment).
973 /* \brief Typedef used for low level memory access.
974 */
975 // typedef unsigned char* TestType;
976
977 // DQ (9/2/2015): This typedef is no longer used, we can't define the
978 // comment here (changed to be a C style comment and not be a doxygen comment).
979 /* \brief Typedef used to hold memory addresses as values.
980 */
981 // typedef unsigned long AddressType;
982
983
984
985 // necessary, to have direct access to the p_freepointer and the private methods !
987 friend class AST_FILE_IO;
988
990 friend class SgAsmGenericSectionStorageClass;
991
993 friend class AstSpecificDataManagingClass;
994
996 friend class AstSpecificDataManagingClassStorageClass;
997 public:
999 SgAsmGenericSection( const SgAsmGenericSectionStorageClass& source );
1000
1001 // private: // JJW hack
1002 /*
1003 name AST Memory Allocation Support Variables
1004 Memory allocations support variables
1005
1006 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
1007 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
1008 and support the AST File I/O Mechanism.
1009 */
1010 /* */
1011
1012 public:
1013
1014 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
1015 // to current node (so that it will work cleanly with build functions to specify patterns).
1016 // virtual SgNode* addRegExpAttribute();
1023
1024#ifndef _MSC_VER
1025// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
1026// and likely never fully implemented nor tested. Files remain in the src tree but are no
1027// longer built.
1028#define BUILD_ATERM_SUPPORT 0
1029 #if BUILD_ATERM_SUPPORT
1030 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
1031 // DQ (10/4/2014): Adding ATerm support to ROSE.
1041 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
1042 virtual ATerm generate_ATerm() override;
1043
1045 virtual void generate_ATerm_Annotation(ATerm & term) override;
1046 #endif
1047 #endif // BUILD_ATERM_SUPPORT
1048#endif
1049 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
1050 // virtual generate_AST(ATerm & term);
1051 // virtual void read_ATerm_Annotation(ATerm & term);
1052
1053// *** COMMON CODE SECTION ENDS HERE ***
1054
1055
1056// End of memberFunctionString
1057// Start of memberFunctionString
1058/* #line 710 "/workspace/src/ROSETTA/Grammar/Node.code" */
1059
1060 // the generated cast function
1061 // friend ROSE_DLL_API SgAsmGenericSection* isSgAsmGenericSection ( SgNode* s );
1062
1063 typedef SgAsmExecutableFileFormat base_node_type;
1064
1065
1066// End of memberFunctionString
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087 protected:
1088// Start of memberFunctionString
1089SgAsmGenericFile* p_file;
1090
1091// End of memberFunctionString
1092// Start of memberFunctionString
1093SgAsmGenericHeader* p_header;
1094
1095// End of memberFunctionString
1096// Start of memberFunctionString
1098
1099// End of memberFunctionString
1100// Start of memberFunctionString
1102
1103// End of memberFunctionString
1104// Start of memberFunctionString
1105Rose::BinaryAnalysis::Address p_fileAlignment;
1106
1107// End of memberFunctionString
1108// Start of memberFunctionString
1109SgFileContentList p_data;
1110
1111// End of memberFunctionString
1112// Start of memberFunctionString
1114
1115// End of memberFunctionString
1116// Start of memberFunctionString
1117bool p_synthesized;
1118
1119// End of memberFunctionString
1120// Start of memberFunctionString
1121int p_id;
1122
1123// End of memberFunctionString
1124// Start of memberFunctionString
1125SgAsmGenericString* p_name;
1126
1127// End of memberFunctionString
1128// Start of memberFunctionString
1129std::string p_shortName;
1130
1131// End of memberFunctionString
1132// Start of memberFunctionString
1133Rose::BinaryAnalysis::Address p_mappedPreferredRva;
1134
1135// End of memberFunctionString
1136// Start of memberFunctionString
1138
1139// End of memberFunctionString
1140// Start of memberFunctionString
1141Rose::BinaryAnalysis::Address p_mappedAlignment;
1142
1143// End of memberFunctionString
1144// Start of memberFunctionString
1145bool p_mappedReadPermission;
1146
1147// End of memberFunctionString
1148// Start of memberFunctionString
1149bool p_mappedWritePermission;
1150
1151// End of memberFunctionString
1152// Start of memberFunctionString
1153bool p_mappedExecutePermission;
1154
1155// End of memberFunctionString
1156// Start of memberFunctionString
1157bool p_containsCode;
1158
1159// End of memberFunctionString
1160// Start of memberFunctionString
1161Rose::BinaryAnalysis::Address p_mappedActualVa;
1162
1163// End of memberFunctionString
1164
1166 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, SgAsmGenericFile*,&SgAsmGenericSection::p_file>;
1167 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, SgAsmGenericHeader*,&SgAsmGenericSection::p_header>;
1168 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_size>;
1169 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_offset>;
1170 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_fileAlignment>;
1171 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, SgFileContentList,&SgAsmGenericSection::p_data>;
1172 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, SgAsmGenericSection::SectionPurpose,&SgAsmGenericSection::p_purpose>;
1173 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, bool,&SgAsmGenericSection::p_synthesized>;
1174 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, int,&SgAsmGenericSection::p_id>;
1175 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, SgAsmGenericString*,&SgAsmGenericSection::p_name>;
1176 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, std::string,&SgAsmGenericSection::p_shortName>;
1177 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_mappedPreferredRva>;
1178 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_mappedSize>;
1179 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_mappedAlignment>;
1180 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, bool,&SgAsmGenericSection::p_mappedReadPermission>;
1181 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, bool,&SgAsmGenericSection::p_mappedWritePermission>;
1182 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, bool,&SgAsmGenericSection::p_mappedExecutePermission>;
1183 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, bool,&SgAsmGenericSection::p_containsCode>;
1184 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSection, Rose::BinaryAnalysis::Address,&SgAsmGenericSection::p_mappedActualVa>;
1185
1186/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1187
1188
1189 };
1190#endif
1191
1192// postdeclarations for SgAsmGenericSection
1193
1194/* #line 1195 "../../../src/frontend/SageIII//SgAsmGenericSection.h" */
1195
1196/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
1197
1198/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1199
1200
1201/* #line 1202 "../../../src/frontend/SageIII//SgAsmGenericSection.h" */
1202
1203#endif // ROSE_SgAsmGenericSection_H
1204
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
A contiguous range of values.
Definition rangemap.h:50
Optionally bound relative virtual address.
Base class for many binary analysis nodes.
Base class for binary files.
Base class for container file headers.
Contiguous region of a file.
SectionPurpose
Reason for section's existence.
Base class for strings related to binary specimens.
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 * SectionPurpose(int64_t)
Convert SgAsmGenericSection::SectionPurpose enum constant to a string.