smp: fix SIGSEGV for "smp off" during target examine
The gdb subsystem is initialized after the first target examine, so the field struct target::gdb_service is NULL during examine. A command "smp off" in the examine event handler causes a SIGSEGV during OpenOCD startup. Check for pointer not NULL before dereferencing it. Change-Id: Id115e28be23a957fef1b97ab66d7273f0ea0dce4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8216 Tested-by: jenkins
This commit is contained in:
parent
c72afedce7
commit
3eba7b53bf
|
@ -119,7 +119,7 @@ COMMAND_HANDLER(default_handle_smp_command)
|
|||
head->target->smp = 0;
|
||||
|
||||
/* fixes the target display to the debugger */
|
||||
if (!list_empty(target->smp_targets))
|
||||
if (!list_empty(target->smp_targets) && target->gdb_service)
|
||||
target->gdb_service->target = target;
|
||||
|
||||
return ERROR_OK;
|
||||
|
|
Loading…
Reference in New Issue