Branch: Tag:

2015-01-27

2015-01-27 20:40:26 by Arne Goedeke <el@laramies.com>

gdb_backtraces: do not use Pike_sp

Pike_interpreter_pointer is not the correct one when printing the
stack of a thread, which is not swapped in. It can even be NULL, when
no thread is swapped in, which will lead to gdb_backtrace() to segfault.
This happens when debugging deadlock situations.

3341:    {    args=0;    }else{ -  args=f->num_args; -  args = DO_NOT_WARN((INT32) MINIMUM(f->num_args, Pike_sp - f->locals)); -  if(of) -  args = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals)); -  args=MAXIMUM(args,0); +  ptrdiff_t tmp; +  +  if(of) { +  tmp = of->locals - f->locals; +  } else { +  tmp = ts->state.stack_pointer - f->locals;    } -  +  args = (INT32)tmp; +  args = MAXIMUM(MINIMUM(args, f->num_args),0); +  }       for (i = 0; i < args; i++) {    struct svalue *arg = f->locals + i;