Skip to content

Commit

Permalink
Merge main into release branch (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoyosjs authored Jul 20, 2021
2 parents f3ffe27 + 8cffa1d commit 5366510
Show file tree
Hide file tree
Showing 71 changed files with 2,603 additions and 1,382 deletions.
5 changes: 5 additions & 0 deletions compileoptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ if(CLR_CMAKE_PLATFORM_UNIX_ARM)
endif(ARM_SOFTFP)
endif(CLR_CMAKE_PLATFORM_UNIX_ARM)

if(CLR_CMAKE_PLATFORM_FREEBSD)
add_compile_options(-Wno-macro-redefined)
add_compile_options(-Wno-pointer-to-int-cast)
endif(CLR_CMAKE_PLATFORM_FREEBSD)

if (WIN32)
# Compile options for targeting windows

Expand Down
62 changes: 60 additions & 2 deletions documentation/design-docs/ipc-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ See: [Profiler Commands](#Profiler-Commands)
```c++
enum class ProcessCommandId : uint8_t
{
ProcessInfo = 0x00,
ResumeRuntime = 0x01,
ProcessInfo = 0x00,
ResumeRuntime = 0x01,
ProcessEnvironment = 0x02,
ProcessInfo2 = 0x04,
// future
}
```
Expand Down Expand Up @@ -787,6 +789,62 @@ struct Payload
}
```

> Available since .NET 6.0

### `ProcessInfo2`

Command Code: `0x0404`

The `ProcessInfo2` command queries the runtime for some basic information about the process. The returned payload has the same information as that of the `ProcessInfo` command in addition to the managed entrypoint assembly name and CLR product version.

In the event of an [error](#Errors), the runtime will attempt to send an error message and subsequently close the connection.

#### Inputs:

Header: `{ Magic; Size; 0x0402; 0x0000 }`

There is no payload.

#### Returns (as an IPC Message Payload):

Header: `{ Magic; size; 0xFF00; 0x0000; }`

Payload:
* `int64 processId`: the process id in the process's PID-space
* `GUID runtimeCookie`: a 128-bit GUID that should be unique across PID-spaces
* `string commandLine`: the command line that invoked the process
* Windows: will be the same as the output of `GetCommandLineW`
* Non-Windows: will be the fully qualified path of the executable in `argv[0]` followed by all arguments as the appear in `argv` separated by spaces, i.e., `/full/path/to/argv[0] argv[1] argv[2] ...`
* `string OS`: the operating system that the process is running on
* macOS => `"macOS"`
* Windows => `"Windows"`
* Linux => `"Linux"`
* other => `"Unknown"`
* `string arch`: the architecture of the process
* 32-bit => `"x86"`
* 64-bit => `"x64"`
* ARM32 => `"arm32"`
* ARM64 => `"arm64"`
* Other => `"Unknown"`
* `string managedEntrypointAssemblyName`: the assembly name from the assembly identity of the entrypoint assembly of the process. This is the same value that is returned from executing `System.Reflection.Assembly.GetEntryAssembly().GetName().Name` in the target process.
* `string clrProductVersion`: the product version of the CLR of the process; may contain prerelease label information e.g. `6.0.0-preview.6.#####`

##### Details:

Returns:
```c++
struct Payload
{
uint64_t ProcessId;
LPCWSTR CommandLine;
LPCWSTR OS;
LPCWSTR Arch;
GUID RuntimeCookie;
LPCWSTR ManagedEntrypointAssemblyName;
LPCWSTR ClrProductVersion;
}
```
## Errors
In the event an error occurs in the handling of an Ipc Message, the Diagnostic Server will attempt to send an Ipc Message encoding the error and subsequently close the connection. The connection will be closed **regardless** of the success of sending the error message. The Client is expected to be resilient in the event of a connection being abruptly closed.
Expand Down
26 changes: 24 additions & 2 deletions documentation/diagnostics-client-library-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,36 @@ public static void PrintEventsLive(int processId)

This sample shows how to attach an ICorProfiler to a process (profiler attach).
```cs
public static int AttachProfiler(int processId, Guid profilerGuid, string profilerPath)
public static void AttachProfiler(int processId, Guid profilerGuid, string profilerPath)
{
var client = new DiagnosticsClient(processId);
return client.AttachProfiler(TimeSpan.FromSeconds(10), profilerGuid, profilerPath);
client.AttachProfiler(TimeSpan.FromSeconds(10), profilerGuid, profilerPath);
}
```

#### 8. Set an ICorProfiler to be used as the startup profiler

This sample shows how to request that the runtime use an ICorProfiler as the startup profiler (not as an attaching profiler). It is only valid to issue this command while the runtime is paused in "reverse server" mode.

```cs
public static void SetStartupProfilerProfiler(Guid profilerGuid, string profilerPath)
{
var client = new DiagnosticsClient(processId);
client.SetStartupProfiler(profilerGuid, profilerPath);
}
```

#### 9. Resume the runtime when it is paused in reverse server mode

This sample shows how a client can instruct the runtime to resume loading after it has been paused in "reverse server" mode.

```cs
public static void ResumeRuntime(Guid profilerGuid, string profilerPath)
{
var client = new DiagnosticsClient(processId);
client.ResumeRuntime();
}
```

## API Description

Expand Down
24 changes: 12 additions & 12 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<Uri>https://github.com/dotnet/symstore</Uri>
<Sha>3ed87724fe4e98c7ecc77617720591783ee2e676</Sha>
</Dependency>
<Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.226801">
<Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.230301">
<Uri>https://github.com/microsoft/clrmd</Uri>
<Sha>52b244f9b62e7a4e398f0cd9cb99d3c9a76f3130</Sha>
<Sha>957981f36eeccb6e9d266407df6522ca5cfbd899</Sha>
</Dependency>
<Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.226801">
<Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.230301">
<Uri>https://github.com/microsoft/clrmd</Uri>
<Sha>52b244f9b62e7a4e398f0cd9cb99d3c9a76f3130</Sha>
<Sha>957981f36eeccb6e9d266407df6522ca5cfbd899</Sha>
</Dependency>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-preview.1.21103.13">
<Uri>https://github.com/dotnet/installer</Uri>
Expand All @@ -32,21 +32,21 @@
<Sha>7f13798e5f567b72ffe63205bf49839245f0f8c1</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.AspNetCore.App.Ref.Internal" Version="6.0.0-preview.6.21275.8">
<Dependency Name="Microsoft.AspNetCore.App.Ref.Internal" Version="6.0.0-preview.7.21363.17">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>e7b5aa6f713e9f040ba0730b915ae407d35971c1</Sha>
<Sha>837b17847c427be12d69623cf32223c10a4ddba5</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.0-preview.6.21275.8">
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.0-preview.7.21363.17">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>e7b5aa6f713e9f040ba0730b915ae407d35971c1</Sha>
<Sha>837b17847c427be12d69623cf32223c10a4ddba5</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.0-preview.6.21276.1">
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.0-preview.7.21361.10">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>f584c7401a24781b4c8e8e2a8097b85462ee4941</Sha>
<Sha>98b7ed1a3b0543a31b5a0f9069cf44cb70c9230c</Sha>
</Dependency>
<Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.6.0" Version="6.0.0-preview.6.21276.1">
<Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.6.0" Version="6.0.0-preview.7.21361.10">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>f584c7401a24781b4c8e8e2a8097b85462ee4941</Sha>
<Sha>98b7ed1a3b0543a31b5a0f9069cf44cb70c9230c</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
12 changes: 6 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<MicrosoftNETCoreApp50Version>5.0.6</MicrosoftNETCoreApp50Version>
<MicrosoftAspNetCoreApp50Version>$(MicrosoftNETCoreApp50Version)</MicrosoftAspNetCoreApp50Version>
<!-- Latest shared runtime version updated by darc -->
<VSRedistCommonNetCoreSharedFrameworkx6460Version>6.0.0-preview.6.21276.1</VSRedistCommonNetCoreSharedFrameworkx6460Version>
<MicrosoftNETCoreAppRuntimewinx64Version>6.0.0-preview.6.21276.1</MicrosoftNETCoreAppRuntimewinx64Version>
<VSRedistCommonNetCoreSharedFrameworkx6460Version>6.0.0-preview.7.21361.10</VSRedistCommonNetCoreSharedFrameworkx6460Version>
<MicrosoftNETCoreAppRuntimewinx64Version>6.0.0-preview.7.21361.10</MicrosoftNETCoreAppRuntimewinx64Version>
<!-- Latest shared aspnetcore version updated by darc -->
<MicrosoftAspNetCoreAppRefInternalVersion>6.0.0-preview.6.21275.8</MicrosoftAspNetCoreAppRefInternalVersion>
<MicrosoftAspNetCoreAppRefVersion>6.0.0-preview.6.21275.8</MicrosoftAspNetCoreAppRefVersion>
<MicrosoftAspNetCoreAppRefInternalVersion>6.0.0-preview.7.21363.17</MicrosoftAspNetCoreAppRefInternalVersion>
<MicrosoftAspNetCoreAppRefVersion>6.0.0-preview.7.21363.17</MicrosoftAspNetCoreAppRefVersion>
<!-- dotnet/installer: Testing version of the SDK. Needed for the signed & entitled host. -->
<MicrosoftDotnetSdkInternalVersion>6.0.100-preview.1.21103.13</MicrosoftDotnetSdkInternalVersion>
</PropertyGroup>
Expand All @@ -36,8 +36,8 @@
<MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
<!-- Other libs -->
<MicrosoftBclAsyncInterfacesVersion>1.1.0</MicrosoftBclAsyncInterfacesVersion>
<MicrosoftDiagnosticsRuntimeVersion>2.0.226801</MicrosoftDiagnosticsRuntimeVersion>
<MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.226801</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
<MicrosoftDiagnosticsRuntimeVersion>2.0.230301</MicrosoftDiagnosticsRuntimeVersion>
<MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.230301</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
<MicrosoftDiaSymReaderNativePackageVersion>16.9.0-beta1.21055.5</MicrosoftDiaSymReaderNativePackageVersion>
<MicrosoftDiagnosticsTracingTraceEventVersion>2.0.64</MicrosoftDiagnosticsTracingTraceEventVersion>
<MicrosoftExtensionsLoggingVersion>2.1.1</MicrosoftExtensionsLoggingVersion>
Expand Down
13 changes: 2 additions & 11 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ case $CPUName in
__HostArch=x86
;;

x86_64)
x86_64|amd64)
__BuildArch=x64
__HostArch=x64
;;
Expand Down Expand Up @@ -259,7 +259,7 @@ while :; do
-clang*)
__Compiler=clang
# clangx.y or clang-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
version="$(echo "$1" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__ClangMajorVersion="${parts[0]}"
__ClangMinorVersion="${parts[1]}"
Expand Down Expand Up @@ -433,15 +433,6 @@ if [ "$__HostOS" == "OSX" ]; then

export MACOSX_DEPLOYMENT_TARGET=10.12

# If Xcode 9.2 exists (like on the CI/build machines), use that. Xcode 9.3 or
# greater (swift 4.1 lldb) doesn't work that well (seg faults on exit).
if [ -f "/Applications/Xcode_9.2.app/Contents/Developer/usr/bin/lldb" ]; then
if [ -f "/Applications/Xcode_9.2.app/Contents/SharedFrameworks/LLDB.framework/LLDB" ]; then
export LLDB_PATH=/Applications/Xcode_9.2.app/Contents/Developer/usr/bin/lldb
export LLDB_LIB=/Applications/Xcode_9.2.app/Contents/SharedFrameworks/LLDB.framework/LLDB
fi
fi

if [ ! -f $LLDB_LIB ]; then
echo "Cannot find the lldb library. Try installing Xcode."
exit 1
Expand Down
6 changes: 5 additions & 1 deletion eng/common/native/find-native-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ check_version_exists() {
desired_version="$1$2"
elif command -v "$compiler-$1$2" > /dev/null; then
desired_version="-$1$2"
elif command -v "$compiler$1" > /dev/null; then
desired_version="$1"
elif command -v "$compiler-$1" > /dev/null; then
desired_version="-$1"
fi

echo "$desired_version"
Expand All @@ -55,7 +59,7 @@ if [ -z "$CLR_CC" ]; then
# Set default versions
if [ -z "$majorVersion" ]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
if [ "$compiler" = "clang" ]; then versions=( 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi

for version in "${versions[@]}"; do
Expand Down
6 changes: 6 additions & 0 deletions eng/gen-buildsys-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ elif command -v "clang$2$3" > /dev/null
elif command -v "clang-$2$3" > /dev/null
then
desired_llvm_version="-$2$3"
elif command -v "clang-$2" > /dev/null
then
desired_llvm_version="-$2"
elif command -v "clang$2" > /dev/null
then
desired_llvm_version="$2"
elif command -v clang > /dev/null
then
desired_llvm_version=
Expand Down
20 changes: 10 additions & 10 deletions src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public enum Flags : byte

private readonly IDisposable _onChangeEvent;
private Flags _flags;
private PdbInfo _pdbInfo;
private PdbFileInfo _pdbFileInfo;
private ImmutableArray<byte> _buildId;
private VersionInfo? _version;
private VersionData _versionData;
private PEImage _peImage;

public readonly ServiceProvider ServiceProvider;
Expand Down Expand Up @@ -118,12 +118,12 @@ public bool? IsFileLayout
}
}

public PdbInfo PdbInfo
public PdbFileInfo PdbFileInfo
{
get
{
GetPEInfo();
return _pdbInfo;
return _pdbFileInfo;
}
}

Expand All @@ -147,10 +147,10 @@ public ImmutableArray<byte> BuildId
}
}

public virtual VersionInfo? Version
public virtual VersionData VersionData
{
get { return _version; }
set { _version = value; }
get { return _versionData; }
set { _versionData = value; }
}

public abstract string VersionString { get; }
Expand All @@ -162,7 +162,7 @@ protected void GetVersionFromVersionString()
GetPEInfo();

// If we can't get the version from the PE, search for version string embedded in the module data
if (!_version.HasValue && !IsPEImage)
if (_versionData is null && !IsPEImage)
{
string versionString = VersionString;
if (versionString != null)
Expand All @@ -178,7 +178,7 @@ protected void GetVersionFromVersionString()
try
{
Version version = System.Version.Parse(versionToParse);
_version = new VersionInfo(version.Major, version.Minor, version.Build, version.Revision);
_versionData = new VersionData(version.Major, version.Minor, version.Build, version.Revision);
}
catch (ArgumentException ex)
{
Expand All @@ -192,7 +192,7 @@ protected void GetVersionFromVersionString()
protected PEImage GetPEInfo()
{
if (InitializeValue(Flags.InitializePEInfo)) {
_peImage = ModuleService.GetPEInfo(ImageBase, ImageSize, ref _pdbInfo, ref _version, ref _flags);
_peImage = ModuleService.GetPEInfo(ImageBase, ImageSize, ref _pdbFileInfo, ref _versionData, ref _flags);
}
return _peImage;
}
Expand Down
Loading

0 comments on commit 5366510

Please sign in to comment.