2#ifndef ROSE_SgAsmGenericSection_H
3#define ROSE_SgAsmGenericSection_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmExecutableFileFormat.h>
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>
33#ifdef ROSE_SgAsmGenericSection_IMPL
34#include <SgAsmBasicString.h>
42#if !defined(DOCUMENTATION)
57#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
59 friend class boost::serialization::access;
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);
184 bool const& get_synthesized()
const;
185 void set_synthesized(
bool const&);
194 int const& get_id()
const;
195 void set_id(
int const&);
217 void set_shortName(std::string
const&);
218 std::string get_shortName()
const;
254 bool const& get_mappedReadPermission()
const;
255 void set_mappedReadPermission(
bool const&);
262 bool const& get_mappedWritePermission()
const;
263 void set_mappedWritePermission(
bool const&);
270 bool const& get_mappedExecutePermission()
const;
271 void set_mappedExecutePermission(
bool const&);
284 bool const& get_containsCode()
const;
285 void set_containsCode(
bool const&);
316 unsigned char *local_data_pool;
332 const SgAsmGenericSectionPtrList&);
346 virtual void dump(FILE*,
const char *prefix, ssize_t idx)
const;
349 virtual bool reallocate() {
return false; }
354 virtual void unparse(std::ostream&)
const;
357 void unparse(std::ostream&,
const ExtentMap&)
const;
360 void unparseHoles(std::ostream&)
const;
498 unsigned char *writableContent(
size_t nbytes);
517 bool isMapped()
const;
550 Extent get_fileExtent()
const;
556 Extent get_mappedPreferredExtent()
const;
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");
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,
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");
657 void initializeProperties();
676 virtual std::
string class_name() const override;
679 virtual VariantT variantT() const override;
684 enum { static_variant = V_SgAsmGenericSection };
699 static const unsigned pool_size;
701 static std::vector<unsigned char *> pools;
706 static unsigned long initializeStorageClassArray(SgAsmGenericSectionStorageClass *);
709 static void clearMemoryPool();
710 static void deleteMemoryPool();
713 static void extendMemoryPoolForFileIO();
718 static SgAsmGenericSection * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
721 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
723 static void resetValidFreepointers();
725 static unsigned long getNumberOfLastValidPointer();
728#if defined(INLINE_FUNCTIONS)
730 inline void *
operator new (
size_t size);
733 void *
operator new (
size_t size);
736 void operator delete (
void* pointer,
size_t size);
739 void operator delete (
void* pointer)
785#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
788 virtual RTIReturnType
roseRTI()
override;
802 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
808 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
990 friend class SgAsmGenericSectionStorageClass;
993 friend class AstSpecificDataManagingClass;
996 friend class AstSpecificDataManagingClassStorageClass;
1028#define BUILD_ATERM_SUPPORT 0
1029 #if BUILD_ATERM_SUPPORT
1030 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
1042 virtual ATerm generate_ATerm()
override;
1045 virtual void generate_ATerm_Annotation(ATerm & term)
override;
1129std::string p_shortName;
1145bool p_mappedReadPermission;
1149bool p_mappedWritePermission;
1153bool p_mappedExecutePermission;
Class holding static data and functions supporting File I/O.
Attribute containing a regex expression as a string.
A contiguous range of values.
Optionally bound relative virtual address.
Base class for binary files.
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.
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.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
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.