From: Andreas Färber Date: Sun, 8 Jul 2018 17:52:06 +0000 (+0200) Subject: target: armv8: Avoid semihosting segfault on halt X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b82ee0799f6e30d3f03bd707c6e9729de92248d2;p=openocd target: armv8: Avoid semihosting segfault on halt Avoid a NULL pointer dereference when halting an aarch64 core. Change-Id: I333d40475ab26e2f0dca5c27302a5fa4d817a12f Signed-off-by: Andreas Färber Reviewed-on: http://openocd.zylin.com/4593 Tested-by: jenkins Reviewed-by: Matthias Welwarsky --- diff --git a/src/target/armv8.c b/src/target/armv8.c index 83f55300..dfa2c67a 100644 --- a/src/target/armv8.c +++ b/src/target/armv8.c @@ -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; }