On Mon, 21 Jan 2019 at 13:53, Peter Maydell <peter.mayd...@linaro.org> wrote: > > On Sat, 19 Jan 2019 at 14:00, Luc Michel <luc.mic...@greensocs.com> wrote: > > > > a TID or PID value means "any thread" (resp. "any process"). This commit > > fixes the different combinations when at least one value is 0. > > > > When both are 0, the function now returns the first attached CPU, > > instead of the CPU with TID 1, which is not necessarily attached or even > > existent. > > > > When PID is specified but TID is 0, the function returns the first CPU > > in the process, or NULL if the process does not exist or is not > > attached. > > > > In other cases, it returns the corresponding CPU, while ignoring the PID > > check when PID is 0. > > > > Reported-by: Peter Maydell <peter.mayd...@linaro.org> > > Signed-off-by: Luc Michel <luc.mic...@greensocs.com> > > --- > > Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> > > I've tracked down why my code was running into this, incidentally: > it turned out to be because I wasn't getting the parenting of the CPU > objects into the container correct, so the gdbstub ended up with > three processes, of which the first two were empty (and the CPUs > in the third default process). So the first thread (cpu 0) wasn't > in the first process, but in the last one.
Applied to target-arm.next, thanks. -- PMM