public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Should push_target pop all targets?
@ 2003-10-15 22:41 Andrew Cagney
  2003-10-15 23:05 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-10-15 22:41 UTC (permalink / raw)
  To: gdb

Hello,

The current push_target code:

>   /* Find the proper stratum to install this target in. */
> 
>   for (prev = NULL, cur = target_stack; cur; prev = cur, cur = cur->next)
>     {
>       if ((int) (t->to_stratum) >= (int) (cur->target_ops->to_stratum))
>         break;
>     }
> 
>   /* If there's already targets at this stratum, remove them. */

only pops targets at the stratum level being pushed.  Doing this - 
changing the target underneath ones feet - just scares me.

I think this should be changed so that all targets above that one get 
poped.  If they are still needed, they can be re-pushed.

I suspect this will affect core-file and thread targets ...
Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should push_target pop all targets?
  2003-10-15 22:41 Should push_target pop all targets? Andrew Cagney
@ 2003-10-15 23:05 ` Daniel Jacobowitz
  2003-10-17 17:59   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-10-15 23:05 UTC (permalink / raw)
  To: gdb

On Wed, Oct 15, 2003 at 06:41:54PM -0400, Andrew Cagney wrote:
> Hello,
> 
> The current push_target code:
> 
> >  /* Find the proper stratum to install this target in. */
> >
> >  for (prev = NULL, cur = target_stack; cur; prev = cur, cur = cur->next)
> >    {
> >      if ((int) (t->to_stratum) >= (int) (cur->target_ops->to_stratum))
> >        break;
> >    }
> >
> >  /* If there's already targets at this stratum, remove them. */
> 
> only pops targets at the stratum level being pushed.  Doing this - 
> changing the target underneath ones feet - just scares me.
> 
> I think this should be changed so that all targets above that one get 
> poped.  If they are still needed, they can be re-pushed.
> 
> I suspect this will affect core-file and thread targets ...

This definitely makes sense to me.  I suspect a lot of the uses of
push/pop target will need some examining, though, based on my last
wander through that code.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should push_target pop all targets?
  2003-10-15 23:05 ` Daniel Jacobowitz
@ 2003-10-17 17:59   ` Andrew Cagney
  2003-10-17 18:51     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-10-17 17:59 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> On Wed, Oct 15, 2003 at 06:41:54PM -0400, Andrew Cagney wrote:
> 
>> Hello,
>> 
>> The current push_target code:
>> 
> 
>> >  /* Find the proper stratum to install this target in. */
>> >
>> >  for (prev = NULL, cur = target_stack; cur; prev = cur, cur = cur->next)
>> >    {
>> >      if ((int) (t->to_stratum) >= (int) (cur->target_ops->to_stratum))
>> >        break;
>> >    }
>> >
>> >  /* If there's already targets at this stratum, remove them. */
> 
>> 
>> only pops targets at the stratum level being pushed.  Doing this - 
>> changing the target underneath ones feet - just scares me.
>> 
>> I think this should be changed so that all targets above that one get 
>> poped.  If they are still needed, they can be re-pushed.
>> 
>> I suspect this will affect core-file and thread targets ...
> 
> 
> This definitely makes sense to me.  I suspect a lot of the uses of
> push/pop target will need some examining, though, based on my last
> wander through that code.

On GNU/Linux, attach breaks (yet the exact same test passes on BSD ...)

Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should push_target pop all targets?
  2003-10-17 17:59   ` Andrew Cagney
@ 2003-10-17 18:51     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2003-10-17 18:51 UTC (permalink / raw)
  To: gdb

> On GNU/Linux, attach breaks (yet the exact same test passes on BSD ...)

I believe this happens:

(gdb) attach pid
-> calls attach_command()
    -> calls ... find_default_run_target's attach
    -> calls exec_file_attach()
       -> calls push_target (&exec_ops)
          pops the "run" target

outch!

Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-10-17 18:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 22:41 Should push_target pop all targets? Andrew Cagney
2003-10-15 23:05 ` Daniel Jacobowitz
2003-10-17 17:59   ` Andrew Cagney
2003-10-17 18:51     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).