36,37c36,42
< # If you want to pass different arguments to the two instances of m5,
< # you can embed them in the simulator arguments like this:
---
> # Script arguments are handled uniformly as follows:
> # - If the argument does not contain a '|' character, it is appended
> # to both command lines.
> # - If the argument has a '|' character in it, the text on either side
> # of the '|' is appended to the respective command lines. Note that
> # you'll have to quote the arg or escape the '|' with a backslash
> # so that the shell doesn't think you're doing a pipe.
39c44
< # % tracediff "m5.opt --option1" "m5.opt --option2" [common args]
---
> # For example:
40a46,57
> # % tracediff m5.opt --opt1 "--opt2|--opt3" --opt4
> # would compare these two runs:
> # m5.opt --opt1 --opt2 --opt4
> # m5.opt --opt1 --opt3 --opt4
> #
> # If you want to compare two different simulator binaries, put a '|'
> # in the first script argument ("path1/m5.opt|path2/m5.opt"). If you
> # want to add arguments to one run only, just put a '|' in with text
> # only on one side ("--onlyOn1|"). You can do this with multiple
> # arguments together too ("|-a -b -c" adds three args to the second
> # run only).
> #
43c60
< die "Usage: tracediff sim1 sim2 [--root.trace.flags=X args...]\n";
---
> die "Usage: tracediff \"sim1|sim2\" [common-arg \"arg1|arg2\" ...]\n";
45a63,73
> foreach $arg (@ARGV) {
> @pair = split('\|', $arg, -1); # -1 enables null trailing fields
> if ($#pair > 0) {
> push @cmd1, $pair[0];
> push @cmd2, $pair[1];
> } else {
> push @cmd1, $arg;
> push @cmd2, $arg;
> }
> }
>
47,48c75,76
< $sim1 = shift;
< $sim2 = shift;
---
> $sim1 = shift @cmd1;
> $sim2 = shift @cmd2;
50,52c78,80
< # Everything else on the command line is taken to be an m5 argument to
< # be given to both invocations
< $simargs = '"' . join('" "', @ARGV) . '"';
---
> # Everything else is a simulator arg.
> $args1 = join(' ', @cmd1);
> $args2 = join(' ', @cmd2);
61,62c89,90
< $cmd1 = "$sim1 -d $dir1 $simargs 2>&1 |";
< $cmd2 = "$sim2 -d $dir2 $simargs 2>&1 |";
---
> $cmd1 = "$sim1 -d $dir1 $args1 2>&1 |";
> $cmd2 = "$sim2 -d $dir2 $args2 2>&1 |";