Fix the following problem:

Thanks!

As promised, I tried the debugger this afternoon and I had a problem with the '-f' option.
  We use -f to run a standard "startup" script before executing the "main" script.  For
example, we run the Rhino shell with the options "-f startup.js main.js".

When running the debugger's shell with the same options the debugger exits after the
startup.js completes; i.e., I can single step starting from startup.js but the debugger
exits at the end of startup.js without letting me single step into main.js.  This worked
fine in the 1.5R2 release of Rhino and the debugger.

I have not had a chance to look into the problem closely, but a cursory look at the code
suggests (to me) that the problem can be in either the debugger or the shell (since the
debugger basically runs the shell after creating the right "hooks".)  Of course, it could
also be a problem with my embedding.

So ... my question is, has anyone tried single stepping when the options to the debugger
include a '-f' option.  If so, I'll continue to look for a problem in my embedding.

Any suggestions would be appreciated.

Thanks,

dave
This commit is contained in:
nboyd%atg.com 2002-01-24 19:57:01 +00:00
parent dc2b105154
commit c24a699dd8

View File

@ -82,23 +82,12 @@ public class Main {
args = processOptions(cx, args);
int skip = 0;
if (fileList.size() == 0 && args.length > 0) {
skip = 1;
fileList.addElement(args[0]);
}
if (processStdin)
fileList.addElement(null);
// get the command line arguments after the name of the script,
// and define "arguments" array in the top-level object
// define "arguments" array in the top-level object
Object[] array = args;
if (args.length > 0) {
int length = args.length - skip;
array = new Object[length];
System.arraycopy(args, skip, array, 0, length);
}
Scriptable argsObj = cx.newArray(global, array);
Scriptable argsObj = cx.newArray(global, args);
global.defineProperty("arguments", argsObj,
ScriptableObject.DONTENUM);
@ -119,8 +108,9 @@ public class Main {
String arg = args[i];
if (!arg.startsWith("-")) {
processStdin = false;
String[] result = new String[args.length - i];
System.arraycopy(args, i, result, 0, args.length - i);
fileList.addElement(arg);
String[] result = new String[args.length - i - 1];
System.arraycopy(args, i+1, result, 0, args.length - i - 1);
return result;
}
if (arg.equals("-version")) {