target/cortex_a: check gdb_service before dereferencing in update_halt_gdb

If gdb was disconnected by the moment the target entered halted state,
update_halt_gdb would segfault.

Change-Id: I67477e9199c1df097be83a49e38602f975c083f5
Reported-by: Younes REGAIEG <younes.regaieg@imag.fr>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2098
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
__archive__
Paul Fertser 2014-04-07 12:33:53 +04:00
parent 85c1790beb
commit ee54f7e9f0
1 changed files with 1 additions and 1 deletions

View File

@ -766,7 +766,7 @@ static int cortex_a8_halt_smp(struct target *target)
static int update_halt_gdb(struct target *target) static int update_halt_gdb(struct target *target)
{ {
int retval = 0; int retval = 0;
if (target->gdb_service->core[0] == -1) { if (target->gdb_service && target->gdb_service->core[0] == -1) {
target->gdb_service->target = target; target->gdb_service->target = target;
target->gdb_service->core[0] = target->coreid; target->gdb_service->core[0] = target->coreid;
retval += cortex_a8_halt_smp(target); retval += cortex_a8_halt_smp(target);