本文整理汇总了C#中Mono.Debugging.Client.StackFrame类的典型用法代码示例。如果您正苦于以下问题:C# StackFrame类的具体用法?C# StackFrame怎么用?C# StackFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackFrame类属于Mono.Debugging.Client命名空间,在下文中一共展示了StackFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdateList
public override void OnUpdateList ()
{
base.OnUpdateList ();
StackFrame frame = DebuggingService.CurrentFrame;
if (frame == null || !FrameEquals (frame, lastFrame)) {
tree.ClearExpressions ();
lastExpressions = null;
}
lastFrame = frame;
if (frame == null)
return;
//FIXME: tree should use the local refs rather than expressions. ATM we exclude items without names
var expr = new HashSet<string> (frame.GetAllLocals ().Select (i => i.Name)
.Where (n => !string.IsNullOrEmpty (n) && n != "?"));
//add expressions not in tree already, remove expressions that are longer valid
if (lastExpressions != null) {
foreach (string rem in lastExpressions.Except (expr))
tree.RemoveExpression (rem);
foreach (string rem in expr.Except (lastExpressions))
tree.AddExpression (rem);
} else {
tree.AddExpressions (expr);
}
lastExpressions = expr;
}
示例2: FrameEquals
static bool FrameEquals (StackFrame a, StackFrame z)
{
if (null == a || null == z)
return a == z;
if (a.SourceLocation == null || z.SourceLocation == null)
return a.SourceLocation == z.SourceLocation;
if (a.SourceLocation.FileName == null) {
if (z.SourceLocation.FileName != null)
return false;
} else {
if (!a.SourceLocation.FileName.Equals (z.SourceLocation.FileName, StringComparison.Ordinal))
return false;
}
if (a.SourceLocation.MethodName == null) {
if (z.SourceLocation.MethodName != null)
return false;
return true;
} else {
return a.SourceLocation.MethodName.Equals (z.SourceLocation.MethodName, StringComparison.Ordinal);
}
}
示例3: FrameEquals
static bool FrameEquals (StackFrame a, StackFrame z)
{
if (null == a || null == z)
return a == z;
return a.SourceLocation.FileName.Equals (z.SourceLocation.FileName, StringComparison.Ordinal) &&
a.SourceLocation.MethodName.Equals (z.SourceLocation.MethodName, StringComparison.Ordinal);
}
示例4: DebugValueWindow
// PinWindow pinWindow;
// TreeIter currentPinIter;
public DebugValueWindow (Mono.TextEditor.TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch): base (Gtk.WindowType.Toplevel)
{
this.TypeHint = WindowTypeHint.PopupMenu;
this.AllowShrink = false;
this.AllowGrow = false;
this.Decorated = false;
TransientFor = (Gtk.Window) editor.Toplevel;
// Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window
AcceptFocus = false;
sw = new ScrolledWindow ();
sw.HscrollbarPolicy = PolicyType.Never;
sw.VscrollbarPolicy = PolicyType.Never;
tree = new ObjectValueTreeView ();
sw.Add (tree);
ContentBox.Add (sw);
tree.Frame = frame;
tree.CompactView = true;
tree.AllowAdding = false;
tree.AllowEditing = true;
tree.HeadersVisible = false;
tree.AllowPinning = true;
tree.RootPinAlwaysVisible = true;
tree.PinnedWatch = watch;
DocumentLocation location = editor.Document.OffsetToLocation (offset);
tree.PinnedWatchLine = location.Line;
tree.PinnedWatchFile = ((ExtensibleTextEditor)editor).View.ContentName;
tree.AddValue (value);
tree.Selection.UnselectAll ();
tree.SizeAllocated += OnTreeSizeChanged;
tree.PinStatusChanged += delegate {
Destroy ();
};
// tree.MotionNotifyEvent += HandleTreeMotionNotifyEvent;
sw.ShowAll ();
// pinWindow = new PinWindow (this);
// pinWindow.SetPinned (false);
// pinWindow.ButtonPressEvent += HandlePinWindowButtonPressEvent;
tree.StartEditing += delegate {
Modal = true;
};
tree.EndEditing += delegate {
Modal = false;
};
ShowArrow = true;
Theme.CornerRadius = 3;
}
示例5: GetStackFrames
public override StackFrame[] GetStackFrames (int firstIndex, int lastIndex)
{
if (lastIndex >= FrameList.Count)
lastIndex = FrameList.Count - 1;
StackFrame[] array = new StackFrame[lastIndex - firstIndex + 1];
for (int n = 0; n < array.Length; n++)
array [n] = CreateFrame (session, FrameList [n + firstIndex]);
return array;
}
示例6: OnUpdateList
public override void OnUpdateList ()
{
base.OnUpdateList ();
StackFrame frame = DebuggingService.CurrentFrame;
if (frame != null && !FrameEquals (frame, lastFrame)) {
tree.ClearExpressions ();
tree.AddExpressions (frame.GetAllLocals ().Select (i => i.Name));
lastFrame = frame;
}
}
示例7: OnUpdateList
public override void OnUpdateList ()
{
base.OnUpdateList ();
StackFrame frame = DebuggingService.CurrentFrame;
if (frame == null || !FrameEquals (frame, lastFrame)) {
tree.ClearExpressions ();
lastLookup = null;
}
lastFrame = frame;
if (frame == null)
return;
//add expressions not in tree already, remove expressions that are longer valid
var frameLocals = frame.GetAllLocals();
var frameLocalLookup = new Dictionary<string, ObjectValue>(frameLocals.Length);
foreach (var local in frameLocals) {
var variableName = local.Name;
//not sure if there is a use case for duplicate variable names, or blanks
if (string.IsNullOrWhiteSpace(variableName) ||
variableName == "?" ||
frameLocalLookup.ContainsKey(variableName)) {
continue;
}
else
frameLocalLookup.Add(variableName, local);
if (lastLookup != null) {
ObjectValue priorValue;
if (lastLookup.TryGetValue(variableName, out priorValue))
tree.ReplaceValue(priorValue, local);
else
tree.AddValue(local);
}
}
if (lastLookup != null) {
//get rid of the values that didnt survive from the last refresh
foreach (var prior in lastLookup) {
if (!frameLocalLookup.ContainsKey(prior.Key))
tree.RemoveValue(prior.Value);
}
}
else {
tree.ClearValues();
tree.AddValues(frameLocalLookup.Values);
}
lastLookup = frameLocalLookup;
}
示例8: DebugValueWindow
public DebugValueWindow (TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch) : base (Gtk.WindowType.Toplevel)
{
this.TypeHint = WindowTypeHint.PopupMenu;
this.AllowShrink = false;
this.AllowGrow = false;
this.Decorated = false;
TransientFor = (Gtk.Window) ((Gtk.Widget)editor).Toplevel;
// Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window
AcceptFocus = false;
sw = new ScrolledWindow ();
sw.HscrollbarPolicy = PolicyType.Never;
sw.VscrollbarPolicy = PolicyType.Never;
tree = new ObjectValueTreeView ();
sw.Add (tree);
ContentBox.Add (sw);
tree.Frame = frame;
tree.CompactView = true;
tree.AllowAdding = false;
tree.AllowEditing = true;
tree.HeadersVisible = false;
tree.AllowPinning = true;
tree.RootPinAlwaysVisible = true;
tree.PinnedWatch = watch;
var location = editor.OffsetToLocation (offset);
tree.PinnedWatchLine = location.Line;
tree.PinnedWatchFile = editor.FileName;
tree.AddValue (value);
tree.Selection.UnselectAll ();
tree.SizeAllocated += OnTreeSizeChanged;
tree.PinStatusChanged += OnPinStatusChanged;
sw.ShowAll ();
tree.StartEditing += OnStartEditing;
tree.EndEditing += OnEndEditing;
ShowArrow = true;
Theme.CornerRadius = 3;
}
示例9: DebugValueWindow
public DebugValueWindow (Mono.TextEditor.TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch)
{
TransientFor = (Gtk.Window) editor.Toplevel;
// Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window
AcceptFocus = false;
sw = new ScrolledWindow ();
sw.HscrollbarPolicy = PolicyType.Never;
sw.VscrollbarPolicy = PolicyType.Never;
tree = new ObjectValueTreeView ();
sw.Add (tree);
Add (sw);
tree.Frame = frame;
tree.CompactView = true;
tree.AllowAdding = false;
tree.AllowEditing = true;
tree.HeadersVisible = false;
tree.AllowPinning = true;
tree.PinnedWatch = watch;
DocumentLocation location = editor.Document.OffsetToLocation (offset);
tree.PinnedWatchLine = location.Line + 1;
tree.PinnedWatchFile = ((ExtensibleTextEditor)editor).View.ContentName;
tree.AddValue (value);
tree.Selection.UnselectAll ();
tree.SizeAllocated += OnTreeSizeChanged;
tree.PinStatusChanged += delegate {
Destroy ();
};
sw.ShowAll ();
tree.StartEditing += delegate {
Modal = true;
};
tree.EndEditing += delegate {
Modal = false;
};
}
示例10: CheckFrameIsInFile
StackFrame CheckFrameIsInFile (StackFrame frame)
{
if (!string.IsNullOrEmpty (ContentName) && frame != null && !string.IsNullOrEmpty (frame.SourceLocation.FileName)
&& ((FilePath)frame.SourceLocation.FileName).FullPath == ((FilePath)ContentName).FullPath)
return frame;
return null;
}
示例11: ConnectCallbacks
internal static void ConnectCallbacks (StackFrame parentFrame, params ObjectValue[] values)
{
Dictionary<IObjectValueUpdater, List<UpdateCallback>> callbacks = null;
List<ObjectValue> valueList = new List<ObjectValue> (values);
for (int n=0; n<valueList.Count; n++) {
ObjectValue val = valueList [n];
val.parentFrame = parentFrame;
UpdateCallback cb = val.GetUpdateCallback ();
if (cb != null) {
if (callbacks == null)
callbacks = new Dictionary<IObjectValueUpdater, List<UpdateCallback>> ();
List<UpdateCallback> list;
if (!callbacks.TryGetValue (val.Updater, out list)) {
list = new List<UpdateCallback> ();
callbacks [val.Updater] = list;
}
list.Add (cb);
}
if (val.children != null)
valueList.AddRange (val.children);
}
if (callbacks != null) {
// Do the callback connection in a background thread
System.Threading.ThreadPool.QueueUserWorkItem (delegate {
foreach (KeyValuePair<IObjectValueUpdater, List<UpdateCallback>> cbs in callbacks) {
cbs.Key.RegisterUpdateCallbacks (cbs.Value.ToArray ());
}
});
}
}
示例12: EvaluateMethodName
string EvaluateMethodName (StackFrame frame)
{
var methodNameBuilder = new StringBuilder (frame.SourceLocation.MethodName);
var options = DebuggingService.DebuggerSession.Options.EvaluationOptions.Clone ();
if (ShowParameterValue) {
options.AllowMethodEvaluation = true;
options.AllowToStringCalls = true;
options.AllowTargetInvoke = true;
} else {
options.AllowMethodEvaluation = false;
options.AllowToStringCalls = false;
options.AllowTargetInvoke = false;
}
var args = frame.GetParameters (options);
//MethodName starting with "["... it's something like [ExternalCode]
if (!frame.SourceLocation.MethodName.StartsWith ("[", StringComparison.Ordinal)) {
if (ShowModuleName && !string.IsNullOrEmpty (frame.FullModuleName)) {
methodNameBuilder.Insert (0, System.IO.Path.GetFileName (frame.FullModuleName) + "!");
}
if (ShowParameterType || ShowParameterName || ShowParameterValue) {
methodNameBuilder.Append ("(");
for (int n = 0; n < args.Length; n++) {
if (n > 0)
methodNameBuilder.Append (", ");
if (ShowParameterType) {
methodNameBuilder.Append (args [n].TypeName);
if (ShowParameterName)
methodNameBuilder.Append (" ");
}
if (ShowParameterName)
methodNameBuilder.Append (args [n].Name);
if (ShowParameterValue) {
if (ShowParameterType || ShowParameterName)
methodNameBuilder.Append (" = ");
var val = args [n].Value ?? "";
methodNameBuilder.Append (val.Replace ("\r\n", " ").Replace ("\n", " "));
}
}
methodNameBuilder.Append (")");
}
}
return methodNameBuilder.ToString ();
}
示例13: DecompilerFormatter
public DecompilerFormatter(StackFrame frame)
{
_frame = frame;
_writer = Logger.WriteInfoString;
IndentationString = " ";
}
示例14: GdbBacktrace
public GdbBacktrace (GdbSession session, long threadId, int count, ResultData firstFrame)
{
fcount = count;
this.threadId = threadId;
if (firstFrame != null)
this.firstFrame = CreateFrame (firstFrame);
this.session = session;
}
示例15: DDebugBacktrace
public DDebugBacktrace(DDebugSession session, long threadId, DEW.DBGEngine engine)
{
this.session = session;
this.Engine = engine;
fcount = engine.CallStack.Length;
this.threadId = threadId;
if (firstFrame != null)
this.firstFrame = CreateFrame(Engine.CallStack[0]);
}