]> git.sur5r.net Git - openocd/commitdiff
target: armv8: Avoid semihosting segfault on halt
authorAndreas Färber <afaerber@suse.de>
Sun, 8 Jul 2018 17:52:06 +0000 (19:52 +0200)
committerMatthias Welwarsky <matthias@welwarsky.de>
Fri, 13 Jul 2018 08:19:09 +0000 (09:19 +0100)
Avoid a NULL pointer dereference when halting an aarch64 core.

Change-Id: I333d40475ab26e2f0dca5c27302a5fa4d817a12f
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/4593
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
src/target/armv8.c

index 83f55300b7261d1a5765db11793e647a184dd7a0..dfa2c67a5ccfa95a99a1291d5771b937acb76f84 100644 (file)
@@ -1063,7 +1063,7 @@ int armv8_aarch64_state(struct target *target)
                armv8_mode_name(arm->core_mode),
                buf_get_u32(arm->cpsr->value, 0, 32),
                buf_get_u64(arm->pc->value, 0, 64),
-               target->semihosting->is_active ? ", semihosting" : "");
+               (target->semihosting && target->semihosting->is_active) ? ", semihosting" : "");
 
        return ERROR_OK;
 }