IDA C++ SDK 9.2
Loading...
Searching...
No Matches
place_t Class Referenceabstract

Denotes a displayed line. More...

#include <kernwin.hpp>

Inheritance diagram for place_t:
simpleline_place_t tiplace_t user_graph_place_t

Public Member Functions

 place_t ()
 Constructor.
 place_t (int ln)
 Constructor.
 DEFINE_MEMORY_ALLOCATION_FUNCS () virtual void idaapi print(qstring *vout
 Generate a short description of the location.
virtual uval_t idaapi touval (void *ud) const =0
 Map the location to a number.
virtual place_t *idaapi clone () const =0
 Clone the location.
virtual void idaapi copyfrom (const place_t *from)=0
 Copy the specified location object to the current object.
virtual place_t *idaapi makeplace (void *ud, uval_t x, int lnnum) const =0
 Map a number to a location.
virtual int idaapi compare (const place_t *t2) const =0
 Deprecated. Please consider compare2(const place_t *, void *) instead.
virtual void idaapi adjust (void *ud)=0
 Adjust the current location to point to a displayable object.
virtual bool idaapi prev (void *ud)=0
 Move to the previous displayable location.
virtual bool idaapi next (void *ud)=0
 Move to the next displayable location.
virtual bool idaapi beginning (void *ud) const =0
 Are we at the first displayable object?
virtual bool idaapi ending (void *ud) const =0
 Are we at the last displayable object?
virtual int idaapi generate (qstrvec_t *out, int *out_deflnnum, color_t *out_pfx_color, bgcolor_t *out_bgcolor, void *ud, int maxsize) const =0
 Generate text lines for the current location.
virtual void idaapi serialize (bytevec_t *out) const =0
 Serialize this instance.
virtual bool idaapi deserialize (const uchar **pptr, const uchar *end)=0
 De-serialize into this instance.
virtual int idaapi id () const =0
 Get the place's ID (i.e., the value returned by register_place_class())
virtual const char *idaapi name () const =0
 Get this place type name.
virtual ea_t idaapi toea () const
 Map the location to an ea_t.
virtual bool idaapi rebase (const segm_move_infos_t &)
 Rebase the place instance.
virtual place_t *idaapi enter (uint32 *) const
 Visit this place, possibly 'unhiding' a section of text.
virtual void idaapi leave (uint32) const
 Leave this place, possibly 'hiding' a section of text that was previously expanded (at enter()-time.)
virtual int idaapi compare2 (const place_t *t2, void *) const
 Compare two locations except line numbers (lnnum).
virtual bool idaapi equals (const place_t *t2, void *ud) const
 Compare two places for equality, ignoring line numbers (lnnum).

Public Attributes

int lnnum
 Number of line within the current object.
void *ud const = 0

Detailed Description

Denotes a displayed line.

(location_t would be a better name but it is too late to rename it now)

An object may be displayed on one or more lines. All lines of an object are generated at once and kept in a linearray_t class.

place_t is an abstract class, another class must be derived from it.
Currently the following classes are used in IDA:

        idaplace_t      - disassembly view                                      \n

Example (idaplace_t):

  004015AC
  004015AC loc_4015AC:                             ; CODE XREF: sub_4014B8+C5␘j
  004015AC                 xor     eax, eax                                         

The first line is denoted by idaplace_t with ea=4015AC, lnnum=0
The second line is denoted by idaplace_t with ea=4015AC, lnnum=1
The third line is denoted by idaplace_t with ea=4015AC, lnnum=2

NB: the place_t class may change in the future, do not rely on it

Constructor & Destructor Documentation

◆ place_t() [1/2]

place_t::place_t ( )
inline

Constructor.

◆ place_t() [2/2]

place_t::place_t ( int ln)
inline

Constructor.

Member Function Documentation

◆ DEFINE_MEMORY_ALLOCATION_FUNCS()

place_t::DEFINE_MEMORY_ALLOCATION_FUNCS ( )

Generate a short description of the location.

This description is used on the status bar.

Parameters
voutthe output buffer
udpointer to user-defined context data. Is supplied by ::linearray_t

◆ touval()

virtual uval_t idaapi place_t::touval ( void * ud) const
pure virtual

Map the location to a number.

This mapping is used to draw the vertical scrollbar.

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t

◆ clone()

virtual place_t *idaapi place_t::clone ( ) const
pure virtual

Clone the location.

Returns
a pointer to a copy of the current location in dynamic memory

◆ copyfrom()

virtual void idaapi place_t::copyfrom ( const place_t * from)
pure virtual

Copy the specified location object to the current object.

◆ makeplace()

virtual place_t *idaapi place_t::makeplace ( void * ud,
uval_t x,
int lnnum ) const
pure virtual

Map a number to a location.

When the user clicks on the scrollbar and drags it, we need to determine the location corresponding to the new scrollbar position. This function is used to determine it. It builds a location object for the specified 'x' and returns a pointer to it.

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t
xnumber to map
lnnumline number to initialize 'lnnum'
Returns
a freshly allocated object. See also PCF_MAKEPLACE_ALLOCATES

◆ compare()

virtual int idaapi place_t::compare ( const place_t * t2) const
pure virtual

Deprecated. Please consider compare2(const place_t *, void *) instead.

◆ adjust()

virtual void idaapi place_t::adjust ( void * ud)
pure virtual

Adjust the current location to point to a displayable object.

This function validates the location and makes sure that it points to an existing object. For example, if the location points to the middle of an instruction, it will be adjusted to point to the beginning of the instruction.

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t

◆ prev()

virtual bool idaapi place_t::prev ( void * ud)
pure virtual

Move to the previous displayable location.

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t
Returns
success

◆ next()

virtual bool idaapi place_t::next ( void * ud)
pure virtual

Move to the next displayable location.

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t
Returns
success

◆ beginning()

virtual bool idaapi place_t::beginning ( void * ud) const
pure virtual

Are we at the first displayable object?

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t
Returns
true if the current location points to the first displayable object

◆ ending()

virtual bool idaapi place_t::ending ( void * ud) const
pure virtual

Are we at the last displayable object?

Parameters
udpointer to user-defined context data. Is supplied by ::linearray_t
Returns
true if the current location points to the last displayable object

◆ generate()

virtual int idaapi place_t::generate ( qstrvec_t * out,
int * out_deflnnum,
color_t * out_pfx_color,
bgcolor_t * out_bgcolor,
void * ud,
int maxsize ) const
pure virtual

Generate text lines for the current location.

Parameters
outstorage for the lines
out_deflnnumpointer to the cell that will contain the number of the most 'interesting' generated line
out_pfx_colorpointer to the cell that will contain the line prefix color
out_bgcolorpointer to the cell that will contain the background color
udpointer to user-defined context data. Is supplied by linearray_t
maxsizethe maximum number of lines to generate
Returns
number of generated lines

◆ serialize()

virtual void idaapi place_t::serialize ( bytevec_t * out) const
pure virtual

Serialize this instance.

It is fundamental that all instances of a particular subclass of of place_t occupy the same number of bytes when serialized.

Parameters
outbuffer to serialize into

◆ deserialize()

virtual bool idaapi place_t::deserialize ( const uchar ** pptr,
const uchar * end )
pure virtual

De-serialize into this instance.

'pptr' should be incremented by as many bytes as de-serialization consumed.

Parameters
pptrpointer to a serialized representation of a place_t of this type.
endpointer to end of buffer.
Returns
whether de-serialization was successful

◆ id()

virtual int idaapi place_t::id ( ) const
pure virtual

Get the place's ID (i.e., the value returned by register_place_class())

Returns
the id

◆ name()

virtual const char *idaapi place_t::name ( ) const
pure virtual

Get this place type name.

All instances of a given class must return the same string.

Returns
the place type name. Please try and pick something that is not too generic, as it might clash w/ other plugins. A good practice is to prefix the class name with the name of your plugin. E.g., "myplugin:srcplace_t".

◆ toea()

virtual ea_t idaapi place_t::toea ( ) const
inlinevirtual

Map the location to an ea_t.

Returns
the corresponding ea_t, or BADADDR;

◆ rebase()

virtual bool idaapi place_t::rebase ( const segm_move_infos_t & )
inlinevirtual

Rebase the place instance.

Parameters
infosthe segments that were moved
Returns
true if place was rebased, false otherwise

◆ enter()

virtual place_t *idaapi place_t::enter ( uint32 * ) const
inlinevirtual

Visit this place, possibly 'unhiding' a section of text.

If entering that place required some expanding, a place_t should be returned that represents that section, plus some flags for later use by 'leave()'.

Parameters
out_flagsflags to be used together with the place_t that is returned, in order to restore the section to its original state when leave() is called.
Returns
a place_t corresponding to the beginning of the section of text that had to be expanded. That place_t's leave() will be called with the flags contained in 'out_flags' when the user navigates away from it.

◆ leave()

virtual void idaapi place_t::leave ( uint32 ) const
inlinevirtual

Leave this place, possibly 'hiding' a section of text that was previously expanded (at enter()-time.)

◆ compare2()

virtual int idaapi place_t::compare2 ( const place_t * t2,
void *  ) const
inlinevirtual

Compare two locations except line numbers (lnnum).

This function is used to organize loops. For example, if the user has selected an range, its boundaries are remembered as location objects. Any operation within the selection will have the following look: for ( loc=starting_location; loc < ending_location; loc.next() ) In this loop, the comparison function is used.

Parameters
t2the place to compare this one to.
udpointer to user-defined context data.
Return values
-1if the current location is less than 't2'
0if the current location is equal to than 't2'
1if the current location is greater than 't2'

◆ equals()

virtual bool idaapi place_t::equals ( const place_t * t2,
void * ud ) const
inlinevirtual

Compare two places for equality, ignoring line numbers (lnnum).

This is semantically different than compare2, although by default it is implemented in terms of it for backwards-compatibility. compare2 implements a three-way comparison to see if two places sort less than, equal to, or grater than. This method actually looks for equality. Thus, t1->equals(t2, ud) implies t1->compare2(t2, ud) == 0, but the reverse is not always true. An example of this is for adjustable places that are sensitive to the x-cursor position, and need to compare differently as a result.

Returns
true if the two places match / are equal.

Member Data Documentation

◆ lnnum

int place_t::lnnum

Number of line within the current object.

◆ const

void* ud place_t::const = 0

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