Skip to content

Commit

Permalink
Merge pull request #180 from vosen/master
Browse files Browse the repository at this point in the history
Bump version to 0.1.1 and fix various gdb regressions
  • Loading branch information
vosen committed Aug 26, 2015
2 parents 6d4f55a + 95f9dcb commit 21089ca
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Microsoft.VisualStudio.Project/Properties/AssemblyInfo.cs
Expand Up @@ -32,8 +32,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]

[assembly: InternalsVisibleTo("VisualRust, PublicKey=00240000048000009400000006020000002400005253413100040000010001007755e184d6da3fe8b941736d1567d465beee5164177fa4517975dc035826e7cb94d733944a9df378cc038429af191f7ca06ddd4a146e6cd5882595030cfcf82b194cec14fe9745368245993236e5059f21a5721c0cad36c71bfa9101f41ac58c39318fdf91b7abf4ae799aa7e3ed5cb79efac57b651eb04c105219cbf1b2b69f")]
[assembly: InternalsVisibleTo("VisualRust.Project, PublicKey=00240000048000009400000006020000002400005253413100040000010001007755e184d6da3fe8b941736d1567d465beee5164177fa4517975dc035826e7cb94d733944a9df378cc038429af191f7ca06ddd4a146e6cd5882595030cfcf82b194cec14fe9745368245993236e5059f21a5721c0cad36c71bfa9101f41ac58c39318fdf91b7abf4ae799aa7e3ed5cb79efac57b651eb04c105219cbf1b2b69f")]
Expand Down
4 changes: 2 additions & 2 deletions RustLexer/Properties/AssemblyInfo.cs
Expand Up @@ -32,7 +32,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]

[assembly: System.CLSCompliant(true)]
4 changes: 2 additions & 2 deletions VisualRust.Build/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
14 changes: 7 additions & 7 deletions VisualRust.Project/DefaultRustLauncher.cs
Expand Up @@ -142,19 +142,17 @@ private void LaunchInGdbDebugger(string file)
// this affects the number of bytes the engine reads when disassembling commands,
// x64 has the largest maximum command size, so it should be safe to use for x86 as well
writer.WriteAttributeString("TargetArchitecture", "x64");

// GDB engine expects to find a shell on the other end of the pipe, so the first thing it sends over is "gdb --interpreter=mi",
// (which GDB complains about, since this isn't a valid command).
// Since we are launching GDB directly, here we create a noop alias for "gdb" to make the error message go away.
writer.WriteElementString("Command", "alias -a gdb=echo");

writer.WriteStartElement("SetupCommands");
// launch debuggee in a new console window
writer.WriteElementString("Command", "set new-console on");
writer.WriteElementString("Command", "-gdb-set new-console on");
if (!string.IsNullOrEmpty(debugConfig.DebuggerScript))
{
foreach (string cmd in debugConfig.DebuggerScript.Split('\r', '\n'))
if (!string.IsNullOrEmpty(cmd))
writer.WriteElementString("Command", cmd);
}
writer.WriteEndElement();

writer.WriteEndElement();
}
Expand All @@ -163,7 +161,9 @@ private void LaunchInGdbDebugger(string file)
VsDebugTargetProcessInfo[] results = new VsDebugTargetProcessInfo[targets.Length];

IVsDebugger4 vsDebugger = (IVsDebugger4)project.GetService(typeof(SVsShellDebugger));
vsDebugger.LaunchDebugTargets4((uint)targets.Length, targets, results);
vsDebugger.LaunchDebugTargets4((uint)targets.Length, targets, results);
var commandWnd = (IVsCommandWindow)project.GetService(typeof(SVsCommandWindow));
commandWnd.ExecuteCommand("alias gdb Debug.VRDebugExec");
}

private string GuessArchitecture()
Expand Down
4 changes: 2 additions & 2 deletions VisualRust.Project/Properties/AssemblyInfo.cs
Expand Up @@ -32,8 +32,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]

[assembly: InternalsVisibleTo("VisualRust, PublicKey=00240000048000009400000006020000002400005253413100040000010001007755e184d6da3fe8b941736d1567d465beee5164177fa4517975dc035826e7cb94d733944a9df378cc038429af191f7ca06ddd4a146e6cd5882595030cfcf82b194cec14fe9745368245993236e5059f21a5721c0cad36c71bfa9101f41ac58c39318fdf91b7abf4ae799aa7e3ed5cb79efac57b651eb04c105219cbf1b2b69f")]
#if TEST
Expand Down
2 changes: 1 addition & 1 deletion VisualRust.Setup/VisualRust.wxs
Expand Up @@ -3,7 +3,7 @@
<Product Id="*"
Name="Visual Rust"
Language="1033"
Version="0.1.0.0"
Version="0.1.1.0"
Manufacturer="The Piston Project"
UpgradeCode="{B5CC88F7-BC23-4400-95D8-9EE3FA95CC3F}">
<Package InstallerVersion="400"
Expand Down
4 changes: 2 additions & 2 deletions VisualRust.Shared/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
4 changes: 2 additions & 2 deletions VisualRust.Templates/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
1 change: 1 addition & 0 deletions VisualRust/Guids.cs
Expand Up @@ -5,5 +5,6 @@ namespace VisualRust
static class GuidList
{
public const string guidVisualRustPkgString = "40c1d2b5-528b-4966-a7b1-1974e3568abe";
public static Guid VisualRustCommandSet = new Guid("{91C8967B-EB9D-4904-AB07-4ACCA9C0ECFE}");
};
}
4 changes: 2 additions & 2 deletions VisualRust/Properties/AssemblyInfo.cs
Expand Up @@ -27,8 +27,8 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]



8 changes: 7 additions & 1 deletion VisualRust/VisualRust.csproj
Expand Up @@ -298,13 +298,19 @@
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Resource Include="Resources\Package.ico" />
<VSCTCompile Include="VisualRust.vsct" />
<VSCTCompile Include="VisualRust.vsct" >
<ResourceName>Menus.ctmenu</ResourceName>
</VSCTCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.VisualStudio.Project\Microsoft.VisualStudio.Project.csproj">
<Project>{cacb60a9-1e76-4f92-8831-b134a658c695}</Project>
<Name>Microsoft.VisualStudio.Project</Name>
</ProjectReference>
<ProjectReference Include="..\MIEngine\src\MICore\MICore.csproj">
<Project>{12cc862d-95b7-4224-8e16-b928c6333677}</Project>
<Name>MICore</Name>
</ProjectReference>
<ProjectReference Include="..\MIEngine\src\MIDebugEngine\MIDebugEngine.csproj">
<Project>{6D2688FE-6FD8-44A8-B96A-6037457F72A7}</Project>
<Name>MIDebugEngine</Name>
Expand Down
22 changes: 22 additions & 0 deletions VisualRust/VisualRust.vsct
@@ -1,3 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Commands package="VisualRustPackage">
<Buttons>
<Button guid="VisualRustCommandSet" id="VRDebugExec" priority="0x0100" type="Button">
<CommandFlag>AllowParams</CommandFlag>
<CommandFlag>CommandWellOnly</CommandFlag>
<Strings>
<ButtonText>Rust GDB Execute Command</ButtonText>
<CanonicalName>Debug.VRDebugExec</CanonicalName>
<LocCanonicalName>Debug.VRDebugExec</LocCanonicalName>
</Strings>
</Button>
</Buttons>
</Commands>

<Symbols>
<GuidSymbol name="VisualRustPackage" value="{40c1d2b5-528b-4966-a7b1-1974e3568abe}" />
<GuidSymbol name="VisualRustCommandSet" value="{91C8967B-EB9D-4904-AB07-4ACCA9C0ECFE}" >
<IDSymbol name="VRDebugExec" value="1" />
</GuidSymbol>
</Symbols>
</CommandTable>
144 changes: 141 additions & 3 deletions VisualRust/VisualRustPackage.cs
Expand Up @@ -16,6 +16,7 @@
using Microsoft.VisualStudioTools.Project;
using Microsoft.VisualStudioTools.Project.Automation;
using VisualRust.Options;
using MICore;

namespace VisualRust
{
Expand All @@ -34,7 +35,7 @@ namespace VisualRust
[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", "0.1", IconResourceID = 400)]
[InstalledProductRegistration("#110", "#112", "0.1.1", IconResourceID = 400)]
[ProvideLanguageService(typeof(RustLanguage), "Rust", 100,
CodeSense = true,
DefaultToInsertSpaces = true,
Expand Down Expand Up @@ -67,9 +68,12 @@ namespace VisualRust
[ProvideOptionPage(typeof(DebuggingOptionsPage), "Visual Rust", "Debugging", 110, 114, true)]
[ProvideProfile(typeof(RustOptionsPage), "Visual Rust", "General", 110, 113, true)]
[ProvideDebugEngine("Rust GDB", typeof(AD7ProgramProvider), typeof(AD7Engine), EngineConstants.EngineId)]
public class VisualRustPackage : CommonProjectPackage
[ProvideMenuResource("Menus.ctmenu", 1)]
public class VisualRustPackage : CommonProjectPackage, IOleCommandTarget
{
private RunningDocTableEventsListener docEventsListener;
private IOleCommandTarget packageCommandTarget;

internal static VisualRustPackage Instance { get; private set; }

/// <summary>
Expand All @@ -96,13 +100,147 @@ public VisualRustPackage()
protected override void Initialize()
{
base.Initialize();
packageCommandTarget = GetService(typeof(IOleCommandTarget)) as IOleCommandTarget;
Instance = this;

docEventsListener = new RunningDocTableEventsListener((IVsRunningDocumentTable)GetService(typeof(SVsRunningDocumentTable)));

Racer.RacerSingleton.Init();
}

int IOleCommandTarget.Exec(ref Guid cmdGroup, uint nCmdID, uint nCmdExecOpt, IntPtr pvaIn, IntPtr pvaOut)
{
if (cmdGroup == GuidList.VisualRustCommandSet)
{
switch (nCmdID)
{
case 1:
return VRDebugExec(nCmdExecOpt, pvaIn, pvaOut);

default:
return VSConstants.E_NOTIMPL;
}
}
return packageCommandTarget.Exec(cmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
}

int IOleCommandTarget.QueryStatus(ref Guid cmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
{
if (cmdGroup == GuidList.VisualRustCommandSet)
{
switch (prgCmds[0].cmdID)
{
case 1:
prgCmds[0].cmdf |= (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_INVISIBLE);
return VSConstants.S_OK;

default:
Debug.Fail("Unknown command id");
return VSConstants.E_NOTIMPL;
}
}

return packageCommandTarget.QueryStatus(ref cmdGroup, cCmds, prgCmds, pCmdText);
}

private int VRDebugExec(uint nCmdExecOpt, IntPtr pvaIn, IntPtr pvaOut)
{
int hr;

if (IsQueryParameterList(pvaIn, pvaOut, nCmdExecOpt))
{
Marshal.GetNativeVariantForObject("$", pvaOut);
return VSConstants.S_OK;
}

string arguments;
hr = EnsureString(pvaIn, out arguments);
if (hr != VSConstants.S_OK)
return hr;

if (string.IsNullOrWhiteSpace(arguments))
throw new ArgumentException("Expected an MI command to execute (ex: Debug.VRDebugExec info sharedlibrary)");

VRDebugExecAsync(arguments);

return VSConstants.S_OK;
}

private async void VRDebugExecAsync(string command)
{
var commandWindow = (IVsCommandWindow)GetService(typeof(SVsCommandWindow));

string results = null;

try
{
results = await MIDebugCommandDispatcher.ExecuteCommand(command);
}
catch (Exception e)
{
if (e.InnerException != null)
e = e.InnerException;

UnexpectedMIResultException miException = e as UnexpectedMIResultException;
string message;
if (miException != null && miException.MIError != null)
message = miException.MIError;
else
message = e.Message;

commandWindow.Print(string.Format("Error: {0}\r\n", message));
return;
}

if (results.Length > 0)
{
// Make sure that we are printing whole lines
if (!results.EndsWith("\n") && !results.EndsWith("\r\n"))
{
results = results + "\n";
}

commandWindow.Print(results);
}
}

static private bool IsQueryParameterList(System.IntPtr pvaIn, System.IntPtr pvaOut, uint nCmdexecopt)
{
ushort lo = (ushort)(nCmdexecopt & (uint)0xffff);
ushort hi = (ushort)(nCmdexecopt >> 16);
if (lo == (ushort)OLECMDEXECOPT.OLECMDEXECOPT_SHOWHELP)
{
if (hi == Microsoft.VisualStudio.Shell.VsMenus.VSCmdOptQueryParameterList)
{
if (pvaOut != IntPtr.Zero)
{
return true;
}
}
}

return false;
}

static private int EnsureString(IntPtr pvaIn, out string arguments)
{
arguments = null;
if (pvaIn == IntPtr.Zero)
{
// No arguments.
return VSConstants.E_INVALIDARG;
}

object vaInObject = Marshal.GetObjectForNativeVariant(pvaIn);
if (vaInObject == null || vaInObject.GetType() != typeof(string))
{
return VSConstants.E_INVALIDARG;
}

arguments = vaInObject as string;
return VSConstants.S_OK;
}

protected override void Dispose(bool disposing)
{
docEventsListener.Dispose();
Expand Down Expand Up @@ -143,7 +281,7 @@ public override string GetProductDescription()

public override string GetProductVersion()
{
return "0.1";
return "0.1.1";
}
}
}
2 changes: 1 addition & 1 deletion VisualRust/source.extension.debug.vsixmanifest
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="40c1d2b5-528b-4966-a7b1-1974e3568abe" Version="0.1" Language="en-US" Publisher="The Piston Project" />
<Identity Id="40c1d2b5-528b-4966-a7b1-1974e3568abe" Version="0.1.1" Language="en-US" Publisher="The Piston Project" />
<DisplayName>Visual Rust</DisplayName>
<Description>Visual Studio integration for the Rust programming language (http://www.rust-lang.org/)</Description>
<License>LICENSE.txt</License>
Expand Down
2 changes: 1 addition & 1 deletion VisualRust/source.extension.release.vsixmanifest
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="40c1d2b5-528b-4966-a7b1-1974e3568abe" Version="0.1" Language="en-US" Publisher="The Piston Project" />
<Identity Id="40c1d2b5-528b-4966-a7b1-1974e3568abe" Version="0.1.1" Language="en-US" Publisher="The Piston Project" />
<DisplayName>Visual Rust</DisplayName>
<Description>Visual Studio integration for the Rust programming language (http://www.rust-lang.org/)</Description>
<License>LICENSE.txt</License>
Expand Down

0 comments on commit 21089ca

Please sign in to comment.