Author: martin
Date: 2006-04-17 22:36:17 -0400 (Mon, 17 Apr 2006)
New Revision: 59573

Added:
   trunk/debugger/backends/ModuleManager.cs
   trunk/debugger/backends/SymbolTableManager.cs
Removed:
   trunk/debugger/classes/ModuleManager.cs
   trunk/debugger/classes/SymbolTableManager.cs
Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backends/Process.cs
   trunk/debugger/frontend/Command.cs
   trunk/debugger/frontend/Completer.cs
   trunk/debugger/frontend/Interpreter.cs
   trunk/debugger/frontend/ScriptingContext.cs
Log:
2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>

        * classes/SymbolTableManager.cs: Moved to ../backends/
        * classes/ModuleManager.cs: Moved to ../backends/

        * backends/Process.cs
        (Process.ModuleManager): Make this internal.
        (Process.SymbolTableManager): Make this internal.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2006-04-18 02:12:49 UTC (rev 59572)
+++ trunk/debugger/ChangeLog    2006-04-18 02:36:17 UTC (rev 59573)
@@ -1,5 +1,14 @@
 2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * classes/SymbolTableManager.cs: Moved to ../backends/
+       * classes/ModuleManager.cs: Moved to ../backends/
+
+       * backends/Process.cs
+       (Process.ModuleManager): Make this internal.
+       (Process.SymbolTableManager): Make this internal.
+
+2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>
+
        * backends/classes/*TargetLocation.cs: Moved to languages/
        * backends/classes/MonoVariableLocation: Moved to languages/mono/.
 

Copied: trunk/debugger/backends/ModuleManager.cs (from rev 59571, 
trunk/debugger/classes/ModuleManager.cs)
===================================================================
--- trunk/debugger/classes/ModuleManager.cs     2006-04-18 02:08:00 UTC (rev 
59571)
+++ trunk/debugger/backends/ModuleManager.cs    2006-04-18 02:36:17 UTC (rev 
59573)
@@ -0,0 +1,137 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace Mono.Debugger.Backends
+{
+       public delegate void ModulesChangedHandler ();
+       public delegate void BreakpointsChangedHandler ();
+
+       internal class ModuleManager : MarshalByRefObject
+       {
+               Hashtable modules = new Hashtable ();
+
+               internal ModuleManager ()
+               {
+               }
+
+               public Module GetModule (string name)
+               {
+                       return (Module) modules [name];
+               }
+
+               public void AddModule (Module module)
+               {
+                       modules.Add (module.Name, module);
+
+                       new ModuleEventSink (this, module);
+
+                       module_changed (module);
+               }
+
+               internal Module CreateModule (string name)
+               {
+                       Module module = (Module) modules [name];
+                       if (module != null)
+                               return module;
+
+                       module = new Module (name);
+                       modules.Add (name, module);
+                       return module;
+               }
+
+               public event ModulesChangedHandler ModulesChanged;
+               public event BreakpointsChangedHandler BreakpointsChanged;
+
+               public Module[] Modules {
+                       get {
+                               Module[] retval = new Module 
[modules.Values.Count];
+                               modules.Values.CopyTo (retval, 0);
+                               return retval;
+                       }
+               }
+
+               int locked = 0;
+               bool needs_module_update = false;
+               bool needs_breakpoint_update = false;
+
+               public void Lock ()
+               {
+                       locked++;
+               }
+
+               public void UnLock ()
+               {
+                       if (--locked > 0)
+                               return;
+
+                       if (needs_module_update) {
+                               needs_module_update = false;
+                               OnModulesChanged ();
+                       }
+                       if (needs_breakpoint_update) {
+                               needs_breakpoint_update = false;
+                               OnBreakpointsChanged ();
+                       }
+               }
+
+               void module_changed (Module module)
+               {
+                       OnModulesChanged ();
+               }
+
+               void breakpoints_changed (Module module)
+               {
+                       OnBreakpointsChanged ();
+               }
+
+               protected virtual void OnModulesChanged ()
+               {
+                       if (locked > 0) {
+                               needs_module_update = true;
+                               return;
+                       }
+
+                       if (ModulesChanged != null)
+                               ModulesChanged ();
+               }
+
+               protected virtual void OnBreakpointsChanged ()
+               {
+                       if (locked > 0) {
+                               needs_breakpoint_update = true;
+                               return;
+                       }
+
+                       if (BreakpointsChanged != null)
+                               BreakpointsChanged ();
+               }
+
+               [Serializable]
+               protected class ModuleEventSink
+               {
+                       public readonly ModuleManager Manager;
+
+                       public ModuleEventSink (ModuleManager manager, Module 
module)
+                       {
+                               this.Manager = manager;
+
+                               module.SymbolsLoadedEvent += OnModuleChanged;
+                               module.SymbolsUnLoadedEvent += OnModuleChanged;
+                               module.BreakpointsChangedEvent += 
OnBreakpointsChanged;
+                       }
+
+                       public void OnModuleChanged (Module module)
+                       {
+                               Manager.module_changed (module);
+                       }
+
+                       public void OnBreakpointsChanged (Module module)
+                       {
+                               Manager.breakpoints_changed (module);
+                       }
+               }
+       }
+}

Modified: trunk/debugger/backends/Process.cs
===================================================================
--- trunk/debugger/backends/Process.cs  2006-04-18 02:12:49 UTC (rev 59572)
+++ trunk/debugger/backends/Process.cs  2006-04-18 02:36:17 UTC (rev 59573)
@@ -114,13 +114,13 @@
                        get { return breakpoint_manager; }
                }
 
-               public ModuleManager ModuleManager {
+               internal ModuleManager ModuleManager {
                        get {
                                return module_manager;
                        }
                }
 
-               public SymbolTableManager SymbolTableManager {
+               internal SymbolTableManager SymbolTableManager {
                        get {
                                return symtab_manager;
                        }

Copied: trunk/debugger/backends/SymbolTableManager.cs (from rev 59571, 
trunk/debugger/classes/SymbolTableManager.cs)
===================================================================
--- trunk/debugger/classes/SymbolTableManager.cs        2006-04-18 02:08:00 UTC 
(rev 59571)
+++ trunk/debugger/backends/SymbolTableManager.cs       2006-04-18 02:36:17 UTC 
(rev 59573)
@@ -0,0 +1,271 @@
+using System;
+using System.Collections;
+using ST = System.Threading;
+using System.Runtime.InteropServices;
+
+using Mono.Debugger.Backends;
+
+namespace Mono.Debugger.Backends
+{
+       // <summary>
+       //   This class maintains the debugger's symbol tables.
+       // </summary>
+       internal class SymbolTableManager : MarshalByRefObject, IDisposable
+       {
+               bool symtab_thread_exit;
+
+               ST.Thread symtab_thread;
+               ST.AutoResetEvent symtab_reload_event;
+               ST.ManualResetEvent symtabs_loaded_event;
+               ST.ManualResetEvent modules_loaded_event;
+               ST.ManualResetEvent update_completed_event;
+               bool symtab_update_in_progress;
+               bool module_update_in_progress;
+
+               internal SymbolTableManager ()
+               {
+                       symtab_reload_event = new ST.AutoResetEvent (false);
+                       symtabs_loaded_event = new ST.ManualResetEvent (true);
+                       modules_loaded_event = new ST.ManualResetEvent (true);
+                       update_completed_event = new ST.ManualResetEvent (true);
+                       symtab_thread = new ST.Thread (new ST.ThreadStart 
(symtab_thread_start));
+                       symtab_thread.IsBackground = true;
+                       symtab_thread.Start ();
+               }
+
+               // <summary>
+               //   Tell the SymbolTableManager that the modules have changed. 
 It will reload
+               //   the symbol tables in the background and emit the 
SymbolTableChangedEvent
+               //   when done.
+               // </summary>
+               internal void SetModules (ICollection modules)
+               {
+                       lock (this) {
+                               new_modules = modules;
+                               symtab_reload_event.Set ();
+                               symtabs_loaded_event.Reset ();
+                               modules_loaded_event.Reset ();
+                               update_completed_event.Reset ();
+                               symtab_update_in_progress = true;
+                               module_update_in_progress = true;
+                       }
+               }
+
+               // <summary>
+               //   Whether an update is currently in progress.
+               // </summary>
+               internal bool SymbolTableUpdateInProgress {
+                       get {
+                               lock (this) {
+                                       return symtab_update_in_progress;
+                               }
+                       }
+               }
+
+               // <summary>
+               //   Whether an update is currently in progress.
+               // </summary>
+               internal bool ModuleUpdateInProgress {
+                       get {
+                               lock (this) {
+                                       return module_update_in_progress;
+                               }
+                       }
+               }
+
+               public void Wait ()
+               {
+                       if (symtab_thread != null) {
+                               update_completed_event.WaitOne ();
+                       }
+               }
+
+               internal delegate void ModuleHandler (object sender, Module[] 
modules);
+
+               // <summary>
+               //   This event is emitted each time the modules have changed.
+               //   The modules won't change while this handler is running.
+               // </summary>
+               internal event ModuleHandler ModulesChangedEvent;
+
+               // <summary>
+               //   The current modules.  This property may change at any 
time, so you
+               //   should use the ModulesChangedEvent to get a notification.
+               // </summary>
+               public Module[] Modules {
+                       get {
+                               if (symtab_thread != null)
+                                       modules_loaded_event.WaitOne ();
+                               lock (this) {
+                                       return current_modules;
+                               }
+                       }
+               }
+
+               public Method Lookup (TargetAddress address)
+               {
+                       if (symtab_thread != null)
+                               symtabs_loaded_event.WaitOne ();
+                       lock (this) {
+                               if (current_symtab == null)
+                                       return null;
+                               return current_symtab.Lookup (address);
+                       }
+               }
+
+               public Symbol SimpleLookup (TargetAddress address, bool 
exact_match)
+               {
+                       if (symtab_thread != null) {
+                               symtabs_loaded_event.WaitOne ();
+                               modules_loaded_event.WaitOne ();
+                       }
+
+                       lock (this) {
+                               if (current_modules == null)
+                                       return null;
+
+                               foreach (Module module in current_modules) {
+                                       Symbol name = module.SimpleLookup 
(address, exact_match);
+                                       if (name != null)
+                                               return name;
+                               }
+
+                               return null;
+                       }
+               }
+
+               protected virtual void OnModulesChanged ()
+               {
+                       lock (this) {
+                               if (ModulesChangedEvent != null)
+                                       ModulesChangedEvent (this, 
current_modules);
+                       }
+               }
+
+               //
+               // The following fields are shared between the two threads !
+               //
+               ICollection new_modules = null;
+               ISymbolTable current_symtab = null;
+               Module[] current_modules = null;
+
+               // <summary>
+               //   This thread reloads the symbol tables in the background.
+               // </summary>
+
+               void symtab_thread_start ()
+               {
+                       Report.Debug (DebugFlags.Threads, "Symtab thread 
started: {0}",
+                                     DebuggerWaitHandle.CurrentThread);
+
+                       symtab_thread_main ();
+
+                       symtabs_loaded_event.Set ();
+                       modules_loaded_event.Set ();
+                       update_completed_event.Set ();
+                       symtab_update_in_progress = false;
+                       module_update_in_progress = false;
+                       symtab_thread = null;
+               }
+
+               void symtab_thread_main ()
+               {
+                       while (true) {
+                               symtab_reload_event.WaitOne ();
+
+                               if (symtab_thread_exit)
+                                       return;
+
+                               ICollection my_new_modules;
+
+                               lock (this) {
+                                       my_new_modules = new_modules;
+                                       new_modules = null;
+                               }
+
+                               if (my_new_modules == null) {
+                                       // Nothing to do, clear the events and 
continue.
+                                       symtabs_loaded_event.Set ();
+                                       modules_loaded_event.Set ();
+                                       update_completed_event.Set ();
+                                       symtab_update_in_progress = false;
+                                       module_update_in_progress = false;
+                                       continue;
+                               }
+
+                               // Updating the symbol tables doesn't take that 
long and they're also
+                               // needed by the SingleSteppingEngine, so let's 
do this first.
+
+                               SymbolTableCollection symtabs = new 
SymbolTableCollection ();
+                               symtabs.Lock ();
+
+                               foreach (Module module in my_new_modules) {
+                                       if (!module.SymbolsLoaded || 
!module.LoadSymbols)
+                                               continue;
+
+                                       ISymbolTable symtab = 
module.SymbolTable;
+                                       symtabs.AddSymbolTable (symtab);
+                               }
+
+                               symtabs.UnLock ();
+
+                               lock (this) {
+                                       current_symtab = symtabs;
+                                       // We need to clear this event as soon 
as we're done updating
+                                       // the symbol tables since the main 
thread may be waiting in
+                                       // the `SymbolTable' accessor.
+                                       symtabs_loaded_event.Set ();
+                                       symtab_update_in_progress = false;
+                               }
+
+                               lock (this) {
+                                       current_modules = new Module 
[my_new_modules.Count];
+                                       my_new_modules.CopyTo (current_modules, 
0);
+                                       modules_loaded_event.Set ();
+                                       module_update_in_progress = false;
+                                       OnModulesChanged ();
+                                       update_completed_event.Set ();
+                               }
+                       }
+               }
+
+               //
+               // IDisposable
+               //
+
+               private bool disposed = false;
+
+               private void check_disposed ()
+               {
+                       if (disposed)
+                               throw new ObjectDisposedException 
("SymbolTableManager");
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!this.disposed) {
+                               if (disposing) {
+                                       if (symtab_thread != null) {
+                                               symtab_thread_exit = true;
+                                               symtab_reload_event.Set ();
+                                               symtab_thread = null;
+                                       }
+                               }
+                               
+                               this.disposed = true;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       // Take yourself off the Finalization queue
+                       GC.SuppressFinalize (this);
+               }
+
+               ~SymbolTableManager ()
+               {
+                       Dispose (false);
+               }
+       }
+}

Deleted: trunk/debugger/classes/ModuleManager.cs
===================================================================
--- trunk/debugger/classes/ModuleManager.cs     2006-04-18 02:12:49 UTC (rev 
59572)
+++ trunk/debugger/classes/ModuleManager.cs     2006-04-18 02:36:17 UTC (rev 
59573)
@@ -1,137 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using System.Collections;
-using System.Runtime.InteropServices;
-
-namespace Mono.Debugger
-{
-       public delegate void ModulesChangedHandler ();
-       public delegate void BreakpointsChangedHandler ();
-
-       public class ModuleManager : MarshalByRefObject
-       {
-               Hashtable modules = new Hashtable ();
-
-               internal ModuleManager ()
-               {
-               }
-
-               public Module GetModule (string name)
-               {
-                       return (Module) modules [name];
-               }
-
-               public void AddModule (Module module)
-               {
-                       modules.Add (module.Name, module);
-
-                       new ModuleEventSink (this, module);
-
-                       module_changed (module);
-               }
-
-               internal Module CreateModule (string name)
-               {
-                       Module module = (Module) modules [name];
-                       if (module != null)
-                               return module;
-
-                       module = new Module (name);
-                       modules.Add (name, module);
-                       return module;
-               }
-
-               public event ModulesChangedHandler ModulesChanged;
-               public event BreakpointsChangedHandler BreakpointsChanged;
-
-               public Module[] Modules {
-                       get {
-                               Module[] retval = new Module 
[modules.Values.Count];
-                               modules.Values.CopyTo (retval, 0);
-                               return retval;
-                       }
-               }
-
-               int locked = 0;
-               bool needs_module_update = false;
-               bool needs_breakpoint_update = false;
-
-               public void Lock ()
-               {
-                       locked++;
-               }
-
-               public void UnLock ()
-               {
-                       if (--locked > 0)
-                               return;
-
-                       if (needs_module_update) {
-                               needs_module_update = false;
-                               OnModulesChanged ();
-                       }
-                       if (needs_breakpoint_update) {
-                               needs_breakpoint_update = false;
-                               OnBreakpointsChanged ();
-                       }
-               }
-
-               void module_changed (Module module)
-               {
-                       OnModulesChanged ();
-               }
-
-               void breakpoints_changed (Module module)
-               {
-                       OnBreakpointsChanged ();
-               }
-
-               protected virtual void OnModulesChanged ()
-               {
-                       if (locked > 0) {
-                               needs_module_update = true;
-                               return;
-                       }
-
-                       if (ModulesChanged != null)
-                               ModulesChanged ();
-               }
-
-               protected virtual void OnBreakpointsChanged ()
-               {
-                       if (locked > 0) {
-                               needs_breakpoint_update = true;
-                               return;
-                       }
-
-                       if (BreakpointsChanged != null)
-                               BreakpointsChanged ();
-               }
-
-               [Serializable]
-               protected class ModuleEventSink
-               {
-                       public readonly ModuleManager Manager;
-
-                       public ModuleEventSink (ModuleManager manager, Module 
module)
-                       {
-                               this.Manager = manager;
-
-                               module.SymbolsLoadedEvent += OnModuleChanged;
-                               module.SymbolsUnLoadedEvent += OnModuleChanged;
-                               module.BreakpointsChangedEvent += 
OnBreakpointsChanged;
-                       }
-
-                       public void OnModuleChanged (Module module)
-                       {
-                               Manager.module_changed (module);
-                       }
-
-                       public void OnBreakpointsChanged (Module module)
-                       {
-                               Manager.breakpoints_changed (module);
-                       }
-               }
-       }
-}

Deleted: trunk/debugger/classes/SymbolTableManager.cs
===================================================================
--- trunk/debugger/classes/SymbolTableManager.cs        2006-04-18 02:12:49 UTC 
(rev 59572)
+++ trunk/debugger/classes/SymbolTableManager.cs        2006-04-18 02:36:17 UTC 
(rev 59573)
@@ -1,271 +0,0 @@
-using System;
-using System.Collections;
-using ST = System.Threading;
-using System.Runtime.InteropServices;
-
-using Mono.Debugger.Backends;
-
-namespace Mono.Debugger
-{
-       // <summary>
-       //   This class maintains the debugger's symbol tables.
-       // </summary>
-       public class SymbolTableManager : MarshalByRefObject, IDisposable
-       {
-               bool symtab_thread_exit;
-
-               ST.Thread symtab_thread;
-               ST.AutoResetEvent symtab_reload_event;
-               ST.ManualResetEvent symtabs_loaded_event;
-               ST.ManualResetEvent modules_loaded_event;
-               ST.ManualResetEvent update_completed_event;
-               bool symtab_update_in_progress;
-               bool module_update_in_progress;
-
-               internal SymbolTableManager ()
-               {
-                       symtab_reload_event = new ST.AutoResetEvent (false);
-                       symtabs_loaded_event = new ST.ManualResetEvent (true);
-                       modules_loaded_event = new ST.ManualResetEvent (true);
-                       update_completed_event = new ST.ManualResetEvent (true);
-                       symtab_thread = new ST.Thread (new ST.ThreadStart 
(symtab_thread_start));
-                       symtab_thread.IsBackground = true;
-                       symtab_thread.Start ();
-               }
-
-               // <summary>
-               //   Tell the SymbolTableManager that the modules have changed. 
 It will reload
-               //   the symbol tables in the background and emit the 
SymbolTableChangedEvent
-               //   when done.
-               // </summary>
-               internal void SetModules (ICollection modules)
-               {
-                       lock (this) {
-                               new_modules = modules;
-                               symtab_reload_event.Set ();
-                               symtabs_loaded_event.Reset ();
-                               modules_loaded_event.Reset ();
-                               update_completed_event.Reset ();
-                               symtab_update_in_progress = true;
-                               module_update_in_progress = true;
-                       }
-               }
-
-               // <summary>
-               //   Whether an update is currently in progress.
-               // </summary>
-               internal bool SymbolTableUpdateInProgress {
-                       get {
-                               lock (this) {
-                                       return symtab_update_in_progress;
-                               }
-                       }
-               }
-
-               // <summary>
-               //   Whether an update is currently in progress.
-               // </summary>
-               internal bool ModuleUpdateInProgress {
-                       get {
-                               lock (this) {
-                                       return module_update_in_progress;
-                               }
-                       }
-               }
-
-               public void Wait ()
-               {
-                       if (symtab_thread != null) {
-                               update_completed_event.WaitOne ();
-                       }
-               }
-
-               internal delegate void ModuleHandler (object sender, Module[] 
modules);
-
-               // <summary>
-               //   This event is emitted each time the modules have changed.
-               //   The modules won't change while this handler is running.
-               // </summary>
-               internal event ModuleHandler ModulesChangedEvent;
-
-               // <summary>
-               //   The current modules.  This property may change at any 
time, so you
-               //   should use the ModulesChangedEvent to get a notification.
-               // </summary>
-               public Module[] Modules {
-                       get {
-                               if (symtab_thread != null)
-                                       modules_loaded_event.WaitOne ();
-                               lock (this) {
-                                       return current_modules;
-                               }
-                       }
-               }
-
-               public Method Lookup (TargetAddress address)
-               {
-                       if (symtab_thread != null)
-                               symtabs_loaded_event.WaitOne ();
-                       lock (this) {
-                               if (current_symtab == null)
-                                       return null;
-                               return current_symtab.Lookup (address);
-                       }
-               }
-
-               public Symbol SimpleLookup (TargetAddress address, bool 
exact_match)
-               {
-                       if (symtab_thread != null) {
-                               symtabs_loaded_event.WaitOne ();
-                               modules_loaded_event.WaitOne ();
-                       }
-
-                       lock (this) {
-                               if (current_modules == null)
-                                       return null;
-
-                               foreach (Module module in current_modules) {
-                                       Symbol name = module.SimpleLookup 
(address, exact_match);
-                                       if (name != null)
-                                               return name;
-                               }
-
-                               return null;
-                       }
-               }
-
-               protected virtual void OnModulesChanged ()
-               {
-                       lock (this) {
-                               if (ModulesChangedEvent != null)
-                                       ModulesChangedEvent (this, 
current_modules);
-                       }
-               }
-
-               //
-               // The following fields are shared between the two threads !
-               //
-               ICollection new_modules = null;
-               ISymbolTable current_symtab = null;
-               Module[] current_modules = null;
-
-               // <summary>
-               //   This thread reloads the symbol tables in the background.
-               // </summary>
-
-               void symtab_thread_start ()
-               {
-                       Report.Debug (DebugFlags.Threads, "Symtab thread 
started: {0}",
-                                     DebuggerWaitHandle.CurrentThread);
-
-                       symtab_thread_main ();
-
-                       symtabs_loaded_event.Set ();
-                       modules_loaded_event.Set ();
-                       update_completed_event.Set ();
-                       symtab_update_in_progress = false;
-                       module_update_in_progress = false;
-                       symtab_thread = null;
-               }
-
-               void symtab_thread_main ()
-               {
-                       while (true) {
-                               symtab_reload_event.WaitOne ();
-
-                               if (symtab_thread_exit)
-                                       return;
-
-                               ICollection my_new_modules;
-
-                               lock (this) {
-                                       my_new_modules = new_modules;
-                                       new_modules = null;
-                               }
-
-                               if (my_new_modules == null) {
-                                       // Nothing to do, clear the events and 
continue.
-                                       symtabs_loaded_event.Set ();
-                                       modules_loaded_event.Set ();
-                                       update_completed_event.Set ();
-                                       symtab_update_in_progress = false;
-                                       module_update_in_progress = false;
-                                       continue;
-                               }
-
-                               // Updating the symbol tables doesn't take that 
long and they're also
-                               // needed by the SingleSteppingEngine, so let's 
do this first.
-
-                               SymbolTableCollection symtabs = new 
SymbolTableCollection ();
-                               symtabs.Lock ();
-
-                               foreach (Module module in my_new_modules) {
-                                       if (!module.SymbolsLoaded || 
!module.LoadSymbols)
-                                               continue;
-
-                                       ISymbolTable symtab = 
module.SymbolTable;
-                                       symtabs.AddSymbolTable (symtab);
-                               }
-
-                               symtabs.UnLock ();
-
-                               lock (this) {
-                                       current_symtab = symtabs;
-                                       // We need to clear this event as soon 
as we're done updating
-                                       // the symbol tables since the main 
thread may be waiting in
-                                       // the `SymbolTable' accessor.
-                                       symtabs_loaded_event.Set ();
-                                       symtab_update_in_progress = false;
-                               }
-
-                               lock (this) {
-                                       current_modules = new Module 
[my_new_modules.Count];
-                                       my_new_modules.CopyTo (current_modules, 
0);
-                                       modules_loaded_event.Set ();
-                                       module_update_in_progress = false;
-                                       OnModulesChanged ();
-                                       update_completed_event.Set ();
-                               }
-                       }
-               }
-
-               //
-               // IDisposable
-               //
-
-               private bool disposed = false;
-
-               private void check_disposed ()
-               {
-                       if (disposed)
-                               throw new ObjectDisposedException 
("SymbolTableManager");
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!this.disposed) {
-                               if (disposing) {
-                                       if (symtab_thread != null) {
-                                               symtab_thread_exit = true;
-                                               symtab_reload_event.Set ();
-                                               symtab_thread = null;
-                                       }
-                               }
-                               
-                               this.disposed = true;
-                       }
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       // Take yourself off the Finalization queue
-                       GC.SuppressFinalize (this);
-               }
-
-               ~SymbolTableManager ()
-               {
-                       Dispose (false);
-               }
-       }
-}

Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2006-04-18 02:12:49 UTC (rev 59572)
+++ trunk/debugger/frontend/Command.cs  2006-04-18 02:36:17 UTC (rev 59573)
@@ -1443,7 +1443,18 @@
                {
                        protected override void DoExecute (ScriptingContext 
context)
                        {
-                               context.ShowModules ();
+                               Module[] modules = 
CurrentThread.Process.Modules;
+
+                               context.Print ("{0,4} {1,5} {2,5} {3}", "Id", 
"step?", "sym?", "Name");
+                               for (int i = 0; i < modules.Length; i++) {
+                                       Module module = modules [i];
+
+                                       context.Print ("{0,4} {1,5} {2,5} {3}",
+                                              i,
+                                              module.StepInto ? "y " : "n ",
+                                              module.SymbolsLoaded ? "y " : "n 
",
+                                              module.Name);
+                               }
                        }
                }
 
@@ -1471,7 +1482,7 @@
                                        }
                                }
 
-                               modules = context.GetModules (ids);
+                               modules = context.Interpreter.GetModules (ids);
                                return modules != null;
                        }
 
@@ -1506,7 +1517,7 @@
                                        }
                                }
 
-                               sources = context.GetSources (ids);
+                               sources = context.Interpreter.GetSources (ids);
                                return sources != null;
                        }
 

Modified: trunk/debugger/frontend/Completer.cs
===================================================================
--- trunk/debugger/frontend/Completer.cs        2006-04-18 02:12:49 UTC (rev 
59572)
+++ trunk/debugger/frontend/Completer.cs        2006-04-18 02:36:17 UTC (rev 
59573)
@@ -235,7 +235,7 @@
                        try {
                                ArrayList method_list = new ArrayList ();
                                string[] namespaces = context.GetNamespaces();
-                               Module[] modules = context.Modules;
+                               Module[] modules = context.GetProcess 
().Modules;
 
                                foreach (Module module in modules) {
                                        if (!module.SymbolsLoaded || 
!module.SymbolTable.HasMethods)

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2006-04-18 02:12:49 UTC (rev 
59572)
+++ trunk/debugger/frontend/Interpreter.cs      2006-04-18 02:36:17 UTC (rev 
59573)
@@ -684,23 +684,16 @@
 
                public string GetFullPathByFilename (string filename)
                {
-                       Process process = CurrentProcess;
-                       try {
-                               process.ModuleManager.Lock ();
+                       Module[] modules = CurrentProcess.Modules;
 
-                               Module[] modules = process.Modules;
+                       foreach (Module module in modules) {
+                               if (!module.SymbolsLoaded)
+                                       continue;
 
-                               foreach (Module module in modules) {
-                                       if (!module.SymbolsLoaded)
-                                               continue;
-
-                                       foreach (SourceFile source in 
module.Sources) {
-                                               if (filename.Equals 
(source.Name))
-                                                       return source.FileName;
-                                       }
+                               foreach (SourceFile source in module.Sources) {
+                                       if (filename.Equals (source.Name))
+                                               return source.FileName;
                                }
-                       } finally {
-                               process.ModuleManager.UnLock ();
                        }
 
                        return null;
@@ -720,6 +713,74 @@
                        return path;
                }
 
+               public Module[] GetModules (int[] indices)
+               {
+                       int pos = 0;
+                       Module[] retval = new Module [indices.Length];
+                       Module[] modules = CurrentProcess.Modules;
+
+                       foreach (int index in indices) {
+                               if ((index < 0) || (index > modules.Length))
+                                       throw new ScriptingException ("No such 
module {0}.", index);
+
+                               retval [pos++] = modules [index];
+                       }
+
+                       return retval;
+               }
+
+               public SourceFile[] GetSources (int[] indices)
+               {
+                       Hashtable source_hash = new Hashtable ();
+                       Module[] modules = CurrentProcess.Modules;
+
+                       foreach (Module module in modules) {
+                               if (!module.SymbolsLoaded)
+                                       continue;
+
+                               foreach (SourceFile source in module.Sources)
+                                       source_hash.Add (source.ID, source);
+                       }
+
+                       int pos = 0;
+                       SourceFile[] retval = new SourceFile [indices.Length];
+
+                       foreach (int index in indices) {
+                               SourceFile source = (SourceFile) source_hash 
[index];
+                               if (source == null)
+                                       throw new ScriptingException (
+                                               "No such source file: {0}", 
index);
+
+                               retval [pos++] = source;
+                       }
+
+                       return retval;
+               }
+
+               public void ModuleOperations (Module[] modules, 
ModuleOperation[] operations)
+               {
+                       foreach (Module module in modules) {
+                               foreach (ModuleOperation operation in 
operations) {
+                                       switch (operation) {
+                                       case ModuleOperation.Ignore:
+                                               module.LoadSymbols = false;
+                                               break;
+                                       case ModuleOperation.UnIgnore:
+                                               module.LoadSymbols = true;
+                                               break;
+                                       case ModuleOperation.Step:
+                                               module.StepInto = true;
+                                               break;
+                                       case ModuleOperation.DontStep:
+                                               module.StepInto = false;
+                                               break;
+                                       default:
+                                               throw new InternalError ();
+                                       }
+                               }
+                       }
+               }
+
                public Process[] Processes {
                        get {
                                if (debugger == null)

Modified: trunk/debugger/frontend/ScriptingContext.cs
===================================================================
--- trunk/debugger/frontend/ScriptingContext.cs 2006-04-18 02:12:49 UTC (rev 
59572)
+++ trunk/debugger/frontend/ScriptingContext.cs 2006-04-18 02:36:17 UTC (rev 
59573)
@@ -410,135 +410,6 @@
                        return process.FindMethod (name);
                }
 
-               public Module[] GetModules (int[] indices)
-               {
-                       Process process = GetProcess ();
-
-                       try {
-                               process.ModuleManager.Lock ();
-
-                               int pos = 0;
-                               Module[] retval = new Module [indices.Length];
-
-                               Module[] modules = process.Modules;
-
-                               foreach (int index in indices) {
-                                       if ((index < 0) || (index > 
modules.Length))
-                                               throw new ScriptingException 
("No such module {0}.", index);
-
-                                       retval [pos++] = modules [index];
-                               }
-
-                               return retval;
-                       } finally {
-                               process.ModuleManager.UnLock ();
-                       }
-               }
-
-               public Module[] Modules {
-                       get {
-                               Process process = GetProcess ();
-                               return process.Modules;
-                       }
-               }
-
-               public SourceFile[] GetSources (int[] indices)
-               {
-                       Process process = GetProcess ();
-
-                       try {
-                               process.ModuleManager.Lock ();
-
-                               Hashtable source_hash = new Hashtable ();
-
-                               Module[] modules = process.Modules;
-
-                               foreach (Module module in modules) {
-                                       if (!module.SymbolsLoaded)
-                                               continue;
-
-                                       foreach (SourceFile source in 
module.Sources)
-                                               source_hash.Add (source.ID, 
source);
-                               }
-
-                               int pos = 0;
-                               SourceFile[] retval = new SourceFile 
[indices.Length];
-
-                               foreach (int index in indices) {
-                                       SourceFile source = (SourceFile) 
source_hash [index];
-                                       if (source == null)
-                                               throw new ScriptingException (
-                                                       "No such source file: 
{0}", index);
-
-                                       retval [pos++] = source;
-                               }
-
-                               return retval;
-                       } finally {
-                               process.ModuleManager.UnLock ();
-                       }
-               }
-
-               public void ShowModules ()
-               {
-                       Process process = GetProcess ();
-
-                       try {
-                               process.ModuleManager.Lock ();
-                               Module[] modules = process.Modules;
-
-                               Print ("{0,4} {1,5} {2,5} {3}", "Id", "step?", 
"sym?", "Name");
-                               for (int i = 0; i < modules.Length; i++) {
-                                       Module module = modules [i];
-
-                                       Print ("{0,4} {1,5} {2,5} {3}",
-                                              i,
-                                              module.StepInto ? "y " : "n ",
-                                              module.SymbolsLoaded ? "y " : "n 
",
-                                              module.Name);
-                               }
-                       } finally {
-                               process.ModuleManager.UnLock ();
-                       }
-               }
-
-               void module_operation (Module module, ModuleOperation[] 
operations)
-               {
-                       foreach (ModuleOperation operation in operations) {
-                               switch (operation) {
-                               case ModuleOperation.Ignore:
-                                       module.LoadSymbols = false;
-                                       break;
-                               case ModuleOperation.UnIgnore:
-                                       module.LoadSymbols = true;
-                                       break;
-                               case ModuleOperation.Step:
-                                       module.StepInto = true;
-                                       break;
-                               case ModuleOperation.DontStep:
-                                       module.StepInto = false;
-                                       break;
-                               default:
-                                       throw new InternalError ();
-                               }
-                       }
-               }
-
-               public void ModuleOperations (Module[] modules, 
ModuleOperation[] operations)
-               {
-                       Process process = GetProcess ();
-
-                       try {
-                               process.ModuleManager.Lock ();
-
-                               foreach (Module module in modules)
-                                       module_operation (module, operations);
-                       } finally {
-                               process.ModuleManager.UnLock ();
-                               process.SymbolTableManager.Wait ();
-                       }
-               }
-
                public void ShowSources (Module module)
                {
                        if (!module.SymbolsLoaded)

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

Reply via email to