From 418515b21ed506449dfc9981265edec7800619b5 Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Sat, 19 Jan 2019 15:58:49 +0100 Subject: [PATCH] target/arm_dap: fix segmentation fault in 'dap info' cmd 'dap info' command fails hard on a hla target. Change-Id: Ia188b1afe527e0ed64512d1bddadd507f978e40b Signed-off-by: Tomas Vanek Reviewed-on: http://openocd.zylin.com/4860 Tested-by: jenkins Reviewed-by: Matthias Welwarsky Reviewed-by: Antonio Borneo --- src/target/arm_dap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c index 3adb4ed267..119e5117d2 100644 --- a/src/target/arm_dap.c +++ b/src/target/arm_dap.c @@ -313,6 +313,11 @@ COMMAND_HANDLER(handle_dap_info_command) struct adiv5_dap *dap = arm->dap; uint32_t apsel; + if (dap == NULL) { + LOG_ERROR("DAP instance not available. Probably a HLA target..."); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + } + switch (CMD_ARGC) { case 0: apsel = dap->apsel; -- 2.30.2