forked from auracaster/openocd
target: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance some checkpatch error due to existing code: - remove useless parenthesis; - remove useless 'break'; - join spit lines; - add space around operators; - remove 'else' after exit() and return. Change-Id: I8a87a0ea104205d087dcb8cbf4c67ff13a47742f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9050 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
@@ -838,7 +838,6 @@ static int arm11_read_memory_inner(struct target *target,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
|
||||||
arm11->arm.core_cache->reg_list[1].dirty = true;
|
arm11->arm.core_cache->reg_list[1].dirty = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
@@ -856,7 +855,6 @@ static int arm11_read_memory_inner(struct target *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
@@ -928,7 +926,6 @@ static int arm11_write_memory_inner(struct target *target,
|
|||||||
|
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
|
||||||
arm11->arm.core_cache->reg_list[1].dirty = true;
|
arm11->arm.core_cache->reg_list[1].dirty = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
@@ -948,10 +945,8 @@ static int arm11_write_memory_inner(struct target *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
|
||||||
arm11->arm.core_cache->reg_list[1].dirty = true;
|
arm11->arm.core_cache->reg_list[1].dirty = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
@@ -974,9 +969,9 @@ static int arm11_write_memory_inner(struct target *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case 4: {
|
case 4:
|
||||||
|
{
|
||||||
/* stream word data through DCC directly to memory */
|
/* stream word data through DCC directly to memory */
|
||||||
/* increment: STC p14,c5,[R0],#4 */
|
/* increment: STC p14,c5,[R0],#4 */
|
||||||
/* no increment: STC p14,c5,[R0]*/
|
/* no increment: STC p14,c5,[R0]*/
|
||||||
|
|||||||
@@ -2329,9 +2329,9 @@ int arm7_9_write_memory(struct target *target,
|
|||||||
/* fast memory writes are only safe when the target is running
|
/* fast memory writes are only safe when the target is running
|
||||||
* from a sufficiently high clock (32 kHz is usually too slow)
|
* from a sufficiently high clock (32 kHz is usually too slow)
|
||||||
*/
|
*/
|
||||||
if (arm7_9->fast_memory_access)
|
if (arm7_9->fast_memory_access) {
|
||||||
retval = arm7_9_execute_fast_sys_speed(target);
|
retval = arm7_9_execute_fast_sys_speed(target);
|
||||||
else {
|
} else {
|
||||||
retval = arm7_9_execute_sys_speed(target);
|
retval = arm7_9_execute_sys_speed(target);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2373,9 +2373,9 @@ int arm7_9_write_memory(struct target *target,
|
|||||||
/* fast memory writes are only safe when the target is running
|
/* fast memory writes are only safe when the target is running
|
||||||
* from a sufficiently high clock (32 kHz is usually too slow)
|
* from a sufficiently high clock (32 kHz is usually too slow)
|
||||||
*/
|
*/
|
||||||
if (arm7_9->fast_memory_access)
|
if (arm7_9->fast_memory_access) {
|
||||||
retval = arm7_9_execute_fast_sys_speed(target);
|
retval = arm7_9_execute_fast_sys_speed(target);
|
||||||
else {
|
} else {
|
||||||
retval = arm7_9_execute_sys_speed(target);
|
retval = arm7_9_execute_sys_speed(target);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2416,9 +2416,9 @@ int arm7_9_write_memory(struct target *target,
|
|||||||
/* fast memory writes are only safe when the target is running
|
/* fast memory writes are only safe when the target is running
|
||||||
* from a sufficiently high clock (32 kHz is usually too slow)
|
* from a sufficiently high clock (32 kHz is usually too slow)
|
||||||
*/
|
*/
|
||||||
if (arm7_9->fast_memory_access)
|
if (arm7_9->fast_memory_access) {
|
||||||
retval = arm7_9_execute_fast_sys_speed(target);
|
retval = arm7_9_execute_fast_sys_speed(target);
|
||||||
else {
|
} else {
|
||||||
retval = arm7_9_execute_sys_speed(target);
|
retval = arm7_9_execute_sys_speed(target);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -816,11 +816,9 @@ static int dsp563xx_write_register(struct target *target, int num, int force)
|
|||||||
arch_info->instr_mask,
|
arch_info->instr_mask,
|
||||||
dsp563xx->core_regs[num]);
|
dsp563xx->core_regs[num]);
|
||||||
|
|
||||||
if ((err == ERROR_OK) && (arch_info->num == DSP563XX_REG_IDX_SP)) {
|
if (err == ERROR_OK && arch_info->num == DSP563XX_REG_IDX_SP) {
|
||||||
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSH].valid =
|
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSH].valid = 0;
|
||||||
0;
|
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSL].valid = 0;
|
||||||
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSL].valid =
|
|
||||||
0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -933,7 +933,6 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
|||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
ctx->pipe_index++;
|
ctx->pipe_index++;
|
||||||
continue;
|
continue;
|
||||||
break;
|
|
||||||
case 0x2: /* trace restarted after FIFO overflow */
|
case 0x2: /* trace restarted after FIFO overflow */
|
||||||
command_print(cmd,
|
command_print(cmd,
|
||||||
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
|
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
|
||||||
@@ -941,7 +940,6 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
|||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
ctx->pipe_index++;
|
ctx->pipe_index++;
|
||||||
continue;
|
continue;
|
||||||
break;
|
|
||||||
case 0x3: /* exit from debug state */
|
case 0x3: /* exit from debug state */
|
||||||
command_print(cmd,
|
command_print(cmd,
|
||||||
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
|
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
|
||||||
@@ -949,7 +947,6 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
|||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
ctx->pipe_index++;
|
ctx->pipe_index++;
|
||||||
continue;
|
continue;
|
||||||
break;
|
|
||||||
case 0x4: /* periodic synchronization point */
|
case 0x4: /* periodic synchronization point */
|
||||||
next_pc = ctx->last_branch;
|
next_pc = ctx->last_branch;
|
||||||
/* if we had no valid PC prior to this synchronization point,
|
/* if we had no valid PC prior to this synchronization point,
|
||||||
@@ -965,8 +962,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: /* reserved */
|
default: /* reserved */
|
||||||
LOG_ERROR(
|
LOG_ERROR("BUG: branch reason code 0x%" PRIx32 " is reserved",
|
||||||
"BUG: branch reason code 0x%" PRIx32 " is reserved",
|
|
||||||
ctx->last_branch_reason);
|
ctx->last_branch_reason);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ static int jsp_input(struct connection *connection)
|
|||||||
while (bytes_read) {
|
while (bytes_read) {
|
||||||
switch (t_con->state) {
|
switch (t_con->state) {
|
||||||
case TELNET_STATE_DATA:
|
case TELNET_STATE_DATA:
|
||||||
if (*buf_p == 0xff)
|
if (*buf_p == 0xff) {
|
||||||
t_con->state = TELNET_STATE_IAC;
|
t_con->state = TELNET_STATE_IAC;
|
||||||
else {
|
} else {
|
||||||
int out_len = 1;
|
int out_len = 1;
|
||||||
int in_len;
|
int in_len;
|
||||||
unsigned char in_buffer[10];
|
unsigned char in_buffer[10];
|
||||||
@@ -129,8 +129,7 @@ static int jsp_input(struct connection *connection)
|
|||||||
&out_len, buf_p, &in_len,
|
&out_len, buf_p, &in_len,
|
||||||
in_buffer);
|
in_buffer);
|
||||||
if (in_len)
|
if (in_len)
|
||||||
telnet_write(connection,
|
telnet_write(connection, in_buffer, in_len);
|
||||||
in_buffer, in_len);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TELNET_STATE_IAC:
|
case TELNET_STATE_IAC:
|
||||||
|
|||||||
@@ -452,7 +452,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 1, fields);
|
retval = semihosting_read_fields(target, 1, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
/* Do not allow to close OpenOCD's own standard streams */
|
/* Do not allow to close OpenOCD's own standard streams */
|
||||||
if (fd == 0 || fd == 1 || fd == 2) {
|
if (fd == 0 || fd == 1 || fd == 2) {
|
||||||
@@ -554,49 +555,43 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
int type = semihosting_get_field(target, 0, fields);
|
|
||||||
int code = semihosting_get_field(target, 1, fields);
|
|
||||||
|
|
||||||
if (type == ADP_STOPPED_APPLICATION_EXIT) {
|
int type = semihosting_get_field(target, 0, fields);
|
||||||
if (!gdb_get_actual_connections())
|
int code = semihosting_get_field(target, 1, fields);
|
||||||
exit(code);
|
|
||||||
else {
|
if (type == ADP_STOPPED_APPLICATION_EXIT) {
|
||||||
fprintf(stderr,
|
if (!gdb_get_actual_connections())
|
||||||
"semihosting: *** application exited with %d ***\n",
|
exit(code);
|
||||||
code);
|
|
||||||
}
|
fprintf(stderr,
|
||||||
} else {
|
"semihosting: *** application exited with %d ***\n",
|
||||||
fprintf(stderr,
|
code);
|
||||||
"semihosting: application exception %#x\n",
|
} else {
|
||||||
type);
|
fprintf(stderr,
|
||||||
}
|
"semihosting: application exception %#x\n", type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (semihosting->param == ADP_STOPPED_APPLICATION_EXIT) {
|
if (semihosting->param == ADP_STOPPED_APPLICATION_EXIT) {
|
||||||
if (!gdb_get_actual_connections())
|
if (!gdb_get_actual_connections())
|
||||||
exit(0);
|
exit(0);
|
||||||
else {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"semihosting: *** application exited normally ***\n");
|
"semihosting: *** application exited normally ***\n");
|
||||||
}
|
|
||||||
} else if (semihosting->param == ADP_STOPPED_RUN_TIME_ERROR) {
|
} else if (semihosting->param == ADP_STOPPED_RUN_TIME_ERROR) {
|
||||||
/* Chosen more or less arbitrarily to have a nicer message,
|
/* Chosen more or less arbitrarily to have a nicer message,
|
||||||
* otherwise all other return the same exit code 1. */
|
* otherwise all other return the same exit code 1. */
|
||||||
if (!gdb_get_actual_connections())
|
if (!gdb_get_actual_connections())
|
||||||
exit(1);
|
exit(1);
|
||||||
else {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"semihosting: *** application exited with error ***\n");
|
"semihosting: *** application exited with error ***\n");
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!gdb_get_actual_connections())
|
if (!gdb_get_actual_connections())
|
||||||
exit(1);
|
exit(1);
|
||||||
else {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"semihosting: application exception %#x\n",
|
"semihosting: application exception %#x\n",
|
||||||
(unsigned) semihosting->param);
|
(unsigned int)semihosting->param);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!semihosting->has_resumable_exit) {
|
if (!semihosting->has_resumable_exit) {
|
||||||
@@ -645,21 +640,20 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int type = semihosting_get_field(target, 0, fields);
|
int type = semihosting_get_field(target, 0, fields);
|
||||||
int code = semihosting_get_field(target, 1, fields);
|
int code = semihosting_get_field(target, 1, fields);
|
||||||
|
|
||||||
if (type == ADP_STOPPED_APPLICATION_EXIT) {
|
if (type == ADP_STOPPED_APPLICATION_EXIT) {
|
||||||
if (!gdb_get_actual_connections())
|
if (!gdb_get_actual_connections())
|
||||||
exit(code);
|
exit(code);
|
||||||
else {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"semihosting: *** application exited with %d ***\n",
|
"semihosting: *** application exited with %d ***\n",
|
||||||
code);
|
code);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "semihosting: exception %#x\n",
|
fprintf(stderr, "semihosting: exception %#x\n", type);
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!semihosting->has_resumable_exit) {
|
if (!semihosting->has_resumable_exit) {
|
||||||
@@ -691,7 +685,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 1, fields);
|
retval = semihosting_read_fields(target, 1, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
semihosting->result = fstat(fd, &buf);
|
semihosting->result = fstat(fd, &buf);
|
||||||
@@ -736,16 +731,16 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr = semihosting_get_field(target, 0, fields);
|
uint64_t addr = semihosting_get_field(target, 0, fields);
|
||||||
size_t size = semihosting_get_field(target, 1, fields);
|
size_t size = semihosting_get_field(target, 1, fields);
|
||||||
|
|
||||||
char *arg = semihosting->cmdline ?
|
char *arg = semihosting->cmdline ? semihosting->cmdline : "";
|
||||||
semihosting->cmdline : "";
|
|
||||||
uint32_t len = strlen(arg) + 1;
|
uint32_t len = strlen(arg) + 1;
|
||||||
if (len > size)
|
if (len > size) {
|
||||||
semihosting->result = -1;
|
semihosting->result = -1;
|
||||||
else {
|
} else {
|
||||||
semihosting_set_field(target, len, 1, fields);
|
semihosting_set_field(target, len, 1, fields);
|
||||||
retval = target_write_buffer(target, addr, len,
|
retval = target_write_buffer(target, addr, len,
|
||||||
(uint8_t *)arg);
|
(uint8_t *)arg);
|
||||||
@@ -784,7 +779,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 1, fields);
|
retval = semihosting_read_fields(target, 1, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr = semihosting_get_field(target, 0, fields);
|
uint64_t addr = semihosting_get_field(target, 0, fields);
|
||||||
/* tell the remote we have no idea */
|
/* tell the remote we have no idea */
|
||||||
memset(fields, 0, 4 * semihosting->word_size_bytes);
|
memset(fields, 0, 4 * semihosting->word_size_bytes);
|
||||||
@@ -908,7 +904,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 3, fields);
|
retval = semihosting_read_fields(target, 3, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr = semihosting_get_field(target, 0, fields);
|
uint64_t addr = semihosting_get_field(target, 0, fields);
|
||||||
uint32_t mode = semihosting_get_field(target, 1, fields);
|
uint32_t mode = semihosting_get_field(target, 1, fields);
|
||||||
size_t len = semihosting_get_field(target, 2, fields);
|
size_t len = semihosting_get_field(target, 2, fields);
|
||||||
@@ -1038,7 +1035,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 3, fields);
|
retval = semihosting_read_fields(target, 3, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
uint64_t addr = semihosting_get_field(target, 1, fields);
|
uint64_t addr = semihosting_get_field(target, 1, fields);
|
||||||
size_t len = semihosting_get_field(target, 2, fields);
|
size_t len = semihosting_get_field(target, 2, fields);
|
||||||
@@ -1117,7 +1115,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr = semihosting_get_field(target, 0, fields);
|
uint64_t addr = semihosting_get_field(target, 0, fields);
|
||||||
size_t len = semihosting_get_field(target, 1, fields);
|
size_t len = semihosting_get_field(target, 1, fields);
|
||||||
if (semihosting->is_fileio) {
|
if (semihosting->is_fileio) {
|
||||||
@@ -1131,9 +1130,7 @@ int semihosting_common(struct target *target)
|
|||||||
semihosting->result = -1;
|
semihosting->result = -1;
|
||||||
semihosting->sys_errno = ENOMEM;
|
semihosting->sys_errno = ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
retval =
|
retval = target_read_memory(target, addr, 1, len, fn);
|
||||||
target_read_memory(target, addr, 1, len,
|
|
||||||
fn);
|
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
free(fn);
|
free(fn);
|
||||||
return retval;
|
return retval;
|
||||||
@@ -1171,7 +1168,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 4, fields);
|
retval = semihosting_read_fields(target, 4, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr1 = semihosting_get_field(target, 0, fields);
|
uint64_t addr1 = semihosting_get_field(target, 0, fields);
|
||||||
size_t len1 = semihosting_get_field(target, 1, fields);
|
size_t len1 = semihosting_get_field(target, 1, fields);
|
||||||
uint64_t addr2 = semihosting_get_field(target, 2, fields);
|
uint64_t addr2 = semihosting_get_field(target, 2, fields);
|
||||||
@@ -1192,15 +1190,13 @@ int semihosting_common(struct target *target)
|
|||||||
semihosting->result = -1;
|
semihosting->result = -1;
|
||||||
semihosting->sys_errno = ENOMEM;
|
semihosting->sys_errno = ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
retval = target_read_memory(target, addr1, 1, len1,
|
retval = target_read_memory(target, addr1, 1, len1, fn1);
|
||||||
fn1);
|
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
free(fn1);
|
free(fn1);
|
||||||
free(fn2);
|
free(fn2);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
retval = target_read_memory(target, addr2, 1, len2,
|
retval = target_read_memory(target, addr2, 1, len2, fn2);
|
||||||
fn2);
|
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
free(fn1);
|
free(fn1);
|
||||||
free(fn2);
|
free(fn2);
|
||||||
@@ -1208,8 +1204,7 @@ int semihosting_common(struct target *target)
|
|||||||
}
|
}
|
||||||
fn1[len1] = 0;
|
fn1[len1] = 0;
|
||||||
fn2[len2] = 0;
|
fn2[len2] = 0;
|
||||||
semihosting->result = rename((char *)fn1,
|
semihosting->result = rename((char *)fn1, (char *)fn2);
|
||||||
(char *)fn2);
|
|
||||||
// rename() on Windows returns nonzero on error
|
// rename() on Windows returns nonzero on error
|
||||||
if (semihosting->result != 0)
|
if (semihosting->result != 0)
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
@@ -1246,7 +1241,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
off_t pos = semihosting_get_field(target, 1, fields);
|
off_t pos = semihosting_get_field(target, 1, fields);
|
||||||
if (semihosting->is_fileio) {
|
if (semihosting->is_fileio) {
|
||||||
@@ -1292,7 +1288,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 2, fields);
|
retval = semihosting_read_fields(target, 2, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
uint64_t addr = semihosting_get_field(target, 0, fields);
|
uint64_t addr = semihosting_get_field(target, 0, fields);
|
||||||
size_t len = semihosting_get_field(target, 1, fields);
|
size_t len = semihosting_get_field(target, 1, fields);
|
||||||
if (semihosting->is_fileio) {
|
if (semihosting->is_fileio) {
|
||||||
@@ -1314,12 +1311,10 @@ int semihosting_common(struct target *target)
|
|||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
free(cmd);
|
free(cmd);
|
||||||
return retval;
|
return retval;
|
||||||
} else {
|
|
||||||
cmd[len] = 0;
|
|
||||||
semihosting->result = system(
|
|
||||||
(const char *)cmd);
|
|
||||||
LOG_DEBUG("system('%s')=%" PRId64, cmd, semihosting->result);
|
|
||||||
}
|
}
|
||||||
|
cmd[len] = 0;
|
||||||
|
semihosting->result = system((const char *)cmd);
|
||||||
|
LOG_DEBUG("system('%s')=%" PRId64, cmd, semihosting->result);
|
||||||
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
@@ -1374,7 +1369,8 @@ int semihosting_common(struct target *target)
|
|||||||
retval = semihosting_read_fields(target, 3, fields);
|
retval = semihosting_read_fields(target, 3, fields);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
else {
|
|
||||||
|
{
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
uint64_t addr = semihosting_get_field(target, 1, fields);
|
uint64_t addr = semihosting_get_field(target, 1, fields);
|
||||||
size_t len = semihosting_get_field(target, 2, fields);
|
size_t len = semihosting_get_field(target, 2, fields);
|
||||||
@@ -1634,7 +1630,7 @@ int semihosting_common(struct target *target)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "semihosting: unsupported call %#x\n",
|
fprintf(stderr, "semihosting: unsupported call %#x\n",
|
||||||
(unsigned) semihosting->op);
|
(unsigned int)semihosting->op);
|
||||||
semihosting->result = -1;
|
semihosting->result = -1;
|
||||||
semihosting->sys_errno = ENOTSUP;
|
semihosting->sys_errno = ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1208,15 +1208,13 @@ static int set_watchpoint(struct target *t, struct watchpoint *wp)
|
|||||||
switch (wp->rw) {
|
switch (wp->rw) {
|
||||||
case WPT_WRITE:
|
case WPT_WRITE:
|
||||||
if (set_debug_regs(t, wp->address, wp_num,
|
if (set_debug_regs(t, wp->address, wp_num,
|
||||||
DR7_BP_WRITE, wp->length) != ERROR_OK) {
|
DR7_BP_WRITE, wp->length) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WPT_ACCESS:
|
case WPT_ACCESS:
|
||||||
if (set_debug_regs(t, wp->address, wp_num, DR7_BP_READWRITE,
|
if (set_debug_regs(t, wp->address, wp_num, DR7_BP_READWRITE,
|
||||||
wp->length) != ERROR_OK) {
|
wp->length) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("%s only 'access' or 'write' watchpoints are supported", __func__);
|
LOG_ERROR("%s only 'access' or 'write' watchpoints are supported", __func__);
|
||||||
|
|||||||
@@ -2708,7 +2708,7 @@ static int xscale_analyze_trace(struct target *target, struct command_invocation
|
|||||||
|
|
||||||
case 13: /* Checkpointed Indirect Branch */
|
case 13: /* Checkpointed Indirect Branch */
|
||||||
xscale_branch_address(trace_data, i, &branch_target);
|
xscale_branch_address(trace_data, i, &branch_target);
|
||||||
if ((trace_data->num_checkpoints == 2) && (chkpt == 0))
|
if (trace_data->num_checkpoints == 2 && chkpt == 0)
|
||||||
chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is
|
chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is
|
||||||
*oldest */
|
*oldest */
|
||||||
else
|
else
|
||||||
@@ -2719,7 +2719,7 @@ static int xscale_analyze_trace(struct target *target, struct command_invocation
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 12: /* Checkpointed Direct Branch */
|
case 12: /* Checkpointed Direct Branch */
|
||||||
if ((trace_data->num_checkpoints == 2) && (chkpt == 0))
|
if (trace_data->num_checkpoints == 2 && chkpt == 0)
|
||||||
chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is
|
chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is
|
||||||
*oldest */
|
*oldest */
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user