Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into thays_fix_debugger_break
Browse files Browse the repository at this point in the history
# By Camillo Toselli (1) and others
# Via GitHub
* origin/main:
  add RID for Debian 11 (dotnet#56789)
  [wasm] [debugger] Skip thread static field (dotnet#56749)
  Fix timeouts in coreroot_determinism test in GC stress mode (dotnet#56770)
  Use File.OpenHandle in Socket.SendFile directly (dotnet#56777)
  accept empty realm for digest auth (dotnet#56369) (dotnet#56455)

# Conflicts:
#	src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs
#	src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs
  • Loading branch information
thaystg committed Aug 3, 2021
2 parents 37260f8 + f598846 commit 3662e3e
Show file tree
Hide file tree
Showing 20 changed files with 234 additions and 34 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
processParameters.EnvironmentOverrides["COMPlus_GCStress"] = "";
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";
return processParameters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static IEnumerable<object[]> Authentication_SocketsHttpHandler_TestData()
{
yield return new object[] { "Digest realm=\"testrealm\",nonce=\"6afd170437eb5144258b308f7c491d96\",opaque=\"\",stale=FALSE,algorithm=MD5,qop=\"auth\"", true };
yield return new object[] { "Digest realm=\"testrealm\", domain=\"\", nonce=\"NA42+vpOFQd1GwCyVRZuhhy+jDn4BMRl\", algorithm=MD5, qop=\"auth\", stale=false", true };
yield return new object[] { "Digest realm=\"\", nonce=\"NA42+vpOFQd1GwCyVRZuhhy+jDn4BMRl\", algorithm=MD5, qop=\"auth\", stale=false", true };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ internal static bool IsDigestAuthTokenValid(string clientResponse, string reques
}

// Realm is mandatory.
if (string.IsNullOrEmpty(realm))
if (realm == null)
return false;
}
else if (trimmedValue.StartsWith(nameof(cnonce)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,74 @@
"any",
"base"
],
"debian.11": [
"debian.11",
"debian",
"linux",
"unix",
"any",
"base"
],
"debian.11-arm": [
"debian.11-arm",
"debian.11",
"debian-arm",
"debian",
"linux-arm",
"linux",
"unix-arm",
"unix",
"any",
"base"
],
"debian.11-arm64": [
"debian.11-arm64",
"debian.11",
"debian-arm64",
"debian",
"linux-arm64",
"linux",
"unix-arm64",
"unix",
"any",
"base"
],
"debian.11-armel": [
"debian.11-armel",
"debian.11",
"debian-armel",
"debian",
"linux-armel",
"linux",
"unix-armel",
"unix",
"any",
"base"
],
"debian.11-x64": [
"debian.11-x64",
"debian.11",
"debian-x64",
"debian",
"linux-x64",
"linux",
"unix-x64",
"unix",
"any",
"base"
],
"debian.11-x86": [
"debian.11-x86",
"debian.11",
"debian-x86",
"debian",
"linux-x86",
"linux",
"unix-x86",
"unix",
"any",
"base"
],
"debian.8": [
"debian.8",
"debian",
Expand Down
35 changes: 35 additions & 0 deletions src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,41 @@
"debian-x86"
]
},
"debian.11": {
"#import": [
"debian"
]
},
"debian.11-arm": {
"#import": [
"debian.11",
"debian-arm"
]
},
"debian.11-arm64": {
"#import": [
"debian.11",
"debian-arm64"
]
},
"debian.11-armel": {
"#import": [
"debian.11",
"debian-armel"
]
},
"debian.11-x64": {
"#import": [
"debian.11",
"debian-x64"
]
},
"debian.11-x86": {
"#import": [
"debian.11",
"debian-x86"
]
},
"debian.8": {
"#import": [
"debian"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<RuntimeGroup Include="debian">
<Parent>linux</Parent>
<Architectures>x64;x86;arm;armel;arm64</Architectures>
<Versions>8;9;10</Versions>
<Versions>8;9;10;11</Versions>
<TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
</RuntimeGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ internal static partial class AuthenticationHelper
}

// Add realm
if (realm != string.Empty)
sb.AppendKeyValue(Realm, realm);
sb.AppendKeyValue(Realm, realm);

// Add nonce
sb.AppendKeyValue(Nonce, nonce);
Expand Down Expand Up @@ -407,9 +406,11 @@ private void Parse(string challenge)
break;

// Ensure value is valid.
// Opaque and Domain can have empty string
// Opaque, Domain and Realm can have empty string
if (value == string.Empty &&
(!key.Equals(Opaque, StringComparison.OrdinalIgnoreCase) && !key.Equals(Domain, StringComparison.OrdinalIgnoreCase)))
!key.Equals(Opaque, StringComparison.OrdinalIgnoreCase) &&
!key.Equals(Domain, StringComparison.OrdinalIgnoreCase) &&
!key.Equals(Realm, StringComparison.OrdinalIgnoreCase))
break;

// Add the key-value pair to Parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Threading.Tasks;
using System.Runtime.Versioning;
using Microsoft.Win32.SafeHandles;

namespace System.Net.Sockets
{
Expand Down Expand Up @@ -190,12 +191,11 @@ private void SendFileInternal(string? fileName, ReadOnlySpan<byte> preBuffer, Re
{
CheckTransmitFileOptions(flags);

SocketError errorCode = SocketError.Success;

// Open the file, if any
// Open it before we send the preBuffer so that any exception happens first
FileStream? fileStream = OpenFile(fileName);

SocketError errorCode = SocketError.Success;
using (fileStream)
using (SafeFileHandle? fileHandle = OpenFileHandle(fileName))
{
// Send the preBuffer, if any
// This will throw on error
Expand All @@ -205,10 +205,10 @@ private void SendFileInternal(string? fileName, ReadOnlySpan<byte> preBuffer, Re
}

// Send the file, if any
if (fileStream != null)
if (fileHandle != null)
{
// This can throw ObjectDisposedException.
errorCode = SocketPal.SendFile(_handle, fileStream);
errorCode = SocketPal.SendFile(_handle, fileHandle);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,11 @@ private Socket GetOrCreateAcceptSocket(Socket? acceptSocket, bool checkDisconnec

private void SendFileInternal(string? fileName, ReadOnlySpan<byte> preBuffer, ReadOnlySpan<byte> postBuffer, TransmitFileOptions flags)
{
// Open the file, if any
FileStream? fileStream = OpenFile(fileName);

SocketError errorCode;
using (fileStream)
{
SafeFileHandle? fileHandle = fileStream?.SafeFileHandle;

// Open the file, if any
using (SafeFileHandle? fileHandle = OpenFileHandle(fileName))
{
// This can throw ObjectDisposedException.
errorCode = SocketPal.SendFile(_handle, fileHandle, preBuffer, postBuffer, flags);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;

namespace System.Net.Sockets
{
Expand Down Expand Up @@ -3783,7 +3784,7 @@ private void ValidateBlockingMode()
partial void ValidateForMultiConnect(bool isMultiEndpoint);

// Helper for SendFile implementations
private static FileStream? OpenFile(string? name) => string.IsNullOrEmpty(name) ? null : File.OpenRead(name);
private static SafeFileHandle? OpenFileHandle(string? name) => string.IsNullOrEmpty(name) ? null : File.OpenHandle(name, FileMode.Open, FileAccess.Read);

private void UpdateReceiveSocketErrorForDisposed(ref SocketError socketError, int bytesTransferred)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1172,13 +1172,10 @@ public static SocketError Send(SafeSocketHandle handle, ReadOnlySpan<byte> buffe
return errorCode;
}

public static SocketError SendFile(SafeSocketHandle handle, FileStream fileStream)
public static SocketError SendFile(SafeSocketHandle handle, SafeFileHandle fileHandle)
{
long offset = 0;
long length = fileStream.Length;

SafeFileHandle fileHandle = fileStream.SafeFileHandle;

long length = RandomAccess.GetLength(fileHandle);
long bytesTransferred = 0;

if (!handle.IsNonBlocking)
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -8025,6 +8025,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
buffer_add_string (buf, f->name);
buffer_add_typeid (buf, domain, mono_class_from_mono_type_internal (f->type));
buffer_add_int (buf, f->type->attrs);
if (CHECK_PROTOCOL_VERSION(2, 61))
buffer_add_int(buf, mono_class_field_is_special_static(f));
i ++;
}
g_assert (i == nfields);
Expand Down
3 changes: 3 additions & 0 deletions src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,9 @@ public async Task<List<FieldTypeClass>> GetTypeFields(SessionId sessionId, int t
string fieldNameStr = retDebuggerCmdReader.ReadString();
int typeId = retDebuggerCmdReader.ReadInt32(); //typeId
retDebuggerCmdReader.ReadInt32(); //attrs
int isSpecialStatic = retDebuggerCmdReader.ReadInt32(); //is_special_static
if (isSpecialStatic == 1)
continue;
if (fieldNameStr.Contains("k__BackingField"))
{
fieldNameStr = fieldNameStr.Replace("k__BackingField", "");
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,32 +259,32 @@ public async Task BreakOnDebuggerBreak()
{
await EvaluateAndCheck(
"window.setTimeout(function() { invoke_static_method_async('[debugger-test] UserBreak:BreakOnDebuggerBreakCommand'); }, 1);",
"dotnet://debugger-test.dll/debugger-test2.cs", 56, 8,
"dotnet://debugger-test.dll/debugger-test2.cs", 58, 8,
"BreakOnDebuggerBreakCommand",
locals_fn: (locals) =>
{
CheckNumber(locals, "a", 10);
}
);
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 57, 8, "BreakOnDebuggerBreakCommand",
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 59, 8, "BreakOnDebuggerBreakCommand",
locals_fn: (locals) =>
{
CheckNumber(locals, "a", 10);
}
);
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 58, 8, "BreakOnDebuggerBreakCommand",
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 60, 8, "BreakOnDebuggerBreakCommand",
locals_fn: (locals) =>
{
CheckNumber(locals, "a", 20);
}
);
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 59, 8, "BreakOnDebuggerBreakCommand",
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 61, 8, "BreakOnDebuggerBreakCommand",
locals_fn: (locals) =>
{
CheckNumber(locals, "a", 50);
}
);
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 60, 4, "BreakOnDebuggerBreakCommand",
await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test2.cs", 62, 4, "BreakOnDebuggerBreakCommand",
locals_fn: (locals) =>
{
CheckNumber(locals, "a", 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public async Task GetObjectValueWithInheritance()
{
var pause_location = await EvaluateAndCheck(
"window.setTimeout(function() { invoke_static_method('[debugger-test] TestChild:TestWatchWithInheritance'); }, 1);",
"dotnet://debugger-test.dll/debugger-test2.cs", 86, 8,
"dotnet://debugger-test.dll/debugger-test2.cs", 125, 8,
"TestWatchWithInheritance");
var frame_id = pause_location["callFrames"][0]["callFrameId"].Value<string>();
var frame_locals = await GetProperties(frame_id);
Expand Down
21 changes: 20 additions & 1 deletion src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ await CheckInspectLocalsAtBreakpointSite(
[Fact]
public async Task InspectLocalsTypesAtBreakpointSite() =>
await CheckInspectLocalsAtBreakpointSite(
"dotnet://debugger-test.dll/debugger-test2.cs", 48, 8, "Types",
"dotnet://debugger-test.dll/debugger-test2.cs", 50, 8, "Types",
"window.setTimeout(function() { invoke_static_method (\"[debugger-test] Fancy:Types\")(); }, 1);",
use_cfo: false,
test_fn: (locals) =>
Expand Down Expand Up @@ -826,6 +826,25 @@ public async Task GetSourceUsingSourceLink()
Assert.True(source.IsOk);
}

[Fact]
public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointSite(
"InspectTask",
"RunInspectTask",
7,
"<RunInspectTask>b__0" ,
$"window.setTimeout(function() {{ invoke_static_method_async('[debugger-test] InspectTask:RunInspectTask'); }}, 1);",
wait_for_event_fn: async (pause_location) =>
{
var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value<string>());
var t_props = await GetObjectOnLocals(locals, "t");
await CheckProps(t_props, new
{
s_taskIdCounter = TNumber(0),
Status = TGetter("Status")
}, "t_props", num_fields: 53);
});

//TODO add tests covering basic stepping behavior as step in/out/over
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<WasmExtraFilesToDeploy Include="debugger-driver.html" />
<WasmExtraFilesToDeploy Include="other.js" />
<WasmExtraFilesToDeploy Include="runtime-debugger.js" />
<WasmExtraFilesToDeploy Include="weather.json" />

<!-- We want to bundle these assemblies, so build them first -->
<ProjectReference Include="..\lazy-debugger-test\lazy-debugger-test.csproj" Private="true"/>
Expand Down
Loading

0 comments on commit 3662e3e

Please sign in to comment.