|
From: openocd-gerrit <ope...@us...> - 2025-10-18 08:37:48
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 557a2082b1b41b288a9acd0400a6f5c75a8f47b7 (commit)
from 3fd975941537346c7a3c37aecc944b30305a8e1e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 557a2082b1b41b288a9acd0400a6f5c75a8f47b7
Author: Antonio Borneo <bor...@gm...>
Date: Mon Aug 4 17:42:22 2025 +0200
openocd: don't test 'debug_level' directly
Use the macro 'LOG_LEVEL_IS()' to test 'debug_level'.
While there, use the macro 'LOG_LVL_*' in place of the numeric
value.
Skip all riscv code, as it is going to be updated soon from the
external fork.
Change-Id: Icad7e879e040d3b9cf1cc004c433f28725017493
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9070
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index 9c29ceff8..4cce57f75 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -69,7 +69,7 @@ extern struct command_context *global_cmd_ctx;
* Do nothing in case we are not at debug level 3 */
static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv)
{
- if (debug_level < LOG_LVL_DEBUG)
+ if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
return;
char *dbg = alloc_printf("command -");
diff --git a/src/helper/log.c b/src/helper/log.c
index d8c4e09ac..2dada3540 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -113,7 +113,7 @@ static void log_puts(enum log_levels level,
if (f)
file = f + 1;
- if (debug_level >= LOG_LVL_DEBUG) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
/* print with count and time information */
int64_t t = timeval_ms() - start;
#ifdef _DEBUG_FREE_SPACE_
diff --git a/src/helper/log.h b/src/helper/log.h
index ac24f8e83..474d082ed 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -101,7 +101,7 @@ extern int debug_level;
#define LOG_DEBUG_IO(expr ...) \
do { \
- if (debug_level >= LOG_LVL_DEBUG_IO) \
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \
log_printf_lf(LOG_LVL_DEBUG, \
__FILE__, __LINE__, __func__, \
expr); \
@@ -109,7 +109,7 @@ extern int debug_level;
#define LOG_DEBUG(expr ...) \
do { \
- if (debug_level >= LOG_LVL_DEBUG) \
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) \
log_printf_lf(LOG_LVL_DEBUG, \
__FILE__, __LINE__, __func__, \
expr); \
@@ -118,7 +118,7 @@ extern int debug_level;
#define LOG_CUSTOM_LEVEL(level, expr ...) \
do { \
enum log_levels _level = level; \
- if (debug_level >= _level) \
+ if (LOG_LEVEL_IS(_level)) \
log_printf_lf(_level, \
__FILE__, __LINE__, __func__, \
expr); \
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 479d2efe5..3261e6079 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -967,7 +967,7 @@ int default_interface_jtag_execute_queue(void)
struct jtag_command *cmd = jtag_command_queue_get();
int result = adapter_driver->jtag_ops->execute_queue(cmd);
- while (debug_level >= LOG_LVL_DEBUG_IO && cmd) {
+ while (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO) && cmd) {
switch (cmd->type) {
case JTAG_SCAN:
LOG_DEBUG_IO("JTAG %s SCAN to %s",
diff --git a/src/rtos/ecos.c b/src/rtos/ecos.c
index 7b993c6f2..41159bf09 100644
--- a/src/rtos/ecos.c
+++ b/src/rtos/ecos.c
@@ -539,7 +539,7 @@ static int ecos_check_app_info(struct rtos *rtos, struct ecos_params *param)
return -1;
if (param->flush_common) {
- if (debug_level >= LOG_LVL_DEBUG) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
for (unsigned int idx = 0; idx < ARRAY_SIZE(ecos_symbol_list); idx++) {
LOG_DEBUG("eCos: %s 0x%016" PRIX64 " %s",
rtos->symbols[idx].optional ? "OPTIONAL" : " ",
diff --git a/src/svf/svf.c b/src/svf/svf.c
index 001ffa263..7491ad651 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -1620,7 +1620,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
LOG_USER("(Above Padding command skipped, as per -tap argument)");
}
- if (debug_level >= LOG_LVL_DEBUG) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
/* for convenient debugging, execute tap if possible */
if ((svf_buffer_index > 0) &&
(((command != STATE) && (command != RUNTEST)) ||
diff --git a/src/target/arc.c b/src/target/arc.c
index 638e22099..629f79aa0 100644
--- a/src/target/arc.c
+++ b/src/target/arc.c
@@ -769,7 +769,7 @@ static int arc_exit_debug(struct target *target)
target->state = TARGET_HALTED;
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
- if (debug_level >= LOG_LVL_DEBUG) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
LOG_TARGET_DEBUG(target, "core stopped (halted) debug-reg: 0x%08" PRIx32, value);
CHECK_RETVAL(arc_jtag_read_aux_reg_one(&arc->jtag_info, AUX_STATUS32_REG, &value));
LOG_TARGET_DEBUG(target, "core STATUS32: 0x%08" PRIx32, value);
@@ -824,7 +824,7 @@ static int arc_halt(struct target *target)
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
/* some more debug information */
- if (debug_level >= LOG_LVL_DEBUG) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
LOG_TARGET_DEBUG(target, "core stopped (halted) DEGUB-REG: 0x%08" PRIx32, value);
CHECK_RETVAL(arc_get_register_value(target, "status32", &value));
LOG_TARGET_DEBUG(target, "core STATUS32: 0x%08" PRIx32, value);
@@ -1148,7 +1148,7 @@ static int arc_arch_state(struct target *target)
{
uint32_t pc_value;
- if (debug_level < LOG_LVL_DEBUG)
+ if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
return ERROR_OK;
CHECK_RETVAL(arc_get_register_value(target, "pc", &pc_value));
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 7098aa472..3f7686fb7 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -323,7 +323,7 @@ static int arm720t_soft_reset_halt(struct target *target)
return retval;
} else
break;
- if (debug_level >= 3)
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
alive_sleep(100);
else
keep_alive();
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c
index c4bedcd85..06e76ac0d 100644
--- a/src/target/arm7_9_common.c
+++ b/src/target/arm7_9_common.c
@@ -637,7 +637,7 @@ int arm7_9_execute_sys_speed(struct target *target)
if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1))
&& (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_SYSCOMP, 1)))
break;
- if (debug_level >= 3)
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
alive_sleep(100);
else
keep_alive();
@@ -1088,7 +1088,7 @@ int arm7_9_soft_reset_halt(struct target *target)
retval = jtag_execute_queue();
if (retval != ERROR_OK)
return retval;
- if (debug_level >= 3)
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
alive_sleep(100);
else
keep_alive();
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 67c212e0b..441e42305 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -746,7 +746,7 @@ int arm920t_soft_reset_halt(struct target *target)
return retval;
} else
break;
- if (debug_level >= 3) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
/* do not eat all CPU, time out after 1 se*/
alive_sleep(100);
} else
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index 0b77981ae..98fe6bf68 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -544,7 +544,7 @@ int arm926ejs_soft_reset_halt(struct target *target)
return retval;
} else
break;
- if (debug_level >= 1) {
+ if (LOG_LEVEL_IS(LOG_LVL_WARNING)) {
/* do not eat all CPU, time out after 1 se*/
alive_sleep(100);
} else
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 613c8d20a..712db4ee2 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -400,7 +400,7 @@ static int xscale_read_tx(struct target *target, int consume)
}
if (!((!(field0_in & 1)) && consume))
goto done;
- if (debug_level >= 3) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
LOG_DEBUG("waiting 100ms");
alive_sleep(100); /* avoid flooding the logs */
} else
@@ -471,7 +471,7 @@ static int xscale_write_rx(struct target *target)
}
if (!(field0_in & 1))
goto done;
- if (debug_level >= 3) {
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
LOG_DEBUG("waiting 100ms");
alive_sleep(100); /* avoid flooding the logs */
} else
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 2 +-
src/helper/log.c | 2 +-
src/helper/log.h | 6 +++---
src/jtag/core.c | 2 +-
src/rtos/ecos.c | 2 +-
src/svf/svf.c | 2 +-
src/target/arc.c | 6 +++---
src/target/arm720t.c | 2 +-
src/target/arm7_9_common.c | 4 ++--
src/target/arm920t.c | 2 +-
src/target/arm926ejs.c | 2 +-
src/target/xscale.c | 4 ++--
12 files changed, 18 insertions(+), 18 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|