Ghidra Decompiler Analysis Engine
Public Types | Public Member Functions | List of all members
ParamTrial Class Reference

A register or memory register that may be used to pass a parameter or return value. More...

#include <fspec.hh>

Public Types

enum  {
  checked = 1, used = 2, defnouse = 4, active = 8,
  unref = 16, killedbycall = 32, rem_formed = 64, indcreate_formed = 128,
  condexe_effect = 256
}
 

Public Member Functions

 ParamTrial (const Address &ad, int4 sz, int4 sl)
 Construct from components.
 
ParamTrial splitHi (int4 sz) const
 Create a trial representing the first part of this. More...
 
ParamTrial splitLo (int4 sz) const
 Create a trial representing the last part of this. More...
 
bool testShrink (const Address &newaddr, int4 sz) const
 Test if this trial can be made smaller. More...
 
bool operator< (const ParamTrial &b) const
 Sort trials in formal parameter order. More...
 

Detailed Description

A register or memory register that may be used to pass a parameter or return value.

The parameter recovery utilities (see ParamActive) use this to denote a putative parameter passing storage location. It is made up of the address and size of the memory range, a set of properties about the use of the range (as a parameter) in context, and a link to the matching part of the PrototypeModel.

Data-flow for the putative parameter is held directly by a Varnode. To quickly map to the Varnode (which may or may not exist at points during the ParamTrial lifetime), the concept of slot is used. ParamTrials are assigned a slot, starting at 1. For sub-function parameters, this represents the actual input index of the Varnode in the corresponding CALL or CALLIND op. For parameters, this gives the position within the list of possible input Varnodes in address order. The slot ordering varies over the course of analysis and is unlikely to match the final parameter ordering. The ParamTrial comparator sorts the trials in final parameter ordering.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
checked 

Trial has been checked.

used 

Trial is definitely used (final verdict)

defnouse 

Trial is definitely not used.

active 

Trial looks active (hint that it is used)

unref 

There is no direct reference to this parameter trial.

killedbycall 

Data in this location is unlikely to flow thru a func and still be a param.

rem_formed 

The trial is built out of a remainder operation.

indcreate_formed 

The trial is built out of an indirect creation.

condexe_effect 

This trial may be affected by conditional execution.

Member Function Documentation

◆ operator<()

bool ParamTrial::operator< ( const ParamTrial b) const

Sort trials in formal parameter order.

Trials are sorted primarily by the group index assigned by the PrototypeModel. Trials within the same group are sorted in address order (or its reverse)

Parameters
bis the other trial to compare with this
Returns
true if this should be ordered before the other trial

◆ splitHi()

ParamTrial ParamTrial::splitHi ( int4  sz) const

Create a trial representing the first part of this.

Create a new ParamTrial based on the first bytes of the memory range.

Parameters
szis the number of bytes to include in the new trial
Returns
the new trial

◆ splitLo()

ParamTrial ParamTrial::splitLo ( int4  sz) const

Create a trial representing the last part of this.

Create a new ParamTrial based on the last bytes of the memory range.

Parameters
szis the number of bytes to include in the new trial
Returns
the new trial

◆ testShrink()

bool ParamTrial::testShrink ( const Address newaddr,
int4  sz 
) const

Test if this trial can be made smaller.

A new address and size for the memory range is given, which must respect the endianness of the putative parameter and any existing match with the PrototypeModel

Parameters
newaddris the new address
szis the new size
Returns
true if the trial can be shrunk to the new range

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