Fixed GDB timeout crash - regression introduced back when log_add/remove_callback was added.

git-svn-id: svn://svn.berlios.de/openocd/trunk@442 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2008-03-04 13:13:55 +00:00
parent 5a6dc5a325
commit f955b90d28
3 changed files with 7 additions and 7 deletions

View File

@ -60,8 +60,6 @@ static int count = 0;
*/ */
static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string) static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string)
{ {
log_callback_t *cb;
if (level == LOG_OUTPUT) if (level == LOG_OUTPUT)
{ {
/* do not prepend any headers, just print out what we were given and return */ /* do not prepend any headers, just print out what we were given and return */
@ -98,10 +96,14 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
/* Never forward LOG_DEBUG, too verbose and they can be found in the log if need be */ /* Never forward LOG_DEBUG, too verbose and they can be found in the log if need be */
if (level <= LOG_INFO) if (level <= LOG_INFO)
{ {
log_callback_t *cb; log_callback_t *cb, *next;
for (cb = log_callbacks; cb; cb = cb->next) cb = log_callbacks;
/* DANGER!!!! the log callback can remove itself!!!! */
while (cb)
{ {
next=cb->next;
cb->fn(cb->priv, file, line, function, string); cb->fn(cb->priv, file, line, function, string);
cb=next;
} }
} }
} }

View File

@ -529,7 +529,7 @@ int gdb_output_con(connection_t *connection, const char* line)
int gdb_output(struct command_context_s *context, char* line) int gdb_output(struct command_context_s *context, char* line)
{ {
/* this will be dumped to the log and also sent as an O packet if possible */ /* this will be dumped to the log and also sent as an O packet if possible */
USER_N(line); USER_N("%s", line);
return ERROR_OK; return ERROR_OK;
} }

View File

@ -1698,8 +1698,6 @@ int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **a
target_process_events(cmd_ctx); target_process_events(cmd_ctx);
target_arch_state(target);
return retval; return retval;
} }