Author: martin
Date: 2006-04-03 09:52:57 -0400 (Mon, 03 Apr 2006)
New Revision: 58952
Modified:
trunk/debugger/ChangeLog
trunk/debugger/arch/CoreFile.cs
trunk/debugger/backends/Debugger.cs
trunk/debugger/backends/MonoThreadManager.cs
trunk/debugger/backends/Process.cs
trunk/debugger/backends/Thread.cs
Log:
2006-04-03 Martin Baulig <[EMAIL PROTECTED]>
* backends/Process.cs
(Process.ID): New public property.
(Process.Threads): New public property.
(Process.TargetApplication): New public property.
(Process.CommandLineArguments): New public property.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2006-04-03 13:47:42 UTC (rev 58951)
+++ trunk/debugger/ChangeLog 2006-04-03 13:52:57 UTC (rev 58952)
@@ -1,5 +1,13 @@
2006-04-03 Martin Baulig <[EMAIL PROTECTED]>
+ * backends/Process.cs
+ (Process.ID): New public property.
+ (Process.Threads): New public property.
+ (Process.TargetApplication): New public property.
+ (Process.CommandLineArguments): New public property.
+
+2006-04-03 Martin Baulig <[EMAIL PROTECTED]>
+
* classes/Breakpoint.cs (Breakpoint): Implement ICloneable.
(Breakpoint.Clone): New public method.
Modified: trunk/debugger/arch/CoreFile.cs
===================================================================
--- trunk/debugger/arch/CoreFile.cs 2006-04-03 13:47:42 UTC (rev 58951)
+++ trunk/debugger/arch/CoreFile.cs 2006-04-03 13:52:57 UTC (rev 58952)
@@ -87,7 +87,9 @@
continue;
int pid = Int32.Parse (section.name.Substring
(5));
- threads.Add (new CoreFileThread (this, pid));
+ CoreFileThread thread = new CoreFileThread
(this, pid);
+ OnThreadCreatedEvent (thread.Thread);
+ threads.Add (thread);
}
return;
@@ -124,17 +126,6 @@
#endif
}
- public Thread[] Threads {
- get {
- Thread[] retval = new Thread [threads.Count];
- for (int i = 0; i < threads.Count; i++) {
- CoreFileThread thread =
(CoreFileThread) threads [i];
- retval [i] = thread.Thread;
- }
- return retval;
- }
- }
-
public Bfd Bfd {
get { return bfd; }
}
Modified: trunk/debugger/backends/Debugger.cs
===================================================================
--- trunk/debugger/backends/Debugger.cs 2006-04-03 13:47:42 UTC (rev 58951)
+++ trunk/debugger/backends/Debugger.cs 2006-04-03 13:52:57 UTC (rev 58952)
@@ -118,6 +118,16 @@
}
}
+ public Process[] Processes {
+ get {
+ lock (process_hash.SyncRoot) {
+ Process[] procs = new Process
[process_hash.Count];
+ process_hash.Values.CopyTo (procs, 0);
+ return procs;
+ }
+ }
+ }
+
public void Error (string message, params object[] args)
{
Console.WriteLine ("ERROR: " + String.Format (message,
args));
Modified: trunk/debugger/backends/MonoThreadManager.cs
===================================================================
--- trunk/debugger/backends/MonoThreadManager.cs 2006-04-03 13:47:42 UTC
(rev 58951)
+++ trunk/debugger/backends/MonoThreadManager.cs 2006-04-03 13:52:57 UTC
(rev 58952)
@@ -147,9 +147,9 @@
main_engine.Attach (debugger_info);
}
- public CommandResult GetThreadID (SingleSteppingEngine engine)
+ public CommandResult GetThreadID (Thread thread)
{
- return engine.GetThreadID (this, debugger_info);
+ return thread.GetThreadID (this, debugger_info);
}
internal void SetThreadId (SingleSteppingEngine engine)
Modified: trunk/debugger/backends/Process.cs
===================================================================
--- trunk/debugger/backends/Process.cs 2006-04-03 13:47:42 UTC (rev 58951)
+++ trunk/debugger/backends/Process.cs 2006-04-03 13:52:57 UTC (rev 58952)
@@ -32,6 +32,9 @@
ThreadGroup global_thread_group;
ThreadGroup main_thread_group;
+ int id = ++next_id;
+ static int next_id = 0;
+
internal Process (ThreadManager manager, ProcessStart start)
{
this.manager = manager;
@@ -86,6 +89,10 @@
initialized_event = new ST.ManualResetEvent (false);
}
+ public int ID {
+ get { return id; }
+ }
+
internal ThreadManager ThreadManager {
get { return manager; }
}
@@ -153,6 +160,14 @@
get { return mono_manager != null; }
}
+ public string TargetApplication {
+ get { return start.TargetApplication; }
+ }
+
+ public string[] CommandLineArguments {
+ get { return start.CommandLineArguments; }
+ }
+
public event ModulesChangedHandler ModulesChangedEvent;
public event BreakpointsChangedHandler BreakpointsChangedEvent;
@@ -203,7 +218,6 @@
Report.Debug (DebugFlags.Threads, "Thread created: {0}
{1}", pid, new_thread);
- thread_hash.Add (pid, new_thread);
manager.AddEngine (new_thread);
if ((mono_manager != null) && !do_attach &&
@@ -212,7 +226,7 @@
// main_engine = new_thread;
}
- manager.Debugger.OnThreadCreatedEvent
(new_thread.Thread);
+ OnThreadCreatedEvent (new_thread.Thread);
if (!do_attach)
new_thread.Start (TargetAddress.Null);
@@ -236,7 +250,7 @@
new_process.main_engine = new_thread;
manager.Debugger.OnProcessCreatedEvent (new_process);
- manager.Debugger.OnThreadCreatedEvent
(new_thread.Thread);
+ OnThreadCreatedEvent (new_thread.Thread);
manager.AddEngine (new_thread);
new_thread.Start (TargetAddress.Null);
@@ -251,7 +265,18 @@
main_engine.Start (main_method);
}
+
+ protected void OnThreadCreatedEvent (Thread new_thread)
+ {
+ thread_hash.Add (new_thread.PID, new_thread);
+ manager.Debugger.OnThreadCreatedEvent (new_thread);
+ }
+ internal void OnThreadExitedEvent (Thread new_thread)
+ {
+ manager.Debugger.OnThreadExitedEvent (new_thread);
+ }
+
internal void WaitForApplication ()
{
initialized_event.WaitOne ();
@@ -267,7 +292,7 @@
mono_manager = MonoThreadManager.Initialize (
manager, inferior, start.PID != 0);
- thread_hash.Add (engine.PID, engine);
+ thread_hash.Add (engine.PID, engine.Thread);
if (start.PID != 0) {
int[] threads = inferior.GetThreads ();
@@ -281,7 +306,7 @@
goto done;
attach_results = new ArrayList ();
- foreach (SingleSteppingEngine thread in
thread_hash.Values)
+ foreach (Thread thread in thread_hash.Values)
attach_results.Add
(mono_manager.GetThreadID (thread));
}
@@ -300,15 +325,18 @@
internal void Kill ()
{
- SingleSteppingEngine[] threads = new
SingleSteppingEngine [thread_hash.Count];
- thread_hash.Values.CopyTo (threads, 0);
+ Thread[] threads;
+ lock (thread_hash.SyncRoot) {
+ threads = new Thread [thread_hash.Count];
+ thread_hash.Values.CopyTo (threads, 0);
+ }
bool main_in_threads = false;
for (int i = 0; i < threads.Length; i++) {
- SingleSteppingEngine thread = threads [i];
+ Thread thread = threads [i];
- if (main_engine == thread) {
+ if (main_engine.Thread == thread) {
main_in_threads = true;
continue;
}
@@ -327,7 +355,7 @@
} else {
thread_hash.Remove (engine.PID);
engine.Thread.Kill ();
- manager.Debugger.OnThreadExitedEvent
(engine.Thread);
+ OnThreadExitedEvent (engine.Thread);
}
}
@@ -404,6 +432,15 @@
return null;
}
+ public Thread[] Threads {
+ get {
+ lock (thread_hash.SyncRoot) {
+ Thread[] threads = new Thread
[thread_hash.Count];
+ thread_hash.Values.CopyTo (threads, 0);
+ return threads;
+ }
+ }
+ }
//
// Thread Groups
Modified: trunk/debugger/backends/Thread.cs
===================================================================
--- trunk/debugger/backends/Thread.cs 2006-04-03 13:47:42 UTC (rev 58951)
+++ trunk/debugger/backends/Thread.cs 2006-04-03 13:52:57 UTC (rev 58952)
@@ -631,6 +631,13 @@
result.Wait ();
}
+ internal CommandResult GetThreadID (MonoThreadManager
mono_manager,
+ MonoDebuggerInfo
debugger_info)
+ {
+ check_engine ();
+ return engine.GetThreadID (mono_manager, debugger_info);
+ }
+
public bool HasTarget {
get { return engine != null; }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches