The new sub-command for info is added using
add_info
add_info ("spr", or1k_info_spr_command, "Show the value of a special purpose register");
The functionality is provided in
or1k_info_spr_command
. The user can specify a
group by name or number (the value of all registers in that group is
displayed), or a register name (the value of that register is
displayed) or a group name/number and register name/number (the
value of that register in the group is displayed).
The arguments are broken out from the text of the command using
or1k_parse_params
, which also handles any
errors in syntax or semantics. If the arguments are successfully
parsed the results are then printed out using the UI independent
function, ui_out_field_fmt
.
The SPR is read using the convenience function
or1k_read_spr
. This converts the access to a
call of the command readspr, which can be passed
to the target usings its to_rcmd
target
operation (see Section 4.3.7). This will
allow the SPR to be accessed in the way most appropriate to the
current target access method.