decompiler
1.0.0
|
Implementation of the StringManager that queries through the ghidra client. More...
#include <string_ghidra.hh>
Public Member Functions | |
GhidraStringManager (ArchitectureGhidra *g, int4 max) | |
Constructor. | |
virtual const vector< uint1 > & | getStringData (const Address &addr, Datatype *charType, bool &isTrunc) |
Retrieve string data at the given address as a UTF8 byte array. More... | |
Public Member Functions inherited from ghidra::StringManager | |
StringManager (int4 max) | |
Constructor. More... | |
virtual | ~StringManager (void) |
Destructor. | |
void | clear (void) |
Clear out any cached strings. | |
bool | isString (const Address &addr, Datatype *charType) |
void | encode (Encoder &encoder) const |
Encode cached strings to a stream. More... | |
void | decode (Decoder &decoder) |
Restore string cache from a stream. More... | |
Private Attributes | |
ArchitectureGhidra * | glb |
The ghidra client interface. | |
uint1 * | testBuffer |
Temporary storage for storing bytes from client. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ghidra::StringManager | |
static bool | hasCharTerminator (const uint1 *buffer, int4 size, int4 charsize) |
Check for a unicode string terminator. More... | |
static int4 | readUtf16 (const uint1 *buf, bool bigend) |
Read a UTF16 code point from a byte array. More... | |
static void | writeUtf8 (ostream &s, int4 codepoint) |
Write unicode character to stream in UTF8 encoding. More... | |
static int4 | getCodepoint (const uint1 *buf, int4 charsize, bool bigend, int4 &skip) |
Extract next unicode codepoint. More... | |
Protected Attributes inherited from ghidra::StringManager | |
map< Address, StringData > | stringMap |
Map from address to string data. | |
int4 | maximumChars |
Maximum characters in a string before truncating. | |
Implementation of the StringManager that queries through the ghidra client.
This acts as a front end to Ghidra's string formats and encodings. The client translates any type of string into a UTF8 representation, and this class stores it for final presentation. Escaping the UTF8 string is left up to the PrintLanguage.
|
virtual |
Retrieve string data at the given address as a UTF8 byte array.
If the address does not represent string data, a zero length vector is returned. Otherwise, the string data is fetched, converted to a UTF8 encoding, cached and returned.
addr | is the given address |
charType | is a character data-type indicating the encoding |
isTrunc | passes back whether the string is truncated |
Implements ghidra::StringManager.
References ghidra::StringManager::StringData::byteData, ghidra::ArchitectureGhidra::getStringData(), glb, ghidra::StringManager::StringData::isTruncated, ghidra::StringManager::maximumChars, and ghidra::StringManager::stringMap.