[Mono-list] [DebuggableAttribute] Patch

Ben S. Stahlhood bitoholic@gmail.com
Mon, 17 Jan 2005 14:32:46 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0012_01C4FCA1.6F6990A0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0013_01C4FCA1.6F6990A0"


------=_NextPart_001_0013_01C4FCA1.6F6990A0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hey everyone,

 

Here is a patch for DebuggableAtrribute.  I hope I am doing this right.

 

Thanks

 

Ben S. Stahlhood II


------=_NextPart_001_0013_01C4FCA1.6F6990A0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hey everyone,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Here is a patch for DebuggableAtrribute.&nbsp; I hope =
I am doing
this right&#8230;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Thanks<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Ben S. Stahlhood II<o:p></o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_001_0013_01C4FCA1.6F6990A0--

------=_NextPart_000_0012_01C4FCA1.6F6990A0
Content-Type: text/plain;
	name="DebuggableAttribute.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="DebuggableAttribute.cs"

//
// System.Collections.DebuggableAttribute.cs
//
// Authors:
//   Nick Drochak II (ndrochak@gol.com)
//   Ben S. Stahlhood II (bitoholic@gmail.com)
//
// (C) 2001 Nick Drochak II
// (C) 2005 Ben S. Stahlhood II
//

//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//=20
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//=20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS =
BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN =
ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

namespace System.Diagnostics {
=09
	[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Module, =
AllowMultiple =3D false)]
	public sealed class DebuggableAttribute : System.Attribute {

		#region Fields
		private DebuggingModes debuggingModes =3D DebuggingModes.None;
		private bool JITTrackingEnabledFlag;
		private bool JITOptimizerDisabledFlag;
		#endregion

		#region Methods
		// Public Instance Constructors
		/// <summary>
		/// Initializes a new instance of the DebuggableAttribute class with =
the specifed=20
		/// debugging modes for the JIT compiler.
		/// </summary>
		/// <param name=3D"modes">Debugging Flags</param>
		public DebuggableAttribute(DebuggingModes modes)
		{
			debuggingModes =3D modes;
			JITTrackingEnabledFlag =3D debuggingModes & DebuggingModes.Default;
			JITOptimizerDisabledFlag =3D debuggingModes & =
DebuggingModes.DisableOptimizations;
		}

		/// <summary>
		/// Initializes a new instance of the DebuggableAttribute class with =
the specifed=20
		/// debugging conditions to control code generation for JIT debugging.
		/// </summary>
		/// <param name=3D"isJITTrackingEnabled">Flag to indicate if the =
runtime will track
		/// information during code generation for the debugger.</param>
		/// <param name=3D"isJITOptimizerDisabled">Flag to indicate if the =
runtime optimizer
		/// is disabled.</param>
		public DebuggableAttribute(bool isJITTrackingEnabled, bool =
isJITOptimizerDisabled)
		{
			JITTrackingEnabledFlag =3D isJITTrackingEnabled;
			JITOptimizerDisabledFlag =3D isJITOptimizerDisabled;
			SetDebuggingMode(isJITTrackingEnabled, isJITOptimizerDisabled);
		} // DebuggableAttribute(bool, bool)

		/// <summary>
		/// Set the debugging mode flags
		/// </summary>
		/// <param name=3D"trackingEnabled">Flag for runtime tracking for =
debugger=20
		/// code generation.</param>
		/// <param name=3D"optimizerDisabled">Flag for runtime =
optimizer</param>
		private void SetDebuggingMode(bool trackingEnabled, bool =
optimizerDisabled)=20
		{
			if (trackingEnabled)=20
			{
				debuggingModes |=3D DebuggingModes.Default;
			} // if
		=09
			if (optimizerDisabled)=20
			{
				debuggingModes |=3D DebuggingModes.DisableOptimizations;
			} // if
		} // SetDebuggingMode(bool, bool)
		#endregion

		#region Public Instance Properties
		/// <summary>
		/// Gets the debugging modes for the JIT compiler.
		/// </summary>
		public DebuggingModes DebuggingFlags=20
		{=20
			get=20
			{=20
				return debuggingModes;=20
			} // get
		} // DebuggingFlags
	=09
		/// <summary>
		/// Gets the value that indicates if the runtime is tracking =
information
		/// during code generation.
		/// </summary>
		public bool IsJITTrackingEnabled=20
		{=20
			get=20
			{=20
				return JITTrackingEnabledFlag;=20
			} // get
		} // IsJITTrackingEnabled
	=09
		/// <summary>
		/// Gets the value that indicates if runtime optimizer is disabled.
		/// </summary>
		public bool IsJITOptimizerDisabled=20
		{=20
			get=20
			{=20
				return JITOptimizerDisabledFlag;=20
			} // get
		} // IsJITOptimizerDisabled
		#endregion

		#region Nested Types
		[Flags]
		public enum DebuggingModes {
			// Fields
			None =3D 0,
			Default =3D 1,
			IgnoreSymbolStoreSequencePoints =3D 2,
			EnableEditAndContinue =3D 4,
			DisableOptimizations =3D 256
		}
		#endregion
	}
}

------=_NextPart_000_0012_01C4FCA1.6F6990A0--