Commit 09bb0732 authored by oharboe's avatar oharboe
Browse files

GDB monitor commands now also get halted state upon e.g. "reset halt".

git-svn-id: svn://svn.berlios.de/openocd/trunk@892 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 0ca1eb28
...@@ -74,6 +74,22 @@ void exit_handler(void) ...@@ -74,6 +74,22 @@ void exit_handler(void)
jtag->quit(); jtag->quit();
} }
static int log_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv)
{
switch (event)
{
case TARGET_EVENT_HALTED:
target_arch_state(target);
break;
default:
break;
}
return ERROR_OK;
}
/* OpenOCD can't really handle failure of this command. Patches welcome! :-) */ /* OpenOCD can't really handle failure of this command. Patches welcome! :-) */
int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{ {
...@@ -128,6 +144,10 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg ...@@ -128,6 +144,10 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
gdb_init(); gdb_init();
tcl_init(); /* allows tcl to just connect without going thru telnet */ tcl_init(); /* allows tcl to just connect without going thru telnet */
target_register_event_callback(log_target_callback_event_handler, cmd_ctx);
return ERROR_OK; return ERROR_OK;
} }
......
...@@ -144,20 +144,6 @@ void telnet_log_callback(void *priv, const char *file, int line, ...@@ -144,20 +144,6 @@ void telnet_log_callback(void *priv, const char *file, int line,
telnet_write(connection, "\b", 1); telnet_write(connection, "\b", 1);
} }
int telnet_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv)
{
switch (event)
{
case TARGET_EVENT_HALTED:
target_arch_state(target);
break;
default:
break;
}
return ERROR_OK;
}
int telnet_new_connection(connection_t *connection) int telnet_new_connection(connection_t *connection)
{ {
telnet_connection_t *telnet_connection = malloc(sizeof(telnet_connection_t)); telnet_connection_t *telnet_connection = malloc(sizeof(telnet_connection_t));
...@@ -197,8 +183,6 @@ int telnet_new_connection(connection_t *connection) ...@@ -197,8 +183,6 @@ int telnet_new_connection(connection_t *connection)
telnet_connection->next_history = 0; telnet_connection->next_history = 0;
telnet_connection->current_history = 0; telnet_connection->current_history = 0;
target_register_event_callback(telnet_target_callback_event_handler, connection->cmd_ctx);
log_add_callback(telnet_log_callback, connection); log_add_callback(telnet_log_callback, connection);
...@@ -601,8 +585,6 @@ int telnet_connection_closed(connection_t *connection) ...@@ -601,8 +585,6 @@ int telnet_connection_closed(connection_t *connection)
LOG_ERROR("BUG: connection->priv == NULL"); LOG_ERROR("BUG: connection->priv == NULL");
} }
target_unregister_event_callback(telnet_target_callback_event_handler, connection->cmd_ctx);
return ERROR_OK; return ERROR_OK;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment