target: fix display halt message logic 75/4475/2
authorTomas Vanek <vanekt@fbl.cz>
Thu, 22 Mar 2018 10:53:40 +0000 (11:53 +0100)
committerMatthias Welwarsky <matthias@welwarsky.de>
Fri, 30 Mar 2018 09:14:56 +0000 (10:14 +0100)
If a target is run from gdb and then stopped from OpenOCD telnet interface,
halt does not show message with status and PC registers.

While on it rename 'display' to 'verbose_halt_msg' and use bool type
instead of int.

Change-Id: Ibe6589015b302e0be97258b06938c297745436a5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4475
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
src/openocd.c
src/target/target.c
src/target/target.h

index 1874530cb2fc4d053052835e19febf591c1599e2..d5d7ebe8768211c97a81caa6320520cf73c65ee6 100644 (file)
@@ -87,13 +87,13 @@ static int log_target_callback_event_handler(struct target *target,
 {
        switch (event) {
                case TARGET_EVENT_GDB_START:
 {
        switch (event) {
                case TARGET_EVENT_GDB_START:
-                       target->display = 0;
+                       target->verbose_halt_msg = false;
                        break;
                case TARGET_EVENT_GDB_END:
                        break;
                case TARGET_EVENT_GDB_END:
-                       target->display = 1;
+                       target->verbose_halt_msg = true;
                        break;
                case TARGET_EVENT_HALTED:
                        break;
                case TARGET_EVENT_HALTED:
-                       if (target->display) {
+                       if (target->verbose_halt_msg) {
                                /* do not display information when debugger caused the halt */
                                target_arch_state(target);
                        }
                                /* do not display information when debugger caused the halt */
                                target_arch_state(target);
                        }
index 4552034ec2f1d0430c159b485e8bb5a16c30cb00..10426023a47c3c5ef1580051e5d9dc0e1bc706d5 100644 (file)
@@ -2959,6 +2959,9 @@ COMMAND_HANDLER(handle_halt_command)
        LOG_DEBUG("-");
 
        struct target *target = get_current_target(CMD_CTX);
        LOG_DEBUG("-");
 
        struct target *target = get_current_target(CMD_CTX);
+
+       target->verbose_halt_msg = true;
+
        int retval = target_halt(target);
        if (ERROR_OK != retval)
                return retval;
        int retval = target_halt(target);
        if (ERROR_OK != retval)
                return retval;
@@ -5579,7 +5582,7 @@ static int target_create(Jim_GetOptInfo *goi)
        target->next                = NULL;
        target->arch_info           = NULL;
 
        target->next                = NULL;
        target->arch_info           = NULL;
 
-       target->display             = 1;
+       target->verbose_halt_msg        = true;
 
        target->halt_issued                     = false;
 
 
        target->halt_issued                     = false;
 
index 0ce4a137add309953fe169283bbb6edeb4048dd2..7a8a80f30438eaff7cffd81d68b16e3c384fe15c 100644 (file)
@@ -176,7 +176,7 @@ struct target {
        void *private_config;                           /* pointer to target specific config data (for jim_configure hook) */
        struct target *next;                            /* next target in list */
 
        void *private_config;                           /* pointer to target specific config data (for jim_configure hook) */
        struct target *next;                            /* next target in list */
 
-       int display;                                            /* display async info in telnet session. Do not display
+       bool verbose_halt_msg;                          /* display async info in telnet session. Do not display
                                                                                 * lots of halted/resumed info when stepping in debugger. */
        bool halt_issued;                                       /* did we transition to halted state? */
        int64_t halt_issued_time;                       /* Note time when halt was issued */
                                                                                 * lots of halted/resumed info when stepping in debugger. */
        bool halt_issued;                                       /* did we transition to halted state? */
        int64_t halt_issued_time;                       /* Note time when halt was issued */

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)