|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
A comment attached to a specific function and code address. More...
#include <comment.hh>
Public Types | |
| enum | comment_type { user1 = 1 , user2 = 2 , user3 = 4 , header = 8 , warning = 16 , warningheader = 32 } |
| Possible properties associated with a comment. More... | |
Public Member Functions | |
| Comment (uint4 tp, const Address &fad, const Address &ad, int4 uq, const string &txt) | |
| Constructor. | |
| Comment (void) | |
| Constructor for use with decode. | |
| void | setEmitted (bool val) const |
| Mark that this comment has been emitted. | |
| bool | isEmitted (void) const |
| Return true if this comment is already emitted. | |
| uint4 | getType (void) const |
| Get the properties associated with the comment. | |
| const Address & | getFuncAddr (void) const |
| Get the address of the function containing the comment. | |
| const Address & | getAddr (void) const |
| Get the address to which the instruction is attached. | |
| int4 | getUniq (void) const |
| Get the sub-sorting index. | |
| const string & | getText (void) const |
| Get the body of the comment. | |
| void | encode (Encoder &encoder) const |
| Encode the comment to a stream. | |
| void | decode (Decoder &decoder) |
| Decode the comment from a stream. | |
Static Public Member Functions | |
| static uint4 | encodeCommentType (const string &name) |
| Convert name string to comment property. | |
| static string | decodeCommentType (uint4 val) |
| Convert comment property to string. | |
Private Attributes | |
| uint4 | type |
| The properties associated with the comment. | |
| int4 | uniq |
| Sub-identifier for uniqueness. | |
| Address | funcaddr |
| Address of the function containing the comment. | |
| Address | addr |
| Address associated with the comment. | |
| string | text |
| The body of the comment. | |
| bool | emitted |
| true if this comment has already been emitted | |
Friends | |
| class | CommentDatabaseInternal |
A comment attached to a specific function and code address.
Things contains the actual character data of the comment. It is fundamentally attached to a specific function and to the address of an instruction (within the function's body). Comments can be categorized as a header (or not) depending on whether it should be displayed as part of the general description of the function or not. Other properties can be assigned to a comment, to allow the user to specify the subset of all comments they want to display.
Possible properties associated with a comment.
| ghidra::Comment::Comment | ( | uint4 | tp, |
| const Address & | fad, | ||
| const Address & | ad, | ||
| int4 | uq, | ||
| const string & | txt | ||
| ) |
| tp | is the set of properties to associate with the comment (or 0 for no properties) |
| fad | is the Address of the function containing the comment |
| ad | is the Address of the instruction associated with the comment |
| uq | is used internally to sub-sort comments at the same address |
| txt | is the body of the comment |
| void ghidra::Comment::decode | ( | Decoder & | decoder | ) |
Decode the comment from a stream.
Parse a <comment> element from the given stream decoder
| decoder | is the given stream decoder |
References addr, ghidra::Decoder::closeElement(), ghidra::Address::decode(), emitted, encodeCommentType(), funcaddr, ghidra::Decoder::openElement(), ghidra::Decoder::peekElement(), ghidra::Decoder::readString(), text, and type.
Referenced by ghidra::CommentDatabaseInternal::decode().
|
static |
| void ghidra::Comment::encode | ( | Encoder & | encoder | ) | const |
Encode the comment to a stream.
The single comment is encoded as a <comment> element.
| encoder | is the stream encoder |
References addr, ghidra::Encoder::closeElement(), decodeCommentType(), ghidra::AddrSpace::encodeAttributes(), funcaddr, ghidra::Address::getOffset(), ghidra::Address::getSpace(), ghidra::Encoder::openElement(), text, type, and ghidra::Encoder::writeString().
|
static |
Convert name string to comment property.
| name | is a string representation of a single comment property |
References header, user1, user2, user3, warning, and warningheader.
Referenced by ghidra::OptionCommentHeader::apply(), ghidra::OptionCommentInstruction::apply(), and decode().