ROSE 0.11.145.247
SgAsmElfSymbol.h
1
2#ifndef ROSE_SgAsmElfSymbol_H
3#define ROSE_SgAsmElfSymbol_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmGenericSymbol.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 SgAsmElfSymbol
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmElfSymbol.h" */
25/* #line 19306 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28#include <Rose/BinaryAnalysis/ByteOrder.h>
29#include <sageContainer.h>
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 SgAsmElfSymbol
38class ROSE_DLL_API SgAsmElfSymbol : public SgAsmGenericSymbol
39 {
40 public:
41
42
43/* #line 44 "../../../src/frontend/SageIII//SgAsmElfSymbol.h" */
44
45 virtual SgNode* copy ( SgCopyHelp& help) const override;
46// Start of memberFunctionString
47/* #line 19351 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
48
49
50 //----------------------- Boost serialization for SgAsmElfSymbol -----------------------
51#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
52private:
53 friend class boost::serialization::access;
54
55 template<class S>
56 void serialize(S &s, const unsigned /*version*/) {
57 debugSerializationBegin("SgAsmElfSymbol");
58 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmGenericSymbol);
59 s & BOOST_SERIALIZATION_NVP(p_st_info);
60 s & BOOST_SERIALIZATION_NVP(p_st_res1);
61 s & BOOST_SERIALIZATION_NVP(p_st_shndx);
62 s & BOOST_SERIALIZATION_NVP(p_st_size);
63 s & BOOST_SERIALIZATION_NVP(p_extra);
64 debugSerializationEnd("SgAsmElfSymbol");
65 }
66#endif // ROSE_ENABLE_BOOST_SERIALIZATION
68 // Local types
70public:
71 enum ElfSymBinding {
72 STB_LOCAL=0,
73 STB_GLOBAL=1,
74 STB_WEAK=2
75 };
76
77 enum ElfSymType {
78 STT_NOTYPE = 0,
79 STT_OBJECT = 1,
80 STT_FUNC = 2,
81 STT_SECTION = 3,
82 STT_FILE = 4,
83 STT_COMMON = 5,
84 STT_TLS = 6,
85 STT_IFUNC = 10
86 };
87
88#ifdef _MSC_VER
89# pragma pack (1)
90#endif
91
93 struct Elf32SymbolEntry_disk {
94 uint32_t st_name;
95 uint32_t st_value;
96 uint32_t st_size;
97 unsigned char st_info;
98 unsigned char st_res1;
99 uint16_t st_shndx;
100 }
101#if !defined(SWIG) && !defined(_MSC_VER)
102 __attribute__((packed))
103#endif
104 ;
105
106 struct Elf64SymbolEntry_disk {
107 uint32_t st_name;
108 unsigned char st_info;
109 unsigned char st_res1;
110 uint16_t st_shndx;
111 uint64_t st_value;
112 uint64_t st_size;
113 }
114#if !defined(SWIG) && !defined(_MSC_VER)
115 __attribute__((packed))
116#endif
117 ;
118
119#ifdef _MSC_VER
120# pragma pack ()
121#endif
122
124 // Properties
126public:
127public:
133 unsigned char const& get_st_info() const;
134 void set_st_info(unsigned char const&);
137public:
143 unsigned char const& get_st_res1() const;
144 void set_st_res1(unsigned char const&);
147public:
153 unsigned const& get_st_shndx() const;
154 void set_st_shndx(unsigned const&);
157public:
163 Rose::BinaryAnalysis::Address const& get_st_size() const;
164 void set_st_size(Rose::BinaryAnalysis::Address const&);
167public:
173 SgUnsignedCharList const& get_extra() const;
174 SgUnsignedCharList& get_extra();
175 void set_extra(SgUnsignedCharList const&);
178 // Functions
180public:
183
188
193
206 virtual void dump(FILE *f, const char *prefix, ssize_t idx) const override;
207 void dump(FILE*, const char *prefix, ssize_t idx, SgAsmGenericSection*) const;
211 SgAsmElfSymbol::ElfSymBinding get_elfBinding() const;
212
214 SgAsmElfSymbol::ElfSymType get_elfType() const;
215
217 static std::string toString(SgAsmElfSymbol::ElfSymBinding);
218
220 static std::string toString(SgAsmElfSymbol::ElfSymType);
221
222private:
223 void parse_common(); // initialization common to all parse() methods
224
226 // Deprecated 2023-11
228public:
229 SgAsmElfSymbol::ElfSymBinding get_elf_binding() const ROSE_DEPRECATED("use get_elfBinding");
230 SgAsmElfSymbol::ElfSymType get_elf_type() const ROSE_DEPRECATED("use get_elfType");
231 static std::string to_string(SgAsmElfSymbol::ElfSymBinding) ROSE_DEPRECATED("use toString");
232 static std::string to_string(SgAsmElfSymbol::ElfSymType) ROSE_DEPRECATED("use toString");
233public:
235 virtual ~SgAsmElfSymbol();
236
237public:
240
241protected:
248 void initializeProperties();
249
250
251// End of memberFunctionString
252// Start of memberFunctionString
253/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
254
255// *** COMMON CODE SECTION BEGINS HERE ***
256
257 public:
258
259 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
260 // and not required which is required to match the other aspects of the copy mechanism code generation.
261 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
262 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
263 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
264 // virtual SgNode* copy ( const SgCopyHelp & help) const;
265
267 virtual std::string class_name() const override;
268
270 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
271
273 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
274 // static const VariantT static_variant = V_SgAsmElfSymbol;
275 enum { static_variant = V_SgAsmElfSymbol };
276
277 /* the generated cast function */
279 ROSE_DLL_API friend SgAsmElfSymbol* isSgAsmElfSymbol( SgNode * s );
280
282 ROSE_DLL_API friend const SgAsmElfSymbol* isSgAsmElfSymbol( const SgNode * s );
283
284 // ******************************************
285 // * Memory Pool / New / Delete
286 // ******************************************
287
288 public:
290 static const unsigned pool_size; //
292 static std::vector<unsigned char *> pools; //
294 static SgAsmElfSymbol * next_node; //
295
297 static unsigned long initializeStorageClassArray(SgAsmElfSymbolStorageClass *); //
298
300 static void clearMemoryPool(); //
301 static void deleteMemoryPool(); //
302
304 static void extendMemoryPoolForFileIO(); //
305
307 static SgAsmElfSymbol * getPointerFromGlobalIndex(unsigned long); //
309 static SgAsmElfSymbol * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
310
312 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
314 static void resetValidFreepointers(); //
316 static unsigned long getNumberOfLastValidPointer(); //
317
318
319#if defined(INLINE_FUNCTIONS)
321 inline void *operator new (size_t size);
322#else
324 void *operator new (size_t size);
325#endif
327 void operator delete (void* pointer, size_t size);
328
329 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
330 void operator delete (void* pointer)
331 {
332 // This is the generated delete operator...
333 SgAsmElfSymbol::operator delete (pointer,sizeof(SgAsmElfSymbol));
334 }
335
337 static size_t numberOfNodes();
338
340 static size_t memoryUsage();
341
342 // End of scope which started in IR nodes specific code
343 /* */
344
345 /* name Internal Functions
346 \brief Internal functions ... incomplete-documentation
347
348 These functions have been made public as part of the design, but they are suggested for internal use
349 or by particularly knowledgeable users for specialized tools or applications.
350
351 \internal We could not make these private because they are required by user for special purposes. And
352 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
353
354 */
355
356 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
357 // overridden in every class by *generated* implementation
359 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override;
360 // MS: 06/28/02 container of names of variables or container indices
361 // used used in the traversal to access AST successor nodes
362 // overridden in every class by *generated* implementation
365 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override;
366
367 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
368 // than all the vector copies. The implementation for these functions is generated for each class.
370 virtual size_t get_numberOfTraversalSuccessors() const override;
372 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const override;
374 virtual size_t get_childIndex(SgNode *child) const override;
375
376#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
377 // MS: 08/16/2002 method for generating RTI information
379 virtual RTIReturnType roseRTI() override;
380#endif
381 /* */
382
383
384
385 /* name Deprecated Functions
386 \brief Deprecated functions ... incomplete-documentation
387
388 These functions have been deprecated from use.
389 */
390 /* */
391
393 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
394
395 // JJW (10/16/2008): Changed to a single function in Node.code, and put
396 // getVariant() in #if 0 block to prevent confusing Doxygen
397#if 0
399 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
401 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
402#endif
403 /* */
404
405
406
407
408 public:
409 /* name Traversal Support Functions
410 \brief Traversal support functions ... incomplete-documentation
411
412 These functions have been made public as part of the design, but they are suggested for internal use
413 or by particularly knowledgable users for specialized tools or applications.
414 */
415 /* */
416
417 // DQ (11/26/2005): Support for visitor pattern mechanims
418 // (inferior to ROSE traversal mechanism, experimental).
422
423 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
425 virtual void accept (ROSE_VisitorPattern & visitor) override;
426
427 // DQ (12/26/2005): Support for traversal based on the memory pool
430 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
431
435
436 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
437 // This traversal helps support internal tools that call static member functions.
438 // note: this function operates on the memory pools.
441 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
442 /* */
443
444 public:
445 /* NodeId support functions */
447 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
450 static SgAsmElfSymbol* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
453 static std::string getNodeIdString(SgAsmElfSymbol* sgnode);
454 static std::string getNodeIdStringInternal(SgAsmElfSymbol* sgnode);
455
456 public:
457 /* name Memory Allocation Functions
458 \brief Memory allocations functions ... incomplete-documentation
459
460 These functions have been made public as part of the design, but they are suggested for internal use
461 or by particularly knowledgable users for specialized tools or applications.
462 */
463 /* */
464
475 virtual bool isInMemoryPool() override;
476
487 virtual void checkDataMemberPointersIfInMemoryPool() override;
488
489 // DQ (4/30/2006): Modified to be a const function.
504 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
505
516
528 virtual long getChildIndex( SgNode* childNode ) const override;
529
530 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
531 // comment here (changed to be a C style comment and not be a doxygen comment).
532 /* \brief Constructor for use by AST File I/O Mechanism
533
534 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
535 which obtained via fast binary file I/O from disk.
536 */
537 // SgAsmElfSymbol( SgAsmElfSymbolStorageClass& source );
538
539
540
541
542
543 // JH (10/24/2005): methods added to support the ast file IO
544 private:
545
546 /* name AST Memory Allocation Support Functions
547 \brief Memory allocations support....
548
549 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
550 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
551 and support the AST File I/O Mechanism.
552 */
553 /* */
554
555 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
556 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
557 that I use the same type everywhere, if any changes are made. THe second one declares the type
558 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
559 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
560 a correspinding one in the AST_FILE_IO class!
561 */
562 // DQ (9/2/2015): This typedef is no longer used, we can't define the
563 // comment here (changed to be a C style comment and not be a doxygen comment).
564 /* \brief Typedef used for low level memory access.
565 */
566 // typedef unsigned char* TestType;
567
568 // DQ (9/2/2015): This typedef is no longer used, we can't define the
569 // comment here (changed to be a C style comment and not be a doxygen comment).
570 /* \brief Typedef used to hold memory addresses as values.
571 */
572 // typedef unsigned long AddressType;
573
574
575
576 // necessary, to have direct access to the p_freepointer and the private methods !
578 friend class AST_FILE_IO;
579
581 friend class SgAsmElfSymbolStorageClass;
582
584 friend class AstSpecificDataManagingClass;
585
587 friend class AstSpecificDataManagingClassStorageClass;
588 public:
590 SgAsmElfSymbol( const SgAsmElfSymbolStorageClass& source );
591
592 // private: // JJW hack
593 /*
594 name AST Memory Allocation Support Variables
595 Memory allocations support variables
596
597 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
598 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
599 and support the AST File I/O Mechanism.
600 */
601 /* */
602
603 public:
604
605 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
606 // to current node (so that it will work cleanly with build functions to specify patterns).
607 // virtual SgNode* addRegExpAttribute();
614
615#ifndef _MSC_VER
616// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
617// and likely never fully implemented nor tested. Files remain in the src tree but are no
618// longer built.
619#define BUILD_ATERM_SUPPORT 0
620 #if BUILD_ATERM_SUPPORT
621 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
622 // DQ (10/4/2014): Adding ATerm support to ROSE.
632 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
633 virtual ATerm generate_ATerm() override;
634
636 virtual void generate_ATerm_Annotation(ATerm & term) override;
637 #endif
638 #endif // BUILD_ATERM_SUPPORT
639#endif
640 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
641 // virtual generate_AST(ATerm & term);
642 // virtual void read_ATerm_Annotation(ATerm & term);
643
644// *** COMMON CODE SECTION ENDS HERE ***
645
646
647// End of memberFunctionString
648// Start of memberFunctionString
649/* #line 710 "/workspace/src/ROSETTA/Grammar/Node.code" */
650
651 // the generated cast function
652 // friend ROSE_DLL_API SgAsmElfSymbol* isSgAsmElfSymbol ( SgNode* s );
653
654 typedef SgAsmGenericSymbol base_node_type;
655
656
657// End of memberFunctionString
658
659
660
661
662
663
664 protected:
665// Start of memberFunctionString
666unsigned char p_st_info;
667
668// End of memberFunctionString
669// Start of memberFunctionString
670unsigned char p_st_res1;
671
672// End of memberFunctionString
673// Start of memberFunctionString
674unsigned p_st_shndx;
675
676// End of memberFunctionString
677// Start of memberFunctionString
679
680// End of memberFunctionString
681// Start of memberFunctionString
682SgUnsignedCharList p_extra;
683
684// End of memberFunctionString
685
687 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbol, unsigned char,&SgAsmElfSymbol::p_st_info>;
688 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbol, unsigned char,&SgAsmElfSymbol::p_st_res1>;
689 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbol, unsigned,&SgAsmElfSymbol::p_st_shndx>;
690 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbol, Rose::BinaryAnalysis::Address,&SgAsmElfSymbol::p_st_size>;
691 friend struct Rose::Traits::generated::describe_field_t<SgAsmElfSymbol, SgUnsignedCharList,&SgAsmElfSymbol::p_extra>;
692
693/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
694
695
696 };
697#endif
698
699// postdeclarations for SgAsmElfSymbol
700
701/* #line 702 "../../../src/frontend/SageIII//SgAsmElfSymbol.h" */
702
703/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
704
705/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
706
707
708/* #line 709 "../../../src/frontend/SageIII//SgAsmElfSymbol.h" */
709
710#endif // ROSE_SgAsmElfSymbol_H
711
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
ELF file section containing symbols.
Represents a single ELF symbol.
Contiguous region of a file.
virtual void dump(FILE *, const char *prefix, ssize_t idx) const
Print some debugging info.
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.
void parse(SgAsmGenericFile *)
Main function to parse DWARF information.
std::uint64_t Address
Address.
Definition Address.h:11
ROSE_UTIL_API std::string toString(const Path &)
Convert a path to a string.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
The ROSE library.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * ElfSymType(int64_t)
Convert SgAsmElfSymbol::ElfSymType enum constant to a string.
const char * ElfSymBinding(int64_t)
Convert SgAsmElfSymbol::ElfSymBinding enum constant to a string.
32-bit format of an ELF symbol.