public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: [RFA] New substitute-path commands
       [not found]                 ` <20060710215839.GA31772@nevyn.them.org>
@ 2006-07-13 21:27                   ` Joel Brobecker
  2006-07-13 21:41                     ` Daniel Jacobowitz
  2006-07-14 10:37                     ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-07-13 21:27 UTC (permalink / raw)
  To: gdb

[moving back to GDB - summary: On gdb-patches, I was convinced by the
feedback that I received that I should spend the effort of implementing
multiple rewrite rules immediately. I have a question about that].

The interface is as follow:

        (gdb) set substitute-path FROM TO
        (gdb) unset substitute-path [FROM]
        (gdb) show substitute-path

The "set" command will add a substitution rule.

My question is the following: When you enter a second rule, should it
take precedence over the first one you entered? More generally, should
the substitution rules entered last be used first, or the opposite?

I'm 50-50 on this:

   . With first-entered/first-used, you enter the rules following the
     logic "if blah, then replace with [...]; else if bloh, then replace
     with [...]; else if [...], then [...]". In other words, you enter
     the rules in the same order you would write a "program". It seems
     pretty natural.

   . With last-entered/first-used, it's possible to override previous
     entries without having to delete the previous rules. Not so natural
     to "program", though.

Actually, as I'm writing this, I now favor first-entered/first-used.
One can delete a rule if he wants to override it. It's marginal anyway.

What do you guys think?

Thanks,
-- 
Joel

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

* Re: [RFA] New substitute-path commands
  2006-07-13 21:27                   ` [RFA] New substitute-path commands Joel Brobecker
@ 2006-07-13 21:41                     ` Daniel Jacobowitz
  2006-07-14 10:37                     ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-07-13 21:41 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb

On Thu, Jul 13, 2006 at 02:27:46PM -0700, Joel Brobecker wrote:
> My question is the following: When you enter a second rule, should it
> take precedence over the first one you entered? More generally, should
> the substitution rules entered last be used first, or the opposite?

Good question.  I'm strongly in favor of intelligent users picking
rules where it doesn't make a difference! :-)

> I'm 50-50 on this:
> 
>    . With first-entered/first-used, you enter the rules following the
>      logic "if blah, then replace with [...]; else if bloh, then replace
>      with [...]; else if [...], then [...]". In other words, you enter
>      the rules in the same order you would write a "program". It seems
>      pretty natural.
> 
>    . With last-entered/first-used, it's possible to override previous
>      entries without having to delete the previous rules. Not so natural
>      to "program", though.
> 
> Actually, as I'm writing this, I now favor first-entered/first-used.
> One can delete a rule if he wants to override it. It's marginal anyway.
> 
> What do you guys think?

I think that's fine.

Let's not overdesign this.  I was only half-kidding about calling a
Python function to transform the source pathnames if you want to do
anything more complicated - if someone comes up with a legitimate use
for anything more complex than a simple list of prefixes, we can do
something along those lines.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: [RFA] New substitute-path commands
  2006-07-13 21:27                   ` [RFA] New substitute-path commands Joel Brobecker
  2006-07-13 21:41                     ` Daniel Jacobowitz
@ 2006-07-14 10:37                     ` Eli Zaretskii
  2006-07-14 13:06                       ` Daniel Jacobowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2006-07-14 10:37 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb

> Date: Thu, 13 Jul 2006 14:27:46 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> The interface is as follow:
> 
>         (gdb) set substitute-path FROM TO
>         (gdb) unset substitute-path [FROM]
>         (gdb) show substitute-path
> 
> The "set" command will add a substitution rule.

If this _adds_ a rule, then "set SOMETHING" is not a good UI, IMO.
How about just "substitute-path", similar to "dir", which also _adds_
a directory?

> Actually, as I'm writing this, I now favor first-entered/first-used.
> One can delete a rule if he wants to override it.

Agreed.  Let's just make the logic clear in the manual.

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

* Re: [RFA] New substitute-path commands
  2006-07-14 10:37                     ` Eli Zaretskii
@ 2006-07-14 13:06                       ` Daniel Jacobowitz
  2006-07-14 13:43                         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-07-14 13:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Joel Brobecker, gdb

On Fri, Jul 14, 2006 at 01:37:18PM +0300, Eli Zaretskii wrote:
> > Date: Thu, 13 Jul 2006 14:27:46 -0700
> > From: Joel Brobecker <brobecker@adacore.com>
> > 
> > The interface is as follow:
> > 
> >         (gdb) set substitute-path FROM TO
> >         (gdb) unset substitute-path [FROM]
> >         (gdb) show substitute-path
> > 
> > The "set" command will add a substitution rule.
> 
> If this _adds_ a rule, then "set SOMETHING" is not a good UI, IMO.
> How about just "substitute-path", similar to "dir", which also _adds_
> a directory?

This was my suggestion, so I'll defend it :-)  I think of it as set "the
substitution path for FROM" to "TO".  The parallel is set env VAR
VALUE, which sets the environment variable VAR to VALUE.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: [RFA] New substitute-path commands
  2006-07-14 13:06                       ` Daniel Jacobowitz
@ 2006-07-14 13:43                         ` Eli Zaretskii
  2006-07-14 13:46                           ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2006-07-14 13:43 UTC (permalink / raw)
  To: gdb

> Date: Fri, 14 Jul 2006 09:05:59 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Joel Brobecker <brobecker@adacore.com>, gdb@sources.redhat.com
> 
> > If this _adds_ a rule, then "set SOMETHING" is not a good UI, IMO.
> > How about just "substitute-path", similar to "dir", which also _adds_
> > a directory?
> 
> This was my suggestion, so I'll defend it :-)  I think of it as set "the
> substitution path for FROM" to "TO".  The parallel is set env VAR
> VALUE, which sets the environment variable VAR to VALUE.

In that case, we should at least have "show substitute-path FROM", not
just "show substitute-path".

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

* Re: [RFA] New substitute-path commands
  2006-07-14 13:43                         ` Eli Zaretskii
@ 2006-07-14 13:46                           ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-07-14 13:46 UTC (permalink / raw)
  To: gdb, gdb

On Fri, Jul 14, 2006 at 04:43:22PM +0300, Eli Zaretskii wrote:
> > Date: Fri, 14 Jul 2006 09:05:59 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: Joel Brobecker <brobecker@adacore.com>, gdb@sources.redhat.com
> > 
> > > If this _adds_ a rule, then "set SOMETHING" is not a good UI, IMO.
> > > How about just "substitute-path", similar to "dir", which also _adds_
> > > a directory?
> > 
> > This was my suggestion, so I'll defend it :-)  I think of it as set "the
> > substitution path for FROM" to "TO".  The parallel is set env VAR
> > VALUE, which sets the environment variable VAR to VALUE.
> 
> In that case, we should at least have "show substitute-path FROM", not
> just "show substitute-path".

Sounds good to me!

I wonder if there's a way we can share the code for this and set env,
thus making it easier in the future to add similar variables?

-- 
Daniel Jacobowitz
CodeSourcery

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

end of thread, other threads:[~2006-07-14 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20060707052219.GA971@adacore.com>
     [not found] ` <u8xn5rbx7.fsf@gnu.org>
     [not found]   ` <20060707191203.GD971@adacore.com>
     [not found]     ` <uhd1sp9uv.fsf@gnu.org>
     [not found]       ` <20060710054027.GF971@adacore.com>
     [not found]         ` <ud5cdnsml.fsf@gnu.org>
     [not found]           ` <20060710214706.GA2390@adacore.com>
     [not found]             ` <20060710215114.GA31444@nevyn.them.org>
     [not found]               ` <20060710215630.GB2390@adacore.com>
     [not found]                 ` <20060710215839.GA31772@nevyn.them.org>
2006-07-13 21:27                   ` [RFA] New substitute-path commands Joel Brobecker
2006-07-13 21:41                     ` Daniel Jacobowitz
2006-07-14 10:37                     ` Eli Zaretskii
2006-07-14 13:06                       ` Daniel Jacobowitz
2006-07-14 13:43                         ` Eli Zaretskii
2006-07-14 13:46                           ` Daniel Jacobowitz

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).