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: [RFA] New substitute-path commands


On Thu, Jul 06, 2006 at 08:03:19AM -0700, PAUL GILLIAM wrote:
> > Would you mind making a design proposal? I'm not sure to understand
> > what you exactly you are thinking about. I think I understand the fact
> > that you would like to have more than one rule because "add" doesn't
> > suggest "replace", but I am not sure I get the rest :-/.

Right.

> How about something like this:
> 
> 	set substitute-path [<path>]
> 		If this variable is set, <path> is a colon-separated
> 		list of <from>,<to> pairs.  When a full path that
> 		has been encoded in the debug information is processed,
> 		each <from>,<to> pair is applied by searching the full
> 		path for the <from> string and replacing it by the <to>
> 		string.  If <path> is not used, then the substitute-path
> 		variable is un-set.
> 
> 	show substitute-path
> 		Display the current list of <from>,<to> pairs.

Well, I was thinking like this:

(gdb) help set env
Set environment variable value to give the program.
Arguments are VAR VALUE where VAR is variable name and VALUE is value.
VALUES of environment variables are uninterpreted strings.
This does not affect the program until the next "run" command.
(gdb) help unset env
Cancel environment variable VAR for the program.
This does not affect the program until the next "run" command.
(gdb) help show env
The environment to give the program, or one variable's value.
With an argument VAR, prints the value of environment variable VAR to
give the program being debugged.  With no arguments, prints the entire
environment to be given to the program.

This isn't a list; it's more like a dictionary or hash table.  But that
ought to work too, right?  I don't think we need to support ordered
substitutions, like "map /foo/bar to /one but all other /foo to /two". 
If we need that, we should hook up a scripting language and say "pass
all source paths to this python function and use the result".  Which is
actually a kind of nice idea, but overkill for the moment.

There's already a "-gdb-show env", although its output is not very
useful to a frontend.  We could change that for MI3 if anyone cares.
I don't think there's a -gdb-unset, but the parallel is fairly obvious,
so we could add one readily.

That gives us:

set substitute-path FROM TO

  [We can make it use buildargv for uniform quoting of TO and FROM. 
  I'd recommend that.]

unset substitute-path FROM

show substitute-path

-- 
Daniel Jacobowitz
CodeSourcery


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