ROSE 0.11.145.192
SgAsmElfSection.h
1
2#ifndef ROSE_SgAsmElfSection_H
3#define ROSE_SgAsmElfSection_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmGenericSection.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 SgAsmElfSection
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmElfSection.h" */
25/* #line 22710 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#ifdef ROSE_SgAsmElfSection_IMPL
28#include <SgAsmElfSectionTableEntry.h>
29#include <SgAsmElfSegmentTableEntry.h>
30#endif
31
32
33/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
34
35/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
36
37#if !defined(DOCUMENTATION)
38// Class Definition for SgAsmElfSection
39class ROSE_DLL_API SgAsmElfSection : public SgAsmGenericSection
40 {
41 public:
42
43
44/* #line 45 "../../../src/frontend/SageIII//SgAsmElfSection.h" */
45
46 virtual SgNode* copy ( SgCopyHelp& help) const override;
47// Start of memberFunctionString
48/* #line 22741 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
49
50
51 //----------------------- Boost serialization for SgAsmElfSection -----------------------
52#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
53private:
54 friend class boost::serialization::access;
55
56 template<class S>
57 void serialize(S &s, const unsigned /*version*/) {
58 debugSerializationBegin("SgAsmElfSection");
59 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmGenericSection);
60 s & BOOST_SERIALIZATION_NVP(p_linkedSection);
61 s & BOOST_SERIALIZATION_NVP(p_sectionEntry);
62 s & BOOST_SERIALIZATION_NVP(p_segmentEntry);
63 debugSerializationEnd("SgAsmElfSection");
64 }
65#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
66public:
67public:
73 SgAsmElfSection* const& get_linkedSection() const;
74 virtual void set_linkedSection(SgAsmElfSection*);
76public:
80 SgAsmElfSectionTableEntry* const& get_sectionEntry() const;
81 void set_sectionEntry(SgAsmElfSectionTableEntry* const&);
84public:
88 SgAsmElfSegmentTableEntry* const& get_segmentEntry() const;
89 void set_segmentEntry(SgAsmElfSegmentTableEntry* const&);
91public:
97
103 SgAsmElfSection *initFromSectionTable(SgAsmElfSectionTableEntry*, SgAsmElfStringSection*, int id);
104
108 SgAsmElfSection *initFromSegmentTable(SgAsmElfSegmentTableEntry*, bool mmapOnly=false);
109
130 rose_addr_t calculateSizes(size_t r32size, size_t r64size, const std::vector<size_t> &optsizes,
131 size_t *entsize, size_t *required, size_t *optional, size_t *entcount) const;
132
133 virtual void finishParsing();
134
151 virtual rose_addr_t calculateSizes(size_t *entsize, size_t *required, size_t *optional, size_t *entcount) const;
152
153 virtual bool reallocate() override;
154
156 virtual void dump(FILE*, const char *prefix, ssize_t idx) const override;
157
159 void allocateNameToStorage(SgAsmElfStringSection*);
160
164 SgAsmElfFileHeader *get_elfHeader() const;
165
167 // Deprecated 2023-11
169public:
170 SgAsmElfSection* get_linked_section() const ROSE_DEPRECATED("use get_linkedSection");
171 virtual void set_linked_section(SgAsmElfSection*) ROSE_DEPRECATED("use set_linkSection");
172 SgAsmElfSectionTableEntry* get_section_entry() const ROSE_DEPRECATED("use get_sectionEntry");
173 void set_section_entry(SgAsmElfSectionTableEntry*) ROSE_DEPRECATED("use set_sectionEntry");
174 SgAsmElfSegmentTableEntry* get_segment_entry() const ROSE_DEPRECATED("use get_segmentEntry");
175 void set_segment_entry(SgAsmElfSegmentTableEntry*) ROSE_DEPRECATED("use set_segmentEntry");
176 SgAsmElfSection *init_from_section_table(SgAsmElfSectionTableEntry*, SgAsmElfStringSection*, int)
177 ROSE_DEPRECATED("use initFromSectionTable");
178 SgAsmElfSection *init_from_segment_table(SgAsmElfSegmentTableEntry*, bool mmap_only=false)
179 ROSE_DEPRECATED("use initFromSegmentTable");
180 rose_addr_t calculate_sizes(size_t, size_t, const std::vector<size_t>&, size_t*, size_t*, size_t*, size_t*) const
181 ROSE_DEPRECATED("use calculateSizes");
182 virtual void finish_parsing() ROSE_DEPRECATED("use finishParsing");
183 virtual rose_addr_t calculate_sizes(size_t*, size_t*, size_t*, size_t*) const ROSE_DEPRECATED("use calculateSizes");
184 void allocate_name_to_storage(SgAsmElfStringSection*) ROSE_DEPRECATED("use allocateNameToStorage");
185 SgAsmElfFileHeader *get_elf_header() const ROSE_DEPRECATED("use get_elfHeader");
186public:
188 virtual ~SgAsmElfSection();
189
190public:
193
194protected:
201 void initializeProperties();
202
203
204// End of memberFunctionString
205// Start of memberFunctionString
206/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
207
208// *** COMMON CODE SECTION BEGINS HERE ***
209
210 public:
211
212 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
213 // and not required which is required to match the other aspects of the copy mechanism code generation.
214 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
215 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
216 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
217 // virtual SgNode* copy ( const SgCopyHelp & help) const;
218
220 virtual std::string class_name() const override;
221
223 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
224
226 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
227 // static const VariantT static_variant = V_SgAsmElfSection;
228 enum { static_variant = V_SgAsmElfSection };
229
230 /* the generated cast function */
232 ROSE_DLL_API friend SgAsmElfSection* isSgAsmElfSection( SgNode * s );
233
235 ROSE_DLL_API friend const SgAsmElfSection* isSgAsmElfSection( const SgNode * s );
236
237 // ******************************************
238 // * Memory Pool / New / Delete
239 // ******************************************
240
241 public:
243 static const unsigned pool_size; //
245 static std::vector<unsigned char *> pools; //
247 static SgAsmElfSection * next_node; //
248
250 static unsigned long initializeStorageClassArray(SgAsmElfSectionStorageClass *); //
251
253 static void clearMemoryPool(); //
254 static void deleteMemoryPool(); //
255
257 static void extendMemoryPoolForFileIO(); //
258
260 static SgAsmElfSection * getPointerFromGlobalIndex(unsigned long); //
262 static SgAsmElfSection * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
263
265 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
267 static void resetValidFreepointers(); //
269 static unsigned long getNumberOfLastValidPointer(); //
270
271
272#if defined(INLINE_FUNCTIONS)
274 inline void *operator new (size_t size);
275#else
277 void *operator new (size_t size);
278#endif
280 void operator delete (void* pointer, size_t size);
281
282 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
283 void operator delete (void* pointer)
284 {
285 // This is the generated delete operator...
286 SgAsmElfSection::operator delete (pointer,sizeof(SgAsmElfSection));
287 }
288
290 static size_t numberOfNodes();
291
293 static size_t memoryUsage();
294
295 // End of scope which started in IR nodes specific code
296 /* */
297
298 /* name Internal Functions
299 \brief Internal functions ... incomplete-documentation
300
301 These functions have been made public as part of the design, but they are suggested for internal use
302 or by particularly knowledgeable users for specialized tools or applications.
303
304 \internal We could not make these private because they are required by user for special purposes. And
305 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
306
307 */
308
309 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
310 // overridden in every class by *generated* implementation
312 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
313 // MS: 06/28/02 container of names of variables or container indices
314 // used used in the traversal to access AST successor nodes
315 // overridden in every class by *generated* implementation
318 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
319
320 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
321 // than all the vector copies. The implementation for these functions is generated for each class.
323 virtual size_t get_numberOfTraversalSuccessors() override;
325 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
327 virtual size_t get_childIndex(SgNode *child) override;
328
329#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
330 // MS: 08/16/2002 method for generating RTI information
332 virtual RTIReturnType roseRTI() override;
333#endif
334 /* */
335
336
337
338 /* name Deprecated Functions
339 \brief Deprecated functions ... incomplete-documentation
340
341 These functions have been deprecated from use.
342 */
343 /* */
344
346 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
347
348 // JJW (10/16/2008): Changed to a single function in Node.code, and put
349 // getVariant() in #if 0 block to prevent confusing Doxygen
350#if 0
352 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
354 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
355#endif
356 /* */
357
358
359
360
361 public:
362 /* name Traversal Support Functions
363 \brief Traversal support functions ... incomplete-documentation
364
365 These functions have been made public as part of the design, but they are suggested for internal use
366 or by particularly knowledgable users for specialized tools or applications.
367 */
368 /* */
369
370 // DQ (11/26/2005): Support for visitor pattern mechanims
371 // (inferior to ROSE traversal mechanism, experimental).
375
376 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
378 virtual void accept (ROSE_VisitorPattern & visitor) override;
379
380 // DQ (12/26/2005): Support for traversal based on the memory pool
383 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
384
388
389 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
390 // This traversal helps support internal tools that call static member functions.
391 // note: this function operates on the memory pools.
394 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
395 /* */
396
397 public:
398 /* NodeId support functions */
400 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
403 static SgAsmElfSection* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
406 static std::string getNodeIdString(SgAsmElfSection* sgnode);
407 static std::string getNodeIdStringInternal(SgAsmElfSection* sgnode);
408
409 public:
410 /* name Memory Allocation Functions
411 \brief Memory allocations functions ... incomplete-documentation
412
413 These functions have been made public as part of the design, but they are suggested for internal use
414 or by particularly knowledgable users for specialized tools or applications.
415 */
416 /* */
417
428 virtual bool isInMemoryPool() override;
429
440 virtual void checkDataMemberPointersIfInMemoryPool() override;
441
442 // DQ (4/30/2006): Modified to be a const function.
457 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
458
469
481 virtual long getChildIndex( SgNode* childNode ) const override;
482
483 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
484 // comment here (changed to be a C style comment and not be a doxygen comment).
485 /* \brief Constructor for use by AST File I/O Mechanism
486
487 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
488 which obtained via fast binary file I/O from disk.
489 */
490 // SgAsmElfSection( SgAsmElfSectionStorageClass& source );
491
492
493
494
495
496 // JH (10/24/2005): methods added to support the ast file IO
497 private:
498
499 /* name AST Memory Allocation Support Functions
500 \brief Memory allocations support....
501
502 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
503 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
504 and support the AST File I/O Mechanism.
505 */
506 /* */
507
508 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
509 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
510 that I use the same type everywhere, if any changes are made. THe second one declares the type
511 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
512 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
513 a correspinding one in the AST_FILE_IO class!
514 */
515 // DQ (9/2/2015): This typedef is no longer used, we can't define the
516 // comment here (changed to be a C style comment and not be a doxygen comment).
517 /* \brief Typedef used for low level memory access.
518 */
519 // typedef unsigned char* TestType;
520
521 // DQ (9/2/2015): This typedef is no longer used, we can't define the
522 // comment here (changed to be a C style comment and not be a doxygen comment).
523 /* \brief Typedef used to hold memory addresses as values.
524 */
525 // typedef unsigned long AddressType;
526
527
528
529 // necessary, to have direct access to the p_freepointer and the private methods !
531 friend class AST_FILE_IO;
532
534 friend class SgAsmElfSectionStorageClass;
535
537 friend class AstSpecificDataManagingClass;
538
540 friend class AstSpecificDataManagingClassStorageClass;
541 public:
543 SgAsmElfSection( const SgAsmElfSectionStorageClass& source );
544
545 // private: // JJW hack
546 /*
547 name AST Memory Allocation Support Variables
548 Memory allocations support variables
549
550 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
551 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
552 and support the AST File I/O Mechanism.
553 */
554 /* */
555
556 public:
557
558 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
559 // to current node (so that it will work cleanly with build functions to specify patterns).
560 // virtual SgNode* addRegExpAttribute();
567
568#ifndef _MSC_VER
569// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
570// and likely never fully implemented nor tested. Files remain in the src tree but are no
571// longer built.
572#define BUILD_ATERM_SUPPORT 0
573 #if BUILD_ATERM_SUPPORT
574 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
575 // DQ (10/4/2014): Adding ATerm support to ROSE.
585 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
586 virtual ATerm generate_ATerm() override;
587
589 virtual void generate_ATerm_Annotation(ATerm & term) override;
590 #endif
591 #endif // BUILD_ATERM_SUPPORT
592#endif
593 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
594 // virtual generate_AST(ATerm & term);
595 // virtual void read_ATerm_Annotation(ATerm & term);
596
597// *** COMMON CODE SECTION ENDS HERE ***
598
599
600// End of memberFunctionString
601// Start of memberFunctionString
602/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
603
604 // the generated cast function
605 // friend ROSE_DLL_API SgAsmElfSection* isSgAsmElfSection ( SgNode* s );
606
607 typedef SgAsmGenericSection base_node_type;
608
609
610// End of memberFunctionString
611
612
613
614
615 protected:
616// Start of memberFunctionString
617SgAsmElfSection* p_linkedSection;
618
619// End of memberFunctionString
620// Start of memberFunctionString
621SgAsmElfSectionTableEntry* p_sectionEntry;
622
623// End of memberFunctionString
624// Start of memberFunctionString
625SgAsmElfSegmentTableEntry* p_segmentEntry;
626
627// End of memberFunctionString
628
630 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSection, SgAsmElfSection*,&SgAsmElfSection::p_linkedSection>;
631 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSection, SgAsmElfSectionTableEntry*,&SgAsmElfSection::p_sectionEntry>;
632 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSection, SgAsmElfSegmentTableEntry*,&SgAsmElfSection::p_segmentEntry>;
633
634/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
635
636
637 };
638#endif
639
640// postdeclarations for SgAsmElfSection
641
642/* #line 643 "../../../src/frontend/SageIII//SgAsmElfSection.h" */
643
644/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
645
646/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
647
648
649/* #line 650 "../../../src/frontend/SageIII//SgAsmElfSection.h" */
650
651#endif // ROSE_SgAsmElfSection_H
652
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Represents the file header of an ELF binary container.
Represents one entry in an ELF section table.
Base class for ELF file sections.
Represents one entry of a segment table.
ELF string table section.
Base class for container file headers.
Contiguous region of a file.
virtual void dump(FILE *, const char *prefix, ssize_t idx) const
Print some debugging info.
virtual bool reallocate()
Called prior to unparse to make things consistent.
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.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.