IDA SDK

- Main Page
- Header Files
- Classes
- Modules

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Attributes | Public Member Functions | List of all members
place_t Class Referenceabstract

## 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
enumplace_t - enum view
structplace_t - structure view

Example (idaplace_t):

      004015AC
      004015AC loc_4015AC:                             ; CODE XREF: sub_4014B8+C5j
      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

Inherited by enumplace_t, idaplace_t, simpleline_place_t, and structplace_t.

## Public Attributes
short | lnnum
| Number of line within the current object.

## Public Member Functions
| place_t (void)
| Constructor.
| place_t (short ln)
| Constructor.
virtual void idaapi | print (void *ud, char *out_buf, size_t bufsize) const =0
| Generate a short description of the location. More...
virtual uval_t idaapi | touval (void *ud) const =0
| Map the location to a number. More...
virtual place_t *idaapi | clone (void) const =0
| Clone the location. More...
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, short lnnum) const =0
| Map a number to a location. More...
virtual int idaapi | compare (const place_t *t2) const =0
| Compare two locations except line numbers (lnnum). More...
virtual void idaapi | adjust (void *ud)=0
| Adjust the current location to point to a displayable object. More...
virtual bool idaapi | prev (void *ud)=0
| Move to the previous displayable location. More...
virtual bool idaapi | next (void *ud)=0
| Move to the next displayable location. More...
virtual bool idaapi | beginning (void *ud) const =0
| Are we at the first displayable object?. More...
virtual bool idaapi | ending (void *ud) const =0
| Are we at the last displayable object?. More...
virtual int idaapi | generate (void *ud, char *lines[], int maxsize, int *default_lnnum, color_t *pfx_color, bgcolor_t *bgcolor) const =0
| Generate text lines for the current location. More...
virtual void idaapi | serialize (bytevec_t *out) const =0
| Serialize this instance. More...
virtual bool idaapi | deserialize (const uchar **pptr, const uchar *end)=0
| De-serialize into this instance. More...
virtual int idaapi | id () const =0
| Get the place's ID (i.e., the value returned by register_place_class()) More...
virtual const char *idaapi | name () const =0
| Get this place type name. More...
virtual ea_t idaapi | toea () const
| Map the location to an ea_t. More...
virtual bool idaapi | rebase (const segm_move_infos_t &)
| Rebase the place instance. More...
virtual place_t *idaapi | enter (uint32 *) const
| Visit this place, possibly 'unhiding' a section of text. More...
virtual void idaapi | leave (uint32) const
| Leave this place, possibly 'hiding' a section of text that was previously expanded (at enter()-time.)

## Member Function Documentation

virtual void idaapi place_t::print | ( | void * | ud,
|  | char * | out_buf,
|  | size_t | bufsize
| ) |  | const
| pure virtual

Generate a short description of the location.

This description is used on the status bar.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t
  out_buf | the output buffer
  bufsize | size of the output buffer

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

  ud | pointer to user-defined context data. Is supplied by linearray_t

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

Clone the location.

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

virtual place_t* idaapi place_t::makeplace | ( | void * | ud,
|  | uval_t | x,
|  | short | 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

  ud | pointer to user-defined context data. Is supplied by linearray_t
  x | number to map
  lnnum | line number to initialize 'lnnum'

Returns
  a static object, no need to destroy it.

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

Compare two locations except line numbers (lnnum).

This function is used to organize loops. For example, if the user has selected an area, 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.

Return values

  -1 | if the current location is less than 't2'
  0 | if the current location is equal to than 't2'
  1 | if the current location is greater than 't2'

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

  ud | pointer to user-defined context data. Is supplied by linearray_t

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

Move to the previous displayable location.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t

Returns
  success

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

Move to the next displayable location.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t

Returns
  success

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

Are we at the first displayable object?.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t

Returns
  true if the current location points to the first displayable object

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

Are we at the last displayable object?.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t

Returns
  true if the current location points to the last displayable object

virtual int idaapi place_t::generate | ( | void * | ud,
|  | char * | lines[],
|  | int | maxsize,
|  | int * | default_lnnum,
|  | color_t * | pfx_color,
|  | bgcolor_t * | bgcolor
| ) |  | const
| pure virtual

Generate text lines for the current location.

Parameters

  ud | pointer to user-defined context data. Is supplied by linearray_t
  lines | array of pointers to output lines. the pointers will be overwritten by lines that are allocated using qstrdup. the caller must qfree them.
  maxsize | maximal number of lines to generate
  default_lnnum | pointer to the cell that will contain the number of the most 'interesting' generated line
  pfx_color | pointer to the cell that will contain the line prefix color
  bgcolor | pointer to the cell that will contain the background color

Returns
  number of generated lines

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

  out | buffer to serialize into

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

  pptr | pointer to a serialized representation of a place_t of this type.
  end | pointer to end of buffer.

Returns
  whether de-serialization was successful

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

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".

virtual ea_t idaapi place_t::toea | ( |  | ) | const
| inline virtual

Map the location to an ea_t.

Returns
  the corresponding ea_t, or BADADDR;

virtual bool idaapi place_t::rebase | ( | const segm_move_infos_t & |  | ) |
| inline virtual

Rebase the place instance.

Parameters

  infos | the segments that were moved

Returns
  true if place was rebased, false otherwise

virtual place_t* idaapi place_t::enter | ( | uint32 * |  | ) | const
| inline virtual

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_flags | flags 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.

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

- kernwin.hpp