ROSE  0.11.59.0
Public Member Functions | List of all members
SgAsmElfStrtab Class Reference

Description

ELF string table.

Definition at line 8591 of file binaryInstruction.C.

Inheritance diagram for SgAsmElfStrtab:
Inheritance graph
[legend]
Collaboration diagram for SgAsmElfStrtab:
Collaboration graph
[legend]

Public Member Functions

 SgAsmElfStrtab (class SgAsmElfSection *containing_section)
 Non-parsing constructor. More...
 
virtual ~SgAsmElfStrtab ()
 Free StringStorage objects associated with this string table. More...
 
virtual SgAsmElfStrtabparse () override
 Parses the string table. More...
 
virtual void unparse (std::ostream &) const
 Write string table back to disk. More...
 
virtual SgAsmStringStoragecreate_storage (rose_addr_t offset, bool shared) override
 Creates the storage item for the string at the specified offset. More...
 
virtual rose_addr_t get_storage_size (const SgAsmStringStorage *) override
 Returns the number of bytes required to store the string in the string table. More...
 
virtual void allocate_overlap (SgAsmStringStorage *) override
 Find offset for a string. More...
 
virtual void rebind (SgAsmStringStorage *, rose_addr_t) override
 Similar to create_storage() but uses a storage object that's already been allocated. More...
 

Constructor & Destructor Documentation

SgAsmElfStrtab::SgAsmElfStrtab ( class SgAsmElfSection containing_section)
inlineexplicit

Non-parsing constructor.

The table is created to be at least one byte long and having a NUL character as the first byte.

Definition at line 8611 of file binaryInstruction.C.

virtual SgAsmElfStrtab::~SgAsmElfStrtab ( )
virtual

Free StringStorage objects associated with this string table.

It may not be safe to blow them away yet since other objects may still have SgAsmStoredStrings pointing to these storage objects. So instead, we will mark all this strtab's storage objects as no longer being associated with a string table. This allows the SgAsmStoredString objects to still function properly and their destructors will free their storage.

Member Function Documentation

virtual SgAsmElfStrtab* SgAsmElfStrtab::parse ( )
overridevirtual

Parses the string table.

All that actually happens at this point is we look to see if the table begins with an empty string.

virtual void SgAsmElfStrtab::unparse ( std::ostream &  ) const
virtual

Write string table back to disk.

Free space is zeroed out; holes are left as they are.

virtual SgAsmStringStorage* SgAsmElfStrtab::create_storage ( rose_addr_t  offset,
bool  shared 
)
overridevirtual

Creates the storage item for the string at the specified offset.

If shared is true then attempt to re-use a previous storage object, otherwise always create a new one. Each storage object is considered a separate string, therefore when two strings share the same storage object, changing one string changes the other.

virtual rose_addr_t SgAsmElfStrtab::get_storage_size ( const SgAsmStringStorage )
overridevirtual

Returns the number of bytes required to store the string in the string table.

This is the length of the string plus one for the NUL terminator.

virtual void SgAsmElfStrtab::allocate_overlap ( SgAsmStringStorage )
overridevirtual

Find offset for a string.

Tries to find a suitable offset for a string such that it overlaps with some other string already allocated. If the new string is the same as the end of some other string (new="main", existing="domain") then we just use an offset into that string since the space is already allocated for the existing string. If the new string ends with an existing string (new="domain", existing="main") and there's enough free space before the existing string (two bytes in this case) then we allocate some of that free space and use a suitable offset. In any case, upon return storege->get_offset() will return the allocated offset if successful, or SgAsmGenericString::unallocated if we couldn't find an overlap.

virtual void SgAsmElfStrtab::rebind ( SgAsmStringStorage ,
rose_addr_t   
)
overridevirtual

Similar to create_storage() but uses a storage object that's already been allocated.


The documentation for this class was generated from the following file: