This is an automated email from Gerrit. "J. Neuschäfer <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9405
-- gerrit commit e5c03b36cc0638c98f7124dc1fb6b649b9fc780a Author: J. Neuschäfer <[email protected]> Date: Tue Jan 27 14:39:32 2026 +0100 arm_dap: Avoid crash due to "dap info" on non-ARM targets Due to user error, "dap info" may be invoked even when the current target is not an Arm processor. Avoid a segfault due to type confusion in this situation. Example interaction: > targets TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* bcm11130.ahb mem_ap little bcm11130.cpu running 1 bcm11130.apb mem_ap little bcm11130.cpu running 2 bcm11130.cpu cortex_a little bcm11130.cpu unknown > targets 2 > dap info AP # 0x0 AP ID register 0x44770001 Type is MEM-AP AHB3 MEM-AP BASE 0xffffffff No ROM table present > targets 0 > dap info Target is not ARM Change-Id: I23705a990281048e1e88f1b20c1c7c830c10f74f Signed-off-by: J. Neuschäfer <[email protected]> diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c index 5ba5e1c387..1f5ba30699 100644 --- a/src/target/arm_dap.c +++ b/src/target/arm_dap.c @@ -433,9 +433,15 @@ COMMAND_HANDLER(handle_dap_info_command) { struct target *target = get_current_target(CMD_CTX); struct arm *arm = target_to_arm(target); - struct adiv5_dap *dap = arm->dap; + struct adiv5_dap *dap; uint64_t apsel; + if (!is_arm(arm)) { + LOG_ERROR("Current target is not an Arm CPU"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + } + + dap = arm->dap; if (!dap) { LOG_ERROR("DAP instance not available. Probably a HLA target..."); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; --
