[Monodevelop-patches-list] r2410 - in trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn: . Gui
Chris Toshok
toshok at mono-cvs.ximian.com
Thu Mar 31 22:57:44 EST 2005
Author: toshok
Date: 2005-03-31 22:57:44 -0500 (Thu, 31 Mar 2005)
New Revision: 2410
Modified:
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugAttributeHandler.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerStackTracePad.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerThreadPad.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs
Log:
2005-03-31 Chris Toshok <toshok at ximian.com>
* DebuggingService.cs: track BreakpointHandle api change, and use
Runtime.DispatchService instead of Gtk.ThreadNotify.
* DebuggerCommands.cs: use Runtime.* instead of
ServiceManager.GetService(...)
* DebuggerAttributeHandler.cs: same.
* Gui/DebuggerStackTracePad.cs: same.
* Gui/DebuggerStackVariablePad.cs: same.
* Gui/DebuggerThreadPad.cs: same, and make this properly
update-without-clearing-the-store, like the other pads.
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog 2005-04-01 03:57:44 UTC (rev 2410)
@@ -1,3 +1,20 @@
+2005-03-31 Chris Toshok <toshok at ximian.com>
+
+ * DebuggingService.cs: track BreakpointHandle api change, and use
+ Runtime.DispatchService instead of Gtk.ThreadNotify.
+
+ * DebuggerCommands.cs: use Runtime.* instead of
+ ServiceManager.GetService(...)
+
+ * DebuggerAttributeHandler.cs: same.
+
+ * Gui/DebuggerStackTracePad.cs: same.
+
+ * Gui/DebuggerStackVariablePad.cs: same.
+
+ * Gui/DebuggerThreadPad.cs: same, and make this properly
+ update-without-clearing-the-store, like the other pads.
+
2005-03-29 Chris Toshok <toshok at ximian.com>
* Gui/DebuggerVariablePad.cs: display "this" if we're in a method
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugAttributeHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugAttributeHandler.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugAttributeHandler.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -57,7 +57,7 @@
public string EvaluateDebuggerDisplay (ITargetObject obj, string display)
{
StringBuilder sb = new StringBuilder ("");
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
+ DebuggingService dbgr = (DebuggingService)Runtime.DebuggingService;
EvaluationContext ctx = new EvaluationContext (obj);
ctx.CurrentProcess = new ProcessHandle (dbgr.MainThread);
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -11,11 +11,10 @@
{
public override void Run ()
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- if (dbgr.IsRunning)
- dbgr.Pause ();
+ if (Runtime.DebuggingService.IsRunning)
+ Runtime.DebuggingService.Pause ();
else
- dbgr.Resume ();
+ Runtime.DebuggingService.Resume ();
}
}
@@ -23,9 +22,7 @@
{
public override void Run ()
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
-
- dbgr.Stop ();
+ Runtime.DebuggingService.Stop();
}
}
@@ -33,9 +30,7 @@
{
public override void Run ()
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
-
- dbgr.StepOver ();
+ Runtime.DebuggingService.StepOver();
}
}
@@ -43,9 +38,7 @@
{
public override void Run ()
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
-
- dbgr.StepInto ();
+ Runtime.DebuggingService.StepInto();
}
}
@@ -54,26 +47,17 @@
public override void Run ()
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- IProjectService projServ = (IProjectService)ServiceManager.GetService (typeof (IProjectService));
+ DebuggingService dbgr = (DebuggingService)Runtime.DebuggingService;
- if (projServ.CurrentOpenCombine != null) {
- //try {
- if (projServ.NeedsCompiling) {
- projServ.BuildActiveCombine ().WaitForCompleted ();
- }
- // if (projServ.BeforeStartProject != null)
- // projServ.BeforeStartProject (projServ, null);
-
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ if (Runtime.ProjectService.NeedsCompiling) {
+ Runtime.ProjectService.BuildActiveCombine ().WaitForCompleted ();
+ }
#if NET_2_0
- dbgr.AttributeHandler.Rescan();
+ dbgr.AttributeHandler.Rescan();
#endif
- projServ.CurrentOpenCombine.Debug (dbgr.DebugProgressMonitor);
- //} catch {
- // IMessageService msgServ = (IMessageService)ServiceManager.Services.GetService (typeof (IMessageService));
- // msgServ.ShowError ("Can't execute the debugger");
- //}
+ Runtime.ProjectService.CurrentOpenCombine.Debug (dbgr.DebugProgressMonitor);
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -126,7 +126,7 @@
{
string key = filename + ":" + linenum;
if (Debugging)
- ((BreakpointHandle)breakpoints [key]).RemoveBreakpoint (proc);
+ ((BreakpointHandle)breakpoints [key]).Remove (proc);
breakpoints.Remove (key);
}
@@ -150,7 +150,7 @@
process.DebuggerError += new DebuggerErrorHandler (debugger_error);
}
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitThreadStateEvent)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (EmitThreadStateEvent), null);
}
private void thread_exited (ThreadManager manager, Process process)
@@ -159,7 +159,7 @@
procs.Remove (process.ID);
}
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitThreadStateEvent)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (EmitThreadStateEvent), null);
}
private void initialized_event (ThreadManager manager, Process process)
@@ -171,7 +171,7 @@
proc.DebuggerError += new DebuggerErrorHandler (debugger_error);
proc.TargetEvent += new TargetEventHandler (target_event);
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitStarted)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (EmitStarted), null);
}
void target_output (bool is_stderr, string line)
@@ -194,11 +194,11 @@
switch (args.Type) {
case TargetEventType.TargetExited:
case TargetEventType.TargetSignaled:
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (KillApplication)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (KillApplication), null);
break;
case TargetEventType.TargetStopped:
case TargetEventType.TargetRunning:
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (ChangeState)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (ChangeState), null);
break;
case TargetEventType.TargetHitBreakpoint:
default:
@@ -227,23 +227,23 @@
}
}
- void EmitThreadStateEvent ()
+ void EmitThreadStateEvent (object obj)
{
if (ThreadStateEvent != null)
ThreadStateEvent (this, new EventArgs ());
}
- void EmitStarted ()
+ void EmitStarted (object obj)
{
insert_breakpoints ();
if (StartedEvent != null)
StartedEvent (this, new EventArgs ());
- ChangeState ();
+ ChangeState (obj);
}
- void ChangeState ()
+ void ChangeState (object obj)
{
if (ThreadStateEvent != null)
ThreadStateEvent (this, new EventArgs ());
@@ -262,7 +262,7 @@
public event EventHandler StoppedEvent;
public event EventHandler ThreadStateEvent;
- void KillApplication ()
+ void KillApplication (object obj)
{
Cleanup ();
}
@@ -403,10 +403,10 @@
private void OnBreakpointHit (Breakpoint pointFromDbg, StackFrame frame)
{
point = pointFromDbg;
- new Gtk.ThreadNotify (new Gtk.ReadyEvent (MainThreadNotify)).WakeupMain();
+ Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (MainThreadNotify), null);
}
- void MainThreadNotify ()
+ void MainThreadNotify (object obj)
{
string[] toks = point.Name.Split (':');
string filename = toks [0];
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerStackTracePad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerStackTracePad.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerStackTracePad.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -44,10 +44,9 @@
Add (tree);
ShowAll ();
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- dbgr.PausedEvent += new EventHandler (OnPausedEvent);
- dbgr.ResumedEvent += new EventHandler (OnResumedEvent);
- dbgr.StoppedEvent += new EventHandler (OnStoppedEvent);
+ Runtime.DebuggingService.PausedEvent += new EventHandler (OnPausedEvent);
+ Runtime.DebuggingService.ResumedEvent += new EventHandler (OnResumedEvent);
+ Runtime.DebuggingService.StoppedEvent += new EventHandler (OnStoppedEvent);
}
public void UpdateDisplay ()
@@ -55,8 +54,7 @@
if ((current_frame == null) || (current_frame.Method == null))
return;
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- string[] trace = dbgr.Backtrace;
+ string[] trace = Runtime.DebuggingService.Backtrace;
TreeIter it;
if (!store.GetIterFirst (out it)) {
@@ -89,8 +87,7 @@
protected void OnPausedEvent (object o, EventArgs args)
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- current_frame = (StackFrame)dbgr.CurrentFrame;
+ current_frame = (StackFrame)Runtime.DebuggingService.CurrentFrame;
UpdateDisplay ();
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerThreadPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerThreadPad.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerThreadPad.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -19,9 +19,12 @@
{
Gtk.TreeView tree;
Gtk.TreeStore store;
+ Hashtable thread_rows;
public DebuggerThreadPad ()
{
+ thread_rows = new Hashtable ();
+
this.ShadowType = ShadowType.In;
store = new TreeStore (typeof (int),
@@ -75,11 +78,10 @@
Add (tree);
ShowAll ();
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- dbgr.ThreadStateEvent += new EventHandler (OnThreadEvent);
+ ((DebuggingService)Runtime.DebuggingService).ThreadStateEvent += new EventHandler (OnThreadEvent);
}
- void add_thread (Process thread)
+ void AddThread (Process thread)
{
TreeIter iter;
store.Append (out iter);
@@ -87,31 +89,84 @@
store.SetValue (iter, 1, new GLib.Value (thread.PID));
store.SetValue (iter, 2, new GLib.Value (thread.State.ToString()));
if (thread.IsStopped)
- store.SetValue (iter, 3, new GLib.Value (thread.GetBacktrace().Frames[0].SourceAddress.Name));
+ store.SetValue (iter, 3, new GLib.Value (thread.GetBacktrace().Frames[0].SourceAddress.Name));
else
- store.SetValue (iter, 3, new GLib.Value (""));
+ store.SetValue (iter, 3, new GLib.Value (""));
+ thread_rows.Add (thread, new TreeRowReference (store, store.GetPath (iter)));
}
- Hashtable iters = null;
+ void UpdateThread (Process thread)
+ {
+ TreeRowReference row = (TreeRowReference)thread_rows[thread];
+ TreeIter iter;
- public void CleanDisplay ()
+ if (row != null && store.GetIter (out iter, row.Path)) {
+ if (thread.ID != (int)store.GetValue (iter, 0))
+ store.SetValue (iter, 0, thread.ID);
+ if (thread.PID != (int)store.GetValue (iter, 1))
+ store.SetValue (iter, 1, thread.PID);
+ if (thread.State.ToString() != (string)store.GetValue (iter, 2))
+ store.SetValue (iter, 2, thread.State.ToString());
+
+ string location;
+ if (thread.IsStopped)
+ location = thread.GetBacktrace().Frames[0].SourceAddress.Name;
+ else
+ location = "";
+
+ if (location != (string)store.GetValue (iter, 3))
+ store.SetValue (iter, 3, location);
+ }
+ else {
+ AddThread (thread);
+ }
+ }
+
+ void RemoveThread (Process thread)
{
- store.Clear ();
- iters = new Hashtable ();
+ TreeRowReference row = (TreeRowReference)thread_rows[thread];
+ TreeIter iter;
+
+ if (row != null && store.GetIter (out iter, row.Path))
+ store.Remove (ref iter);
+
+ thread_rows.Remove (thread);
}
public void UpdateDisplay ()
{
- CleanDisplay ();
+ Hashtable threads_to_remove = new Hashtable();
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- Process[] threads = dbgr.Threads;
+ foreach (Process thread in thread_rows.Keys) {
+ threads_to_remove.Add (thread, thread);
+ }
- foreach (Process t in threads)
- if (!t.IsDaemon)
- add_thread (t);
+ foreach (Process t in ((DebuggingService)Runtime.DebuggingService).Threads) {
+ if (!t.IsDaemon) {
+ UpdateThread (t);
+ threads_to_remove.Remove (t);
+ }
+ }
+
+ foreach (Process t in threads_to_remove.Keys) {
+ RemoveThread (t);
+ }
}
+ public void CleanDisplay ()
+ {
+ UpdateDisplay ();
+ }
+
+ public void RedrawContent ()
+ {
+ UpdateDisplay ();
+ }
+
+ public void BringToFront ()
+ {
+ }
+
protected void OnThreadEvent (object o, EventArgs args)
{
UpdateDisplay ();
@@ -143,15 +198,6 @@
}
}
- public void RedrawContent ()
- {
- UpdateDisplay ();
- }
-
- public void BringToFront ()
- {
- }
-
protected virtual void OnTitleChanged(EventArgs e)
{
if (TitleChanged != null) {
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs 2005-03-31 23:42:47 UTC (rev 2409)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs 2005-04-01 03:57:44 UTC (rev 2410)
@@ -90,9 +90,8 @@
Add (tree);
ShowAll ();
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- dbgr.PausedEvent += new EventHandler (OnPausedEvent);
- dbgr.StoppedEvent += new EventHandler (OnStoppedEvent);
+ Runtime.DebuggingService.PausedEvent += new EventHandler (OnPausedEvent);
+ Runtime.DebuggingService.StoppedEvent += new EventHandler (OnStoppedEvent);
}
bool InsertArrayChildren (TreeIter parent, ITargetArrayObject array)
@@ -220,8 +219,6 @@
ITargetStructObject proxy_obj = ctor.Type.InvokeStatic (frame, args, false) as ITargetStructObject;
if (proxy_obj != null) {
- ResourceService res = (ResourceService)ServiceManager.GetService (typeof (ResourceService));
-
foreach (ITargetPropertyInfo prop in proxy_obj.Type.Properties) {
InsertStructMember (parent, proxy_obj, prop, false);
}
@@ -230,7 +227,7 @@
store.SetValue (iter, NAME_COL, "Raw View");
store.SetValue (iter, RAW_VIEW_COL, true);
- Gdk.Pixbuf icon = res.GetIcon (Stock.Class, Gtk.IconSize.Menu);
+ Gdk.Pixbuf icon = Runtime.ResourceService.GetIcon (Stock.Class, Gtk.IconSize.Menu);
if (icon != null)
store.SetValue (iter, PIXBUF_COL, icon);
@@ -252,7 +249,7 @@
#if NET_2_0
if (!raw_view) {
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
+ DebuggingService dbgr = (DebuggingService)Runtime.DebuggingService;
DebuggerTypeProxyAttribute pattr = GetDebuggerTypeProxyAttribute (dbgr, sobj);
if (pattr != null) {
@@ -400,7 +397,7 @@
case TargetObjectKind.Class:
try {
#if NET_2_0
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
+ DebuggingService dbgr = (DebuggingService)Runtime.DebuggingService;
DebuggerDisplayAttribute dattr = GetDebuggerDisplayAttribute (dbgr, obj);
if (dattr != null) {
return dbgr.AttributeHandler.EvaluateDebuggerDisplay (obj, dattr.Value);
@@ -424,13 +421,11 @@
void AddObject (string name, string icon_name, ITargetObject obj, TreeIter iter)
{
- AmbienceService amb = (AmbienceService)ServiceManager.GetService (typeof (AmbienceService));
- ResourceService res = (ResourceService)ServiceManager.GetService (typeof (ResourceService));
-
store.SetValue (iter, NAME_COL, name);
store.SetValue (iter, VALUE_COL, GetObjectValueString (obj));
- store.SetValue (iter, TYPE_COL, obj == null ? "" : amb.CurrentAmbience.GetIntrinsicTypeName (obj.TypeInfo.Type.Name));
- Gdk.Pixbuf icon = res.GetIcon (icon_name, Gtk.IconSize.Menu);
+ store.SetValue (iter, TYPE_COL,
+ obj == null ? "" : Runtime.Ambience.CurrentAmbience.GetIntrinsicTypeName (obj.TypeInfo.Type.Name));
+ Gdk.Pixbuf icon = Runtime.ResourceService.GetIcon (icon_name, Gtk.IconSize.Menu);
if (icon != null)
store.SetValue (iter, PIXBUF_COL, icon);
if (obj != null)
@@ -439,24 +434,22 @@
string GetIcon (ITargetObject obj)
{
- IconService iconSrv = (IconService)ServiceManager.GetService (typeof (IconService));
string icon = "";
if (obj.TypeInfo.Type.TypeHandle is Type)
- icon = iconSrv.GetIcon ((Type)obj.TypeInfo.Type.TypeHandle);
+ icon = Runtime.IconService.GetIcon ((Type)obj.TypeInfo.Type.TypeHandle);
return icon;
}
string GetIcon (ITargetMemberInfo member)
{
- IconService iconSrv = (IconService)ServiceManager.GetService (typeof (IconService));
string icon = "";
if (member.Handle is PropertyInfo)
- icon = iconSrv.GetIcon ((PropertyInfo)member.Handle);
+ icon = Runtime.IconService.GetIcon ((PropertyInfo)member.Handle);
else if (member.Handle is FieldInfo)
- icon = iconSrv.GetIcon ((FieldInfo)member.Handle);
+ icon = Runtime.IconService.GetIcon ((FieldInfo)member.Handle);
return icon;
}
@@ -622,15 +615,13 @@
protected void OnStoppedEvent (object o, EventArgs args)
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- current_frame = (Mono.Debugger.StackFrame)dbgr.CurrentFrame;
+ current_frame = (Mono.Debugger.StackFrame)Runtime.DebuggingService.CurrentFrame;
UpdateDisplay ();
}
protected void OnPausedEvent (object o, EventArgs args)
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
- current_frame = (Mono.Debugger.StackFrame)dbgr.CurrentFrame;
+ current_frame = (Mono.Debugger.StackFrame)Runtime.DebuggingService.CurrentFrame;
UpdateDisplay ();
}
More information about the Monodevelop-patches-list
mailing list