Implement breakpointing a given line.
diff --git a/org/mozilla/javascript/InterpretedFunction.java b/org/mozilla/javascript/InterpretedFunction.java
index f8557e8..7df0391 100644
--- a/org/mozilla/javascript/InterpretedFunction.java
+++ b/org/mozilla/javascript/InterpretedFunction.java
@@ -92,7 +92,7 @@
     }
     
     public String getSourceName() {
-        return itsData.itsSource;
+        return itsData.itsSourceFile;
     }
     
     public Enumeration getLineNumbers() { 
diff --git a/org/mozilla/javascript/InterpretedScript.java b/org/mozilla/javascript/InterpretedScript.java
index 9ba87c9..3d2c9eb 100644
--- a/org/mozilla/javascript/InterpretedScript.java
+++ b/org/mozilla/javascript/InterpretedScript.java
@@ -76,7 +76,7 @@
     }
     
     public String getSourceName() {
-        return itsData.itsSource;
+        return itsData.itsSourceFile;
     }
     
     public Enumeration getLineNumbers() {
diff --git a/org/mozilla/javascript/Interpreter.java b/org/mozilla/javascript/Interpreter.java
index b5a2847..ce0180c 100644
--- a/org/mozilla/javascript/Interpreter.java
+++ b/org/mozilla/javascript/Interpreter.java
@@ -130,7 +130,10 @@
         itsData.itsRegExpLiterals = regExpLiterals;
         if (printICode) dumpICode(itsData);
                                                                
-        return new InterpretedScript(itsData, cx);
+        InterpretedScript result = new InterpretedScript(itsData, cx);
+        if (cx.debugger != null)
+            cx.debugger.handleCompilationDone(cx, result, null);
+        return result;
     }
     
     private void generateNestedFunctions(Scriptable scope,
@@ -172,12 +175,17 @@
                                securityDomain);
             
         itsData.itsName = theFunction.getFunctionName();
+        itsData.itsSourceFile = (String) theFunction.getProp(
+                                    Node.SOURCENAME_PROP);
         itsData.itsSource = (String)theFunction.getProp(Node.SOURCE_PROP);
         itsData.itsNestedFunctions = itsNestedFunctions;
         itsData.itsRegExpLiterals = regExpLiterals;
         if (printICode) dumpICode(itsData);            
             
-        return new InterpretedFunction(itsData, cx);
+        InterpretedFunction result = new InterpretedFunction(itsData, cx);
+        if (cx.debugger != null)
+            cx.debugger.handleCompilationDone(cx, result, null);
+        return result;
     }
     
     boolean itsInFunctionFlag;
@@ -206,7 +214,7 @@
             }
             if (itsData.itsLineNumberTable != null) {
                 itsData.itsLineNumberTable.put(new Integer(lineNumber), 
-                                           new Integer(iCodeTop));
+                                               new Integer(iCodeTop));
             }
             iCodeTop = addByte((byte) TokenStream.LINE, iCodeTop);
             iCodeTop = addByte((byte)(lineNumber >> 8), iCodeTop);
diff --git a/org/mozilla/javascript/InterpreterData.java b/org/mozilla/javascript/InterpreterData.java
index 023c6dd..572639a 100644
--- a/org/mozilla/javascript/InterpreterData.java
+++ b/org/mozilla/javascript/InterpreterData.java
@@ -68,7 +68,8 @@
     
     public boolean placeBreakpoint(int line) { // XXX throw exn?
         int offset = getOffset(line);
-        if (offset != -1 && itsICode[offset] == TokenStream.LINE)
+        if (offset != -1 && (itsICode[offset] == TokenStream.LINE ||
+                             itsICode[offset] == TokenStream.BREAKPOINT))
         {
             itsICode[offset] = (byte) TokenStream.BREAKPOINT;
             return true;
diff --git a/org/mozilla/javascript/debug/Debugger.java b/org/mozilla/javascript/debug/Debugger.java
index 4ae5098..da43af0 100644
--- a/org/mozilla/javascript/debug/Debugger.java
+++ b/org/mozilla/javascript/debug/Debugger.java
@@ -41,10 +41,8 @@
 
 public interface Debugger {
     
-    /* LATER
     void handleCompilationDone(Context cx, DebuggableScript fnOrScript, 
                                String source);
-    */
 
     void handleBreakpointHit(Context cx);
     
diff --git a/org/mozilla/javascript/tools/debugger/DebugShell.java b/org/mozilla/javascript/tools/debugger/DebugShell.java
index b9ece9f..7448c29 100644
--- a/org/mozilla/javascript/tools/debugger/DebugShell.java
+++ b/org/mozilla/javascript/tools/debugger/DebugShell.java
@@ -49,6 +49,29 @@
     public DebugShell(Context cx) {
         cx.setDebugger(this);
     }
+    
+    public class SourceEntry {
+        SourceEntry(String source, DebuggableScript fnOrScript) {
+            this.source = source;
+            this.fnOrScript = fnOrScript;
+        }
+        String source;
+        DebuggableScript fnOrScript;
+    };
+    
+    public void handleCompilationDone(Context cx, DebuggableScript fnOrScript, 
+                                      String source)
+    {
+        String sourceName = fnOrScript.getSourceName();
+        if (sourceName != null) {
+            Vector v = (Vector) sourceNames.get(sourceName);
+            if (v == null) {
+                v = new Vector();
+                sourceNames.put(sourceName, v);
+            }
+            v.addElement(new SourceEntry(source, fnOrScript));
+        }
+    }
 
     public void handleBreakpointHit(Context cx) {
         if (stopAtFrameDepth != -1) {
@@ -100,20 +123,7 @@
                 args = line.substring(space+1);
             }
             if (command.equals("b")) {
-                Object o = scope.get(args, scope);  // XXX: b obj.f
-                if (o == Scriptable.NOT_FOUND) {
-                    Main.getErr().println("function " + args + " was not found");
-                    continue;
-                }
-                if (!(o instanceof DebuggableScript)) {
-                    Main.getErr().println("function " + args + " is not debuggable");
-                    continue;
-                }
-                int min = getMinLineNumber((DebuggableScript) o);
-                if (((DebuggableScript)o).placeBreakpoint(min))
-                    Main.getErr().println("Breakpoint placed at line " + min); /// xx source
-                else
-                    Main.getErr().println("Cannot place breakpoint for " + args);
+                breakpointCommand(scope, args);
             } else if (command.equals("c")) {
                 return;
             } else if (command.equals("p")) {
@@ -166,6 +176,57 @@
                             f.getLineNumber() + ")");
     }
     
+    void breakpointCommand(Scriptable scope, String args) {
+        // First look for args that are of form "sourceName:lineNo"
+        int colon = args.indexOf(":");
+        if (colon != -1) {
+            String sourceName = args.substring(0, colon);
+            Vector v = (Vector) sourceNames.get(sourceName);
+            if (v == null) {
+                Main.getErr().println("Can't find source named \"" + 
+                                      sourceName + "\".");
+                return;
+            }
+            String lineString = args.substring(colon+1);
+            int lineNumber;
+            try {
+                lineNumber = Integer.parseInt(lineString);
+            } catch (NumberFormatException e) {
+                Main.getErr().println("Expected a line number "+
+                                      "following ':', had " + 
+                                      lineString + " instead.");
+                return;
+            }
+            int i=0;
+            for (; i < v.size(); i++) {
+                SourceEntry se = (SourceEntry) v.elementAt(i);
+                if (se.fnOrScript.placeBreakpoint(lineNumber))
+                    break;
+            }
+            if (i == v.size()) {
+                Main.getErr().println("Can't place breakpoint at line " +
+                                      lineNumber + ".");
+            }
+            return;
+        }                    
+                
+        // Now look for a function name
+        Object o = scope.get(args, scope);  // XXX: b obj.f
+        if (o == Scriptable.NOT_FOUND) {
+            Main.getErr().println("function " + args + " was not found");
+            return;
+        }
+        if (!(o instanceof DebuggableScript)) {
+            Main.getErr().println("function " + args + " is not debuggable");
+            return;
+        }
+        int min = getMinLineNumber((DebuggableScript) o);
+        if (((DebuggableScript)o).placeBreakpoint(min))
+            Main.getErr().println("Breakpoint placed at line " + min); /// xx source
+        else
+            Main.getErr().println("Cannot place breakpoint for " + args);
+    }
+    
     int getMinLineNumber(DebuggableScript ds) {
         Enumeration e = ds.getLineNumbers();
         int min = Integer.MAX_VALUE;
@@ -180,4 +241,5 @@
     
     private int stopAtFrameDepth = -1;
     private String lastCommand = null;
+    private Hashtable sourceNames = new Hashtable();
 }
diff --git a/src/org/mozilla/javascript/InterpretedFunction.java b/src/org/mozilla/javascript/InterpretedFunction.java
index f8557e8..7df0391 100644
--- a/src/org/mozilla/javascript/InterpretedFunction.java
+++ b/src/org/mozilla/javascript/InterpretedFunction.java
@@ -92,7 +92,7 @@
     }
     
     public String getSourceName() {
-        return itsData.itsSource;
+        return itsData.itsSourceFile;
     }
     
     public Enumeration getLineNumbers() { 
diff --git a/src/org/mozilla/javascript/InterpretedScript.java b/src/org/mozilla/javascript/InterpretedScript.java
index 9ba87c9..3d2c9eb 100644
--- a/src/org/mozilla/javascript/InterpretedScript.java
+++ b/src/org/mozilla/javascript/InterpretedScript.java
@@ -76,7 +76,7 @@
     }
     
     public String getSourceName() {
-        return itsData.itsSource;
+        return itsData.itsSourceFile;
     }
     
     public Enumeration getLineNumbers() {
diff --git a/src/org/mozilla/javascript/Interpreter.java b/src/org/mozilla/javascript/Interpreter.java
index b5a2847..ce0180c 100644
--- a/src/org/mozilla/javascript/Interpreter.java
+++ b/src/org/mozilla/javascript/Interpreter.java
@@ -130,7 +130,10 @@
         itsData.itsRegExpLiterals = regExpLiterals;
         if (printICode) dumpICode(itsData);
                                                                
-        return new InterpretedScript(itsData, cx);
+        InterpretedScript result = new InterpretedScript(itsData, cx);
+        if (cx.debugger != null)
+            cx.debugger.handleCompilationDone(cx, result, null);
+        return result;
     }
     
     private void generateNestedFunctions(Scriptable scope,
@@ -172,12 +175,17 @@
                                securityDomain);
             
         itsData.itsName = theFunction.getFunctionName();
+        itsData.itsSourceFile = (String) theFunction.getProp(
+                                    Node.SOURCENAME_PROP);
         itsData.itsSource = (String)theFunction.getProp(Node.SOURCE_PROP);
         itsData.itsNestedFunctions = itsNestedFunctions;
         itsData.itsRegExpLiterals = regExpLiterals;
         if (printICode) dumpICode(itsData);            
             
-        return new InterpretedFunction(itsData, cx);
+        InterpretedFunction result = new InterpretedFunction(itsData, cx);
+        if (cx.debugger != null)
+            cx.debugger.handleCompilationDone(cx, result, null);
+        return result;
     }
     
     boolean itsInFunctionFlag;
@@ -206,7 +214,7 @@
             }
             if (itsData.itsLineNumberTable != null) {
                 itsData.itsLineNumberTable.put(new Integer(lineNumber), 
-                                           new Integer(iCodeTop));
+                                               new Integer(iCodeTop));
             }
             iCodeTop = addByte((byte) TokenStream.LINE, iCodeTop);
             iCodeTop = addByte((byte)(lineNumber >> 8), iCodeTop);
diff --git a/src/org/mozilla/javascript/InterpreterData.java b/src/org/mozilla/javascript/InterpreterData.java
index 023c6dd..572639a 100644
--- a/src/org/mozilla/javascript/InterpreterData.java
+++ b/src/org/mozilla/javascript/InterpreterData.java
@@ -68,7 +68,8 @@
     
     public boolean placeBreakpoint(int line) { // XXX throw exn?
         int offset = getOffset(line);
-        if (offset != -1 && itsICode[offset] == TokenStream.LINE)
+        if (offset != -1 && (itsICode[offset] == TokenStream.LINE ||
+                             itsICode[offset] == TokenStream.BREAKPOINT))
         {
             itsICode[offset] = (byte) TokenStream.BREAKPOINT;
             return true;
diff --git a/src/org/mozilla/javascript/debug/Debugger.java b/src/org/mozilla/javascript/debug/Debugger.java
index 4ae5098..da43af0 100644
--- a/src/org/mozilla/javascript/debug/Debugger.java
+++ b/src/org/mozilla/javascript/debug/Debugger.java
@@ -41,10 +41,8 @@
 
 public interface Debugger {
     
-    /* LATER
     void handleCompilationDone(Context cx, DebuggableScript fnOrScript, 
                                String source);
-    */
 
     void handleBreakpointHit(Context cx);