|
| 1 | +using EnvDTE; |
| 2 | + |
| 3 | +namespace GraphicalDebugging |
| 4 | +{ |
| 5 | + class Wrappers |
| 6 | + { |
| 7 | + public class CppExpression : Expression |
| 8 | + { |
| 9 | + public CppExpression(Expression expression) |
| 10 | + { |
| 11 | + this.expression = expression; |
| 12 | + this.normalizedType = Util.CppNormalizeType(expression.Type); |
| 13 | + } |
| 14 | + |
| 15 | + private Expression expression; |
| 16 | + |
| 17 | + public string Name => expression.Name; |
| 18 | + |
| 19 | + public string Type { get { return this.normalizedType; } } |
| 20 | + |
| 21 | + public Expressions DataMembers => expression.DataMembers; |
| 22 | + |
| 23 | + public string Value { get => expression.Value; set => expression.Value = value; } |
| 24 | + |
| 25 | + public bool IsValidValue => expression.IsValidValue; |
| 26 | + |
| 27 | + public DTE DTE => expression.DTE; |
| 28 | + |
| 29 | + public Debugger Parent => expression.Parent; |
| 30 | + |
| 31 | + public Expressions Collection => expression.Collection; |
| 32 | + |
| 33 | + private string normalizedType; |
| 34 | + } |
| 35 | + |
| 36 | + public class DebuggerWrapper : Debugger |
| 37 | + { |
| 38 | + public DebuggerWrapper(Debugger debugger) |
| 39 | + { |
| 40 | + this.debugger = debugger; |
| 41 | + } |
| 42 | + private Debugger debugger; |
| 43 | + |
| 44 | + public Expression GetExpression(string ExpressionText, bool UseAutoExpandRules = false, int Timeout = -1) |
| 45 | + { |
| 46 | + Expression expr = debugger.GetExpression(ExpressionText, UseAutoExpandRules, Timeout); |
| 47 | + return CurrentStackFrame.Language == "C++" ? new CppExpression(expr) : expr; |
| 48 | + } |
| 49 | + |
| 50 | + public void DetachAll() |
| 51 | + { |
| 52 | + debugger.DetachAll(); |
| 53 | + } |
| 54 | + |
| 55 | + public void StepInto(bool WaitForBreakOrEnd = true) |
| 56 | + { |
| 57 | + debugger.StepInto(WaitForBreakOrEnd); |
| 58 | + } |
| 59 | + |
| 60 | + public void StepOver(bool WaitForBreakOrEnd = true) |
| 61 | + { |
| 62 | + debugger.StepOver(WaitForBreakOrEnd); |
| 63 | + } |
| 64 | + |
| 65 | + public void StepOut(bool WaitForBreakOrEnd = true) |
| 66 | + { |
| 67 | + debugger.StepOut(WaitForBreakOrEnd); |
| 68 | + } |
| 69 | + |
| 70 | + public void Go(bool WaitForBreakOrEnd = true) |
| 71 | + { |
| 72 | + debugger.Go(WaitForBreakOrEnd); |
| 73 | + } |
| 74 | + |
| 75 | + public void Break(bool WaitForBreakMode = true) |
| 76 | + { |
| 77 | + debugger.Break(WaitForBreakMode); |
| 78 | + } |
| 79 | + |
| 80 | + public void Stop(bool WaitForDesignMode = true) |
| 81 | + { |
| 82 | + debugger.Stop(WaitForDesignMode); |
| 83 | + } |
| 84 | + |
| 85 | + public void SetNextStatement() |
| 86 | + { |
| 87 | + debugger.SetNextStatement(); |
| 88 | + } |
| 89 | + |
| 90 | + public void RunToCursor(bool WaitForBreakOrEnd = true) |
| 91 | + { |
| 92 | + debugger.RunToCursor(WaitForBreakOrEnd); |
| 93 | + } |
| 94 | + |
| 95 | + public void ExecuteStatement(string Statement, int Timeout = -1, bool TreatAsExpression = false) |
| 96 | + { |
| 97 | + debugger.ExecuteStatement(Statement, Timeout, TreatAsExpression); |
| 98 | + } |
| 99 | + |
| 100 | + public void TerminateAll() |
| 101 | + { |
| 102 | + debugger.TerminateAll(); |
| 103 | + } |
| 104 | + |
| 105 | + public Breakpoints Breakpoints => debugger.Breakpoints; |
| 106 | + |
| 107 | + public Languages Languages => debugger.Languages; |
| 108 | + |
| 109 | + public dbgDebugMode CurrentMode => debugger.CurrentMode; |
| 110 | + |
| 111 | + public Process CurrentProcess { get => debugger.CurrentProcess; set => debugger.CurrentProcess = value; } |
| 112 | + public Program CurrentProgram { get => debugger.CurrentProgram; set => debugger.CurrentProgram = value; } |
| 113 | + public Thread CurrentThread { get => debugger.CurrentThread; set => debugger.CurrentThread = value; } |
| 114 | + public StackFrame CurrentStackFrame { get => debugger.CurrentStackFrame; set => debugger.CurrentStackFrame = value; } |
| 115 | + public bool HexDisplayMode { get => debugger.HexDisplayMode; set => debugger.HexDisplayMode = value; } |
| 116 | + public bool HexInputMode { get => debugger.HexInputMode; set => debugger.HexInputMode = value; } |
| 117 | + |
| 118 | + public dbgEventReason LastBreakReason => debugger.LastBreakReason; |
| 119 | + |
| 120 | + public Breakpoint BreakpointLastHit => debugger.BreakpointLastHit; |
| 121 | + |
| 122 | + public Breakpoints AllBreakpointsLastHit => debugger.AllBreakpointsLastHit; |
| 123 | + |
| 124 | + public Processes DebuggedProcesses => debugger.DebuggedProcesses; |
| 125 | + |
| 126 | + public Processes LocalProcesses => debugger.LocalProcesses; |
| 127 | + |
| 128 | + public DTE DTE => debugger.DTE; |
| 129 | + |
| 130 | + public DTE Parent => debugger.Parent; |
| 131 | + } |
| 132 | + } |
| 133 | +} |
0 commit comments