helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
committed by
Tomas Vanek
parent
6916550938
commit
6cb5ba6f11
@@ -142,7 +142,7 @@ static int xscale_verify_pointer(struct command_invocation *cmd,
|
||||
struct xscale_common *xscale)
|
||||
{
|
||||
if (xscale->common_magic != XSCALE_COMMON_MAGIC) {
|
||||
command_print(cmd->ctx, xscale_not);
|
||||
command_print(cmd, xscale_not);
|
||||
return ERROR_TARGET_INVALID;
|
||||
}
|
||||
return ERROR_OK;
|
||||
@@ -2658,9 +2658,9 @@ static inline void xscale_display_instruction(struct target *target, uint32_t pc
|
||||
{
|
||||
int retval = xscale_read_instruction(target, pc, instruction);
|
||||
if (retval == ERROR_OK)
|
||||
command_print(cmd->ctx, "%s", instruction->text);
|
||||
command_print(cmd, "%s", instruction->text);
|
||||
else
|
||||
command_print(cmd->ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc);
|
||||
command_print(cmd, "0x%8.8" PRIx32 "\t<not found in image>", pc);
|
||||
}
|
||||
|
||||
static int xscale_analyze_trace(struct target *target, struct command_invocation *cmd)
|
||||
@@ -2787,7 +2787,7 @@ static int xscale_analyze_trace(struct target *target, struct command_invocation
|
||||
continue;
|
||||
|
||||
if (exception) {
|
||||
command_print(cmd->ctx, "--- exception %i ---", exception);
|
||||
command_print(cmd, "--- exception %i ---", exception);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2813,7 +2813,7 @@ static int xscale_analyze_trace(struct target *target, struct command_invocation
|
||||
}
|
||||
|
||||
if (current_pc == 0)
|
||||
command_print(cmd->ctx, "address unknown");
|
||||
command_print(cmd, "address unknown");
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -3136,7 +3136,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -3150,7 +3150,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command)
|
||||
xscale->armv4_5_mmu.mmu_enabled = enable;
|
||||
}
|
||||
|
||||
command_print(CMD_CTX, "mmu %s",
|
||||
command_print(CMD, "mmu %s",
|
||||
(xscale->armv4_5_mmu.mmu_enabled) ? "enabled" : "disabled");
|
||||
|
||||
return ERROR_OK;
|
||||
@@ -3166,7 +3166,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -3195,7 +3195,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command)
|
||||
xscale->armv4_5_mmu.armv4_5_cache.i_cache_enabled :
|
||||
xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled;
|
||||
const char *msg = enabled ? "enabled" : "disabled";
|
||||
command_print(CMD_CTX, "%s %s", CMD_NAME, msg);
|
||||
command_print(CMD, "%s %s", CMD_NAME, msg);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -3257,7 +3257,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command)
|
||||
|
||||
dcsr_value = buf_get_u32(dcsr_reg->value, 0, 32);
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(vec_ids); i++) {
|
||||
command_print(CMD_CTX, "%15s: %s", vec_ids[i].name,
|
||||
command_print(CMD, "%15s: %s", vec_ids[i].name,
|
||||
(dcsr_value & vec_ids[i].mask) ? "catch" : "ignore");
|
||||
}
|
||||
|
||||
@@ -3279,16 +3279,16 @@ COMMAND_HANDLER(xscale_handle_vector_table_command)
|
||||
if (CMD_ARGC == 0) { /* print current settings */
|
||||
int idx;
|
||||
|
||||
command_print(CMD_CTX, "active user-set static vectors:");
|
||||
command_print(CMD, "active user-set static vectors:");
|
||||
for (idx = 1; idx < 8; idx++)
|
||||
if (xscale->static_low_vectors_set & (1 << idx))
|
||||
command_print(CMD_CTX,
|
||||
command_print(CMD,
|
||||
"low %d: 0x%" PRIx32,
|
||||
idx,
|
||||
xscale->static_low_vectors[idx]);
|
||||
for (idx = 1; idx < 8; idx++)
|
||||
if (xscale->static_high_vectors_set & (1 << idx))
|
||||
command_print(CMD_CTX,
|
||||
command_print(CMD,
|
||||
"high %d: 0x%" PRIx32,
|
||||
idx,
|
||||
xscale->static_high_vectors[idx]);
|
||||
@@ -3335,7 +3335,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -3354,7 +3354,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
|
||||
if (CMD_ARGC >= 3)
|
||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], buffcount);
|
||||
if (buffcount < 1) { /* invalid */
|
||||
command_print(CMD_CTX, "fill buffer count must be > 0");
|
||||
command_print(CMD, "fill buffer count must be > 0");
|
||||
xscale->trace.mode = XSCALE_TRACE_DISABLED;
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
@@ -3371,11 +3371,11 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
|
||||
if (xscale->trace.mode != XSCALE_TRACE_DISABLED) {
|
||||
char fill_string[12];
|
||||
sprintf(fill_string, "fill %d", xscale->trace.buffer_fill);
|
||||
command_print(CMD_CTX, "trace buffer enabled (%s)",
|
||||
command_print(CMD, "trace buffer enabled (%s)",
|
||||
(xscale->trace.mode == XSCALE_TRACE_FILL)
|
||||
? fill_string : "wrap");
|
||||
} else
|
||||
command_print(CMD_CTX, "trace buffer disabled");
|
||||
command_print(CMD, "trace buffer disabled");
|
||||
|
||||
dcsr_value = buf_get_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 0, 32);
|
||||
if (xscale->trace.mode == XSCALE_TRACE_FILL)
|
||||
@@ -3402,7 +3402,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
|
||||
if (xscale->trace.image) {
|
||||
image_close(xscale->trace.image);
|
||||
free(xscale->trace.image);
|
||||
command_print(CMD_CTX, "previously loaded image found and closed");
|
||||
command_print(CMD, "previously loaded image found and closed");
|
||||
}
|
||||
|
||||
xscale->trace.image = malloc(sizeof(struct image));
|
||||
@@ -3439,7 +3439,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -3449,7 +3449,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
|
||||
trace_data = xscale->trace.data;
|
||||
|
||||
if (!trace_data) {
|
||||
command_print(CMD_CTX, "no trace data collected");
|
||||
command_print(CMD, "no trace data collected");
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -3502,7 +3502,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_OK;
|
||||
}
|
||||
uint32_t reg_no = 0;
|
||||
@@ -3536,7 +3536,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
|
||||
reg_no = XSCALE_CPACCESS;
|
||||
break;
|
||||
default:
|
||||
command_print(CMD_CTX, "invalid register number");
|
||||
command_print(CMD, "invalid register number");
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
reg = &xscale->reg_cache->reg_list[reg_no];
|
||||
@@ -3548,7 +3548,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
|
||||
/* read cp15 control register */
|
||||
xscale_get_reg(reg);
|
||||
value = buf_get_u32(reg->value, 0, 32);
|
||||
command_print(CMD_CTX, "%s (/%i): 0x%" PRIx32 "", reg->name, (int)(reg->size),
|
||||
command_print(CMD, "%s (/%i): 0x%" PRIx32 "", reg->name, (int)(reg->size),
|
||||
value);
|
||||
} else if (CMD_ARGC == 2) {
|
||||
uint32_t value;
|
||||
|
||||
Reference in New Issue
Block a user