ROSE 0.11.145.147
SgAsmPEImportItem.h
1
2#ifndef ROSE_SgAsmPEImportItem_H
3#define ROSE_SgAsmPEImportItem_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 SgAsmPEImportItem
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmPEImportItem.h" */
25/* #line 3046 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/RelativeVirtualAddress.h>
28
29#ifdef ROSE_SgAsmPEImportItem_IMPL
30#include <SgAsmBasicString.h>
31#endif
32
33
34/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
35
36/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
37
38#if !defined(DOCUMENTATION)
39// Class Definition for SgAsmPEImportItem
40class ROSE_DLL_API SgAsmPEImportItem : public SgAsmExecutableFileFormat
41 {
42 public:
43
44
45/* #line 46 "../../../src/frontend/SageIII//SgAsmPEImportItem.h" */
46
47 virtual SgNode* copy ( SgCopyHelp& help) const override;
48// Start of memberFunctionString
49/* #line 3114 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
50
51
52 //----------------------- Boost serialization for SgAsmPEImportItem -----------------------
53#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
54private:
55 friend class boost::serialization::access;
56
57 template<class S>
58 void serialize(S &s, const unsigned /*version*/) {
59 debugSerializationBegin("SgAsmPEImportItem");
60 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
61 s & BOOST_SERIALIZATION_NVP(p_by_ordinal);
62 s & BOOST_SERIALIZATION_NVP(p_ordinal);
63 s & BOOST_SERIALIZATION_NVP(p_hint);
64 s & BOOST_SERIALIZATION_NVP(p_name);
65 s & BOOST_SERIALIZATION_NVP(p_hintname_rva);
66 s & BOOST_SERIALIZATION_NVP(p_hintname_nalloc);
67 s & BOOST_SERIALIZATION_NVP(p_bound_rva);
68 s & BOOST_SERIALIZATION_NVP(p_iat_written);
69 debugSerializationEnd("SgAsmPEImportItem");
70 }
71#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
72public:
73public:
79 bool const& get_by_ordinal() const;
80 void set_by_ordinal(bool const&);
83public:
89 unsigned const& get_ordinal() const;
90 void set_ordinal(unsigned const&);
93public:
99 unsigned const& get_hint() const;
100 void set_hint(unsigned const&);
103public:
109 SgAsmGenericString* const& get_name() const;
110 void set_name(SgAsmGenericString* const&);
113public:
119 Rose::BinaryAnalysis::RelativeVirtualAddress const& get_hintname_rva() const;
121 void set_hintname_rva(Rose::BinaryAnalysis::RelativeVirtualAddress const&);
124public:
130 size_t const& get_hintname_nalloc() const;
131 void set_hintname_nalloc(size_t const&);
134public:
140 Rose::BinaryAnalysis::RelativeVirtualAddress const& get_bound_rva() const;
142 void set_bound_rva(Rose::BinaryAnalysis::RelativeVirtualAddress const&);
145public:
151 bool const& get_iat_written() const;
152 void set_iat_written(bool const&);
154public:
157 SgAsmPEImportItem(SgAsmPEImportDirectory*, const std::string &name, unsigned hint=0);
158 SgAsmPEImportItem(SgAsmPEImportDirectory*, const unsigned ordinal);
159
160 virtual void dump(FILE*, const char *prefix, ssize_t idx) const;
161
167 size_t hintNameRequiredSize() const;
168
173 rose_addr_t get_iatEntryVa() const;
174
175private:
176 void initFromParent(SgAsmPEImportItemList *parent);
177
179 // Deprecated 2023-11
181public:
182 size_t hintname_required_size() const ROSE_DEPRECATED("use hintNameRequiredSize");
183 rose_addr_t get_iat_entry_va() const ROSE_DEPRECATED("use get_iatEntryVa");
184public:
186 virtual ~SgAsmPEImportItem();
187
188public:
191
192protected:
199 void initializeProperties();
200
201
202// End of memberFunctionString
203// Start of memberFunctionString
204/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
205
206// *** COMMON CODE SECTION BEGINS HERE ***
207
208 public:
209
210 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
211 // and not required which is required to match the other aspects of the copy mechanism code generation.
212 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
213 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
214 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
215 // virtual SgNode* copy ( const SgCopyHelp & help) const;
216
218 virtual std::string class_name() const override;
219
221 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
222
224 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
225 // static const VariantT static_variant = V_SgAsmPEImportItem;
226 enum { static_variant = V_SgAsmPEImportItem };
227
228 /* the generated cast function */
230 ROSE_DLL_API friend SgAsmPEImportItem* isSgAsmPEImportItem( SgNode * s );
231
233 ROSE_DLL_API friend const SgAsmPEImportItem* isSgAsmPEImportItem( const SgNode * s );
234
235 // ******************************************
236 // * Memory Pool / New / Delete
237 // ******************************************
238
239 public:
241 static const unsigned pool_size; //
243 static std::vector<unsigned char *> pools; //
245 static SgAsmPEImportItem * next_node; //
246
248 static unsigned long initializeStorageClassArray(SgAsmPEImportItemStorageClass *); //
249
251 static void clearMemoryPool(); //
252 static void deleteMemoryPool(); //
253
255 static void extendMemoryPoolForFileIO(); //
256
258 static SgAsmPEImportItem * getPointerFromGlobalIndex(unsigned long); //
260 static SgAsmPEImportItem * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
261
263 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
265 static void resetValidFreepointers(); //
267 static unsigned long getNumberOfLastValidPointer(); //
268
269
270#if defined(INLINE_FUNCTIONS)
272 inline void *operator new (size_t size);
273#else
275 void *operator new (size_t size);
276#endif
278 void operator delete (void* pointer, size_t size);
279
280 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
281 void operator delete (void* pointer)
282 {
283 // This is the generated delete operator...
284 SgAsmPEImportItem::operator delete (pointer,sizeof(SgAsmPEImportItem));
285 }
286
288 static size_t numberOfNodes();
289
291 static size_t memoryUsage();
292
293 // End of scope which started in IR nodes specific code
294 /* */
295
296 /* name Internal Functions
297 \brief Internal functions ... incomplete-documentation
298
299 These functions have been made public as part of the design, but they are suggested for internal use
300 or by particularly knowledgeable users for specialized tools or applications.
301
302 \internal We could not make these private because they are required by user for special purposes. And
303 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
304
305 */
306
307 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
308 // overridden in every class by *generated* implementation
310 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
311 // MS: 06/28/02 container of names of variables or container indices
312 // used used in the traversal to access AST successor nodes
313 // overridden in every class by *generated* implementation
316 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
317
318 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
319 // than all the vector copies. The implementation for these functions is generated for each class.
321 virtual size_t get_numberOfTraversalSuccessors() override;
323 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
325 virtual size_t get_childIndex(SgNode *child) override;
326
327#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
328 // MS: 08/16/2002 method for generating RTI information
330 virtual RTIReturnType roseRTI() override;
331#endif
332 /* */
333
334
335
336 /* name Deprecated Functions
337 \brief Deprecated functions ... incomplete-documentation
338
339 These functions have been deprecated from use.
340 */
341 /* */
342
344 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
345
346 // JJW (10/16/2008): Changed to a single function in Node.code, and put
347 // getVariant() in #if 0 block to prevent confusing Doxygen
348#if 0
350 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
352 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
353#endif
354 /* */
355
356
357
358
359 public:
360 /* name Traversal Support Functions
361 \brief Traversal support functions ... incomplete-documentation
362
363 These functions have been made public as part of the design, but they are suggested for internal use
364 or by particularly knowledgable users for specialized tools or applications.
365 */
366 /* */
367
368 // DQ (11/26/2005): Support for visitor pattern mechanims
369 // (inferior to ROSE traversal mechanism, experimental).
373
374 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
376 virtual void accept (ROSE_VisitorPattern & visitor) override;
377
378 // DQ (12/26/2005): Support for traversal based on the memory pool
381 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
382
386
387 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
388 // This traversal helps support internal tools that call static member functions.
389 // note: this function operates on the memory pools.
392 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
393 /* */
394
395 public:
396 /* NodeId support functions */
398 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
401 static SgAsmPEImportItem* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
404 static std::string getNodeIdString(SgAsmPEImportItem* sgnode);
405 static std::string getNodeIdStringInternal(SgAsmPEImportItem* sgnode);
406
407 public:
408 /* name Memory Allocation Functions
409 \brief Memory allocations functions ... incomplete-documentation
410
411 These functions have been made public as part of the design, but they are suggested for internal use
412 or by particularly knowledgable users for specialized tools or applications.
413 */
414 /* */
415
426 virtual bool isInMemoryPool() override;
427
438 virtual void checkDataMemberPointersIfInMemoryPool() override;
439
440 // DQ (4/30/2006): Modified to be a const function.
455 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
456
467
479 virtual long getChildIndex( SgNode* childNode ) const override;
480
481 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
482 // comment here (changed to be a C style comment and not be a doxygen comment).
483 /* \brief Constructor for use by AST File I/O Mechanism
484
485 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
486 which obtained via fast binary file I/O from disk.
487 */
488 // SgAsmPEImportItem( SgAsmPEImportItemStorageClass& source );
489
490
491
492
493
494 // JH (10/24/2005): methods added to support the ast file IO
495 private:
496
497 /* name AST Memory Allocation Support Functions
498 \brief Memory allocations support....
499
500 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
501 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
502 and support the AST File I/O Mechanism.
503 */
504 /* */
505
506 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
507 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
508 that I use the same type everywhere, if any changes are made. THe second one declares the type
509 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
510 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
511 a correspinding one in the AST_FILE_IO class!
512 */
513 // DQ (9/2/2015): This typedef is no longer used, we can't define the
514 // comment here (changed to be a C style comment and not be a doxygen comment).
515 /* \brief Typedef used for low level memory access.
516 */
517 // typedef unsigned char* TestType;
518
519 // DQ (9/2/2015): This typedef is no longer used, we can't define the
520 // comment here (changed to be a C style comment and not be a doxygen comment).
521 /* \brief Typedef used to hold memory addresses as values.
522 */
523 // typedef unsigned long AddressType;
524
525
526
527 // necessary, to have direct access to the p_freepointer and the private methods !
529 friend class AST_FILE_IO;
530
532 friend class SgAsmPEImportItemStorageClass;
533
535 friend class AstSpecificDataManagingClass;
536
538 friend class AstSpecificDataManagingClassStorageClass;
539 public:
541 SgAsmPEImportItem( const SgAsmPEImportItemStorageClass& source );
542
543 // private: // JJW hack
544 /*
545 name AST Memory Allocation Support Variables
546 Memory allocations support variables
547
548 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
549 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
550 and support the AST File I/O Mechanism.
551 */
552 /* */
553
554 public:
555
556 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
557 // to current node (so that it will work cleanly with build functions to specify patterns).
558 // virtual SgNode* addRegExpAttribute();
565
566#ifndef _MSC_VER
567// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
568// and likely never fully implemented nor tested. Files remain in the src tree but are no
569// longer built.
570#define BUILD_ATERM_SUPPORT 0
571 #if BUILD_ATERM_SUPPORT
572 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
573 // DQ (10/4/2014): Adding ATerm support to ROSE.
583 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
584 virtual ATerm generate_ATerm() override;
585
587 virtual void generate_ATerm_Annotation(ATerm & term) override;
588 #endif
589 #endif // BUILD_ATERM_SUPPORT
590#endif
591 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
592 // virtual generate_AST(ATerm & term);
593 // virtual void read_ATerm_Annotation(ATerm & term);
594
595// *** COMMON CODE SECTION ENDS HERE ***
596
597
598// End of memberFunctionString
599// Start of memberFunctionString
600/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
601
602 // the generated cast function
603 // friend ROSE_DLL_API SgAsmPEImportItem* isSgAsmPEImportItem ( SgNode* s );
604
605 typedef SgAsmExecutableFileFormat base_node_type;
606
607
608// End of memberFunctionString
609
610
611
612
613
614
615
616
617
618 protected:
619// Start of memberFunctionString
620bool p_by_ordinal;
621
622// End of memberFunctionString
623// Start of memberFunctionString
624unsigned p_ordinal;
625
626// End of memberFunctionString
627// Start of memberFunctionString
628unsigned p_hint;
629
630// End of memberFunctionString
631// Start of memberFunctionString
632SgAsmGenericString* p_name;
633
634// End of memberFunctionString
635// Start of memberFunctionString
637
638// End of memberFunctionString
639// Start of memberFunctionString
640size_t p_hintname_nalloc;
641
642// End of memberFunctionString
643// Start of memberFunctionString
645
646// End of memberFunctionString
647// Start of memberFunctionString
648bool p_iat_written;
649
650// End of memberFunctionString
651
653 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, bool,&SgAsmPEImportItem::p_by_ordinal>;
654 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, unsigned,&SgAsmPEImportItem::p_ordinal>;
655 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, unsigned,&SgAsmPEImportItem::p_hint>;
656 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, SgAsmGenericString*,&SgAsmPEImportItem::p_name>;
657 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, Rose::BinaryAnalysis::RelativeVirtualAddress,&SgAsmPEImportItem::p_hintname_rva>;
658 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, size_t,&SgAsmPEImportItem::p_hintname_nalloc>;
659 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, Rose::BinaryAnalysis::RelativeVirtualAddress,&SgAsmPEImportItem::p_bound_rva>;
660 friend struct Rose::Traits::generated::describe_field_t<SgAsmPEImportItem, bool,&SgAsmPEImportItem::p_iat_written>;
661
662/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
663
664
665 };
666#endif
667
668// postdeclarations for SgAsmPEImportItem
669
670/* #line 671 "../../../src/frontend/SageIII//SgAsmPEImportItem.h" */
671
672/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
673
674/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
675
676
677/* #line 678 "../../../src/frontend/SageIII//SgAsmPEImportItem.h" */
678
679#endif // ROSE_SgAsmPEImportItem_H
680
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Optionally bound relative virtual address.
Base class for many binary analysis nodes.
Base class for strings related to binary specimens.
One import directory per library.
A list of imported items.
A single imported object.
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.
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.