This is an automated email from Gerrit.

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

-- gerrit

commit 80c31f564bebe2a857d2f790317d00390b9bc37b
Author: Antonio Borneo <[email protected]>
Date:   Mon Jun 25 15:09:31 2018 +0200

    gdb_server: only trigger once the event gdb-detach at gdb quit
    
    When GDB quits (e.g. with "quit" command) we first execute
    gdb_detach() to reply "OK" then, at GDB disconnect (either TCP
    or pipe connection type), we execute gdb_connection_closed().
    In case GDB is killed or it crashes, OpenOCD only executes the
    latter when detects the disconnection.
    Both gdb_detach() and gdb_connection_closed() trigger the event
    TARGET_EVENT_GDB_DETACH thus getting it triggered twice on clean
    GDB quit.
    
    Do not trigger the event TARGET_EVENT_GDB_DETACH in gdb_detach()
    and let only gdb_connection_closed() to handle it.
    
    Change-Id: Iacf035c855b8b3e2239c1c0e259c279688b418ee
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index a9c2a64..f0b552d 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3016,9 +3016,12 @@ static int gdb_v_packet(struct connection *connection,
 
 static int gdb_detach(struct connection *connection)
 {
-       target_call_event_callbacks(get_target_from_connection(connection),
-               TARGET_EVENT_GDB_DETACH);
-
+       /*
+        * Only reply "OK" to GDB
+        * it will close the connection and this will trigger a call to
+        * gdb_connection_closed() that will in turn trigger the event
+        * TARGET_EVENT_GDB_DETACH
+        */
        return gdb_put_packet(connection, "OK", 2);
 }
 

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to