target: Use 'bool' data type in target_{step,resume}

While at it, adapt data types of related functions and fix some coding
style issues.

Change-Id: I74db9258fc17b1ee8aa446f35ae722ea7c2f67e6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8524
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marc Schink
2024-10-10 17:07:20 +02:00
committed by Antonio Borneo
parent f63b41bbe4
commit 297844cf46
44 changed files with 303 additions and 285 deletions

View File

@@ -1192,7 +1192,7 @@ static int full_step(struct target *target, bool announce)
return ERROR_OK;
}
static int resume(struct target *target, int debug_execution, bool step)
static int resume(struct target *target, bool debug_execution, bool step)
{
if (debug_execution) {
LOG_ERROR("TODO: debug_execution is true");
@@ -1439,8 +1439,8 @@ static int strict_step(struct target *target, bool announce)
return ERROR_OK;
}
static int step(struct target *target, int current, target_addr_t address,
int handle_breakpoints)
static int step(struct target *target, bool current, target_addr_t address,
bool handle_breakpoints)
{
jtag_add_ir_scan(target->tap, &select_dbus, TAP_IDLE);
@@ -1929,8 +1929,9 @@ static int riscv011_poll(struct target *target)
return poll_target(target, true);
}
static int riscv011_resume(struct target *target, int current,
target_addr_t address, int handle_breakpoints, int debug_execution)
static int riscv011_resume(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints,
bool debug_execution)
{
RISCV_INFO(r);
jtag_add_ir_scan(target->tap, &select_dbus, TAP_IDLE);

View File

@@ -1096,16 +1096,15 @@ static int riscv_hit_watchpoint(struct target *target, struct watchpoint **hit_w
return ERROR_FAIL;
}
static int oldriscv_step(struct target *target, int current, uint32_t address,
int handle_breakpoints)
static int oldriscv_step(struct target *target, bool current, uint32_t address,
bool handle_breakpoints)
{
struct target_type *tt = get_target_type(target);
return tt->step(target, current, address, handle_breakpoints);
}
static int old_or_new_riscv_step(struct target *target, int current,
target_addr_t address, int handle_breakpoints)
static int old_or_new_riscv_step(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints)
{
RISCV_INFO(r);
LOG_DEBUG("handle_breakpoints=%d", handle_breakpoints);
@@ -1115,7 +1114,6 @@ static int old_or_new_riscv_step(struct target *target, int current,
return riscv_openocd_step(target, current, address, handle_breakpoints);
}
static int riscv_examine(struct target *target)
{
LOG_DEBUG("riscv_examine()");
@@ -1395,8 +1393,8 @@ static int enable_triggers(struct target *target, riscv_reg_t *state)
/**
* Get everything ready to resume.
*/
static int resume_prep(struct target *target, int current,
target_addr_t address, int handle_breakpoints, int debug_execution)
static int resume_prep(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints, bool debug_execution)
{
RISCV_INFO(r);
LOG_DEBUG("[%d]", target->coreid);
@@ -1434,8 +1432,8 @@ static int resume_prep(struct target *target, int current,
* Resume all the harts that have been prepped, as close to instantaneous as
* possible.
*/
static int resume_go(struct target *target, int current,
target_addr_t address, int handle_breakpoints, int debug_execution)
static int resume_go(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints, bool debug_execution)
{
RISCV_INFO(r);
int result;
@@ -1465,10 +1463,10 @@ static int resume_finish(struct target *target)
*/
static int riscv_resume(
struct target *target,
int current,
bool current,
target_addr_t address,
int handle_breakpoints,
int debug_execution,
bool handle_breakpoints,
bool debug_execution,
bool single_hart)
{
LOG_DEBUG("handle_breakpoints=%d", handle_breakpoints);
@@ -1515,8 +1513,8 @@ static int riscv_resume(
return result;
}
static int riscv_target_resume(struct target *target, int current, target_addr_t address,
int handle_breakpoints, int debug_execution)
static int riscv_target_resume(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints, bool debug_execution)
{
return riscv_resume(target, current, address, handle_breakpoints,
debug_execution, false);
@@ -1904,7 +1902,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params,
/* Run algorithm */
LOG_DEBUG("resume at 0x%" TARGET_PRIxADDR, entry_point);
if (riscv_resume(target, 0, entry_point, 0, 0, true) != ERROR_OK)
if (riscv_resume(target, false, entry_point, false, false, true) != ERROR_OK)
return ERROR_FAIL;
int64_t start = timeval_ms();
@@ -2245,7 +2243,7 @@ int riscv_openocd_poll(struct target *target)
riscv_halt(target);
} else if (should_resume) {
LOG_DEBUG("resume all");
riscv_resume(target, true, 0, 0, 0, false);
riscv_resume(target, true, 0, false, false, false);
}
/* Sample memory if any target is running. */
@@ -2287,7 +2285,7 @@ int riscv_openocd_poll(struct target *target)
target_call_event_callbacks(target, TARGET_EVENT_HALTED);
break;
case SEMIHOSTING_HANDLED:
if (riscv_resume(target, true, 0, 0, 0, false) != ERROR_OK)
if (riscv_resume(target, true, 0, false, false, false) != ERROR_OK)
return ERROR_FAIL;
break;
case SEMIHOSTING_ERROR:
@@ -2300,8 +2298,8 @@ int riscv_openocd_poll(struct target *target)
return ERROR_OK;
}
int riscv_openocd_step(struct target *target, int current,
target_addr_t address, int handle_breakpoints)
int riscv_openocd_step(struct target *target, bool current,
target_addr_t address, bool handle_breakpoints)
{
LOG_DEBUG("stepping rtos hart");

View File

@@ -294,9 +294,9 @@ int riscv_halt(struct target *target);
int riscv_openocd_step(
struct target *target,
int current,
bool current,
target_addr_t address,
int handle_breakpoints
bool handle_breakpoints
);
int riscv_openocd_assert_reset(struct target *target);