This is an automated email from Gerrit.

James Zhao ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/233

-- gerrit

commit 11922453b3ebb3c37b29bfd71d678ad81f42dab4
Author: James Zhao <[email protected]>
Date:   Tue Nov 22 00:47:54 2011 -0800

    gdb: add config command to auto send halt cmd
    
    Since for a gdb to be attached to a device, one need to open a telnet
    terminal first to halt the device.
    So including a new configuration command to allow halt command to be
    send when gdb_new_connection is invoked. This way saves the telnet step.
    This change is just to make openocd more user friendly, and easier to use.
    
    Change-Id: Ia1d55ab2596642dab485ac612ab7d5ad44b6da21
    Signed-off-by: James Zhao <[email protected]>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 4dd9bd1..ce91d84 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -112,6 +112,11 @@ static int gdb_flash_program = 1;
  */
 static int gdb_report_data_abort;
 
+/* if set, when gdb_new_connection is invoked will automaticly send halt 
command.
+ * Disabled by default.
+ */
+static int gdb_halt_upon_connection = 0;
+
 static int gdb_last_signal(struct target *target)
 {
        switch (target->debug_reason)
@@ -833,7 +838,12 @@ static int gdb_new_connection(struct connection 
*connection)
        gdb_write(connection, "+", 1);
 
        /* output goes through gdb connection */
-       command_set_output_handler(connection->cmd_ctx, gdb_output, connection);
+       command_set_output_handler(connection->cmd_ctx, gdb_output, 
connection); 
+    
+    LOG_DEBUG("running gdb_new_connection");
+    if (gdb_halt_upon_connection) {
+        command_run_line(connection->cmd_ctx, "halt");
+    }
 
        /* we must remove all breakpoints registered to the target as a previous
         * GDB session could leave dangling breakpoints if e.g. communication
@@ -2593,6 +2603,14 @@ COMMAND_HANDLER(handle_gdb_breakpoint_override_command)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(handle_gdb_halt_upon_connection_command) {
+       if (CMD_ARGC != 1)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       COMMAND_PARSE_ENABLE(CMD_ARGV[0], gdb_halt_upon_connection);
+    return ERROR_OK;
+}
+
 static const struct command_registration gdb_command_handlers[] = {
        {
                .name = "gdb_sync",
@@ -2644,6 +2662,13 @@ static const struct command_registration 
gdb_command_handlers[] = {
                        "to be used by gdb 'break' commands.",
                .usage = "('hard'|'soft'|'disable')"
        },
+       {
+               .name = "gdb_halt_upon_connection",
+               .handler = handle_gdb_halt_upon_connection_command,
+               .mode = COMMAND_CONFIG,
+               .help = "enable or disable auto halt device upon gdb 
connection",
+               .usage = "('enable'|'disable')"
+       },
        COMMAND_REGISTRATION_DONE
 };
 

-- 

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to