Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 24 additions & 7 deletions RaspberryDebugger/Connection/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,22 @@ private async Task<bool> InstallSdkPrerequsitesAsync()
if ! apt-get update ; then
exit 1
fi

if ! apt-get install -yq libc6 libgcc1 libgssapi-krb5-2 libicu-dev libssl1.1 libstdc++6 zlib1g libgdiplus ; then
exit 1

debianVersion=$(cat /etc/debian_version)
versionTwelve='12'
if dpkg --compare-versions $debianVersion gt $versionTwelve
then
# Debian 12 or newer
if ! apt-get install -yq libc6 libgcc-s1 libgssapi-krb5-2 libicu-dev libssl3 libstdc++6 zlib1g libgdiplus ; then
exit 1
fi
else
# Older than Debian 12
if ! apt-get install -yq libc6 libgcc1 libgssapi-krb5-2 libicu-dev libssl1.1 libstdc++6 zlib1g libgdiplus ; then
exit 1
fi
fi

exit 0
""";

Expand Down Expand Up @@ -708,10 +719,16 @@ public async Task<bool> SetupDebuggerAsync()
// see: https://developercommunity.visualstudio.com/t/VS2022-remote-debugging-over-SSH-does-no/10394545#T-N10410651
// This structure is used when Debug->Attach to Process is used. Unfortunately it's tied to
// the VS version.
// Currently the VSIX is only targeted to VS2022 so keep the version selector fixed.
// TODO: Use RaspberryDebuggerPackage.VisualStudioVersion for DIR.
// The getvsdbgsh docs suggest that one should use the VS Version to select the proper debugger. I tried
// that as VS2026 has been released. Unfortunately, getvsdbgsh returns an error using "vs2026" as a -v option.
// At least it does at this time anyway. In the process of trying to reverse engineer the valid options for
// -v I noticed that for any version I submitted - vs2019/vs2022/vs2017/latest, the script always attempted
// to download the latest revision of vsdbg. So I'm just going to use latest until that decides to stop working.
// It's going to be installed in the dir associated with the VS version though, keeping the paradigm suggested
// above.
var installCommand =
$"""curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v vs2022 -l {PackageHelper.RemoteDebuggerFolder}""";
//$"""curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v {PackageHelper.VisualStudioVersion} -l {PackageHelper.RemoteDebuggerFolder}""";
$"""curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l {PackageHelper.RemoteDebuggerFolder}""";

try
{
Expand Down
40 changes: 36 additions & 4 deletions RaspberryDebugger/PackageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@

namespace RaspberryDebugger
{
enum VisualStudioVersions
{
Unknown,

vs2017 = 15,
vs2019,
vs2022,
vs2026
}

/// <summary>
/// Package specific constants.
/// </summary>
Expand All @@ -61,6 +71,30 @@
/// </summary>
private static readonly string ConnectionsPath;

/// <summary>
/// Indicates what VS application is currently running.
/// </summary>
private static VisualStudioVersions _visualStudioVersion = VisualStudioVersions.Unknown;
public static VisualStudioVersions VisualStudioVersion
{
get
{
if ( _visualStudioVersion == VisualStudioVersions.Unknown )
{
ThreadHelper.ThrowIfNotOnUIThread();

Check warning on line 84 in RaspberryDebugger/PackageHelper.cs

View workflow job for this annotation

GitHub Actions / build_Windows (Release, Any CPU)


DTE2 dte = (DTE2)Package.GetGlobalService(typeof(SDTE));

if (Version.TryParse(dte.Version, out Version result))
{
Enum.TryParse(result.Major.ToString(), out _visualStudioVersion);
}
}

return _visualStudioVersion;
}
}

/// <summary>
/// Directory on the Raspberry Pi where .NET Core SDKs will be installed along with the
/// <b>vsdbg</b> remote debugger.
Expand All @@ -74,15 +108,13 @@

/// <summary>
/// Directory on the Raspberry Pi where the <b>vsdbg</b> remote debugger will be installed.
/// Currently the VSIX is only targeted to VS2022 so keep the version selector fixed.
/// TODO: Use RaspberryDebuggerPackage.VisualStudioVersion for DIR..
/// </summary>
public const string RemoteDebuggerFolder = "~/.vs-debugger/vs2022";
public static readonly string RemoteDebuggerFolder = $"~/.vs-debugger/{VisualStudioVersion}";

/// <summary>
/// Path to the <b>vsdbg</b> program on the remote machine.
/// </summary>
public const string RemoteDebuggerPath = RemoteDebuggerFolder + "/vsdbg";
public static string RemoteDebuggerPath = RemoteDebuggerFolder + "/vsdbg";

/// <summary>
/// Returns the root directory on the Raspberry Pi where the folder where
Expand Down
1 change: 1 addition & 0 deletions RaspberryDebugger/RaspberryDebugger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<WarningLevel>4</WarningLevel>
<NoWarn>CS0414</NoWarn>
<LangVersion>latest</LangVersion>
<DeployExtension>True</DeployExtension>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down