Diablo provides a number of wrappers to facilitate IO:
The functions described hereafter print a message which can contain conversion specifiers, each of which results in fetching zero or more subsequent arguments. These conversion specifiers will be discussed later.
VERBOSE((t_int32 verboselevel), (t_string message, ...));
This function will print the message if diablosupport_options.verbose is larger than or equal to verboselevel.
FATAL((t_string message, ...));
This function can be used to print out a message before terminating the program.
ASSERT((scalar expression),(t_string message, ...));
This function will check whether the expression evaluates to a non-zero value. If it does evaluate to zero, the program will terminate after writing the message.
WARNING((t_string message, ...));
This function will print out the message as a warning
DEBUG((t_string message, ...));
This function will print out the message as debug information
STATUS((START,t_string message, ...)); STATUS((STOP,t_string message, ...));
This STATUS function is used to indicate the boundaries of some step in the program rewriting.
Conversion Specifiers
There are two types of conversion specifiers.
The first type is introduced by a %, followed by the conversion specifier. These are the traditional conversion specifiers which are also used in standard input/output.
The second type is introduced by an @, followed by the conversion specifier. These are diablo specific conversion specifiers.
Conversion Specifier | Purpose | Modifier |
---|---|---|
|
allows you to print @ | |
|
Basic Block (t_bbl *) | <none>: short info |
e: print edges | ||
i: print instructions | ||
|
Instruction (t_ins *) | |
|
Edge (t_cfg_edge *) | |
|
Relocation (t_reloc *) | |
|
Symbol (t_symbol *) | |
|
Path (t_path *) | |
|
Address (t_address) | |
|
Regset (t_regset) |
Example: Print the instruction (t_ins * ins) and the used registers:
VERBOSE(0,("Instruction:@I Used Regs:@X\n",ins,CPREGSET(BBL_CFG(INS_BBL(ins)),INS_REGS_USE(ins))));