Skip to content

Commit

Permalink
Add SkipNativeTransitions and StackFrameFormat options
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneySprings committed Nov 23, 2024
1 parent b66c896 commit c5b42f0
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"name": ".NET Core Debugger (attach)",
"type": "coreclr",
"request": "attach",
"processId": "${command:dotrush-essentials.pickProcess}"
"processId": "${command:dotrush.pickProcess}"
},
{
"name": ".NET Core Debugger (launch)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "dotrush-essentials: Build"
"preLaunchTask": "dotrush: Build"
}
]
}
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,36 @@
"items": {
"type": "string"
}
},
"dotnetMeteor.debuggerOptions.skipNativeTransitions": {
"type": "boolean",
"default": true,
"description": "%configuration.description.debuggerOptions.skipNativeTransitions%"
},
"dotnetMeteor.debuggerOptions.stackFrameFormat.module": {
"type": "boolean",
"default": true,
"description": "%configuration.description.debuggerOptions.stackFrameFormat.module%"
},
"dotnetMeteor.debuggerOptions.stackFrameFormat.parameterTypes": {
"type": "boolean",
"default": false,
"description": "%configuration.description.debuggerOptions.stackFrameFormat.parameterTypes%"
},
"dotnetMeteor.debuggerOptions.stackFrameFormat.parameterValues": {
"type": "boolean",
"default": false,
"description": "%configuration.description.debuggerOptions.stackFrameFormat.parameterValues%"
},
"dotnetMeteor.debuggerOptions.stackFrameFormat.parameterNames": {
"type": "boolean",
"default": false,
"description": "%configuration.description.debuggerOptions.stackFrameFormat.parameterNames%"
},
"dotnetMeteor.debuggerOptions.stackFrameFormat.language": {
"type": "boolean",
"default": false,
"description": "%configuration.description.debuggerOptions.stackFrameFormat.language%"
}
}
},
Expand Down
9 changes: 8 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,12 @@
"configuration.description.debuggerOptions.integerDisplayFormat": "Specifies the format of displayed integers in the debugging window.",
"configuration.description.debuggerOptions.sourceCodeMappings": "Modifies locations for the debugged source code by replacing values on the left with values on the right.",
"configuration.description.debuggerOptions.automaticSourcelinkDownload": "Automatically downloads source files from the SourceLink.",
"configuration.description.debuggerOptions.symbolSearchPaths": "Specifies the paths to search for symbols."
"configuration.description.debuggerOptions.symbolSearchPaths": "Specifies the paths to search for symbols.",
"configuration.description.debuggerOptions.skipNativeTransitions": "Specifies whether the debugger should skip native transitions in the call stack.",

"configuration.description.debuggerOptions.stackFrameFormat.module": "Display stack frame module in debugger.",
"configuration.description.debuggerOptions.stackFrameFormat.parameterTypes": "Display stack frame parameter types in debugger.",
"configuration.description.debuggerOptions.stackFrameFormat.parameterValues": "Display stack frame parameter values in debugger.",
"configuration.description.debuggerOptions.stackFrameFormat.parameterNames": "Display stack frame parameter names in debugger.",
"configuration.description.debuggerOptions.stackFrameFormat.language": "Display stack frame language type in debugger."
}
21 changes: 14 additions & 7 deletions src/DotNet.Meteor.Debug/DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ protected override StackTraceResponse HandleStackTraceRequest(StackTraceArgument
stackFrames.Add(new DebugProtocol.StackFrame(0, "<unknown>", 0, 0));
continue;
}
if (frame.Language == "Transition" && session.Options.SkipNativeTransitions)
continue;

DebugProtocol.Source? source = null;
var frameId = frameHandles.Create(frame);
Expand All @@ -267,22 +269,24 @@ protected override StackTraceResponse HandleStackTraceRequest(StackTraceArgument
AlternateSourceReference = frameId,
VsSourceLinkInfo = frame.SourceLocation.SourceLink.ToSourceLinkInfo(),
Name = string.IsNullOrEmpty(frame.SourceLocation.FileName)
? frame.FullModuleName
? Path.GetFileName(frame.FullModuleName)
: Path.GetFileName(frame.SourceLocation.FileName)
};
}

stackFrames.Add(new DebugProtocol.StackFrame() {
Id = frameId,
Source = source,
Name = frame.SourceLocation.GetMethodName(),
Name = frame.GetFullStackFrameText(),
Line = frame.SourceLocation.Line,
Column = frame.SourceLocation.Column,
EndLine = frame.SourceLocation.EndLine,
EndColumn = frame.SourceLocation.EndColumn,
PresentationHint = frame.IsExternalCode
? StackFrame.PresentationHintValue.Subtle
: StackFrame.PresentationHintValue.Normal
PresentationHint = StackFrame.PresentationHintValue.Normal
// VSCode does not focus the exceptions in the 'Subtle' presentation hint
// PresentationHint = frame.IsExternalCode
// ? StackFrame.PresentationHintValue.Subtle
// : StackFrame.PresentationHintValue.Normal
});
}

Expand Down Expand Up @@ -389,8 +393,11 @@ protected override EvaluateResponse HandleEvaluateRequest(EvaluateArguments argu
protected override SourceResponse HandleSourceRequest(SourceArguments arguments) {
return ServerExtensions.DoSafe(() => {
var sourceLinkUri = arguments.Source.VsSourceLinkInfo?.Url;
if (!string.IsNullOrEmpty(sourceLinkUri) && session.Options.AutomaticSourceLinkDownload)
return new SourceResponse(SymbolServerExtensions.DownloadSourceFile(sourceLinkUri));
if (!string.IsNullOrEmpty(sourceLinkUri) && session.Options.AutomaticSourceLinkDownload) {
var content = SymbolServerExtensions.DownloadSourceFile(sourceLinkUri);
if (!string.IsNullOrEmpty(content))
return new SourceResponse(content);
}

var frame = frameHandles.Get(arguments.Source.AlternateSourceReference ?? -1, null);
if (frame == null)
Expand Down
6 changes: 0 additions & 6 deletions src/DotNet.Meteor.Debug/Extensions/MonoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ public static string GetAssemblyCode(this StackFrame frame) {

return sb.ToString();
}
public static string GetMethodName(this SourceLocation sourceLocation) {
if (sourceLocation.MethodName.EndsWith('.'))
return $"{sourceLocation.MethodName}AnonymousMethod__()";

return sourceLocation.MethodName;
}
public static bool HasNullValue(this ObjectValue objectValue) {
return objectValue.Value == "(null)";
}
Expand Down
4 changes: 2 additions & 2 deletions src/DotNet.Meteor.Debug/Extensions/SymbolServerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ private static async Task<bool> DownloadFileAsync(string url, string outputFileP
return false;
}
}
private static async Task<string> GetFileContentAsync(string url) {
private static async Task<string?> GetFileContentAsync(string url) {
try {
using var response = await httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
return $"Error while loading file '{url}': {response.StatusCode}";
return null;

using var content = response.Content;
var data = await content.ReadAsByteArrayAsync();
Expand Down
10 changes: 8 additions & 2 deletions src/VSCode.Extension/controllers/configurationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ export class ConfigurationController {
currentExceptionTag: ConfigurationController.getSettingOrDefault<string>(res.configIdDebuggerOptionsCurrentExceptionTag),
ellipsizeStrings: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsEllipsizeStrings),
ellipsizedLength: ConfigurationController.getSettingOrDefault<number>(res.configIdDebuggerOptionsEllipsizedLength),
StackFrameFormat: {

stackFrameFormat: {
line: false, // VSCode already shows the line number
module: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStackFrameFormatModule),
parameterTypes: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStackFrameFormatParameterTypes),
parameterValues: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStackFrameFormatParameterValues),
parameterNames: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStackFrameFormatParameterNames),
language: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStackFrameFormatLanguage),
},
},
stepOverPropertiesAndOperators: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStepOverPropertiesAndOperators),
Expand All @@ -108,6 +113,7 @@ export class ConfigurationController {
symbolSearchPaths: ConfigurationController.getSettingOrDefault<string[]>(res.configIdDebuggerOptionsSymbolSearchPaths),
sourceCodeMappings: ConfigurationController.getSettingOrDefault<any>(res.configIdDebuggerOptionsSourceCodeMappings),
searchMicrosoftSymbolServer: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsSearchMicrosoftSymbolServer),
skipNativeTransitions: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsSkipNativeTransitions),
};
}
public static getSetting<TResult>(id: string, fallback: TResult): TResult {
Expand Down
11 changes: 10 additions & 1 deletion src/VSCode.Extension/resources/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const configIdUninstallApplicationBeforeInstalling = "uninstallApplicatio
export const configIdApplyHotReloadChangesOnSave = "applyHotReloadChangesOnSave";

export const configIdDebuggerOptions = "debuggerOptions";
export const configIdStackFrameFormat = `${configIdDebuggerOptions}.stackFrameFormat`;

export const configIdDebuggerOptionsEvaluationTimeout = `${configIdDebuggerOptions}.evaluationTimeout`;
export const configIdDebuggerOptionsMemberEvaluationTimeout = `${configIdDebuggerOptions}.memberEvaluationTimeout`;
export const configIdDebuggerOptionsAllowTargetInvoke = `${configIdDebuggerOptions}.allowTargetInvoke`;
Expand All @@ -81,4 +83,11 @@ export const configIdDebuggerOptionsSearchMicrosoftSymbolServer = `${configIdDeb
export const configIdDebuggerOptionsSearchNuGetSymbolServer = `${configIdDebuggerOptions}.searchNugetSymbolServer`;
export const configIdDebuggerOptionsSourceCodeMappings = `${configIdDebuggerOptions}.sourceCodeMappings`;
export const configIdDebuggerOptionsAutomaticSourcelinkDownload = `${configIdDebuggerOptions}.automaticSourcelinkDownload`;
export const configIdDebuggerOptionsSymbolSearchPaths = `${configIdDebuggerOptions}.symbolSearchPaths`;
export const configIdDebuggerOptionsSymbolSearchPaths = `${configIdDebuggerOptions}.symbolSearchPaths`;
export const configIdDebuggerOptionsSkipNativeTransitions = `${configIdDebuggerOptions}.skipNativeTransitions`;

export const configIdDebuggerOptionsStackFrameFormatModule = `${configIdStackFrameFormat}.module`;
export const configIdDebuggerOptionsStackFrameFormatParameterTypes = `${configIdStackFrameFormat}.parameterTypes`;
export const configIdDebuggerOptionsStackFrameFormatParameterValues = `${configIdStackFrameFormat}.parameterValues`;
export const configIdDebuggerOptionsStackFrameFormatParameterNames = `${configIdStackFrameFormat}.parameterNames`;
export const configIdDebuggerOptionsStackFrameFormatLanguage = `${configIdStackFrameFormat}.language`;

0 comments on commit c5b42f0

Please sign in to comment.