Re: [Fwd: Re: [Fwd: Re: gdb/725: Crash using debug target and regcaches (in 5.3 branch?)]]

Andrew Cagney
2002-12-03T21:41:03Z

>
> It's not an assumption at this point. proc-service.c:230 to
> thread_db_fetch_registers is the only path into lin_lwp_fetch_registers.
> And that does:
> inferior_ptid = BUILD_LWP (lwpid, ph->pid);
>
> So at this point we _know_ that the thread we're querying has its
> registers in the LWP. That's the whole point.

To just to clarify something, I'm being critical of the overall design
here, not your patch. The comment is for sparc-nat.c (which also gets
used on sun-4 and free bsd systems).

The target/*-nat interface shouldn't be be making assumptions such as
this (global state, only ever one LWP / thread active, ...). Doing so
is poor design, it leads to bugs just like the one being discussed here.

If, instead, the code had been correctly implemented (what 5 years ago?)
this bug, and these on-going problems, wouldn't have occured.

Andrew