ROSE 0.11.145.147
SgAsmElfSymbolSection.h
1
2#ifndef ROSE_SgAsmElfSymbolSection_H
3#define ROSE_SgAsmElfSymbolSection_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmElfSection.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 SgAsmElfSymbolSection
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmElfSymbolSection.h" */
25/* #line 18832 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#ifdef ROSE_SgAsmElfSymbolSection_IMPL
28#include <SgAsmElfSymbolList.h>
29#endif
30
31
32/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
33
34/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
35
36#if !defined(DOCUMENTATION)
37// Class Definition for SgAsmElfSymbolSection
38class ROSE_DLL_API SgAsmElfSymbolSection : public SgAsmElfSection
39 {
40 public:
41
42
43/* #line 44 "../../../src/frontend/SageIII//SgAsmElfSymbolSection.h" */
44
45 virtual SgNode* copy ( SgCopyHelp& help) const override;
46// Start of memberFunctionString
47/* #line 18856 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
48
49
50 //----------------------- Boost serialization for SgAsmElfSymbolSection -----------------------
51#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
52private:
53 friend class boost::serialization::access;
54
55 template<class S>
56 void serialize(S &s, const unsigned /*version*/) {
57 debugSerializationBegin("SgAsmElfSymbolSection");
58 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmElfSection);
59 s & BOOST_SERIALIZATION_NVP(p_isDynamic);
60 s & BOOST_SERIALIZATION_NVP(p_symbols);
61 debugSerializationEnd("SgAsmElfSymbolSection");
62 }
63#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
64public:
65public:
69 bool const& get_isDynamic() const;
70 void set_isDynamic(bool const&);
73public:
80 SgAsmElfSymbolList* const& get_symbols() const;
81 void set_symbols(SgAsmElfSymbolList* const&);
83public:
86
88 virtual SgAsmElfSymbolSection* parse() override;
89
102 virtual void finishParsing() override;
103
105 size_t indexOf(SgAsmElfSymbol*);
106
111 virtual rose_addr_t calculateSizes(size_t *total, size_t *required, size_t *optional, size_t *nentries) const override;
112
116 virtual bool reallocate() override;
117
119 virtual void unparse(std::ostream&) const override;
120
122 virtual void dump(FILE*, const char *prefix, ssize_t idx) const override;
123
125 // Deprecated 2023-11
127public:
128 bool get_is_dynamic() const ROSE_DEPRECATED("use get_isDynamic");
129 void set_is_dynamic(bool) ROSE_DEPRECATED("use set_isDynamic");
130 virtual void finish_parsing() override ROSE_DEPRECATED("use finishParsing");
131 size_t index_of(SgAsmElfSymbol*) ROSE_DEPRECATED("use indexOf");
132 using SgAsmElfSection::calculate_sizes;
133 virtual rose_addr_t calculate_sizes(size_t*, size_t*, size_t*, size_t*) const override ROSE_DEPRECATED("use calculateSizes");
134public:
136 virtual ~SgAsmElfSymbolSection();
137
138public:
141
142protected:
149 void initializeProperties();
150
151
152// End of memberFunctionString
153// Start of memberFunctionString
154/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
155
156// *** COMMON CODE SECTION BEGINS HERE ***
157
158 public:
159
160 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
161 // and not required which is required to match the other aspects of the copy mechanism code generation.
162 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
163 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
164 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
165 // virtual SgNode* copy ( const SgCopyHelp & help) const;
166
168 virtual std::string class_name() const override;
169
171 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
172
174 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
175 // static const VariantT static_variant = V_SgAsmElfSymbolSection;
176 enum { static_variant = V_SgAsmElfSymbolSection };
177
178 /* the generated cast function */
180 ROSE_DLL_API friend SgAsmElfSymbolSection* isSgAsmElfSymbolSection( SgNode * s );
181
183 ROSE_DLL_API friend const SgAsmElfSymbolSection* isSgAsmElfSymbolSection( const SgNode * s );
184
185 // ******************************************
186 // * Memory Pool / New / Delete
187 // ******************************************
188
189 public:
191 static const unsigned pool_size; //
193 static std::vector<unsigned char *> pools; //
195 static SgAsmElfSymbolSection * next_node; //
196
198 static unsigned long initializeStorageClassArray(SgAsmElfSymbolSectionStorageClass *); //
199
201 static void clearMemoryPool(); //
202 static void deleteMemoryPool(); //
203
205 static void extendMemoryPoolForFileIO(); //
206
208 static SgAsmElfSymbolSection * getPointerFromGlobalIndex(unsigned long); //
210 static SgAsmElfSymbolSection * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
211
213 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
215 static void resetValidFreepointers(); //
217 static unsigned long getNumberOfLastValidPointer(); //
218
219
220#if defined(INLINE_FUNCTIONS)
222 inline void *operator new (size_t size);
223#else
225 void *operator new (size_t size);
226#endif
228 void operator delete (void* pointer, size_t size);
229
230 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
231 void operator delete (void* pointer)
232 {
233 // This is the generated delete operator...
234 SgAsmElfSymbolSection::operator delete (pointer,sizeof(SgAsmElfSymbolSection));
235 }
236
238 static size_t numberOfNodes();
239
241 static size_t memoryUsage();
242
243 // End of scope which started in IR nodes specific code
244 /* */
245
246 /* name Internal Functions
247 \brief Internal functions ... incomplete-documentation
248
249 These functions have been made public as part of the design, but they are suggested for internal use
250 or by particularly knowledgeable users for specialized tools or applications.
251
252 \internal We could not make these private because they are required by user for special purposes. And
253 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
254
255 */
256
257 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
258 // overridden in every class by *generated* implementation
260 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
261 // MS: 06/28/02 container of names of variables or container indices
262 // used used in the traversal to access AST successor nodes
263 // overridden in every class by *generated* implementation
266 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
267
268 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
269 // than all the vector copies. The implementation for these functions is generated for each class.
271 virtual size_t get_numberOfTraversalSuccessors() override;
273 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
275 virtual size_t get_childIndex(SgNode *child) override;
276
277#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
278 // MS: 08/16/2002 method for generating RTI information
280 virtual RTIReturnType roseRTI() override;
281#endif
282 /* */
283
284
285
286 /* name Deprecated Functions
287 \brief Deprecated functions ... incomplete-documentation
288
289 These functions have been deprecated from use.
290 */
291 /* */
292
294 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
295
296 // JJW (10/16/2008): Changed to a single function in Node.code, and put
297 // getVariant() in #if 0 block to prevent confusing Doxygen
298#if 0
300 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
302 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
303#endif
304 /* */
305
306
307
308
309 public:
310 /* name Traversal Support Functions
311 \brief Traversal support functions ... incomplete-documentation
312
313 These functions have been made public as part of the design, but they are suggested for internal use
314 or by particularly knowledgable users for specialized tools or applications.
315 */
316 /* */
317
318 // DQ (11/26/2005): Support for visitor pattern mechanims
319 // (inferior to ROSE traversal mechanism, experimental).
323
324 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
326 virtual void accept (ROSE_VisitorPattern & visitor) override;
327
328 // DQ (12/26/2005): Support for traversal based on the memory pool
331 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
332
336
337 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
338 // This traversal helps support internal tools that call static member functions.
339 // note: this function operates on the memory pools.
342 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
343 /* */
344
345 public:
346 /* NodeId support functions */
348 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
351 static SgAsmElfSymbolSection* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
354 static std::string getNodeIdString(SgAsmElfSymbolSection* sgnode);
355 static std::string getNodeIdStringInternal(SgAsmElfSymbolSection* sgnode);
356
357 public:
358 /* name Memory Allocation Functions
359 \brief Memory allocations functions ... incomplete-documentation
360
361 These functions have been made public as part of the design, but they are suggested for internal use
362 or by particularly knowledgable users for specialized tools or applications.
363 */
364 /* */
365
376 virtual bool isInMemoryPool() override;
377
388 virtual void checkDataMemberPointersIfInMemoryPool() override;
389
390 // DQ (4/30/2006): Modified to be a const function.
405 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
406
417
429 virtual long getChildIndex( SgNode* childNode ) const override;
430
431 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
432 // comment here (changed to be a C style comment and not be a doxygen comment).
433 /* \brief Constructor for use by AST File I/O Mechanism
434
435 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
436 which obtained via fast binary file I/O from disk.
437 */
438 // SgAsmElfSymbolSection( SgAsmElfSymbolSectionStorageClass& source );
439
440
441
442
443
444 // JH (10/24/2005): methods added to support the ast file IO
445 private:
446
447 /* name AST Memory Allocation Support Functions
448 \brief Memory allocations support....
449
450 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
451 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
452 and support the AST File I/O Mechanism.
453 */
454 /* */
455
456 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
457 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
458 that I use the same type everywhere, if any changes are made. THe second one declares the type
459 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
460 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
461 a correspinding one in the AST_FILE_IO class!
462 */
463 // DQ (9/2/2015): This typedef is no longer used, we can't define the
464 // comment here (changed to be a C style comment and not be a doxygen comment).
465 /* \brief Typedef used for low level memory access.
466 */
467 // typedef unsigned char* TestType;
468
469 // DQ (9/2/2015): This typedef is no longer used, we can't define the
470 // comment here (changed to be a C style comment and not be a doxygen comment).
471 /* \brief Typedef used to hold memory addresses as values.
472 */
473 // typedef unsigned long AddressType;
474
475
476
477 // necessary, to have direct access to the p_freepointer and the private methods !
479 friend class AST_FILE_IO;
480
482 friend class SgAsmElfSymbolSectionStorageClass;
483
485 friend class AstSpecificDataManagingClass;
486
488 friend class AstSpecificDataManagingClassStorageClass;
489 public:
491 SgAsmElfSymbolSection( const SgAsmElfSymbolSectionStorageClass& source );
492
493 // private: // JJW hack
494 /*
495 name AST Memory Allocation Support Variables
496 Memory allocations support variables
497
498 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
499 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
500 and support the AST File I/O Mechanism.
501 */
502 /* */
503
504 public:
505
506 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
507 // to current node (so that it will work cleanly with build functions to specify patterns).
508 // virtual SgNode* addRegExpAttribute();
515
516#ifndef _MSC_VER
517// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
518// and likely never fully implemented nor tested. Files remain in the src tree but are no
519// longer built.
520#define BUILD_ATERM_SUPPORT 0
521 #if BUILD_ATERM_SUPPORT
522 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
523 // DQ (10/4/2014): Adding ATerm support to ROSE.
533 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
534 virtual ATerm generate_ATerm() override;
535
537 virtual void generate_ATerm_Annotation(ATerm & term) override;
538 #endif
539 #endif // BUILD_ATERM_SUPPORT
540#endif
541 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
542 // virtual generate_AST(ATerm & term);
543 // virtual void read_ATerm_Annotation(ATerm & term);
544
545// *** COMMON CODE SECTION ENDS HERE ***
546
547
548// End of memberFunctionString
549// Start of memberFunctionString
550/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
551
552 // the generated cast function
553 // friend ROSE_DLL_API SgAsmElfSymbolSection* isSgAsmElfSymbolSection ( SgNode* s );
554
555 typedef SgAsmElfSection base_node_type;
556
557
558// End of memberFunctionString
559
560
561
562 protected:
563// Start of memberFunctionString
564bool p_isDynamic;
565
566// End of memberFunctionString
567// Start of memberFunctionString
568SgAsmElfSymbolList* p_symbols;
569
570// End of memberFunctionString
571
573 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbolSection, bool,&SgAsmElfSymbolSection::p_isDynamic>;
574 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbolSection, SgAsmElfSymbolList*,&SgAsmElfSymbolSection::p_symbols>;
575
576/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
577
578
579 };
580#endif
581
582// postdeclarations for SgAsmElfSymbolSection
583
584/* #line 585 "../../../src/frontend/SageIII//SgAsmElfSymbolSection.h" */
585
586/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
587
588/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
589
590
591/* #line 592 "../../../src/frontend/SageIII//SgAsmElfSymbolSection.h" */
592
593#endif // ROSE_SgAsmElfSymbolSection_H
594
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.
Base class for ELF file sections.
virtual void dump(FILE *, const char *prefix, ssize_t idx) const override
Print some debugging info.
virtual bool reallocate() override
Called prior to unparse to make things consistent.
rose_addr_t calculateSizes(size_t r32size, size_t r64size, const std::vector< size_t > &optsizes, size_t *entsize, size_t *required, size_t *optional, size_t *entcount) const
Returns info about the size of the entries based on information already available.
ELF string table section.
ELF file section containing symbols.
Represents a single ELF symbol.
virtual SgAsmGenericSection * parse()
Parse contents of the section.
virtual void unparse(std::ostream &) const
Write a section back to the 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.
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.