Ghidra Decompiler Analysis Engine
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Comment Class Reference

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. More...
 
void saveXml (ostream &s) const
 Save the comment to an XML stream. More...
 
void restoreXml (const Element *el, const AddrSpaceManager *manage)
 Restore the comment from XML. More...
 

Static Public Member Functions

static uint4 encodeCommentType (const string &name)
 Convert name string to comment property. More...
 
static string decodeCommentType (uint4 val)
 Convert comment property to string. More...
 

Friends

class CommentDatabaseInternal
 

Detailed Description

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.

Member Enumeration Documentation

◆ comment_type

Possible properties associated with a comment.

Enumerator
user1 

The first user defined property.

user2 

The second user defined property.

user3 

The third user defined property.

header 

The comment should be displayed in the function header.

warning 

The comment is auto-generated to alert the user.

warningheader 

The comment is auto-generated and should be in the header.

Constructor & Destructor Documentation

◆ Comment()

Comment::Comment ( uint4  tp,
const Address fad,
const Address ad,
int4  uq,
const string &  txt 
)

Constructor.

Parameters
tpis the set of properties to associate with the comment (or 0 for no properties)
fadis the Address of the function containing the comment
adis the Address of the instruction associated with the comment
uqis used internally to sub-sort comments at the same address
txtis the body of the comment

Member Function Documentation

◆ decodeCommentType()

string Comment::decodeCommentType ( uint4  val)
static

Convert comment property to string.

Parameters
valis a single comment property
Returns
the string representation of the property

◆ encodeCommentType()

uint4 Comment::encodeCommentType ( const string &  name)
static

Convert name string to comment property.

Parameters
nameis a string representation of a single comment property
Returns
the enumerated property type

◆ restoreXml()

void Comment::restoreXml ( const Element el,
const AddrSpaceManager manage 
)

Restore the comment from XML.

The comment is parsed from a <comment> tag.

Parameters
elis the <comment> element
manageis a manager for resolving address space references

◆ saveXml()

void Comment::saveXml ( ostream &  s) const

Save the comment to an XML stream.

The single comment is saved as a <comment> tag.

Parameters
sis the output stream

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