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 <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9070 Tested-by: jenkins
This commit is contained in:
@@ -69,7 +69,7 @@ extern struct command_context *global_cmd_ctx;
|
|||||||
* Do nothing in case we are not at debug level 3 */
|
* 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)
|
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;
|
return;
|
||||||
|
|
||||||
char *dbg = alloc_printf("command -");
|
char *dbg = alloc_printf("command -");
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ static void log_puts(enum log_levels level,
|
|||||||
if (f)
|
if (f)
|
||||||
file = f + 1;
|
file = f + 1;
|
||||||
|
|
||||||
if (debug_level >= LOG_LVL_DEBUG) {
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||||
/* print with count and time information */
|
/* print with count and time information */
|
||||||
int64_t t = timeval_ms() - start;
|
int64_t t = timeval_ms() - start;
|
||||||
#ifdef _DEBUG_FREE_SPACE_
|
#ifdef _DEBUG_FREE_SPACE_
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ extern int debug_level;
|
|||||||
|
|
||||||
#define LOG_DEBUG_IO(expr ...) \
|
#define LOG_DEBUG_IO(expr ...) \
|
||||||
do { \
|
do { \
|
||||||
if (debug_level >= LOG_LVL_DEBUG_IO) \
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \
|
||||||
log_printf_lf(LOG_LVL_DEBUG, \
|
log_printf_lf(LOG_LVL_DEBUG, \
|
||||||
__FILE__, __LINE__, __func__, \
|
__FILE__, __LINE__, __func__, \
|
||||||
expr); \
|
expr); \
|
||||||
@@ -109,7 +109,7 @@ extern int debug_level;
|
|||||||
|
|
||||||
#define LOG_DEBUG(expr ...) \
|
#define LOG_DEBUG(expr ...) \
|
||||||
do { \
|
do { \
|
||||||
if (debug_level >= LOG_LVL_DEBUG) \
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) \
|
||||||
log_printf_lf(LOG_LVL_DEBUG, \
|
log_printf_lf(LOG_LVL_DEBUG, \
|
||||||
__FILE__, __LINE__, __func__, \
|
__FILE__, __LINE__, __func__, \
|
||||||
expr); \
|
expr); \
|
||||||
@@ -118,7 +118,7 @@ extern int debug_level;
|
|||||||
#define LOG_CUSTOM_LEVEL(level, expr ...) \
|
#define LOG_CUSTOM_LEVEL(level, expr ...) \
|
||||||
do { \
|
do { \
|
||||||
enum log_levels _level = level; \
|
enum log_levels _level = level; \
|
||||||
if (debug_level >= _level) \
|
if (LOG_LEVEL_IS(_level)) \
|
||||||
log_printf_lf(_level, \
|
log_printf_lf(_level, \
|
||||||
__FILE__, __LINE__, __func__, \
|
__FILE__, __LINE__, __func__, \
|
||||||
expr); \
|
expr); \
|
||||||
|
|||||||
@@ -967,7 +967,7 @@ int default_interface_jtag_execute_queue(void)
|
|||||||
struct jtag_command *cmd = jtag_command_queue_get();
|
struct jtag_command *cmd = jtag_command_queue_get();
|
||||||
int result = adapter_driver->jtag_ops->execute_queue(cmd);
|
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) {
|
switch (cmd->type) {
|
||||||
case JTAG_SCAN:
|
case JTAG_SCAN:
|
||||||
LOG_DEBUG_IO("JTAG %s SCAN to %s",
|
LOG_DEBUG_IO("JTAG %s SCAN to %s",
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ static int ecos_check_app_info(struct rtos *rtos, struct ecos_params *param)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (param->flush_common) {
|
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++) {
|
for (unsigned int idx = 0; idx < ARRAY_SIZE(ecos_symbol_list); idx++) {
|
||||||
LOG_DEBUG("eCos: %s 0x%016" PRIX64 " %s",
|
LOG_DEBUG("eCos: %s 0x%016" PRIX64 " %s",
|
||||||
rtos->symbols[idx].optional ? "OPTIONAL" : " ",
|
rtos->symbols[idx].optional ? "OPTIONAL" : " ",
|
||||||
|
|||||||
@@ -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)");
|
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 */
|
/* for convenient debugging, execute tap if possible */
|
||||||
if ((svf_buffer_index > 0) &&
|
if ((svf_buffer_index > 0) &&
|
||||||
(((command != STATE) && (command != RUNTEST)) ||
|
(((command != STATE) && (command != RUNTEST)) ||
|
||||||
|
|||||||
@@ -769,7 +769,7 @@ static int arc_exit_debug(struct target *target)
|
|||||||
target->state = TARGET_HALTED;
|
target->state = TARGET_HALTED;
|
||||||
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_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);
|
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));
|
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);
|
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));
|
CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
|
||||||
|
|
||||||
/* some more debug information */
|
/* 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);
|
LOG_TARGET_DEBUG(target, "core stopped (halted) DEGUB-REG: 0x%08" PRIx32, value);
|
||||||
CHECK_RETVAL(arc_get_register_value(target, "status32", &value));
|
CHECK_RETVAL(arc_get_register_value(target, "status32", &value));
|
||||||
LOG_TARGET_DEBUG(target, "core STATUS32: 0x%08" PRIx32, 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;
|
uint32_t pc_value;
|
||||||
|
|
||||||
if (debug_level < LOG_LVL_DEBUG)
|
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
CHECK_RETVAL(arc_get_register_value(target, "pc", &pc_value));
|
CHECK_RETVAL(arc_get_register_value(target, "pc", &pc_value));
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ static int arm720t_soft_reset_halt(struct target *target)
|
|||||||
return retval;
|
return retval;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
if (debug_level >= 3)
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
|
||||||
alive_sleep(100);
|
alive_sleep(100);
|
||||||
else
|
else
|
||||||
keep_alive();
|
keep_alive();
|
||||||
|
|||||||
@@ -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))
|
if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1))
|
||||||
&& (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_SYSCOMP, 1)))
|
&& (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_SYSCOMP, 1)))
|
||||||
break;
|
break;
|
||||||
if (debug_level >= 3)
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
|
||||||
alive_sleep(100);
|
alive_sleep(100);
|
||||||
else
|
else
|
||||||
keep_alive();
|
keep_alive();
|
||||||
@@ -1088,7 +1088,7 @@ int arm7_9_soft_reset_halt(struct target *target)
|
|||||||
retval = jtag_execute_queue();
|
retval = jtag_execute_queue();
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (debug_level >= 3)
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG))
|
||||||
alive_sleep(100);
|
alive_sleep(100);
|
||||||
else
|
else
|
||||||
keep_alive();
|
keep_alive();
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ int arm920t_soft_reset_halt(struct target *target)
|
|||||||
return retval;
|
return retval;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
if (debug_level >= 3) {
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||||
/* do not eat all CPU, time out after 1 se*/
|
/* do not eat all CPU, time out after 1 se*/
|
||||||
alive_sleep(100);
|
alive_sleep(100);
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ int arm926ejs_soft_reset_halt(struct target *target)
|
|||||||
return retval;
|
return retval;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
if (debug_level >= 1) {
|
if (LOG_LEVEL_IS(LOG_LVL_WARNING)) {
|
||||||
/* do not eat all CPU, time out after 1 se*/
|
/* do not eat all CPU, time out after 1 se*/
|
||||||
alive_sleep(100);
|
alive_sleep(100);
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ static int xscale_read_tx(struct target *target, int consume)
|
|||||||
}
|
}
|
||||||
if (!((!(field0_in & 1)) && consume))
|
if (!((!(field0_in & 1)) && consume))
|
||||||
goto done;
|
goto done;
|
||||||
if (debug_level >= 3) {
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||||
LOG_DEBUG("waiting 100ms");
|
LOG_DEBUG("waiting 100ms");
|
||||||
alive_sleep(100); /* avoid flooding the logs */
|
alive_sleep(100); /* avoid flooding the logs */
|
||||||
} else
|
} else
|
||||||
@@ -471,7 +471,7 @@ static int xscale_write_rx(struct target *target)
|
|||||||
}
|
}
|
||||||
if (!(field0_in & 1))
|
if (!(field0_in & 1))
|
||||||
goto done;
|
goto done;
|
||||||
if (debug_level >= 3) {
|
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||||
LOG_DEBUG("waiting 100ms");
|
LOG_DEBUG("waiting 100ms");
|
||||||
alive_sleep(100); /* avoid flooding the logs */
|
alive_sleep(100); /* avoid flooding the logs */
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user