Skip to content

Commit 557a208

Browse files
committed
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 <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/9070 Tested-by: jenkins
1 parent 3fd9759 commit 557a208

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

src/helper/command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern struct command_context *global_cmd_ctx;
6969
* Do nothing in case we are not at debug level 3 */
7070
static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv)
7171
{
72-
if (debug_level < LOG_LVL_DEBUG)
72+
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
7373
return;
7474

7575
char *dbg = alloc_printf("command -");

src/helper/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void log_puts(enum log_levels level,
113113
if (f)
114114
file = f + 1;
115115

116-
if (debug_level >= LOG_LVL_DEBUG) {
116+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
117117
/* print with count and time information */
118118
int64_t t = timeval_ms() - start;
119119
#ifdef _DEBUG_FREE_SPACE_

src/helper/log.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ extern int debug_level;
101101

102102
#define LOG_DEBUG_IO(expr ...) \
103103
do { \
104-
if (debug_level >= LOG_LVL_DEBUG_IO) \
104+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \
105105
log_printf_lf(LOG_LVL_DEBUG, \
106106
__FILE__, __LINE__, __func__, \
107107
expr); \
108108
} while (0)
109109

110110
#define LOG_DEBUG(expr ...) \
111111
do { \
112-
if (debug_level >= LOG_LVL_DEBUG) \
112+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) \
113113
log_printf_lf(LOG_LVL_DEBUG, \
114114
__FILE__, __LINE__, __func__, \
115115
expr); \
@@ -118,7 +118,7 @@ extern int debug_level;
118118
#define LOG_CUSTOM_LEVEL(level, expr ...) \
119119
do { \
120120
enum log_levels _level = level; \
121-
if (debug_level >= _level) \
121+
if (LOG_LEVEL_IS(_level)) \
122122
log_printf_lf(_level, \
123123
__FILE__, __LINE__, __func__, \
124124
expr); \

src/jtag/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ int default_interface_jtag_execute_queue(void)
967967
struct jtag_command *cmd = jtag_command_queue_get();
968968
int result = adapter_driver->jtag_ops->execute_queue(cmd);
969969

970-
while (debug_level >= LOG_LVL_DEBUG_IO && cmd) {
970+
while (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO) && cmd) {
971971
switch (cmd->type) {
972972
case JTAG_SCAN:
973973
LOG_DEBUG_IO("JTAG %s SCAN to %s",

src/rtos/ecos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ static int ecos_check_app_info(struct rtos *rtos, struct ecos_params *param)
539539
return -1;
540540

541541
if (param->flush_common) {
542-
if (debug_level >= LOG_LVL_DEBUG) {
542+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
543543
for (unsigned int idx = 0; idx < ARRAY_SIZE(ecos_symbol_list); idx++) {
544544
LOG_DEBUG("eCos: %s 0x%016" PRIX64 " %s",
545545
rtos->symbols[idx].optional ? "OPTIONAL" : " ",

src/svf/svf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
16201620
LOG_USER("(Above Padding command skipped, as per -tap argument)");
16211621
}
16221622

1623-
if (debug_level >= LOG_LVL_DEBUG) {
1623+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
16241624
/* for convenient debugging, execute tap if possible */
16251625
if ((svf_buffer_index > 0) &&
16261626
(((command != STATE) && (command != RUNTEST)) ||

src/target/arc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ static int arc_exit_debug(struct target *target)
769769
target->state = TARGET_HALTED;
770770
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
771771

772-
if (debug_level >= LOG_LVL_DEBUG) {
772+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
773773
LOG_TARGET_DEBUG(target, "core stopped (halted) debug-reg: 0x%08" PRIx32, value);
774774
CHECK_RETVAL(arc_jtag_read_aux_reg_one(&arc->jtag_info, AUX_STATUS32_REG, &value));
775775
LOG_TARGET_DEBUG(target, "core STATUS32: 0x%08" PRIx32, value);
@@ -824,7 +824,7 @@ static int arc_halt(struct target *target)
824824
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
825825

826826
/* some more debug information */
827-
if (debug_level >= LOG_LVL_DEBUG) {
827+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
828828
LOG_TARGET_DEBUG(target, "core stopped (halted) DEGUB-REG: 0x%08" PRIx32, value);
829829
CHECK_RETVAL(arc_get_register_value(target, "status32", &value));
830830
LOG_TARGET_DEBUG(target, "core STATUS32: 0x%08" PRIx32, value);
@@ -1148,7 +1148,7 @@ static int arc_arch_state(struct target *target)
11481148
{
11491149
uint32_t pc_value;
11501150

1151-
if (debug_level < LOG_LVL_DEBUG)
1151+
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
11521152
return ERROR_OK;
11531153

11541154
CHECK_RETVAL(arc_get_register_value(target, "pc", &pc_value));

src/target/arm720t.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static int arm720t_soft_reset_halt(struct target *target)
323323
return retval;
324324
} else
325325
break;
326-
if (debug_level >= 3)
326+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
327327
alive_sleep(100);
328328
else
329329
keep_alive();

src/target/arm7_9_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ int arm7_9_execute_sys_speed(struct target *target)
637637
if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1))
638638
&& (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_SYSCOMP, 1)))
639639
break;
640-
if (debug_level >= 3)
640+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
641641
alive_sleep(100);
642642
else
643643
keep_alive();
@@ -1088,7 +1088,7 @@ int arm7_9_soft_reset_halt(struct target *target)
10881088
retval = jtag_execute_queue();
10891089
if (retval != ERROR_OK)
10901090
return retval;
1091-
if (debug_level >= 3)
1091+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
10921092
alive_sleep(100);
10931093
else
10941094
keep_alive();

src/target/arm920t.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ int arm920t_soft_reset_halt(struct target *target)
746746
return retval;
747747
} else
748748
break;
749-
if (debug_level >= 3) {
749+
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
750750
/* do not eat all CPU, time out after 1 se*/
751751
alive_sleep(100);
752752
} else

0 commit comments

Comments
 (0)