gdb_server: check target before executing event callback 01/1501/2
authorHsiangkai Wang <hsiangkai@gmail.com>
Thu, 11 Jul 2013 02:44:59 +0000 (10:44 +0800)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 7 Aug 2013 21:01:55 +0000 (21:01 +0000)
As debugging multi-targets, every target has its own gdb connection.
If there are two connections, gdb_target_callback_event_handler will
be registered twice.  Everytime event occurs, the registered callback
will be executed twice.  If both targets are running, as user issues
ctrl-c in one gdb client, both connections will send "stop reply" to
GDB clients even TARGET_EVENT_GDB_HALT is caused by one of them.

The commit fix above problem as debugging multi-targets.

Change-Id: I1e12d4846927d7dcf1e3bb9aeb1affabc80df813
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1501
Tested-by: jenkins
Reviewed-by: Sergey Borshch <sb-sf@users.sourceforge.net>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/server/gdb_server.c

index c4ad91cfab5743f9e30f9fe90256d6031da2ad69..48015abcda1f8e4e65aace51151808f66bd9b911 100644 (file)
@@ -864,6 +864,10 @@ static int gdb_target_callback_event_handler(struct target *target,
 {
        int retval;
        struct connection *connection = priv;
+       struct gdb_service *gdb_service = connection->service->priv;
+
+       if (gdb_service->target != target)
+               return ERROR_OK;
 
        switch (event) {
                case TARGET_EVENT_GDB_HALT:

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)