return ERROR_OK;
}
-int gdb_output(struct command_context_s *context, char* line)
+int gdb_output(struct command_context_s *context, const char* line)
{
/* this will be dumped to the log and also sent as an O packet if possible */
LOG_USER_N("%s", line);
int gdb_program_handler(struct target_s *target, enum target_event event, void *priv)
{
- FILE *script;
struct command_context_s *cmd_ctx = priv;
- if (target->gdb_program_script)
- {
- script = open_file_from_path(target->gdb_program_script, "r");
- if (!script)
- {
- LOG_ERROR("couldn't open script file %s", target->gdb_program_script);
- return ERROR_OK;
- }
-
- LOG_INFO("executing gdb_program script '%s'", target->gdb_program_script);
- command_run_file(cmd_ctx, script, COMMAND_EXEC);
- fclose(script);
-
- jtag_execute_queue();
- }
+ target_invoke_script(cmd_ctx, target, "gdb_program");
+ jtag_execute_queue();
return ERROR_OK;
}
if (packet[0] == 'c')
{
LOG_DEBUG("continue");
+ target_invoke_script(connection->cmd_ctx, target, "pre_resume");
target_resume(target, current, address, 0, 0); /* resume at current address, don't handle breakpoints, not debugging */
}
else if (packet[0] == 's')
switch( detach_mode )
{
case GDB_DETACH_RESUME:
+ target_invoke_script(connection->cmd_ctx, target, "pre_resume");
target_resume(target, 1, 0, 1, 0);
break;
case GDB_DETACH_RESET:
- target_process_reset(connection->cmd_ctx);
+ /* FIX?? make this configurable?? */
+ target_process_reset(connection->cmd_ctx, RESET_HALT);
break;
case GDB_DETACH_HALT:
gdb_output_con(connection, string);
}
+/* Do not allocate this on the stack */
+char gdb_packet_buffer[GDB_BUFFER_SIZE];
+
int gdb_input_inner(connection_t *connection)
{
gdb_service_t *gdb_service = connection->service->priv;
target_t *target = gdb_service->target;
- char packet[GDB_BUFFER_SIZE];
+ char *packet=gdb_packet_buffer;
int packet_size;
int retval;
gdb_connection_t *gdb_con = connection->priv;
break;
case 'R':
/* handle extended restart packet */
- target_process_reset(connection->cmd_ctx);
+ /* fix?? make this configurable? */
+ target_process_reset(connection->cmd_ctx, RESET_HALT);
break;
default:
/* ignore unkown packets */