This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: target_find_description question


On Wed, Sep 03, 2008 at 01:47:56AM +0200, Ulrich Weigand wrote:
> Hi Dan,
> 
> in testing the Cell debugger, I came across the question how to handle
> target_find_description for native (inf-ptrace) targets.  As I understand
> it, the idea is to determine the target description *before* any access
> to target registers happens.

That's right.  The remote target used to have a similar problem to the
one you describe, and before final merge I redid bits of it in order
to move target description reads earlier.

> But it seems a proper fix should be rather to call target_find_description
> earlier, indeed before any register access happens.  Unfortunately this 
> is a bit awkward as it would mean that either startup_inferior can no
> longer just call wait_for_inferior, or else that there would need to 
> be special handling for this case in wait_for_inferior ...
> 
> Do you have any suggestions how best to handle this?

target_find_description currently has a global flag,
target_desc_fetched, which means that reading the description multiple
times is harmless.  The flag will need to become per-target in a
multi-target GDB, of course.  So it's OK to call
target_find_description by hand at an earlier point, before any
register access.

Unfortunately we're supposed to do that when the target is stopped.
Otherwise, any check which attempts to read the registers or aux
vector will not work.

I suppose the easiest thing to do would be to call
target_find_description right before handle_inferior_event, and rely
on target_desc_fetched to prevent duplicate work.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]