2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / class / Mono.Debugger.Soft / Mono.Debugger.Soft / ThreadMirror.cs
blobd18804bd89a67a79b855263af0dc1cb3d2a6d563
1 using System;
2 using System.Threading;
4 namespace Mono.Debugger.Soft
6 public class ThreadMirror : ObjectMirror
8 string name;
10 internal ThreadMirror (VirtualMachine vm, long id) : base (vm, id) {
13 // FIXME: Cache, invalidate when the thread/runtime is resumed
14 public StackFrame[] GetFrames () {
15 FrameInfo[] frame_info = vm.conn.Thread_GetFrameInfo (id, 0, -1);
17 StackFrame[] frames = new StackFrame [frame_info.Length];
18 for (int i = 0; i < frame_info.Length; ++i) {
19 FrameInfo info = (FrameInfo)frame_info [i];
20 MethodMirror method = vm.GetMethod (info.method);
21 frames [i] = new StackFrame (vm, info.id, this, method, info.il_offset, info.flags);
24 return frames;
27 public string Name {
28 get {
29 if (name == null)
30 name = vm.conn.Thread_GetName (id);
31 return name;
35 public new long Id {
36 get {
37 return id;
41 public ThreadState ThreadState {
42 get {
43 return (ThreadState)vm.conn.Thread_GetState (id);
47 public bool IsThreadPoolThread {
48 get {
49 ThreadInfo info = vm.conn.Thread_GetInfo (id);
51 return info.is_thread_pool;
56 * Return a unique identifier for this thread, multiple ThreadMirror objects
57 * may have the same ThreadId because of appdomains.
59 public long ThreadId {
60 get {
61 return vm.conn.Thread_GetId (id);