Author: martin
Date: 2007-02-28 09:31:55 -0500 (Wed, 28 Feb 2007)
New Revision: 73551

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backend/ProcessStart.cs
   trunk/debugger/classes/Process.cs
   trunk/debugger/frontend/Command.cs
Log:
2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>

        * backend/ProcessStart.cs
        (ProcessStart..ctor): Set `options.WorkingDirectory' if null.

        * classes/Process.cs
        (Process.FindFile): Correctly implement this.
        (Process.FindLocation): Removed; use FileFile() instead.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-02-28 14:30:40 UTC (rev 73550)
+++ trunk/debugger/ChangeLog    2007-02-28 14:31:55 UTC (rev 73551)
@@ -1,6 +1,15 @@
 2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * backend/ProcessStart.cs
+       (ProcessStart..ctor): Set `options.WorkingDirectory' if null.
+
        * classes/Process.cs
+       (Process.FindFile): Correctly implement this.
+       (Process.FindLocation): Removed; use FileFile() instead.
+
+2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * classes/Process.cs
        (Process.GetFullPath): Removed; use FindFile() instead.
 
 2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>

Modified: trunk/debugger/backend/ProcessStart.cs
===================================================================
--- trunk/debugger/backend/ProcessStart.cs      2007-02-28 14:30:40 UTC (rev 
73550)
+++ trunk/debugger/backend/ProcessStart.cs      2007-02-28 14:31:55 UTC (rev 
73551)
@@ -75,7 +75,7 @@
 
                        cwd = options.WorkingDirectory;
                        if (cwd == null)
-                               cwd = System.Environment.CurrentDirectory;
+                               cwd = options.WorkingDirectory = 
System.Environment.CurrentDirectory;
                        string mono_path = options.MonoPath != null ?
                                options.MonoPath : MonoPath;
 

Modified: trunk/debugger/classes/Process.cs
===================================================================
--- trunk/debugger/classes/Process.cs   2007-02-28 14:30:40 UTC (rev 73550)
+++ trunk/debugger/classes/Process.cs   2007-02-28 14:31:55 UTC (rev 73551)
@@ -86,28 +86,22 @@
                        get { return servant.Modules; }
                }
 
-               public SourceLocation FindLocation (string file, int line)
+               public SourceFile FindFile (string filename)
                {
-                       foreach (Module module in Modules) {
-                               SourceLocation location = module.FindLocation 
(file, line);
-                               
-                               if (location != null)
-                                       return location;
+                       Module[] modules = servant.Modules;
+
+                       foreach (Module module in modules) {
+                               SourceFile file = module.FindFile (filename);
+                               if (file != null)
+                                       return file;
                        }
 
-                       return null;
-               }
+                       if (Path.IsPathRooted (filename))
+                               return null;
 
-               public SourceFile FindFile (string filename)
-               {
-                       if (!Path.IsPathRooted (filename))
-                               filename = String.Concat (
-                                       
servant.ProcessStart.Options.WorkingDirectory,
-                                       DirectorySeparatorStr,
-                                       filename);
+                       filename = Path.GetFullPath (Path.Combine (
+                               servant.ProcessStart.Options.WorkingDirectory, 
filename));
 
-                       Module[] modules = servant.Modules;
-
                        foreach (Module module in modules) {
                                SourceFile file = module.FindFile (filename);
                                if (file != null)

Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2007-02-28 14:30:40 UTC (rev 73550)
+++ trunk/debugger/frontend/Command.cs  2007-02-28 14:31:55 UTC (rev 73551)
@@ -2211,9 +2211,25 @@
                        }
                }
 
+               protected bool FindFile (string filename, int line)
+               {
+                       SourceFile file = CurrentProcess.FindFile (filename);
+                       if (file == null)
+                               throw new ScriptingException ("Cannot find 
source file `{0}'.",
+                                                             filename);
+
+                       SourceMethod source = file.FindMethod (line);
+                       if (source == null)
+                               throw new ScriptingException (
+                                       "Cannot find method in line {0} in 
`{1}'.", line, file.Name);
+
+                       location = new SourceLocation (source, line);
+                       return true;
+               }
+
                protected override bool DoResolve (ScriptingContext context)
                {
-                       int line;
+                       int line = -1;
                        int pos = Argument.IndexOf (':');
                        if (pos >= 0) {
                                string filename = Argument.Substring (0, pos);
@@ -2223,8 +2239,7 @@
                                        throw new ScriptingException ("Expected 
filename:line");
                                }
 
-                               location = CurrentProcess.FindLocation 
(filename, line);
-                               return true;
+                               return FindFile (filename, line);
                        }
 
                        if (Argument == "") {
@@ -2234,13 +2249,15 @@
 
                        try {
                                line = (int) UInt32.Parse (Argument);
+                       } catch {
+                       }
+
+                       if (line != -1) {
                                location = context.CurrentLocation;
                                if (location.FileName == null)
                                        throw new ScriptingException ("Location 
doesn't have any source code.");
 
-                               location = CurrentProcess.FindLocation 
(location.FileName, line);
-                               return location != null;
-                       } catch {
+                               return FindFile (location.FileName, line);
                        }
 
                        MethodExpression mexpr;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to