From: <ge...@op...> - 2025-08-04 16:09:57
|
This is an automated email from Gerrit. "Antonio Borneo <bor...@gm...>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9071 -- gerrit commit 5933039469b5605478ff294dd3697adeef9a776e Author: Antonio Borneo <bor...@gm...> Date: Mon Aug 4 17:40:39 2025 +0200 target: riscv: don't test 'debug_level' directly Use the macro 'LOG_LEVEL_IS()' to test 'debug_level'. Change-Id: Ic931fd2eff0fa97a7a315b4b276f85dfc5fc8d5f Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/riscv/batch.c b/src/target/riscv/batch.c index 56143808f0..5acbddaf37 100644 --- a/src/target/riscv/batch.c +++ b/src/target/riscv/batch.c @@ -204,7 +204,7 @@ static void log_batch(const struct riscv_batch *batch, size_t start_idx, const struct riscv_scan_delays *delays, bool resets_delays, size_t reset_delays_after) { - if (debug_level < LOG_LVL_DEBUG) + if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) return; const unsigned int abits = riscv_get_dmi_address_bits(batch->target); diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c index a84beb2a97..15c1c307d7 100644 --- a/src/target/riscv/riscv-011.c +++ b/src/target/riscv/riscv-011.c @@ -391,7 +391,7 @@ static void dump_field(const struct scan_field *field) static const char * const op_string[] = {"nop", "r", "w", "?"}; static const char * const status_string[] = {"+", "?", "F", "b"}; - if (debug_level < LOG_LVL_DEBUG) + if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) return; uint64_t out = buf_get_u64(field->out_value, 0, field->num_bits); @@ -1934,7 +1934,7 @@ static int poll_target(struct target *target, bool announce) /* Inhibit debug logging during poll(), which isn't usually interesting and * just fills up the screen/logs with clutter. */ int old_debug_level = debug_level; - if (debug_level >= LOG_LVL_DEBUG) + if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) debug_level = LOG_LVL_INFO; bits_t bits = { .haltnot = 0, diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index abb339aca5..b472e08ebc 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -368,7 +368,7 @@ static struct riscv_debug_reg_ctx get_riscv_debug_reg_ctx(const struct target *t static void log_debug_reg(struct target *target, enum riscv_debug_reg_ordinal reg, riscv_reg_t value, const char *file, unsigned int line, const char *func) { - if (debug_level < LOG_LVL_DEBUG) + if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) return; const struct riscv_debug_reg_ctx context = get_riscv_debug_reg_ctx(target); char * const buf = malloc(riscv_debug_reg_to_s(NULL, reg, context, value, RISCV_DEBUG_REG_HIDE_UNNAMED_0) + 1); @@ -735,7 +735,7 @@ int riscv013_execute_abstract_command(struct target *target, uint32_t command, { assert(cmderr); *cmderr = CMDERR_NONE; - if (debug_level >= LOG_LVL_DEBUG) { + if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) { switch (get_field(command, DM_COMMAND_CMDTYPE)) { case 0: LOG_DEBUG_REG(target, AC_ACCESS_REGISTER, command); @@ -3094,7 +3094,7 @@ static int execute_autofence(struct target *target) static void log_memory_access128(target_addr_t address, uint64_t value_h, uint64_t value_l, bool is_read) { - if (debug_level < LOG_LVL_DEBUG) + if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) return; char fmt[80]; @@ -3106,7 +3106,7 @@ static void log_memory_access128(target_addr_t address, uint64_t value_h, static void log_memory_access64(target_addr_t address, uint64_t value, unsigned int size_bytes, bool is_read) { - if (debug_level < LOG_LVL_DEBUG) + if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) return; char fmt[80]; -- |