target/xscale: change prototype of xscale_display_instruction()

To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should be ready to switch
to CMD as first parameter.

Change prototype of xscale_display_instruction() and of
xscale_analyze_trace() to pass CMD instead of CMD_CTX.

This change was part of http://openocd.zylin.com/1815 from Paul
Fertser and has been extracted and rebased to simplify the review.

Change-Id: I8420f19c1b2ff0d2a2f2a8d3627767f7acda437c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5065
Tested-by: jenkins
This commit is contained in:
Paul Fertser 2019-04-01 04:06:58 +02:00 committed by Tomas Vanek
parent 32470a973f
commit c779387279
1 changed files with 11 additions and 11 deletions

View File

@ -2654,16 +2654,16 @@ static inline void xscale_branch_address(struct xscale_trace_data *trace_data,
static inline void xscale_display_instruction(struct target *target, uint32_t pc,
struct arm_instruction *instruction,
struct command_context *cmd_ctx)
struct command_invocation *cmd)
{
int retval = xscale_read_instruction(target, pc, instruction);
if (retval == ERROR_OK)
command_print(cmd_ctx, "%s", instruction->text);
command_print(cmd->ctx, "%s", instruction->text);
else
command_print(cmd_ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc);
command_print(cmd->ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc);
}
static int xscale_analyze_trace(struct target *target, struct command_context *cmd_ctx)
static int xscale_analyze_trace(struct target *target, struct command_invocation *cmd)
{
struct xscale_common *xscale = target_to_xscale(target);
struct xscale_trace_data *trace_data = xscale->trace.data;
@ -2771,7 +2771,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
count = trace_data->entries[i].data & 0x0f;
for (j = 0; j < count; j++) {
xscale_display_instruction(target, current_pc, &instruction,
cmd_ctx);
cmd);
current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
}
@ -2779,7 +2779,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
* rollover and some exceptions: undef, swi, prefetch abort. */
if ((trace_msg_type == 15) || (exception > 0 && exception < 4)) {
xscale_display_instruction(target, current_pc, &instruction,
cmd_ctx);
cmd);
current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
}
@ -2787,13 +2787,13 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
continue;
if (exception) {
command_print(cmd_ctx, "--- exception %i ---", exception);
command_print(cmd->ctx, "--- exception %i ---", exception);
continue;
}
/* not exception or rollover; next instruction is a branch and is
* not included in the count */
xscale_display_instruction(target, current_pc, &instruction, cmd_ctx);
xscale_display_instruction(target, current_pc, &instruction, cmd);
/* for direct branches, extract branch destination from instruction */
if ((trace_msg_type == 8) || (trace_msg_type == 12)) {
@ -2813,7 +2813,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
}
if (current_pc == 0)
command_print(cmd_ctx, "address unknown");
command_print(cmd->ctx, "address unknown");
continue;
}
@ -2855,7 +2855,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
/* display remaining instructions */
for (i = 0; i < gap_count; i++) {
xscale_display_instruction(target, current_pc, &instruction, cmd_ctx);
xscale_display_instruction(target, current_pc, &instruction, cmd);
current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
}
@ -3486,7 +3486,7 @@ COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command)
if (retval != ERROR_OK)
return retval;
xscale_analyze_trace(target, CMD_CTX);
xscale_analyze_trace(target, CMD);
return ERROR_OK;
}