Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / corlib / System.Diagnostics / Debugger.cs
index 76f2a205bdb24eadbfdec9823ba1a7e0171c8324..02113358021b795cd8d3eb873ff73c66549469fa 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 using System;
+using System.Runtime.CompilerServices;
+
+using System.Runtime.InteropServices;
 
 namespace System.Diagnostics
 {
        /// <summary>
        /// Enables communication with a debugger.
        /// </summary>
-       [MonoTODO]
+       [ComVisible (true)]
+       [MonoTODO ("The Debugger class is not functional")]
        public sealed class Debugger
        {
-               private static bool isAttached;
-               
+
                /// <summary>
                /// Represents the default category of a message with a constant.
                /// </summary>
                public static readonly string DefaultCategory = "";
-               
+
                /// <summary>
                /// Returns a Boolean indicating whether a debugger is attached to a process.
                /// </summary>
@@ -56,40 +59,36 @@ namespace System.Diagnostics
                {
                        get
                        {
-                               return isAttached;
+                               return IsAttached_internal ();
                        }
                }
-               
+
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               private extern static bool IsAttached_internal ();
+
                /// <summary>
                /// Causes a breakpoint to be signaled to an attached debugger.
                /// </summary>
-               [MonoTODO]
                public static void Break()
                {
-                       throw new NotImplementedException();
+                       // The JIT inserts a breakpoint on the caller.
                }
-               
+
                /// <summary>
                /// Checks to see if logging is enabled by an attached debugger.
                /// </summary>
-               [MonoTODO]
-               public static bool IsLogging()
-               {
-                       // Return false. DefaultTraceListener invokes this method, so throwing
-                       // a NotImplementedException wouldn't be appropriate.
-      return false;
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern bool IsLogging();
 
-               }
-               
                /// <summary>
                /// Launches and attaches a debugger to the process.
                /// </summary>
-               [MonoTODO]
+               [MonoTODO ("Not implemented")]
                public static bool Launch()
                {
                        throw new NotImplementedException();
                }
-               
+
                /// <summary>
                /// Posts a message for the attached debugger.
                /// </summary>
@@ -102,16 +101,14 @@ namespace System.Diagnostics
                /// <param name="message">
                /// A string representing the message to show.
                /// </param>
-               [MonoTODO]
-               public static void Log(int level, string category, string message)
-               {
-                       // Do nothing. DefaultTraceListener invokes this method, so throwing
-                       // a NotImplementedException wouldn't be appropriate.
-               }
-               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern void Log(int level, string category, string message);
+
+#if NET_4_0
+               [ObsoleteAttribute("Call the static methods directly on this type", true)]
+#endif
                public Debugger()
                {
-                       isAttached = false;
                }
        }
 }