Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LogPoints in OpenDebugAD7 #1013

Merged
merged 8 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address PR issues
  • Loading branch information
WardenGnaw committed Jun 24, 2020
commit 6425d8416bd63cae8f050579c69f79084368612d
30 changes: 18 additions & 12 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1706,8 1706,8 @@ protected override void HandleSetBreakpointsRequestAsync(IRequestResponder<SetBr
Id = (int)pBPRequest.Id,
Verified = verified,
Line = bp.Line,
Message = "Unable to parse logMessage."
});
Message = string.Format(CultureInfo.CurrentCulture, AD7Resources.Error_UnableToSetTracepoint)
}); ;
WardenGnaw marked this conversation as resolved.
Show resolved Hide resolved
}
}
catch (Exception e)
Expand Down Expand Up @@ -1958,7 1958,7 @@ protected override void HandleEvaluateRequestAsync(IRequestResponder<EvaluateArg
IDebugExpression2 expressionObject;
string error;
uint errorIndex;
hr = expressionContext.ParseText(expression, enum_PARSEFLAGS.PARSE_EXPRESSION, Constants.EvaluationRadix, out expressionObject, out error, out errorIndex);
hr = expressionContext.ParseText(expression, enum_PARSEFLAGS.PARSE_EXPRESSION, Constants.ParseRadix, out expressionObject, out error, out errorIndex);
if (!string.IsNullOrEmpty(error))
{
// TODO: Is this how errors should be returned?
Expand Down Expand Up @@ -2161,19 2161,25 @@ public void HandleIDebugBreakpointEvent2(IDebugEngine2 pEngine, IDebugProcess2 p
{
foreach (var tp in tracepoints)
{
string logMessage = tp.GetLogMessage(pThread, Constants.EvaluationRadix, m_processName);
string logMessage = tp.GetLogMessage(pThread, Constants.ParseRadix, m_processName);

m_logger.WriteLine(LoggingCategory.DebuggerStatus, logMessage);
}
});
}

if (!m_isStepping && tracepoints.Any())
{
ThreadPool.QueueUserWorkItem((o) =>
{
BeforeContinue();
m_program.Continue(pThread);
// Need to check to see if the previous continuation of the debuggee was a step.
// If so, we need to send a stopping event to the UI to signal the step completed successfully.
if (!m_isStepping)
{
ThreadPool.QueueUserWorkItem((obj) =>
{
BeforeContinue();
m_program.Continue(pThread);
});
}
else
{
FireStoppedEvent(pThread, StoppedEvent.ReasonValue.Breakpoint);
}
});
}
else
Expand Down
9 changes: 9 additions & 0 deletions src/OpenDebugAD7/AD7Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/OpenDebugAD7/AD7Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 192,9 @@
<data name="Error_UnableToSetBreakpoint" xml:space="preserve">
<value>Error setting breakpoint. {0}</value>
</data>
<data name="Error_UnableToSetTracepoint" xml:space="preserve">
WardenGnaw marked this conversation as resolved.
Show resolved Hide resolved
<value>Unable to parse 'logMessage'.</value>
</data>
<data name="Msg_E_CRASHDUMP_UNSUPPORTED" xml:space="preserve">
<value>This operation is not supported when debugging dump files.</value>
</data>
Expand Down
4 changes: 3 additions & 1 deletion src/OpenDebugAD7/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,9 @@ internal static class Constants
{
// POST_PREVIEW_TODO: no-func-eval support, radix, timeout
public const uint EvaluationRadix = 10;
public const uint ParseRadix = 10;
public const uint EvaluationTimeout = 5000;
public const int DisconnectTimeout = 2000;
public const int DefaultNumCallStacksShownToken = 10;
WardenGnaw marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
18 changes: 2 additions & 16 deletions src/OpenDebugAD7/Tracepoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 206,7 @@ private string InterpolateToken(string token, IDebugThread2 pThread, IDebugStack
int hr = pThread.EnumFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FRAME | enum_FRAMEINFO_FLAGS.FIF_FLAGS, Constants.EvaluationRadix, out frameInfoEnum);
int count = 0;
StringBuilder sb = new StringBuilder();
while (count < 5)
while (count < Constants.DefaultNumCallStacksShownToken)
WardenGnaw marked this conversation as resolved.
Show resolved Hide resolved
{
FRAMEINFO[] frames = new FRAMEINFO[1];
uint fetched = 0;
Expand Down Expand Up @@ -288,8 288,7 @@ private string InterpolateVariable(string variable, IDebugStackFrame2 topFrame,
/// in the token. If not, it will just add $ and continue.
/// 4. If it is a open curl brace, try to find end match curl brace for the interpolated expression. Add to m_indexToExpressions.
/// If there is no matching end brace, an exception will be thrown.
/// 5. If there is a double quote, find the associated end quote. Ignore any interpolation in here.
/// 6. Other character, just add to message to output.
/// 5. Other character, just add to message to output.
/// </summary>
/// <param name="input">The logMessage to parse</param>
/// <returns>The new string after it has been parsed, it will check for excaped curl braces.</returns>
Expand Down Expand Up @@ -355,19 354,6 @@ private string Parse(string input)
throw new InvalidTracepointException();
}
}
else if (c == '"')
{
if (FindEndQuote(input.Substring(index), out int length))
{
length = length 1;
}
else
{
length = input.Length - index;
}
replace.Append(input.Substring(index, length));
index = length - 1;
}
else
{
replace.Append(c);
Expand Down