]> git.sur5r.net Git - openocd/commitdiff
- fix pre_resume script not being called
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 8 Jul 2008 10:49:58 +0000 (10:49 +0000)
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 8 Jul 2008 10:49:58 +0000 (10:49 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@771 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/server/gdb_server.c
src/target/target.c
src/target/target.h

index 3ea1dde0f5a54f8fc30f53464a3785ef4fbcd144..850d0de3ab2223876afe9346ac26d215c851948b 100644 (file)
@@ -1219,6 +1219,7 @@ void gdb_step_continue_packet(connection_t *connection, target_t *target, char *
        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')
@@ -1801,6 +1802,7 @@ int gdb_detach(connection_t *connection, target_t *target)
        switch( detach_mode )
        {
                case GDB_DETACH_RESUME:
+                       target_invoke_script(connection->cmd_ctx, target, "pre_resume");
                        target_resume(target, 1, 0, 1, 0);
                        break;
 
index a37f56f7c4452d9bce3be1479c022f296ed5bdab..ce4f845424f68440e32fb5ced0368fa923942985 100644 (file)
@@ -49,7 +49,6 @@
 
 int cli_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv);
 
-
 int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
 int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
 
@@ -225,9 +224,7 @@ int target_init_handler(struct target_s *target, enum target_event event, void *
        if (event == TARGET_EVENT_HALTED)
        {
                target_unregister_event_callback(target_init_handler, priv);
-
                target_invoke_script(cmd_ctx, target, "post_reset");
-
                jtag_execute_queue();
        }
        
@@ -273,10 +270,10 @@ int target_resume(struct target_s *target, int current, u32 address, int handle_
                LOG_ERROR("Target not examined yet");
                return ERROR_FAIL;
        }
+       
        return target->type->resume(target, current, address, handle_breakpoints, debug_execution);
 }
 
-
 int target_process_reset(struct command_context_s *cmd_ctx)
 {
        int retval = ERROR_OK;
@@ -460,7 +457,6 @@ int target_process_reset(struct command_context_s *cmd_ctx)
                target = target->next;
        }
        target_unregister_event_callback(target_init_handler, cmd_ctx);
-                               
        
        jtag->speed(jtag_speed_post_reset);
        
@@ -783,7 +779,6 @@ int target_call_timer_callbacks_now()
        return target_call_timer_callbacks(0);
 }
 
-
 int target_alloc_working_area(struct target_s *target, u32 size, working_area_t **area)
 {
        working_area_t *c = target->working_areas;
@@ -1472,7 +1467,6 @@ int target_invoke_script(struct command_context_s *cmd_ctx, target_t *target, ch
        name, get_num_by_target(target));
 }
 
-
 int handle_target_script_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        target_t *target = NULL;
@@ -1818,7 +1812,6 @@ int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
        return handle_wait_halt_command(cmd_ctx, cmd, args, argc);
 }
 
-               
 int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        target_t *target = get_current_target(cmd_ctx);
@@ -1886,6 +1879,8 @@ int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **a
        int retval;
        target_t *target = get_current_target(cmd_ctx);
        
+       target_invoke_script(cmd_ctx, target, "pre_resume");
+       
        if (argc == 0)
                retval = target_resume(target, 1, 0, 1, 0); /* current pc, addr = 0, handle breakpoints, not debugging */
        else if (argc == 1)
@@ -2010,8 +2005,7 @@ int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args,
        value = strtoul(args[1], NULL, 0);
        if (argc == 3)
                count = strtoul(args[2], NULL, 0);
-
-
+       
        switch (cmd[2])
        {
                case 'w':
index 05ea584f89ab33c22ba545a6617d78227c9d8a91..6ee520bfb01988ec446c1a0c9788e839c042c770 100644 (file)
@@ -201,8 +201,7 @@ typedef struct target_s
        enum target_reset_mode reset_mode;      /* what to do after a reset */
        int run_and_halt_time;                          /* how long the target should run after a run_and_halt reset */
        u32 working_area;                                       /* working area (initialized RAM). Evaluated 
-                                                                                  upon first allocation from virtual/physical address.
-                                                                                 */
+                                                                                  upon first allocation from virtual/physical address. */
        u32 working_area_virt;                          /* virtual address */
        u32 working_area_phys;                          /* physical address */
        u32 working_area_size;                          /* size in bytes */
@@ -299,7 +298,6 @@ extern int target_free_working_area_restore(struct target_s *target, working_are
 extern int target_free_all_working_areas(struct target_s *target);
 extern int target_free_all_working_areas_restore(struct target_s *target, int restore);
 
-
 extern target_t *targets;
 
 extern target_event_callback_t *target_event_callbacks;
@@ -322,7 +320,6 @@ int target_arch_state(struct target_s *target);
 
 int target_invoke_script(struct command_context_s *cmd_ctx, target_t *target, char *name);
 
-
 #define ERROR_TARGET_INVALID   (-300)
 #define ERROR_TARGET_INIT_FAILED (-301)
 #define ERROR_TARGET_TIMEOUT   (-302)