Skip to content

Commit

Permalink
Merge pull request #1285 from microsoft/main
Browse files Browse the repository at this point in the history
Merge 'main' into 'release-cpptools'
  • Loading branch information
WardenGnaw authored Mar 5, 2022
2 parents b7e3d6f + de8db64 commit c405048
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Build-And-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ jobs:
run: dotnet build ${{ github.workspace }}/src/MIDebugEngine-Unix.sln

- run: |
sudo apt update
sudo apt-get install gdb g++ -y
which g++
which gdb
Expand Down
45 changes: 41 additions & 4 deletions src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,13 @@ private async Task HandleBreakModeEvent(ResultEventArgs results, BreakRequest br
}
else
{
// not one of our breakpoints, so stop with a message
_callback.OnException(thread, "Unknown breakpoint", "", 0);
// This is not one of our breakpoints, so stop with a message. Possibly it
// was set by the user via "-exec break ...", so display the available
// information.
string desc = String.Format(CultureInfo.CurrentCulture,
ResourceStrings.UnknownBreakpoint,
bkptno, addr);
_callback.OnException(thread, desc, "", 0);
}
}
}
Expand Down Expand Up @@ -1263,8 +1268,40 @@ private async Task HandleBreakModeEvent(ResultEventArgs results, BreakRequest br
}
else
{
// not one of our breakpoints, so stop with a message
_callback.OnException(thread, "Unknown watchpoint", "", 0);
// This is not one of our watchpoints, so stop with a message. Possibly it
// was set by the user via "-exec watch ...", so display the available
// information.
string desc = string.Empty;
string exp = wpt.TryFindString("exp");
if (string.IsNullOrEmpty(exp)) {
desc = String.Format(CultureInfo.CurrentCulture,
ResourceStrings.UnknownWatchpoint,
bkptno, addr);
}
else
{
desc = String.Format(CultureInfo.CurrentCulture,
ResourceStrings.UnknownWatchpointWithExpression,
bkptno, exp, addr);
}
var value = results.Results.TryFind<TupleValue>("value");
if (value != null) {
string oldValue = value.TryFindString("old");
if (!string.IsNullOrEmpty(oldValue)) {
desc += "\n";
desc += String.Format(CultureInfo.CurrentCulture,
ResourceStrings.UnknownWatchpointOldValue,
oldValue);
}
string newValue = value.TryFindString("new");
if (!string.IsNullOrEmpty(newValue)) {
desc += "\n";
desc += String.Format(CultureInfo.CurrentCulture,
ResourceStrings.UnknownWatchpointNewValue,
newValue);
}
}
_callback.OnException(thread, desc, "", 0);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/MIDebugEngine/Engine.Impl/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ public enum NodeType
private string StripFormatSpecifier(string exp, out string formatSpecifier)
{
formatSpecifier = null; // will be used with -var-set-format

if (EngineUtils.IsConsoleExecCmd(exp, out string _, out string _))
{
return exp;
}

int lastComma = exp.LastIndexOf(',');
if (lastComma <= 0)
return exp;
Expand Down
3 changes: 2 additions & 1 deletion src/MIDebugEngine/Natvis.Impl/Natvis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ internal IVariableInformation[] Expand(IVariableInformation variable)
internal IVariableInformation GetVariable(string expr, AD7StackFrame frame)
{
IVariableInformation variable;
if (expr.EndsWith(",viz", StringComparison.Ordinal))
if (!EngineUtils.IsConsoleExecCmd(expr, out string _, out string _)
&& expr.EndsWith(",viz", StringComparison.Ordinal))
{
expr = expr.Substring(0, expr.Length - 4);
variable = new VariableInformation(expr, expr, frame.ThreadContext, frame.Engine, frame.Thread);
Expand Down
45 changes: 45 additions & 0 deletions src/MIDebugEngine/ResourceStrings.Designer.cs

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

20 changes: 20 additions & 0 deletions src/MIDebugEngine/ResourceStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,24 @@ See https://aka.ms/miengine-gdb-troubleshooting for details.</value>
<value>Exception{0} thrown at 0x{1:X} in {2}.</value>
<comment>0 = optional exception name, 1 = address, 2 = exception file</comment>
</data>
<data name="UnknownBreakpoint" xml:space="preserve">
<value>Hit breakpoint {0} at 0x{1:x}.</value>
<comment>0 = breakpoint number, 1 = address</comment>
</data>
<data name="UnknownWatchpoint" xml:space="preserve">
<value>Hit watchpoint {0} at 0x{1:x}.</value>
<comment>0 = watchpoint number, 1 = address</comment>
</data>
<data name="UnknownWatchpointWithExpression" xml:space="preserve">
<value>Hit watchpoint {0}: {1} at 0x{2:x}.</value>
<comment>0 = watchpoint number, 1 = expression, 2 = address</comment>
</data>
<data name="UnknownWatchpointOldValue" xml:space="preserve">
<value>Old value = {0}</value>
<comment>0 = old value of watchpoint</comment>
</data>
<data name="UnknownWatchpointNewValue" xml:space="preserve">
<value>New value = {0}</value>
<comment>0 = new value of watchpoint</comment>
</data>
</root>
1 change: 0 additions & 1 deletion src/MIDebugPackage/MIDebugPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
</ItemGroup>

<ItemGroup>
<Content Include="Resources\Package.ico" />
<Content Include="OpenFolderSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
Expand Down
5 changes: 1 addition & 4 deletions src/MIDebugPackage/MIDebugPackagePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ namespace Microsoft.MIDebugPackage
/// </summary>
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
// a package.
[PackageRegistration(UseManagedResourcesOnly = true)]
// This attribute is used to register the information needed to show this package
// in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[PackageRegistration(UseManagedResourcesOnly = true)]
// This attribute is needed to let the shell know that this package exposes some menus.
[ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(GuidList.guidMIDebugPackagePkgString)]
Expand Down
Binary file removed src/MIDebugPackage/Resources/Package.ico
Binary file not shown.
10 changes: 0 additions & 10 deletions src/MIDebugPackage/VSPackage.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="110" xml:space="preserve">
<value>Microsoft MI-Based Debugger</value>
</data>
<data name="112" xml:space="preserve">
<value>Provides support for connecting Visual Studio to MI compatible debuggers</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

0 comments on commit c405048

Please sign in to comment.