[Pdbg] [PATCH] libpdbg: ensure thread state validity, only print requested targets

Nicholas Piggin npiggin at gmail.com
Thu Aug 9 17:53:14 AEST 2018


On Thu, 09 Aug 2018 16:46:09 +1000
Alistair Popple <alistair at popple.id.au> wrote:

> Thanks Nick,
> 
> On Thursday, 9 August 2018 2:28:45 PM AEST Nicholas Piggin wrote:
> > Thread state is not queried from the target each time, but cached.
> > This patch adds a valid flag in the thread state cache to ensure
> > this is being probed proprly before use.  
> 
> I really need to add some comments/documentation but there is already a
> pdbg_target_status() function which is supposed to indicate if a particular
> target has been initialised or not (and therefore if thread_status() is
> initialised).
> 
> So rather than adding a target specific valid flag I think it would be best to
> just check that. There is also an implicit (ie. undocumented :-) rule that
> target functions other than target_probe() should only be called on targets with
> status == PDBG_TARGET_ENABLED.

Oh it's not the target status field but the thread_state one (which is
of course target specific), so I think it's okay. Using the target
status maybe works, but we pass around that thread_state structure
without the target in some places, also could target status be used
with things like ramming that wants to check status of non-target
siblings? (not that I've added the valid check there, but I should)

Thanks,
Nick


More information about the Pdbg mailing list