mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
620cf53820 | ||
|
|
41494af55d | ||
|
|
66e2b84002 | ||
|
|
d3daacdaa8 | ||
|
|
e59c1cd70f | ||
|
|
648655b86d | ||
|
|
ec71e8a7ae | ||
|
|
20bb4f9a6d | ||
|
|
9ca6fa646a | ||
|
|
2ff424be29 | ||
|
|
83105ba224 | ||
|
|
109b4b6f44 | ||
|
|
15782aa740 | ||
|
|
6ea4cbcee0 | ||
|
|
d45ff3af75 | ||
|
|
bc1dd071a7 | ||
|
|
87ef555701 | ||
|
|
8c085a99b3 | ||
|
|
89d772a3ab | ||
|
|
e9d3af508e | ||
|
|
d6f0c25d34 | ||
|
|
075c3f0619 | ||
|
|
35cc82cc6c | ||
|
|
00ae178a04 | ||
|
|
c23ad4f5b3 | ||
|
|
83558de96b | ||
|
|
051408e0be | ||
|
|
58b04da0d7 | ||
|
|
f51cb7ad85 | ||
|
|
62414d588b | ||
|
|
259ec2ef65 | ||
|
|
165f4b0341 | ||
|
|
b04dc7e6a4 | ||
|
|
ecde08600b | ||
|
|
8fb9301292 | ||
|
|
7bfb441fb4 | ||
|
|
e77cea1910 | ||
|
|
fda73998f9 | ||
|
|
beccf5ba43 | ||
|
|
5bea89d861 | ||
|
|
4b0424cd68 | ||
|
|
2444b38b3c | ||
|
|
93a2f4ea39 | ||
|
|
0565f6e2c0 | ||
|
|
b7196c45e8 | ||
|
|
88c1989895 | ||
|
|
d2be7389b1 | ||
|
|
a7e29665d2 | ||
|
|
c51a2eba84 | ||
|
|
f0784b26dd | ||
|
|
d90665a422 | ||
|
|
74bf77a59c | ||
|
|
f0ce5105d4 | ||
|
|
4ca7d77e34 | ||
|
|
338349925c | ||
|
|
3a4122f14f | ||
|
|
6134b2fdc9 | ||
|
|
8cac8ee9c3 | ||
|
|
8c184a19d1 | ||
|
|
72c8e7c7ff | ||
|
|
544930719e | ||
|
|
69d8e50279 | ||
|
|
017cd6e606 | ||
|
|
79f94d9960 | ||
|
|
2aa8108972 | ||
|
|
2b7e10ebda | ||
|
|
23b4f40e1b | ||
|
|
4cc5d1bdd3 | ||
|
|
86f2aad309 | ||
|
|
de18868297 | ||
|
|
9a18f06a45 | ||
|
|
e40d66b687 | ||
|
|
86679ca35a | ||
|
|
fce530c0b0 | ||
|
|
daf5d55df9 | ||
|
|
ab4049e219 | ||
|
|
76126c14e9 | ||
|
|
bfd182bd20 | ||
|
|
5070e45d54 | ||
|
|
8f348378ec | ||
|
|
124300cac1 | ||
|
|
ecc716b89e | ||
|
|
f460694bac | ||
|
|
778878e336 | ||
|
|
4fcb57e73b | ||
|
|
879f6699bb | ||
|
|
688a178aa4 | ||
|
|
5be9a0f156 | ||
|
|
a503f98e06 | ||
|
|
9af77d0093 | ||
|
|
75a7ff235a | ||
|
|
05dc198dfc | ||
|
|
950644e9de | ||
|
|
cd8a898912 |
No files matched your search
+2
-1
@@ -116,6 +116,8 @@
|
||||
|
||||
/mono/sgen @BrzVlad @lambdageek
|
||||
|
||||
/mono/tools/offsets-tool @lewurm @rolfbjarne
|
||||
|
||||
/mono/utils @vargaz @lewurm @lambdageek
|
||||
/mono/utils/atomic* @lewurm @vargaz
|
||||
/mono/utils/mono-hwcap* @lewurm @vargaz
|
||||
@@ -156,6 +158,5 @@
|
||||
/tools @lambdageek @vargaz
|
||||
/tools/locale-builder @marek-safar @egorbo
|
||||
/tools/nuget-hash-extractor @marek-safar @radical @akoeplinger
|
||||
/tools/offsets-tool @lewurm @rolfbjarne
|
||||
/tools/pedump @lambdageek @lewurm
|
||||
/tools/sgen @brzvlad @vargaz @naricc
|
||||
@@ -139,8 +139,6 @@ llvm/usr/
|
||||
sdks/builds/llvm-*/
|
||||
sdks/builds/android-*/
|
||||
mcs/build/compiler-server.log
|
||||
tools/offsets-tool-py/offtool/
|
||||
tools/offsets-tool-py/clang/__pycache__
|
||||
|
||||
##############################################################################
|
||||
# Arcade output directories
|
||||
|
||||
+21
-3
@@ -4,7 +4,7 @@
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
AC_INIT(mono, [6.11.0],
|
||||
AC_INIT(mono, [6.12.0],
|
||||
[https://github.com/mono/mono/issues/new])
|
||||
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
@@ -1208,6 +1208,7 @@ if test x$enable_monotouch = xyes; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(cxx, [ --enable-cxx compile some code as C++])
|
||||
AM_CONDITIONAL(ENABLE_CXX, test x$enable_cxx = xyes)
|
||||
|
||||
# mono/corefx/native has a lot of invalid C++98 in its headers
|
||||
# dotnet/corefx/native looks a lot better, i.e. 44e5bdafb8d989a220c9cf1b94f31a64a6e4f052
|
||||
@@ -2936,6 +2937,23 @@ if test x$host_win32 = xno; then
|
||||
])
|
||||
fi
|
||||
|
||||
dnl ********************************
|
||||
dnl *** Checks for sys_signame ***
|
||||
dnl ********************************
|
||||
AC_MSG_CHECKING(for sys_signame)
|
||||
AC_TRY_LINK([
|
||||
#include <signal.h>
|
||||
], [
|
||||
const char *signame = sys_signame[0];
|
||||
], [
|
||||
# Yes, we have it...
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SYSSIGNAME, 1, [Have sys_signame])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
dnl ********************************
|
||||
dnl *** Checks for semaphore lib ***
|
||||
dnl ********************************
|
||||
@@ -6080,8 +6098,8 @@ fi
|
||||
AC_SUBST(mono_runtime)
|
||||
AC_SUBST(mono_runtime_wrapper)
|
||||
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/VBCSCompiler.exe
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/VBCSCompiler.exe
|
||||
|
||||
if test $csc_compiler = mcs; then
|
||||
CSC=$mcs_topdir/class/lib/build/mcs.exe
|
||||
|
||||
Vendored
+1
-1
Submodule external/api-snapshot updated: 5b8247e289...e6b00a4772.
Vendored
+1
-1
Submodule external/bockbuild updated: 5a05db67cb...0ab42dc099.
Vendored
+1
-1
Submodule external/boringssl updated: d7b108ee11...296137cf98.
Vendored
+1
-1
Submodule external/corefx updated: 7c9e215892...7c24bb0756.
Vendored
+1
-1
Submodule external/linker updated: 6e0105e0fc...e1c7a72951.
Vendored
+1
-1
Submodule external/nunit-lite updated: 5406f2a7a0...a977ca5757.
Vendored
+1
-1
Submodule external/roslyn-binaries updated: 27c352d6ed...8867d9ad53.
+7
-1
@@ -1498,6 +1498,9 @@ scanning is available.
|
||||
\fBno-managed-allocator\fR
|
||||
Disables the managed allocator.
|
||||
.TP
|
||||
\fBmanaged-allocator\fR
|
||||
Enables the managed allocator.
|
||||
.TP
|
||||
\fBcheck-scan-starts\fR
|
||||
If set, does a plausibility check on the scan_starts before and after each collection
|
||||
.TP
|
||||
@@ -1523,7 +1526,10 @@ sgen-gc.c. You can then use this command to explore the output
|
||||
\fBnursery-canaries\fR
|
||||
If set, objects allocated in the nursery are suffixed with a canary (guard)
|
||||
word, which is checked on each minor collection. Can be used to detect/debug
|
||||
heap corruption issues.
|
||||
heap corruption issues. This disables the usage of the managed allocator,
|
||||
because allocation from full aot code is inconsistent with this option. If
|
||||
the application is guaranteed not to use aot code, the managed allocator can
|
||||
be enabled back with managed-allocator option.
|
||||
|
||||
.TP
|
||||
\fBdo-not-finalize(=\fIclasses\fB)\fR
|
||||
|
||||
@@ -19,8 +19,7 @@ endif
|
||||
|
||||
TEST_HARNESS = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/$(PARENT_PROFILE)nunit-lite-console.exe
|
||||
PLATFORM_DEBUG_FLAGS = /debug:portable
|
||||
# Workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=59967
|
||||
MCS_FLAGS = /features:peverify-compat /langversion:latest
|
||||
MCS_FLAGS = /langversion:latest
|
||||
LIBRARY_FLAGS =
|
||||
ifndef CFLAGS
|
||||
CFLAGS = -g -O2
|
||||
|
||||
@@ -409,6 +409,9 @@ namespace Mono.Debugger.Soft
|
||||
public ErrorCode ErrorCode {
|
||||
get; set;
|
||||
}
|
||||
public string ErrorMessage {
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -436,7 +439,7 @@ namespace Mono.Debugger.Soft
|
||||
* with newer runtimes, and vice versa.
|
||||
*/
|
||||
internal const int MAJOR_VERSION = 2;
|
||||
internal const int MINOR_VERSION = 54;
|
||||
internal const int MINOR_VERSION = 57;
|
||||
|
||||
enum WPSuspendPolicy {
|
||||
NONE = 0,
|
||||
@@ -792,10 +795,12 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
// For reply packets
|
||||
offset = 0;
|
||||
ReadInt (); // length
|
||||
var len = ReadInt (); // length
|
||||
ReadInt (); // id
|
||||
ReadByte (); // flags
|
||||
ErrorCode = ReadShort ();
|
||||
if (ErrorCode == (int)Mono.Debugger.Soft.ErrorCode.INVALID_ARGUMENT && connection.Version.AtLeast (2, 56) && len > offset)
|
||||
ErrorMsg = ReadString ();
|
||||
}
|
||||
|
||||
public CommandSet CommandSet {
|
||||
@@ -810,6 +815,10 @@ namespace Mono.Debugger.Soft
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string ErrorMsg {
|
||||
get; internal set;
|
||||
}
|
||||
|
||||
public int Offset {
|
||||
get {
|
||||
return offset;
|
||||
@@ -1792,7 +1801,7 @@ namespace Mono.Debugger.Soft
|
||||
LogPacket (packetId, encoded_packet, reply, command_set, command, watch);
|
||||
if (r.ErrorCode != 0) {
|
||||
if (ErrorHandler != null)
|
||||
ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode });
|
||||
ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode, ErrorMessage = r.ErrorMsg});
|
||||
throw new NotImplementedException ("No error handler set.");
|
||||
} else {
|
||||
return r;
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace Mono.Debugger.Soft
|
||||
}
|
||||
}
|
||||
|
||||
public int GetId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public EventType EventType {
|
||||
get {
|
||||
return etype;
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace Mono.Debugger.Soft
|
||||
case ErrorCode.NO_SEQ_POINT_AT_IL_OFFSET:
|
||||
throw new ArgumentException ("Cannot set breakpoint on the specified IL offset.");
|
||||
default:
|
||||
throw new CommandException (args.ErrorCode);
|
||||
throw new CommandException (args.ErrorCode, args.ErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,7 +657,9 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
internal EventRequest GetRequest (int id) {
|
||||
lock (requests_lock) {
|
||||
return requests [id];
|
||||
EventRequest obj;
|
||||
requests.TryGetValue (id, out obj);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,13 +887,18 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
public class CommandException : Exception {
|
||||
|
||||
internal CommandException (ErrorCode error_code) : base ("Debuggee returned error code " + error_code + ".") {
|
||||
internal CommandException (ErrorCode error_code, string error_message) : base ("Debuggee returned error code " + error_code + (error_message == null || error_message.Length == 0 ? "." : " - " + error_message + ".")) {
|
||||
ErrorCode = error_code;
|
||||
ErrorMessage = error_message;
|
||||
}
|
||||
|
||||
public ErrorCode ErrorCode {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string ErrorMessage {
|
||||
get; internal set;
|
||||
}
|
||||
}
|
||||
|
||||
public class VMNotSuspendedException : InvalidOperationException
|
||||
|
||||
@@ -613,6 +613,11 @@ public class Tests : TestsBase, ITest2
|
||||
pointers2 ();
|
||||
return 0;
|
||||
}
|
||||
if (args.Length >0 && args [0] == "ss_multi_thread") {
|
||||
ss_multi_thread ();
|
||||
return 0;
|
||||
}
|
||||
test_invalid_argument_assembly_get_type ();
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -641,6 +646,10 @@ public class Tests : TestsBase, ITest2
|
||||
LocalReflectClass.RunMe ();
|
||||
}
|
||||
|
||||
public static void test_invalid_argument_assembly_get_type () {
|
||||
|
||||
}
|
||||
|
||||
public static void breakpoints () {
|
||||
/* Call these early so it is JITted by the time a breakpoint is placed on it */
|
||||
bp3 ();
|
||||
@@ -861,6 +870,24 @@ public class Tests : TestsBase, ITest2
|
||||
n.Buffer2 = new char4('a', 'b', 'c', 'd');
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void ss_multi_thread () {
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
var t = new Thread(mt_ss);
|
||||
t.Name = "Thread_" + i;
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
static void mt_ss()
|
||||
{
|
||||
int a = 12;
|
||||
int b = 13;
|
||||
int c = 13;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void test_new_exception_filter () {
|
||||
test_new_exception_filter1();
|
||||
|
||||
@@ -470,7 +470,6 @@ public class DebuggerTests
|
||||
|
||||
var pdbFromMemory = assemblyMirror.GetPdbBlob ();
|
||||
if (!File.Exists (pdbPath)) {
|
||||
Assert.IsFalse (assemblyMirror.HasPdb);
|
||||
Assert.IsTrue (assemblyMirror.HasFetchedPdb);
|
||||
continue;
|
||||
}
|
||||
@@ -5198,8 +5197,101 @@ public class DebuggerTests
|
||||
Assert.IsInstanceOfType (typeof (ArgumentException), ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvalidArgumentAssemblyGetType () {
|
||||
Event e = run_until ("test_invalid_argument_assembly_get_type");
|
||||
var assembly = entry_point.DeclaringType.Assembly;
|
||||
try {
|
||||
var type = assembly.GetType ("System.Collections.Generic.Dictionary<double, float>.Main");
|
||||
}
|
||||
catch (CommandException ex) {
|
||||
Assert.AreEqual(ex.ErrorMessage, "Unexpected assembly-qualified type \"System.Collections.Generic.Dictionary<double, float>.Main\" was provided");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckSuspendPolicySentWhenLaunchSuspendYes () {
|
||||
vm.Exit (0);
|
||||
var port = GetFreePort ();
|
||||
|
||||
// Launch the app using server=y,suspend=y
|
||||
var pi = CreateStartInfo (dtest_app_path, "attach", $"--debugger-agent=transport=dt_socket,address=127.0.0.1:{port},server=y,suspend=y");
|
||||
pi.UseShellExecute = false;
|
||||
var process = Diag.Process.Start (pi);
|
||||
|
||||
string failMessage = null;
|
||||
try {
|
||||
vm = ConnectToPort (port);
|
||||
|
||||
vm.EnableEvents (EventType.AssemblyLoad, EventType.ThreadStart);
|
||||
var es = vm.GetNextEventSet ();
|
||||
Assert.AreEqual (es.SuspendPolicy, SuspendPolicy.All);
|
||||
Assert.AreEqual (EventType.VMStart, es[0].EventType);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
failMessage = ex.Message;
|
||||
}
|
||||
finally {
|
||||
vm.Exit (0);
|
||||
vm = null;
|
||||
}
|
||||
if (failMessage != null)
|
||||
Assert.Fail (failMessage);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeSingleStepMultiThread () {
|
||||
vm.Detach ();
|
||||
Start (dtest_app_path, "ss_multi_thread");
|
||||
MethodMirror m = entry_point.DeclaringType.GetMethod ("mt_ss");
|
||||
int firstLineFound = m.Locations [0].LineNumber + 1;
|
||||
int line_first_counter = 5;
|
||||
int line_second_counter = 5;
|
||||
int line_third_counter = 3;
|
||||
Event e = run_until ("ss_multi_thread");
|
||||
EventRequest req = create_step (e);
|
||||
req.Disable ();
|
||||
ReusableBreakpoint breakpoint = new ReusableBreakpoint (this, "mt_ss");
|
||||
breakpoint.Continue ();
|
||||
e = breakpoint.lastEvent;
|
||||
req = create_step (e);
|
||||
while (line_first_counter > 0 || line_second_counter > 0 || line_third_counter > 0) {
|
||||
var thread = e.Thread;
|
||||
var l = thread.GetFrames ()[0].Location;
|
||||
var frame = thread.GetFrames()[0];
|
||||
|
||||
if (l.LineNumber == firstLineFound)
|
||||
line_first_counter--;
|
||||
if (l.LineNumber == firstLineFound + 1)
|
||||
line_second_counter--;
|
||||
if (l.LineNumber == firstLineFound + 2)
|
||||
line_third_counter--;
|
||||
|
||||
if (req.GetId() != breakpoint.req.GetId())
|
||||
req.Disable ();
|
||||
|
||||
req = create_step (e);
|
||||
((StepEventRequest)req).Size = StepSize.Line;
|
||||
try {
|
||||
if ((e.Thread.GetFrames ()[0].Location.LineNumber == firstLineFound + 1 && (e.Thread.Name.Equals("Thread_0") || e.Thread.Name.Equals("Thread_1"))) || l.LineNumber == firstLineFound + 2) {
|
||||
vm.Resume ();
|
||||
e = GetNextEvent ();
|
||||
}
|
||||
else
|
||||
e = step_over_or_breakpoint ();
|
||||
req = e.Request;
|
||||
}
|
||||
catch (Exception z){
|
||||
//expected vmdeath
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assert.AreEqual(0, line_first_counter);
|
||||
Assert.AreEqual(0, line_second_counter);
|
||||
Assert.AreEqual(0, line_third_counter);
|
||||
vm = null;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // class DebuggerTests
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Net.Http
|
||||
{
|
||||
partial class HttpClientHandler : HttpMessageHandler
|
||||
{
|
||||
static IMonoHttpClientHandler CreateDefaultHandler ()
|
||||
{
|
||||
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
|
||||
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
|
||||
{
|
||||
Type monoWrhType = Type.GetType (envvar, false);
|
||||
if (monoWrhType != null)
|
||||
return (IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType);
|
||||
}
|
||||
|
||||
// Ignore other types of handlers here (e.g. AndroidHttpHandler) to keep the old behavior
|
||||
// and always create SocketsHttpHandler for code like this if MonoWebRequestHandler was not specified:
|
||||
//
|
||||
// var handler = new HttpClientHandler { Credentials = ... };
|
||||
// var httpClient = new HttpClient (handler);
|
||||
//
|
||||
// AndroidHttpHandler is used only when we use the parameterless ctor of HttpClient
|
||||
return new SocketsHttpHandler ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace System.Net.Http
|
||||
TimeSpan? timeout;
|
||||
bool disposed;
|
||||
|
||||
internal MonoWebRequestHandler ()
|
||||
public MonoWebRequestHandler ()
|
||||
{
|
||||
allowAutoRedirect = true;
|
||||
maxAutomaticRedirections = 50;
|
||||
|
||||
@@ -1328,7 +1328,7 @@
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamContent.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamToStreamCopy.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StringContent.cs" />
|
||||
<Compile Include="HttpClientHandler.SocketsHandler.cs" />
|
||||
<Compile Include="HttpClientHandler.SocketsHandler.Android.cs" />
|
||||
<Compile Include="HttpClientHandler.cs" />
|
||||
<Compile Include="HttpRequestMessage.Mono.cs" />
|
||||
<Compile Include="IMonoHttpClientHandler.cs" />
|
||||
|
||||
@@ -8,27 +8,34 @@ namespace System.Net.Http {
|
||||
|
||||
static HttpMessageHandler CreateDefaultHandler ()
|
||||
{
|
||||
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
|
||||
if (type == null)
|
||||
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
|
||||
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
|
||||
|
||||
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (method == null)
|
||||
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
|
||||
if (string.IsNullOrEmpty (envvar))
|
||||
return new HttpClientHandler ();
|
||||
|
||||
object ret = method.Invoke (null, null);
|
||||
if (ret == null)
|
||||
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
|
||||
if (envvar?.StartsWith ("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
|
||||
{
|
||||
Type monoWrhType = Type.GetType (envvar, false);
|
||||
if (monoWrhType != null)
|
||||
return new HttpClientHandler ((IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType));
|
||||
|
||||
var handler = ret as HttpMessageHandler;
|
||||
if (handler == null)
|
||||
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
|
||||
return handler;
|
||||
}
|
||||
return new HttpClientHandler ();
|
||||
}
|
||||
|
||||
Type handlerType = Type.GetType (envvar, false);
|
||||
if (handlerType == null && !envvar.Contains (", "))
|
||||
{
|
||||
// if assembly was not specified - look for it in Mono.Android too
|
||||
// (e.g. AndroidHttpHandler is there)
|
||||
handlerType = Type.GetType (envvar + ", Mono.Android", false);
|
||||
}
|
||||
|
||||
if (handlerType == null)
|
||||
return new HttpClientHandler ();
|
||||
|
||||
if (Activator.CreateInstance (handlerType) is HttpMessageHandler msgHandler)
|
||||
return msgHandler;
|
||||
|
||||
static HttpMessageHandler GetFallback (string message)
|
||||
{
|
||||
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
|
||||
return new HttpClientHandler ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
HttpClient.DefaultHandler.cs
|
||||
HttpClientHandler.SocketsHandler.cs
|
||||
@@ -1,2 +1,3 @@
|
||||
#include socketshandler.sources
|
||||
System.Net.Http/HttpClient.android.cs
|
||||
HttpClientHandler.SocketsHandler.Android.cs
|
||||
+3
-1
@@ -423,8 +423,10 @@ namespace System.Runtime.Serialization.Json
|
||||
XmlDictionaryString namespaceLocal = null;
|
||||
if (nameLocal != null && nameLocal is string)
|
||||
writer.WriteStartElement ((string) name, null);
|
||||
else
|
||||
else if (name is XmlDictionaryString)
|
||||
writer.WriteStartElement ((XmlDictionaryString) name, null);
|
||||
else
|
||||
writer.WriteStartElement (name.ToString(), null);
|
||||
}
|
||||
|
||||
void WriteEndElement ()
|
||||
|
||||
@@ -429,13 +429,9 @@ namespace System.Xml.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
static Encoding DefaultEncoding = Encoding.Default;
|
||||
|
||||
public void Serialize (Stream stream, object o)
|
||||
{
|
||||
XmlTextWriter xmlWriter = new XmlTextWriter (stream, DefaultEncoding);
|
||||
xmlWriter.Formatting = Formatting.Indented;
|
||||
Serialize (xmlWriter, o, null);
|
||||
Serialize (stream, o, null);
|
||||
}
|
||||
|
||||
public void Serialize (TextWriter textWriter, object o)
|
||||
@@ -452,7 +448,7 @@ namespace System.Xml.Serialization
|
||||
|
||||
public void Serialize (Stream stream, object o, XmlSerializerNamespaces namespaces)
|
||||
{
|
||||
XmlTextWriter xmlWriter = new XmlTextWriter (stream, DefaultEncoding);
|
||||
XmlTextWriter xmlWriter = new XmlTextWriter (stream, Encoding.UTF8);
|
||||
xmlWriter.Formatting = Formatting.Indented;
|
||||
Serialize (xmlWriter, o, namespaces);
|
||||
}
|
||||
|
||||
@@ -2676,6 +2676,19 @@ namespace MonoTests.System.XmlSerialization
|
||||
Assert.AreEqual ("<:GenComplexStructOfInt32String http://www.w3.org/2000/xmlns/:xsd='http://www.w3.org/2001/XMLSchema' http://www.w3.org/2000/xmlns/:xsi='http://www.w3.org/2001/XMLSchema-instance'><:something>123</><:simpleclass><:something>456</></><:simplestruct><:something>789</></><:listclass><:somelist><:int>100</><:int>200</></></><:arrayclass><:arr><:int>11</><:int>22</><:int>33</></></><:twoclass><:something1>10</><:something2>Ten</></><:derivedclass><:something1>two</><:something2>2</><:another1>1</><:another2>one</></><:derived2><:something1>4</><:something2>four</><:another1>3</><:another2>three</></><:nestedouter><:outer>5</></><:nestedinner><:inner>six</><:something>6</></></>", WriterText);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSerializeStreamPreserveUTFChars () {
|
||||
string foo = "BÄR";
|
||||
XmlSerializer serializer = new XmlSerializer (typeof (string));
|
||||
|
||||
MemoryStream stream = new MemoryStream ();
|
||||
|
||||
serializer.Serialize (stream, foo);
|
||||
stream.Position = 0;
|
||||
foo = (string) serializer.Deserialize (stream);
|
||||
Assert.AreEqual("BÄR", foo);
|
||||
}
|
||||
|
||||
[Test] // bug #80759
|
||||
public void HasNullableField ()
|
||||
{
|
||||
|
||||
@@ -488,6 +488,26 @@ namespace System.Net.Security
|
||||
return Impl.WriteAsync (buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
return TaskToApm.Begin (Impl.ReadAsync (buffer, offset, count), callback, state);
|
||||
}
|
||||
|
||||
public override int EndRead (IAsyncResult asyncResult)
|
||||
{
|
||||
return TaskToApm.End<int> (asyncResult);
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
return TaskToApm.Begin (Impl.WriteAsync (buffer, offset, count), callback, state);
|
||||
}
|
||||
|
||||
public override void EndWrite (IAsyncResult asyncResult)
|
||||
{
|
||||
TaskToApm.End (asyncResult);
|
||||
}
|
||||
|
||||
#else // !SECURITY_DEP
|
||||
const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform.";
|
||||
|
||||
|
||||
@@ -237,8 +237,12 @@ namespace System.Net {
|
||||
}
|
||||
|
||||
if (ProcessInput (ms)) {
|
||||
if (!context.HaveError)
|
||||
context.Request.FinishInitialization ();
|
||||
if (!context.HaveError) {
|
||||
if (!context.Request.FinishInitialization()) {
|
||||
Close (true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.HaveError) {
|
||||
SendError ();
|
||||
|
||||
@@ -192,12 +192,12 @@ namespace System.Net {
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void FinishInitialization ()
|
||||
internal bool FinishInitialization ()
|
||||
{
|
||||
string host = UserHostName;
|
||||
if (version > HttpVersion.Version10 && (host == null || host.Length == 0)) {
|
||||
context.ErrorMessage = "Invalid host name";
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
string path;
|
||||
@@ -223,7 +223,7 @@ namespace System.Net {
|
||||
|
||||
if (!Uri.TryCreate (base_uri + path, UriKind.Absolute, out url)){
|
||||
context.ErrorMessage = WebUtility.HtmlEncode ("Invalid url: " + base_uri + path);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
CreateQueryString (url.Query);
|
||||
@@ -239,7 +239,7 @@ namespace System.Net {
|
||||
// 'identity' is not valid!
|
||||
if (t_encoding != null && !is_chunked) {
|
||||
context.Connection.SendError (null, 501);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace System.Net {
|
||||
if (String.Compare (method, "POST", StringComparison.OrdinalIgnoreCase) == 0 ||
|
||||
String.Compare (method, "PUT", StringComparison.OrdinalIgnoreCase) == 0) {
|
||||
context.Connection.SendError (null, 411);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,8 @@ namespace System.Net {
|
||||
ResponseStream output = context.Connection.GetResponseStream ();
|
||||
output.InternalWrite (_100continue, 0, _100continue.Length);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static string Unquote (String str) {
|
||||
|
||||
@@ -630,28 +630,28 @@
|
||||
<method signature="System.Void .ctor(System.String)" />
|
||||
</type>
|
||||
|
||||
<type fullname="System.Reflection.Emit.AssemblyBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ConstructorBuilder" preserve="fields" required="false" feature="sre"/>
|
||||
<type fullname="System.Reflection.Emit.DynamicMethod" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.AssemblyBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ConstructorBuilder" preserve="fields" feature="sre"/>
|
||||
<type fullname="System.Reflection.Emit.DynamicMethod" preserve="fields" feature="sre" />
|
||||
<!-- mono_dynamic_image_register_token -->
|
||||
<type fullname="System.Reflection.Emit.EnumBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.EventBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.FieldBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.EnumBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.EventBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.FieldBuilder" preserve="fields" feature="sre" />
|
||||
<type
|
||||
fullname="System.Reflection.Emit.GenericTypeParameterBuilder" preserve="fields" required="false" feature="sre" />
|
||||
fullname="System.Reflection.Emit.GenericTypeParameterBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ILExceptionBlock" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ILExceptionInfo" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ILGenerator" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.LocalBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields" required="false" feature="sre">
|
||||
<type fullname="System.Reflection.Emit.ILGenerator" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.LocalBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields" feature="sre">
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.MonoResource" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ParameterBuilder" preserve="nothing" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.PropertyBuilder" preserve="nothing" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.SignatureHelper" preserve="nothing" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.TypeBuilder" preserve="fields" required="false" feature="sre">
|
||||
<type fullname="System.Reflection.Emit.MonoResource" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ParameterBuilder" preserve="nothing" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.PropertyBuilder" preserve="nothing" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.SignatureHelper" preserve="nothing" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.TypeBuilder" preserve="fields" feature="sre">
|
||||
<method name="SetCharSet" feature="sre" />
|
||||
<!-- reflection.c mono_reflection_call_is_assignable_to () -->
|
||||
<method name="IsAssignableTo" feature="sre" />
|
||||
@@ -660,12 +660,12 @@
|
||||
<method name="DefineCustom" feature="sre" />
|
||||
<method name="DefineLPArrayInternal" feature="sre" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.ArrayType" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ByRefType" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.PointerType" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.FieldOnTypeBuilderInst" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MethodOnTypeBuilderInst" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ConstructorOnTypeBuilderInst" preserve="fields" required="false" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ArrayType" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ByRefType" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.PointerType" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.FieldOnTypeBuilderInst" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.MethodOnTypeBuilderInst" preserve="fields" feature="sre" />
|
||||
<type fullname="System.Reflection.Emit.ConstructorOnTypeBuilderInst" preserve="fields" feature="sre" />
|
||||
|
||||
<!-- exception.c: mono_get_exception_runtime_wrapped () -->
|
||||
<type fullname="System.Runtime.CompilerServices.RuntimeWrappedException">
|
||||
|
||||
@@ -6,7 +6,7 @@ export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
|
||||
LIBRARY = corlib.dll
|
||||
LIBRARY_NAME = mscorlib.dll
|
||||
|
||||
LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%)
|
||||
LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%) $(UNICODECHARINFO:%=-resource:%)
|
||||
|
||||
USE_XTEST_REMOTE_EXECUTOR = YES
|
||||
LIBRARY_WARN_AS_ERROR = yes
|
||||
@@ -95,7 +95,6 @@ else
|
||||
endif
|
||||
|
||||
RESOURCE_FILES = \
|
||||
$(UNICODECHARINFO) \
|
||||
$(MANAGED_COLLATOR_RESOURCES_FILES) \
|
||||
LinkerDescriptor/mscorlib.xml
|
||||
|
||||
@@ -207,6 +206,7 @@ EXTRA_DISTFILES = \
|
||||
$(RESOURCE_FILES) \
|
||||
$(TEST_RESOURCE_FILES) \
|
||||
$(TEST_RESOURCES:.resources=.resx) \
|
||||
resources/charinfo.nlp \
|
||||
LinkerDescriptor/mscorlib_test.xml
|
||||
|
||||
TEST_RESOURCE_FILES = \
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -255,6 +256,43 @@ namespace Mono {
|
||||
}
|
||||
}
|
||||
|
||||
static string get_breadcrumb_value (string file_prefix, string directory_str, bool clear)
|
||||
{
|
||||
var allfiles = Directory.GetFiles (directory_str, $"{file_prefix}_*" );
|
||||
if (allfiles.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
if (allfiles.Length > 1) {
|
||||
// it's impossible to tell which breadcrumb is the last one (let's not trust filesystem timestamps)
|
||||
// delete the multiple files so at least next crash can make sense
|
||||
try {
|
||||
Array.ForEach (allfiles, f => File.Delete (f) );
|
||||
} catch (Exception) { }
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (clear)
|
||||
File.Delete (allfiles [0]);
|
||||
|
||||
var filename = Path.GetFileName (allfiles [0]);
|
||||
return filename.Substring (file_prefix.Length + 1);
|
||||
}
|
||||
|
||||
static long CheckCrashReportHash (string directory_str, bool clear)
|
||||
{
|
||||
var value = get_breadcrumb_value ("crash_hash", directory_str, clear);
|
||||
if (value == string.Empty)
|
||||
return 0;
|
||||
else
|
||||
return Convert.ToInt64 (value, 16);
|
||||
}
|
||||
|
||||
static string CheckCrashReportReason (string directory_str, bool clear)
|
||||
{
|
||||
return get_breadcrumb_value ("crash_reason", directory_str, clear);
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void AnnotateMicrosoftTelemetry_internal (IntPtr key, IntPtr val);
|
||||
|
||||
|
||||
@@ -186,7 +186,11 @@ namespace System
|
||||
{
|
||||
try {
|
||||
// TODO: Should use __ConsoleStream from reference sources
|
||||
return new FileStream (handle, access, false, bufferSize, false, true);
|
||||
var stream = new FileStream (handle, access, false, bufferSize, false, true);
|
||||
// Don't run the finalizer on the underlying stream so that System.WriteLine can be
|
||||
// called inside a finalizer during shutdown or domain unload.
|
||||
GC.SuppressFinalize (stream);
|
||||
return stream;
|
||||
} catch (IOException) {
|
||||
return Stream.Null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace Internal.Runtime.Augments {
|
||||
partial class RuntimeAugments {
|
||||
@@ -7,7 +8,8 @@ namespace Internal.Runtime.Augments {
|
||||
|
||||
public static void ReportUnhandledException (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
var edi = ExceptionDispatchInfo.Capture (exception);
|
||||
edi.Throw ();
|
||||
}
|
||||
|
||||
internal static ReflectionExecutionDomainCallbacks Callbacks => s_reflectionExecutionDomainCallbacks;
|
||||
@@ -19,4 +21,4 @@ namespace Internal.Runtime.Augments {
|
||||
return new MissingMetadataException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ endif
|
||||
|
||||
LINKER_OUTPUT := illink-output-$(PROFILE_DIRECTORY)
|
||||
PROFILE_PATH = $(topdir)/class/lib/$(PROFILE_DIRECTORY)
|
||||
LINKER = MONO_PATH=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe -c link -out $(LINKER_OUTPUT) -b true -d $(PROFILE_PATH)
|
||||
LINKER = MONO_PATH=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe -c link -o $(LINKER_OUTPUT) -b true -d $(PROFILE_PATH)
|
||||
LINKER_DEFAULT = $(LINKER) -l none $(LINKER_PROFILE_OPTIONS)
|
||||
TEST_EXEC = MONO_PATH=$(LINKER_OUTPUT) $(RUNTIME) $(RUNTIME_FLAGS) --debug -O=-aot
|
||||
|
||||
|
||||
@@ -130,13 +130,11 @@ libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\"
|
||||
#
|
||||
# Support is a separate library because it is not valid C++.
|
||||
#
|
||||
if !ENABLE_NETCORE
|
||||
support_libraries = libmonoruntime-support.la
|
||||
|
||||
libmonoruntime_support_la_SOURCES = support.c
|
||||
libmonoruntime_support_la_LDFLAGS = $(Z_LIBS)
|
||||
libmonoruntime_support_la_CFLAGS = $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @ZLIB_CFLAGS@
|
||||
endif
|
||||
|
||||
#
|
||||
# This library contains the icall tables if the runtime was configured with --disable-icall-tables
|
||||
|
||||
+106
-106
@@ -2537,6 +2537,11 @@ apply_override (MonoClass *klass, MonoClass *override_class, MonoMethod **vtable
|
||||
}
|
||||
|
||||
dslot += mono_class_interface_offset (klass, decl->klass);
|
||||
|
||||
//check if the override comes from an interface and the overrided method is from a class, if this is the case it shouldn't be changed
|
||||
if (vtable [dslot] && vtable [dslot]->klass && MONO_CLASS_IS_INTERFACE_INTERNAL (override->klass) && !MONO_CLASS_IS_INTERFACE_INTERNAL (vtable [dslot]->klass))
|
||||
return TRUE;
|
||||
|
||||
vtable [dslot] = override;
|
||||
if (!MONO_CLASS_IS_INTERFACE_INTERNAL (override->klass)) {
|
||||
/*
|
||||
@@ -2856,6 +2861,102 @@ print_vtable_layout_result (MonoClass *klass, MonoMethod **vtable, int cur_slot)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* LOCKING: this is supposed to be called with the loader lock held.
|
||||
*/
|
||||
static int
|
||||
setup_class_vtsize (MonoClass *klass, GList *in_setup, int *cur_slot, int *stelemref_slot, MonoError *error)
|
||||
{
|
||||
GPtrArray *ifaces = NULL;
|
||||
int i, max_vtsize = 0;
|
||||
ifaces = mono_class_get_implemented_interfaces (klass, error);
|
||||
if (!is_ok (error)) {
|
||||
char *name = mono_type_get_full_name (klass);
|
||||
mono_class_set_type_load_failure (klass, "Could not resolve %s interfaces due to %s", name, mono_error_get_message (error));
|
||||
g_free (name);
|
||||
mono_error_cleanup (error);
|
||||
return -1;
|
||||
} else if (ifaces) {
|
||||
for (i = 0; i < ifaces->len; i++) {
|
||||
MonoClass *ic = (MonoClass *)g_ptr_array_index (ifaces, i);
|
||||
max_vtsize += mono_class_get_method_count (ic);
|
||||
}
|
||||
g_ptr_array_free (ifaces, TRUE);
|
||||
ifaces = NULL;
|
||||
}
|
||||
|
||||
if (klass->parent) {
|
||||
mono_class_init_internal (klass->parent);
|
||||
mono_class_setup_vtable_full (klass->parent, in_setup);
|
||||
|
||||
if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Parent class failed to load"))
|
||||
return -1;
|
||||
|
||||
max_vtsize += klass->parent->vtable_size;
|
||||
*cur_slot = klass->parent->vtable_size;
|
||||
}
|
||||
|
||||
max_vtsize += mono_class_get_method_count (klass);
|
||||
|
||||
/*Array have a slot for stelemref*/
|
||||
if (mono_class_need_stelemref_method (klass)) {
|
||||
*stelemref_slot = *cur_slot;
|
||||
++max_vtsize;
|
||||
++*cur_slot;
|
||||
}
|
||||
return max_vtsize;
|
||||
}
|
||||
|
||||
/*
|
||||
* LOCKING: this is supposed to be called with the loader lock held.
|
||||
*/
|
||||
static void
|
||||
mono_class_setup_vtable_ginst (MonoClass *klass, GList *in_setup)
|
||||
{
|
||||
ERROR_DECL (error);
|
||||
int i;
|
||||
MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
|
||||
MonoMethod **tmp;
|
||||
|
||||
mono_class_setup_vtable_full (gklass, in_setup);
|
||||
if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Could not load generic definition"))
|
||||
return;
|
||||
|
||||
tmp = (MonoMethod **)mono_class_alloc0 (klass, sizeof (gpointer) * gklass->vtable_size);
|
||||
klass->vtable_size = gklass->vtable_size;
|
||||
for (i = 0; i < gklass->vtable_size; ++i)
|
||||
if (gklass->vtable [i]) {
|
||||
MonoMethod *inflated = mono_class_inflate_generic_method_full_checked (gklass->vtable [i], klass, mono_class_get_context (klass), error);
|
||||
if (!is_ok (error)) {
|
||||
char *name = mono_type_get_full_name (klass);
|
||||
mono_class_set_type_load_failure (klass, "VTable setup of type %s failed due to: %s", name, mono_error_get_message (error));
|
||||
mono_error_cleanup (error);
|
||||
g_free (name);
|
||||
return;
|
||||
}
|
||||
tmp [i] = inflated;
|
||||
tmp [i]->slot = gklass->vtable [i]->slot;
|
||||
}
|
||||
mono_memory_barrier ();
|
||||
klass->vtable = tmp;
|
||||
|
||||
mono_loader_lock ();
|
||||
klass->has_dim_conflicts = gklass->has_dim_conflicts;
|
||||
mono_loader_unlock ();
|
||||
|
||||
/* Have to set method->slot for abstract virtual methods */
|
||||
if (klass->methods && gklass->methods) {
|
||||
int mcount = mono_class_get_method_count (klass);
|
||||
for (i = 0; i < mcount; ++i)
|
||||
if (klass->methods [i]->slot == -1)
|
||||
klass->methods [i]->slot = gklass->methods [i]->slot;
|
||||
}
|
||||
|
||||
if (mono_print_vtable)
|
||||
print_vtable_layout_result (klass, klass->vtable, gklass->vtable_size);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* LOCKING: this is supposed to be called with the loader lock held.
|
||||
*/
|
||||
@@ -2866,7 +2967,6 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
|
||||
MonoClass *k, *ic;
|
||||
MonoMethod **vtable = NULL;
|
||||
int i, max_vtsize = 0, cur_slot = 0;
|
||||
GPtrArray *ifaces = NULL;
|
||||
GHashTable *override_map = NULL;
|
||||
GHashTable *override_class_map = NULL;
|
||||
GHashTable *conflict_map = NULL;
|
||||
@@ -2883,44 +2983,10 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
|
||||
if (overrides && !verify_class_overrides (klass, overrides, onum))
|
||||
return;
|
||||
|
||||
ifaces = mono_class_get_implemented_interfaces (klass, error);
|
||||
if (!is_ok (error)) {
|
||||
char *name = mono_type_get_full_name (klass);
|
||||
mono_class_set_type_load_failure (klass, "Could not resolve %s interfaces due to %s", name, mono_error_get_message (error));
|
||||
g_free (name);
|
||||
mono_error_cleanup (error);
|
||||
max_vtsize = setup_class_vtsize (klass, in_setup, &cur_slot, &stelemref_slot, error);
|
||||
if (max_vtsize == -1)
|
||||
return;
|
||||
} else if (ifaces) {
|
||||
for (i = 0; i < ifaces->len; i++) {
|
||||
MonoClass *ic = (MonoClass *)g_ptr_array_index (ifaces, i);
|
||||
max_vtsize += mono_class_get_method_count (ic);
|
||||
}
|
||||
g_ptr_array_free (ifaces, TRUE);
|
||||
ifaces = NULL;
|
||||
}
|
||||
|
||||
if (klass->parent) {
|
||||
mono_class_init_internal (klass->parent);
|
||||
mono_class_setup_vtable_full (klass->parent, in_setup);
|
||||
|
||||
if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Parent class failed to load"))
|
||||
return;
|
||||
|
||||
max_vtsize += klass->parent->vtable_size;
|
||||
cur_slot = klass->parent->vtable_size;
|
||||
}
|
||||
|
||||
max_vtsize += mono_class_get_method_count (klass);
|
||||
|
||||
/*Array have a slot for stelemref*/
|
||||
if (mono_class_need_stelemref_method (klass)) {
|
||||
stelemref_slot = cur_slot;
|
||||
++max_vtsize;
|
||||
++cur_slot;
|
||||
}
|
||||
|
||||
/* printf ("METAINIT %s.%s\n", klass->name_space, klass->name); */
|
||||
|
||||
cur_slot = setup_interface_offsets (klass, cur_slot, TRUE);
|
||||
if (cur_slot == -1) /*setup_interface_offsets fails the type.*/
|
||||
return;
|
||||
@@ -2929,80 +2995,14 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
|
||||
|
||||
/* Optimized version for generic instances */
|
||||
if (mono_class_is_ginst (klass)) {
|
||||
ERROR_DECL (error);
|
||||
MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
|
||||
MonoMethod **tmp;
|
||||
|
||||
mono_class_setup_vtable_full (gklass, in_setup);
|
||||
if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Could not load generic definition"))
|
||||
return;
|
||||
|
||||
tmp = (MonoMethod **)mono_class_alloc0 (klass, sizeof (gpointer) * gklass->vtable_size);
|
||||
klass->vtable_size = gklass->vtable_size;
|
||||
for (i = 0; i < gklass->vtable_size; ++i)
|
||||
if (gklass->vtable [i]) {
|
||||
MonoMethod *inflated = mono_class_inflate_generic_method_full_checked (gklass->vtable [i], klass, mono_class_get_context (klass), error);
|
||||
goto_if_nok (error, fail);
|
||||
tmp [i] = inflated;
|
||||
tmp [i]->slot = gklass->vtable [i]->slot;
|
||||
}
|
||||
mono_memory_barrier ();
|
||||
klass->vtable = tmp;
|
||||
|
||||
mono_loader_lock ();
|
||||
klass->has_dim_conflicts = gklass->has_dim_conflicts;
|
||||
mono_loader_unlock ();
|
||||
|
||||
/* Have to set method->slot for abstract virtual methods */
|
||||
if (klass->methods && gklass->methods) {
|
||||
int mcount = mono_class_get_method_count (klass);
|
||||
for (i = 0; i < mcount; ++i)
|
||||
if (klass->methods [i]->slot == -1)
|
||||
klass->methods [i]->slot = gklass->methods [i]->slot;
|
||||
}
|
||||
|
||||
if (mono_print_vtable)
|
||||
print_vtable_layout_result (klass, klass->vtable, gklass->vtable_size);
|
||||
|
||||
mono_class_setup_vtable_ginst (klass, in_setup);
|
||||
return;
|
||||
}
|
||||
|
||||
vtable = (MonoMethod **)g_malloc0 (sizeof (gpointer) * max_vtsize);
|
||||
|
||||
if (klass->parent && klass->parent->vtable_size) {
|
||||
MonoClass *parent = klass->parent;
|
||||
int i;
|
||||
|
||||
memcpy (vtable, parent->vtable, sizeof (gpointer) * parent->vtable_size);
|
||||
|
||||
// Also inherit parent interface vtables, just as a starting point.
|
||||
// This is needed otherwise bug-77127.exe fails when the property methods
|
||||
// have different names in the iterface and the class, because for child
|
||||
// classes the ".override" information is not used anymore.
|
||||
for (i = 0; i < parent->interface_offsets_count; i++) {
|
||||
MonoClass *parent_interface = parent->interfaces_packed [i];
|
||||
int interface_offset = mono_class_interface_offset (klass, parent_interface);
|
||||
/*FIXME this is now dead code as this condition will never hold true.
|
||||
Since interface offsets are inherited then the offset of an interface implemented
|
||||
by a parent will never be the out of it's vtable boundary.
|
||||
*/
|
||||
if (interface_offset >= parent->vtable_size) {
|
||||
int parent_interface_offset = mono_class_interface_offset (parent, parent_interface);
|
||||
int j;
|
||||
|
||||
mono_class_setup_methods (parent_interface); /*FIXME Just kill this whole chunk of dead code*/
|
||||
TRACE_INTERFACE_VTABLE (printf (" +++ Inheriting interface %s.%s\n", parent_interface->name_space, parent_interface->name));
|
||||
int mcount = mono_class_get_method_count (parent_interface);
|
||||
for (j = 0; j < mcount && !mono_class_has_failure (klass); j++) {
|
||||
vtable [interface_offset + j] = parent->vtable [parent_interface_offset + j];
|
||||
TRACE_INTERFACE_VTABLE (printf (" --- Inheriting: [%03d][(%03d)+(%03d)] => [%03d][(%03d)+(%03d)]\n",
|
||||
parent_interface_offset + j, parent_interface_offset, j,
|
||||
interface_offset + j, interface_offset, j));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (klass->parent && klass->parent->vtable_size)
|
||||
memcpy (vtable, klass->parent->vtable, sizeof (gpointer) * klass->parent->vtable_size);
|
||||
|
||||
/*Array have a slot for stelemref*/
|
||||
if (mono_class_need_stelemref_method (klass)) {
|
||||
|
||||
@@ -46,13 +46,6 @@ typedef enum {
|
||||
MONO_WRAPPER_NUM
|
||||
} MonoWrapperType;
|
||||
|
||||
typedef enum {
|
||||
MONO_TYPE_NAME_FORMAT_IL,
|
||||
MONO_TYPE_NAME_FORMAT_REFLECTION,
|
||||
MONO_TYPE_NAME_FORMAT_FULL_NAME,
|
||||
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
|
||||
} MonoTypeNameFormat;
|
||||
|
||||
typedef enum {
|
||||
MONO_REMOTING_TARGET_UNKNOWN,
|
||||
MONO_REMOTING_TARGET_APPDOMAIN,
|
||||
@@ -1150,9 +1143,6 @@ mono_class_get_exception_for_failure (MonoClass *klass);
|
||||
char*
|
||||
mono_identifier_escape_type_name_chars (const char* identifier);
|
||||
|
||||
char*
|
||||
mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
|
||||
|
||||
char*
|
||||
mono_type_get_full_name (MonoClass *klass);
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@ typedef struct _MonoClassField MonoClassField;
|
||||
typedef struct _MonoProperty MonoProperty;
|
||||
typedef struct _MonoEvent MonoEvent;
|
||||
|
||||
typedef enum {
|
||||
MONO_TYPE_NAME_FORMAT_IL,
|
||||
MONO_TYPE_NAME_FORMAT_REFLECTION,
|
||||
MONO_TYPE_NAME_FORMAT_FULL_NAME,
|
||||
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
|
||||
} MonoTypeNameFormat;
|
||||
|
||||
MONO_API MONO_RT_EXTERNAL_ONLY
|
||||
MonoClass *
|
||||
mono_class_get (MonoImage *image, uint32_t type_token);
|
||||
@@ -130,6 +137,9 @@ MONO_API MONO_RT_EXTERNAL_ONLY
|
||||
void*
|
||||
mono_ldtoken (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context);
|
||||
|
||||
MONO_API char *
|
||||
mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
|
||||
|
||||
MONO_API char*
|
||||
mono_type_get_name (MonoType *type);
|
||||
|
||||
|
||||
@@ -1606,7 +1606,7 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
|
||||
guint32 cols [MONO_CUSTOM_ATTR_SIZE];
|
||||
MonoTableInfo *ca;
|
||||
MonoCustomAttrInfo *ainfo;
|
||||
GList *tmp, *list = NULL;
|
||||
GArray *attr_array;
|
||||
const char *data;
|
||||
MonoCustomAttrEntry* attr;
|
||||
|
||||
@@ -1618,20 +1618,24 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
|
||||
if (!i)
|
||||
return NULL;
|
||||
i --;
|
||||
// initial size chosen arbitrarily, but default is 16 which is rather small
|
||||
attr_array = g_array_sized_new (TRUE, TRUE, sizeof (guint32), 128);
|
||||
while (i < ca->rows) {
|
||||
if (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx)
|
||||
break;
|
||||
list = g_list_prepend (list, GUINT_TO_POINTER (i));
|
||||
attr_array = g_array_append_val (attr_array, i);
|
||||
++i;
|
||||
}
|
||||
len = g_list_length (list);
|
||||
if (!len)
|
||||
len = attr_array->len;
|
||||
if (!len) {
|
||||
g_array_free (attr_array, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
ainfo = (MonoCustomAttrInfo *)g_malloc0 (MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * len);
|
||||
ainfo->num_attrs = len;
|
||||
ainfo->image = image;
|
||||
for (i = len, tmp = list; i != 0; --i, tmp = tmp->next) {
|
||||
mono_metadata_decode_row (ca, GPOINTER_TO_UINT (tmp->data), cols, MONO_CUSTOM_ATTR_SIZE);
|
||||
for (i = 0; i < len; ++i) {
|
||||
mono_metadata_decode_row (ca, g_array_index (attr_array, guint32, i), cols, MONO_CUSTOM_ATTR_SIZE);
|
||||
mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
|
||||
switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
|
||||
case MONO_CUSTOM_ATTR_TYPE_METHODDEF:
|
||||
@@ -1644,7 +1648,7 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
|
||||
g_error ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
|
||||
break;
|
||||
}
|
||||
attr = &ainfo->attrs [i - 1];
|
||||
attr = &ainfo->attrs [i];
|
||||
attr->ctor = mono_get_method_checked (image, mtoken, NULL, NULL, error);
|
||||
if (!attr->ctor) {
|
||||
g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x due to: %s", image->name, mtoken, mono_error_get_message (error));
|
||||
@@ -1652,14 +1656,14 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
|
||||
mono_error_cleanup (error);
|
||||
error_init (error);
|
||||
} else {
|
||||
g_list_free (list);
|
||||
g_array_free (attr_array, TRUE);
|
||||
g_free (ainfo);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mono_verifier_verify_cattr_blob (image, cols [MONO_CUSTOM_ATTR_VALUE], error)) {
|
||||
g_list_free (list);
|
||||
g_array_free (attr_array, TRUE);
|
||||
g_free (ainfo);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1667,7 +1671,7 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
|
||||
attr->data_size = mono_metadata_decode_value (data, &data);
|
||||
attr->data = (guchar*)data;
|
||||
}
|
||||
g_list_free (list);
|
||||
g_array_free (attr_array, TRUE);
|
||||
|
||||
return ainfo;
|
||||
}
|
||||
|
||||
@@ -172,8 +172,7 @@ mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Temporarily disabled to unblock Roslyn
|
||||
#if HOST_WIN32 //|| HAVE_SYS_ZLIB
|
||||
#if HOST_WIN32 || HAVE_SYS_ZLIB
|
||||
if (ppdb_data) {
|
||||
/* Embedded PPDB data */
|
||||
/* ppdb_size is the uncompressed size */
|
||||
@@ -436,7 +435,8 @@ mono_ppdb_lookup_location (MonoDebugMethodInfo *minfo, uint32_t offset)
|
||||
}
|
||||
|
||||
location = g_new0 (MonoDebugSourceLocation, 1);
|
||||
location->source_file = docname;
|
||||
if (docname && docname [0])
|
||||
location->source_file = docname;
|
||||
location->row = start_line;
|
||||
location->column = start_col;
|
||||
location->il_offset = iloffset;
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
#include "icall-decl.h"
|
||||
#include "mono/utils/mono-threads-coop.h"
|
||||
#include "mono/metadata/icall-signatures.h"
|
||||
#include "mono/utils/mono-signal-handler.h"
|
||||
|
||||
//#define MONO_DEBUG_ICALLARRAY
|
||||
|
||||
@@ -6479,7 +6480,7 @@ ves_icall_Mono_Runtime_ExceptionToState (MonoExceptionHandle exc_handle, guint64
|
||||
// FIXME: Push handles down into mini/mini-exceptions.c
|
||||
MonoException *exc = MONO_HANDLE_RAW (exc_handle);
|
||||
MonoThreadSummary out;
|
||||
mono_summarize_timeline_start ();
|
||||
mono_summarize_timeline_start ("ExceptionToState");
|
||||
mono_summarize_timeline_phase_log (MonoSummarySuspendHandshake);
|
||||
mono_summarize_timeline_phase_log (MonoSummaryUnmanagedStacks);
|
||||
mono_get_eh_callbacks ()->mono_summarize_exception (exc, &out);
|
||||
@@ -6524,8 +6525,7 @@ ves_icall_Mono_Runtime_SendMicrosoftTelemetry (const char *payload, guint64 port
|
||||
hashes.offset_free_hash = portable_hash;
|
||||
hashes.offset_rich_hash = unportable_hash;
|
||||
|
||||
// Tells mono that we want to send the HANG EXC_TYPE.
|
||||
const char *signal = "SIGTERM";
|
||||
const char *signal = "MANAGED_EXCEPTION";
|
||||
|
||||
gboolean success = mono_merp_invoke (crashed_pid, signal, payload, &hashes);
|
||||
if (!success) {
|
||||
@@ -6643,7 +6643,7 @@ ves_icall_Mono_Runtime_DumpStateTotal (guint64 *portable_hash, guint64 *unportab
|
||||
|
||||
mono_get_runtime_callbacks ()->install_state_summarizer ();
|
||||
|
||||
mono_summarize_timeline_start ();
|
||||
mono_summarize_timeline_start ("DumpStateTotal");
|
||||
|
||||
gboolean success = mono_threads_summarize (ctx, &out, &hashes, TRUE, FALSE, scratch, MONO_MAX_SUMMARY_LEN_ICALL);
|
||||
mono_summarize_timeline_phase_log (MonoSummaryCleanup);
|
||||
@@ -7745,7 +7745,12 @@ ves_icall_System_Environment_FailFast (MonoStringHandle message, MonoExceptionHa
|
||||
} else {
|
||||
char *msg = mono_string_handle_to_utf8 (message, error);
|
||||
g_warning ("CLR: Managed code called FailFast, saying \"%s\"", msg);
|
||||
#ifndef DISABLE_CRASH_REPORTING
|
||||
char *old_msg = mono_crash_save_failfast_msg (msg);
|
||||
g_free (old_msg);
|
||||
#else
|
||||
g_free (msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!MONO_HANDLE_IS_NULL (exception)) {
|
||||
|
||||
@@ -2450,10 +2450,6 @@ mono_image_close_except_pools (MonoImage *image)
|
||||
|
||||
mono_wrapper_caches_free (&image->wrapper_caches);
|
||||
|
||||
for (i = 0; i < image->gshared_types_len; ++i)
|
||||
free_hash (image->gshared_types [i]);
|
||||
g_free (image->gshared_types);
|
||||
|
||||
/* The ownership of signatures is not well defined */
|
||||
g_hash_table_destroy (image->memberref_signatures);
|
||||
g_hash_table_destroy (image->method_signatures);
|
||||
|
||||
@@ -567,11 +567,6 @@ struct _MonoImage {
|
||||
GHashTable *pinvoke_scopes;
|
||||
#endif
|
||||
|
||||
/* Indexed by MonoGenericParam pointers */
|
||||
GHashTable **gshared_types;
|
||||
/* The length of the above array */
|
||||
int gshared_types_len;
|
||||
|
||||
/* The loader used to load this image */
|
||||
MonoImageLoader *loader;
|
||||
|
||||
@@ -613,6 +608,11 @@ typedef struct {
|
||||
|
||||
GHashTable *aggregate_modifiers_cache;
|
||||
|
||||
/* Indexed by MonoGenericParam pointers */
|
||||
GHashTable **gshared_types;
|
||||
/* The length of the above array */
|
||||
int gshared_types_len;
|
||||
|
||||
mono_mutex_t lock;
|
||||
|
||||
/*
|
||||
@@ -897,6 +897,12 @@ mono_image_set_strdup (MonoImageSet *set, const char *s);
|
||||
MonoImageSet *
|
||||
mono_metadata_get_image_set_for_aggregate_modifiers (MonoAggregateModContainer *amods);
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_get_image_set_for_type (MonoType *type);
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_merge_image_sets (MonoImageSet *set1, MonoImageSet *set2);
|
||||
|
||||
#define mono_image_set_new0(image,type,size) ((type *) mono_image_set_alloc0 (image, sizeof (type)* (size)))
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -2796,6 +2796,12 @@ delete_image_set (MonoImageSet *set)
|
||||
|
||||
g_hash_table_destroy (set->aggregate_modifiers_cache);
|
||||
|
||||
for (i = 0; i < set->gshared_types_len; ++i) {
|
||||
if (set->gshared_types [i])
|
||||
g_hash_table_destroy (set->gshared_types [i]);
|
||||
}
|
||||
g_free (set->gshared_types);
|
||||
|
||||
mono_wrapper_caches_free (&set->wrapper_caches);
|
||||
|
||||
image_sets_lock ();
|
||||
@@ -3312,19 +3318,25 @@ mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericConte
|
||||
}
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_get_image_set_for_class (MonoClass *klass)
|
||||
mono_metadata_get_image_set_for_type (MonoType *type)
|
||||
{
|
||||
MonoImageSet *set;
|
||||
CollectData image_set_data;
|
||||
|
||||
collect_data_init (&image_set_data);
|
||||
collect_type_images (m_class_get_byval_arg (klass), &image_set_data);
|
||||
collect_type_images (type, &image_set_data);
|
||||
set = get_image_set (image_set_data.images, image_set_data.nimages);
|
||||
collect_data_free (&image_set_data);
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_get_image_set_for_class (MonoClass *klass)
|
||||
{
|
||||
return mono_metadata_get_image_set_for_type (m_class_get_byval_arg (klass));
|
||||
}
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_get_image_set_for_method (MonoMethodInflated *method)
|
||||
{
|
||||
@@ -3352,6 +3364,29 @@ mono_metadata_get_image_set_for_aggregate_modifiers (MonoAggregateModContainer *
|
||||
return set;
|
||||
}
|
||||
|
||||
MonoImageSet *
|
||||
mono_metadata_merge_image_sets (MonoImageSet *set1, MonoImageSet *set2)
|
||||
{
|
||||
MonoImage **images = g_newa (MonoImage*, set1->nimages + set2->nimages);
|
||||
|
||||
/* Add images from set1 */
|
||||
memcpy (images, set1->images, sizeof (MonoImage*) * set1->nimages);
|
||||
|
||||
int nimages = set1->nimages;
|
||||
// FIXME: Quaratic
|
||||
/* Add images from set2 */
|
||||
for (int i = 0; i < set2->nimages; ++i) {
|
||||
int j;
|
||||
for (j = 0; j < set1->nimages; ++j) {
|
||||
if (set2->images [i] == set1->images [j])
|
||||
break;
|
||||
}
|
||||
if (j == set1->nimages)
|
||||
images [nimages ++] = set2->images [i];
|
||||
}
|
||||
return get_image_set (images, nimages);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
type_is_gtd (MonoType *type)
|
||||
{
|
||||
|
||||
+11
-7
@@ -6624,13 +6624,12 @@ mono_string_empty_handle (MonoDomain *domain)
|
||||
MonoString *
|
||||
mono_string_new_utf16 (MonoDomain *domain, const mono_unichar2 *text, gint32 len)
|
||||
{
|
||||
MONO_REQ_GC_UNSAFE_MODE;
|
||||
|
||||
ERROR_DECL (error);
|
||||
MonoString *res = NULL;
|
||||
MONO_ENTER_GC_UNSAFE;
|
||||
ERROR_DECL (error);
|
||||
res = mono_string_new_utf16_checked (domain, text, len, error);
|
||||
mono_error_cleanup (error);
|
||||
|
||||
MONO_EXIT_GC_UNSAFE;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -6727,10 +6726,12 @@ mono_string_new_utf32 (MonoDomain *domain, const mono_unichar4 *text, gint32 len
|
||||
MonoString *
|
||||
mono_string_new_size (MonoDomain *domain, gint32 len)
|
||||
{
|
||||
MonoString *str;
|
||||
MONO_ENTER_GC_UNSAFE;
|
||||
ERROR_DECL (error);
|
||||
MonoString *str = mono_string_new_size_checked (domain, len, error);
|
||||
str = mono_string_new_size_checked (domain, len, error);
|
||||
mono_error_cleanup (error);
|
||||
|
||||
MONO_EXIT_GC_UNSAFE;
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -7563,9 +7564,12 @@ mono_string_intern (MonoString *str_raw)
|
||||
MonoString*
|
||||
mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx)
|
||||
{
|
||||
MonoString *result;
|
||||
MONO_ENTER_GC_UNSAFE;
|
||||
ERROR_DECL (error);
|
||||
MonoString *result = mono_ldstr_checked (domain, image, idx, error);
|
||||
result = mono_ldstr_checked (domain, image, idx, error);
|
||||
mono_error_cleanup (error);
|
||||
MONO_EXIT_GC_UNSAFE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1958,7 +1958,7 @@ _mono_reflection_get_type_from_info (MonoAssemblyLoadContext *alc, MonoTypeNameP
|
||||
MonoAssemblyByNameRequest req;
|
||||
mono_assembly_request_prepare_byname (&req, MONO_ASMCTX_DEFAULT, alc);
|
||||
req.requesting_assembly = NULL;
|
||||
req.basedir = image->assembly->basedir;
|
||||
req.basedir = image ? image->assembly->basedir : NULL;
|
||||
assembly = mono_assembly_request_byname (&info->assembly, &req, NULL);
|
||||
if (!assembly)
|
||||
return NULL;
|
||||
|
||||
@@ -2639,7 +2639,7 @@ mono_gc_get_allocated_bytes_for_current_thread (void)
|
||||
info = mono_thread_info_current ();
|
||||
|
||||
/*There are some more allocated bytes in the current tlab that have not been recorded yet */
|
||||
return info->total_bytes_allocated + info->tlab_next - info->tlab_start;
|
||||
return info->total_bytes_allocated + (ptrdiff_t)(info->tlab_next - info->tlab_start);
|
||||
}
|
||||
|
||||
guint64
|
||||
@@ -3018,6 +3018,13 @@ sgen_client_handle_gc_debug (const char *opt)
|
||||
mono_log_finalizers = TRUE;
|
||||
} else if (!strcmp (opt, "no-managed-allocator")) {
|
||||
sgen_set_use_managed_allocator (FALSE);
|
||||
} else if (!strcmp (opt, "managed-allocator")) {
|
||||
/*
|
||||
* This option can be used to override the disabling of the managed allocator by
|
||||
* the nursery canaries option. This can be used when knowing for sure that no
|
||||
* aot code will be used by the application.
|
||||
*/
|
||||
sgen_set_use_managed_allocator (TRUE);
|
||||
} else if (!sgen_bridge_handle_gc_debug (opt)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -6514,6 +6514,9 @@ summarizer_state_term (SummarizerGlobalState *state, gchar **out, gchar *mem, si
|
||||
mono_get_eh_callbacks ()->mono_summarize_managed_stack (threads [i]);
|
||||
}
|
||||
|
||||
/* The value of the breadcrumb should match the "StackHash" value written by `mono_merp_write_fingerprint_payload` */
|
||||
mono_create_crash_hash_breadcrumb (controlling);
|
||||
|
||||
MonoStateWriter writer;
|
||||
memset (&writer, 0, sizeof (writer));
|
||||
|
||||
|
||||
@@ -4925,6 +4925,10 @@ mono_method_verify (MonoMethod *method, int level)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Disable for now
|
||||
if (TRUE)
|
||||
return NULL;
|
||||
|
||||
memset (&ctx, 0, sizeof (VerifyContext));
|
||||
|
||||
//FIXME use mono_method_get_signature_full
|
||||
|
||||
@@ -175,6 +175,11 @@ mono_w32process_get_modules (pid_t pid)
|
||||
return g_slist_reverse (ret);
|
||||
}
|
||||
|
||||
void
|
||||
mono_w32process_platform_init_once (void)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
MONO_EMPTY_SOURCE_FILE (w32process_unix_bsd);
|
||||
|
||||
@@ -360,4 +360,9 @@ mono_w32process_get_modules (pid_t pid)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_w32process_platform_init_once (void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -57,6 +57,11 @@ mono_w32process_get_modules (pid_t pid)
|
||||
return g_slist_reverse (ret);
|
||||
}
|
||||
|
||||
void
|
||||
mono_w32process_platform_init_once (void)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
MONO_EMPTY_SOURCE_FILE (w32process_unix_haiku);
|
||||
|
||||
@@ -40,6 +40,9 @@ mono_w32process_get_name (pid_t pid);
|
||||
GSList*
|
||||
mono_w32process_get_modules (pid_t pid);
|
||||
|
||||
void
|
||||
mono_w32process_platform_init_once (void);
|
||||
|
||||
static void G_GNUC_UNUSED
|
||||
mono_w32process_module_free (MonoW32ProcessModule *module)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach-o/getsect.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
/* sys/resource.h (for rusage) is required when using osx 10.3 (but not 10.4) */
|
||||
#ifdef __APPLE__
|
||||
@@ -117,58 +118,128 @@ mono_w32process_get_path (pid_t pid)
|
||||
#endif
|
||||
}
|
||||
|
||||
GSList*
|
||||
struct mono_dyld_image_info
|
||||
{
|
||||
const void *header_addr;
|
||||
const void *data_section_start;
|
||||
const void *data_section_end;
|
||||
const char *name;
|
||||
guint64 order;
|
||||
};
|
||||
|
||||
static guint64 dyld_order = 0;
|
||||
static GHashTable *images;
|
||||
static mono_mutex_t images_mutex;
|
||||
|
||||
static int
|
||||
sort_modules_by_load_order (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
MonoW32ProcessModule *ma = (MonoW32ProcessModule *) a;
|
||||
MonoW32ProcessModule *mb = (MonoW32ProcessModule *) b;
|
||||
return ma->inode == mb->inode ? 0 : ma->inode < mb->inode ? -1 : 1;
|
||||
}
|
||||
|
||||
GSList *
|
||||
mono_w32process_get_modules (pid_t pid)
|
||||
{
|
||||
GSList *ret = NULL;
|
||||
MonoW32ProcessModule *mod;
|
||||
guint32 count;
|
||||
int i = 0;
|
||||
|
||||
MONO_ENTER_GC_SAFE;
|
||||
if (pid != getpid ())
|
||||
return NULL;
|
||||
goto done;
|
||||
|
||||
count = _dyld_image_count ();
|
||||
for (i = 0; i < count; i++) {
|
||||
#if SIZEOF_VOID_P == 8
|
||||
const struct mach_header_64 *hdr;
|
||||
const struct section_64 *sec;
|
||||
#else
|
||||
const struct mach_header *hdr;
|
||||
const struct section *sec;
|
||||
#endif
|
||||
const char *name;
|
||||
GHashTableIter it;
|
||||
g_hash_table_iter_init (&it, images);
|
||||
|
||||
name = _dyld_get_image_name (i);
|
||||
#if SIZEOF_VOID_P == 8
|
||||
hdr = (const struct mach_header_64*)_dyld_get_image_header (i);
|
||||
sec = getsectbynamefromheader_64 (hdr, SEG_DATA, SECT_DATA);
|
||||
#else
|
||||
hdr = _dyld_get_image_header (i);
|
||||
sec = getsectbynamefromheader (hdr, SEG_DATA, SECT_DATA);
|
||||
#endif
|
||||
gpointer val;
|
||||
|
||||
/* Some dynlibs do not have data sections on osx (#533893) */
|
||||
if (sec == 0)
|
||||
continue;
|
||||
|
||||
mod = g_new0 (MonoW32ProcessModule, 1);
|
||||
mod->address_start = GINT_TO_POINTER (sec->addr);
|
||||
mod->address_end = GINT_TO_POINTER (sec->addr+sec->size);
|
||||
mono_os_mutex_lock (&images_mutex);
|
||||
while (g_hash_table_iter_next (&it, NULL, &val)) {
|
||||
struct mono_dyld_image_info *info = (struct mono_dyld_image_info *) val;
|
||||
MonoW32ProcessModule *mod = g_new0 (MonoW32ProcessModule, 1);
|
||||
mod->address_start = GINT_TO_POINTER (info->data_section_start);
|
||||
mod->address_end = GINT_TO_POINTER (info->data_section_end);
|
||||
mod->perms = g_strdup ("r--p");
|
||||
mod->address_offset = 0;
|
||||
mod->device = makedev (0, 0);
|
||||
mod->inode = i;
|
||||
mod->filename = g_strdup (name);
|
||||
|
||||
if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) {
|
||||
ret = g_slist_prepend (ret, mod);
|
||||
} else {
|
||||
mono_w32process_module_free (mod);
|
||||
}
|
||||
mod->device = 0;
|
||||
mod->inode = info->order;
|
||||
mod->filename = g_strdup (info->name);
|
||||
ret = g_slist_prepend (ret, mod);
|
||||
}
|
||||
mono_os_mutex_unlock (&images_mutex);
|
||||
ret = g_slist_sort (ret, &sort_modules_by_load_order);
|
||||
done:
|
||||
MONO_EXIT_GC_SAFE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return g_slist_reverse (ret);
|
||||
static void
|
||||
mono_dyld_image_info_free (void *info)
|
||||
{
|
||||
struct mono_dyld_image_info *dinfo = (struct mono_dyld_image_info *) info;
|
||||
g_free ((void *) dinfo->name);
|
||||
g_free (dinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
image_added (const struct mach_header *hdr32, intptr_t vmaddr_slide)
|
||||
{
|
||||
#if SIZEOF_VOID_P == 8
|
||||
const struct mach_header_64 *hdr64 = (const struct mach_header_64 *)hdr32;
|
||||
const struct section_64 *sec = getsectbynamefromheader_64 (hdr64, SEG_DATA, SECT_DATA);
|
||||
#else
|
||||
const struct section *sec = getsectbynamefromheader (hdr32, SEG_DATA, SECT_DATA);
|
||||
#endif
|
||||
Dl_info dlinfo;
|
||||
if (!dladdr (hdr32, &dlinfo)) return;
|
||||
if (sec == NULL) return;
|
||||
|
||||
mono_os_mutex_lock (&images_mutex);
|
||||
gpointer found = g_hash_table_lookup (images, (gpointer) hdr32);
|
||||
mono_os_mutex_unlock (&images_mutex);
|
||||
|
||||
if (found == NULL) {
|
||||
struct mono_dyld_image_info *info = g_new0 (struct mono_dyld_image_info, 1);
|
||||
info->header_addr = hdr32;
|
||||
info->data_section_start = GINT_TO_POINTER (sec->addr);
|
||||
info->data_section_end = GINT_TO_POINTER (sec->addr + sec->size);
|
||||
info->name = g_strdup (dlinfo.dli_fname);
|
||||
info->order = dyld_order;
|
||||
++dyld_order;
|
||||
|
||||
mono_os_mutex_lock (&images_mutex);
|
||||
g_hash_table_insert (images, (gpointer) hdr32, info);
|
||||
mono_os_mutex_unlock (&images_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_removed (const struct mach_header *hdr32, intptr_t vmaddr_slide)
|
||||
{
|
||||
mono_os_mutex_lock (&images_mutex);
|
||||
g_hash_table_remove (images, hdr32);
|
||||
mono_os_mutex_unlock (&images_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
mono_w32process_platform_init_once (void)
|
||||
{
|
||||
mono_os_mutex_init (&images_mutex);
|
||||
images = g_hash_table_new_full (NULL, NULL, NULL, &mono_dyld_image_info_free);
|
||||
|
||||
/* Ensure that the functions used within the lock-protected region in
|
||||
* mono_w32process_get_modules have been loaded, in case these symbols
|
||||
* are lazily bound. g_new0 and g_strdup will be called by
|
||||
* _dyld_register_func_for_add_image when it calls image_added with the
|
||||
* current list of all loaded dynamic libraries
|
||||
*/
|
||||
GSList *dummy = g_slist_prepend (NULL, NULL);
|
||||
g_slist_free (dummy);
|
||||
GHashTableIter it;
|
||||
g_hash_table_iter_init (&it, images);
|
||||
g_hash_table_iter_next (&it, NULL, NULL);
|
||||
|
||||
_dyld_register_func_for_add_image (&image_added);
|
||||
_dyld_register_func_for_remove_image (&image_removed);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
#include <mono/utils/mono-io-portability.h>
|
||||
#include <mono/utils/w32api.h>
|
||||
#include <mono/utils/mono-errno.h>
|
||||
#include <mono/utils/mono-once.h>
|
||||
#include <mono/utils/mono-error-internals.h>
|
||||
#include <mono/utils/mono-threads-coop.h>
|
||||
#include "object-internals.h"
|
||||
@@ -594,6 +595,8 @@ process_set_name (MonoW32HandleProcess *process_handle)
|
||||
}
|
||||
}
|
||||
|
||||
static mono_once_t init_state = MONO_ONCE_INIT;
|
||||
|
||||
void
|
||||
mono_w32process_init (void)
|
||||
{
|
||||
@@ -615,6 +618,7 @@ mono_w32process_init (void)
|
||||
g_assert (current_process != INVALID_HANDLE_VALUE);
|
||||
|
||||
mono_coop_mutex_init (&processes_mutex);
|
||||
mono_once (&init_state, &mono_w32process_platform_init_once);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -3386,12 +3386,14 @@ get_shared_ginst_ref (MonoAotCompile *acfg, MonoGenericInst *ginst)
|
||||
guint32 offset = GPOINTER_TO_UINT (g_hash_table_lookup (acfg->ginst_blob_hash, ginst));
|
||||
if (!offset) {
|
||||
guint8 *buf2, *p2;
|
||||
int len;
|
||||
|
||||
buf2 = (guint8 *)g_malloc (1024);
|
||||
len = 1024 + (ginst->type_argc * 32);
|
||||
buf2 = (guint8 *)g_malloc (len);
|
||||
p2 = buf2;
|
||||
|
||||
encode_ginst (acfg, ginst, p2, &p2);
|
||||
g_assert (p2 - buf2 < 1024);
|
||||
g_assert (p2 - buf2 < len);
|
||||
|
||||
offset = add_to_blob (acfg, buf2, p2 - buf2);
|
||||
g_free (buf2);
|
||||
|
||||
+40
-15
@@ -220,7 +220,7 @@ static gsize aot_code_high_addr = 0;
|
||||
static gint32 async_jit_info_size;
|
||||
|
||||
#ifdef MONOTOUCH
|
||||
#define USE_PAGE_TRAMPOLINES (mono_defaults.corlib->aot_module->use_page_trampolines)
|
||||
#define USE_PAGE_TRAMPOLINES (mscorlib_aot_module->use_page_trampolines)
|
||||
#else
|
||||
#define USE_PAGE_TRAMPOLINES 0
|
||||
#endif
|
||||
@@ -2079,6 +2079,32 @@ init_amodule_got (MonoAotModule *amodule, gboolean preinit)
|
||||
mono_loader_unlock ();
|
||||
}
|
||||
|
||||
#ifdef MONOTOUCH
|
||||
// Follow branch islands on ARM iOS machines.
|
||||
static inline guint8 *
|
||||
method_address_resolve (guint8 *code_addr) {
|
||||
#if defined(TARGET_ARM)
|
||||
// Skip branches to thumb destinations; the convention used is that the
|
||||
// lowest bit is set if the destination is thumb. See
|
||||
// get_call_table_entry.
|
||||
if (((uintptr_t) code_addr) & 0x1)
|
||||
return code_addr;
|
||||
#endif
|
||||
for (;;) {
|
||||
// `mono_arch_get_call_target` takes the IP after the branch
|
||||
// instruction, not before. Add 4 bytes to compensate.
|
||||
guint8 *next = mono_arch_get_call_target (code_addr + 4);
|
||||
if (next == NULL) return code_addr;
|
||||
code_addr = next;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static inline guint8 *
|
||||
method_address_resolve (guint8 *code_addr) {
|
||||
return code_addr;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer user_data, MonoError *error)
|
||||
{
|
||||
@@ -2379,6 +2405,8 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
|
||||
g_assert (addr);
|
||||
if (addr == amodule->info.method_addresses)
|
||||
addr = NULL;
|
||||
else
|
||||
addr = method_address_resolve ((guint8 *) addr);
|
||||
}
|
||||
if (addr == NULL)
|
||||
amodule->methods [i] = GINT_TO_POINTER (-1);
|
||||
@@ -2426,10 +2454,6 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
|
||||
|
||||
init_amodule_got (amodule, TRUE);
|
||||
|
||||
if (info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM)
|
||||
/* Directly called methods might make calls through the PLT */
|
||||
init_plt (amodule);
|
||||
|
||||
if (amodule->jit_code_start)
|
||||
mono_jit_info_add_aot_module (assembly->image, amodule->jit_code_start, amodule->jit_code_end);
|
||||
if (amodule->llvm_code_start)
|
||||
@@ -2444,6 +2468,10 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
|
||||
/*g_warning ("using page trampolines: %d", amodule->use_page_trampolines);*/
|
||||
}
|
||||
|
||||
if (info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM)
|
||||
/* Directly called methods might make calls through the PLT */
|
||||
init_plt (amodule);
|
||||
|
||||
/*
|
||||
* Register the plt region as a single trampoline so we can unwind from this code
|
||||
*/
|
||||
@@ -5537,13 +5565,12 @@ read_page_trampoline_uwinfo (MonoTrampInfo *info, int tramp_type, gboolean is_ge
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
read_unwind_info (mono_defaults.corlib->aot_module, info, symbol_name);
|
||||
read_unwind_info (mscorlib_aot_module, info, symbol_name);
|
||||
}
|
||||
|
||||
static unsigned char*
|
||||
get_new_trampoline_from_page (int tramp_type)
|
||||
{
|
||||
MonoAotModule *amodule;
|
||||
MonoImage *image;
|
||||
TrampolinePage *page;
|
||||
int count;
|
||||
@@ -5565,13 +5592,11 @@ get_new_trampoline_from_page (int tramp_type)
|
||||
return code;
|
||||
}
|
||||
mono_aot_page_unlock ();
|
||||
/* the trampoline template page is in the mscorlib module */
|
||||
image = mono_defaults.corlib;
|
||||
g_assert (image);
|
||||
|
||||
psize = MONO_AOT_TRAMP_PAGE_SIZE;
|
||||
|
||||
amodule = image->aot_module;
|
||||
/* the trampoline template page is in the mscorlib module */
|
||||
MonoAotModule *amodule = mscorlib_aot_module;
|
||||
g_assert (amodule);
|
||||
|
||||
if (tramp_type == MONO_AOT_TRAMP_SPECIFIC)
|
||||
@@ -5795,7 +5820,7 @@ no_specific_trampoline (void)
|
||||
* Return a specific trampoline from the AOT file.
|
||||
*/
|
||||
gpointer
|
||||
mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
|
||||
mono_aot_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
|
||||
{
|
||||
MonoAotModule *amodule;
|
||||
guint32 got_offset, tramp_size;
|
||||
@@ -6024,7 +6049,7 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
|
||||
{
|
||||
char *symbol;
|
||||
gpointer code;
|
||||
MonoAotModule *amodule = mono_defaults.corlib->aot_module;
|
||||
MonoAotModule *amodule = mscorlib_aot_module;
|
||||
guint32 index = MONO_RGCTX_SLOT_INDEX (slot);
|
||||
static int count = 0;
|
||||
|
||||
@@ -6046,7 +6071,7 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
|
||||
}
|
||||
|
||||
symbol = mono_get_rgctx_fetch_trampoline_name (slot);
|
||||
code = load_function (mono_defaults.corlib->aot_module, symbol);
|
||||
code = load_function (amodule, symbol);
|
||||
g_free (symbol);
|
||||
/* The caller expects an ftnptr */
|
||||
return mono_create_ftnptr (mono_domain_get (), code);
|
||||
@@ -6360,7 +6385,7 @@ mono_aot_get_plt_info_offset (host_mgreg_t *regs, guint8 *code)
|
||||
}
|
||||
|
||||
gpointer
|
||||
mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
|
||||
mono_aot_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
return NULL;
|
||||
|
||||
@@ -247,7 +247,7 @@ MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *imag
|
||||
gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error);
|
||||
void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, host_mgreg_t *regs, guint8 *addr);
|
||||
gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot, MonoError *error);
|
||||
gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
|
||||
gpointer mono_aot_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
|
||||
gpointer mono_aot_get_trampoline (const char *name);
|
||||
gpointer mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo);
|
||||
gpointer mono_aot_get_unbox_trampoline (MonoMethod *method, gpointer addr);
|
||||
|
||||
+77
-18
@@ -226,6 +226,8 @@ struct _DebuggerTlsData {
|
||||
* Number of times this thread has been resumed using resume_thread ().
|
||||
*/
|
||||
guint32 resume_count;
|
||||
guint32 resume_count_internal;
|
||||
guint32 suspend_count;
|
||||
|
||||
MonoInternalThread *thread;
|
||||
intptr_t thread_id;
|
||||
@@ -292,7 +294,7 @@ typedef struct {
|
||||
#define HEADER_LENGTH 11
|
||||
|
||||
#define MAJOR_VERSION 2
|
||||
#define MINOR_VERSION 54
|
||||
#define MINOR_VERSION 57
|
||||
|
||||
typedef enum {
|
||||
CMD_SET_VM = 1,
|
||||
@@ -726,7 +728,7 @@ static void invalidate_frames (DebuggerTlsData *tls);
|
||||
|
||||
/* Callbacks used by debugger-engine */
|
||||
static MonoContext* tls_get_restore_state (void *the_tls);
|
||||
static gboolean try_process_suspend (void *tls, MonoContext *ctx);
|
||||
static gboolean try_process_suspend (void *tls, MonoContext *ctx, gboolean from_breakpoint);
|
||||
static gboolean begin_breakpoint_processing (void *tls, MonoContext *ctx, MonoJitInfo *ji, gboolean from_signal);
|
||||
static void begin_single_step_processing (MonoContext *ctx, gboolean from_signal);
|
||||
static void ss_discard_frame_context (void *the_tls);
|
||||
@@ -2715,6 +2717,8 @@ reset_native_thread_suspend_state (gpointer key, gpointer value, gpointer user_d
|
||||
tls->async_state.valid = FALSE;
|
||||
invalidate_frames (tls);
|
||||
}
|
||||
tls->resume_count_internal++;
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -2823,19 +2827,24 @@ process_suspend (DebuggerTlsData *tls, MonoContext *ctx)
|
||||
|
||||
/* Conditionally call process_suspend depending oh the current state */
|
||||
static gboolean
|
||||
try_process_suspend (void *the_tls, MonoContext *ctx)
|
||||
try_process_suspend (void *the_tls, MonoContext *ctx, gboolean from_breakpoint)
|
||||
{
|
||||
DebuggerTlsData *tls = (DebuggerTlsData*)the_tls;
|
||||
|
||||
if (suspend_count > 0) {
|
||||
/* if there is a suspend pending that is not executed yes */
|
||||
if (suspend_count > 0) {
|
||||
/* Fastpath during invokes, see in process_suspend () */
|
||||
if (suspend_count - tls->resume_count == 0)
|
||||
/* if there is a suspend pending but this thread is already resumed, we shouldn't suspend it again and the breakpoint/ss can run */
|
||||
if (suspend_count - tls->resume_count == 0)
|
||||
return FALSE;
|
||||
if (tls->invoke)
|
||||
/* if there is in a invoke the breakpoint/step should be executed even with the suspend pending */
|
||||
if (tls->invoke)
|
||||
return FALSE;
|
||||
/* with the multithreaded single step check if there is a suspend_count pending in the current thread and not in the vm */
|
||||
if (from_breakpoint && tls->suspend_count <= tls->resume_count_internal)
|
||||
return FALSE;
|
||||
process_suspend (tls, ctx);
|
||||
return TRUE;
|
||||
}
|
||||
} /* if there isn't any suspend pending, the breakpoint/ss will be executed and will suspend then vm when the event is sent */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2945,6 +2954,8 @@ resume_thread (MonoInternalThread *thread)
|
||||
DEBUG_PRINTF (1, "[sdb] Resuming thread %p...\n", (gpointer)(gssize)thread->tid);
|
||||
|
||||
tls->resume_count += suspend_count;
|
||||
tls->resume_count_internal += tls->suspend_count;
|
||||
tls->suspend_count = 0;
|
||||
|
||||
/*
|
||||
* Signal suspend_count without decreasing suspend_count, the threads will wake up
|
||||
@@ -3901,7 +3912,10 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (event == EVENT_KIND_VM_START)
|
||||
suspend_policy = agent_config.suspend ? SUSPEND_POLICY_ALL : SUSPEND_POLICY_NONE;
|
||||
|
||||
nevents = g_slist_length (events);
|
||||
buffer_init (&buf, 128);
|
||||
buffer_add_byte (&buf, suspend_policy);
|
||||
@@ -4012,7 +4026,6 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
|
||||
}
|
||||
|
||||
if (event == EVENT_KIND_VM_START) {
|
||||
suspend_policy = agent_config.suspend ? SUSPEND_POLICY_ALL : SUSPEND_POLICY_NONE;
|
||||
if (!agent_config.defer) {
|
||||
ERROR_DECL (error);
|
||||
start_debugger_thread (error);
|
||||
@@ -4035,6 +4048,8 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
|
||||
* returns.
|
||||
*/
|
||||
save_thread_context (ctx);
|
||||
DebuggerTlsData *tls = (DebuggerTlsData *)mono_g_hash_table_lookup (thread_to_tls, mono_thread_internal_current ());
|
||||
tls->suspend_count++;
|
||||
suspend_vm ();
|
||||
|
||||
if (keepalive_obj)
|
||||
@@ -4337,6 +4352,9 @@ send_types_for_domain (MonoDomain *domain, void *user_data)
|
||||
MonoDomain* old_domain;
|
||||
AgentDomainInfo *info = NULL;
|
||||
|
||||
if (mono_domain_is_unloading (domain))
|
||||
return;
|
||||
|
||||
info = get_agent_domain_info (domain);
|
||||
g_assert (info);
|
||||
|
||||
@@ -4357,6 +4375,9 @@ send_assemblies_for_domain (MonoDomain *domain, void *user_data)
|
||||
GSList *tmp;
|
||||
MonoDomain* old_domain;
|
||||
|
||||
if (mono_domain_is_unloading (domain))
|
||||
return;
|
||||
|
||||
old_domain = mono_domain_get ();
|
||||
|
||||
mono_domain_set_fast (domain, TRUE);
|
||||
@@ -4962,7 +4983,6 @@ debugger_agent_breakpoint_from_context (MonoContext *ctx)
|
||||
if (MONO_CONTEXT_GET_IP (ctx) == orig_ip - 1)
|
||||
MONO_CONTEXT_SET_IP (ctx, orig_ip);
|
||||
}
|
||||
|
||||
static void
|
||||
ss_args_destroy (SingleStepArgs *ss_args)
|
||||
{
|
||||
@@ -4973,7 +4993,9 @@ ss_args_destroy (SingleStepArgs *ss_args)
|
||||
static int
|
||||
handle_multiple_ss_requests (void)
|
||||
{
|
||||
return DE_ERR_NOT_IMPLEMENTED;
|
||||
if (!CHECK_PROTOCOL_VERSION (2, 57))
|
||||
return DE_ERR_NOT_IMPLEMENTED;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -5125,6 +5147,7 @@ ss_clear_for_assembly (SingleStepReq *req, MonoAssembly *assembly)
|
||||
static void
|
||||
mono_debugger_agent_send_crash (char *json_dump, MonoStackHash *hashes, int pause)
|
||||
{
|
||||
MONO_ENTER_GC_UNSAFE;
|
||||
#ifndef DISABLE_CRASH_REPORTING
|
||||
int suspend_policy;
|
||||
GSList *events;
|
||||
@@ -5167,6 +5190,7 @@ mono_debugger_agent_send_crash (char *json_dump, MonoStackHash *hashes, int paus
|
||||
// Don't die before it is sent.
|
||||
sleep (4);
|
||||
#endif
|
||||
MONO_EXIT_GC_UNSAFE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6235,7 +6259,7 @@ clear_event_request (int req_id, int etype)
|
||||
if (req->event_kind == EVENT_KIND_BREAKPOINT)
|
||||
mono_de_clear_breakpoint ((MonoBreakpoint *)req->info);
|
||||
if (req->event_kind == EVENT_KIND_STEP) {
|
||||
mono_de_cancel_ss ();
|
||||
mono_de_cancel_ss ((SingleStepReq *)req->info);
|
||||
}
|
||||
if (req->event_kind == EVENT_KIND_METHOD_ENTRY)
|
||||
mono_de_clear_breakpoint ((MonoBreakpoint *)req->info);
|
||||
@@ -6516,7 +6540,10 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8
|
||||
else {
|
||||
ERROR_DECL (error);
|
||||
this_arg = mono_object_new_checked (domain, m->klass, error);
|
||||
mono_error_assert_ok (error);
|
||||
if (!is_ok (error)) {
|
||||
mono_error_cleanup (error);
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
@@ -6840,6 +6867,10 @@ get_types (gpointer key, gpointer value, gpointer user_data)
|
||||
MonoType *t;
|
||||
GSList *tmp;
|
||||
MonoDomain *domain = (MonoDomain*)key;
|
||||
|
||||
if (mono_domain_is_unloading (domain))
|
||||
return;
|
||||
|
||||
MonoAssemblyLoadContext *alc = mono_domain_default_alc (domain);
|
||||
GetTypesArgs *ud = (GetTypesArgs*)user_data;
|
||||
|
||||
@@ -6879,6 +6910,9 @@ get_types_for_source_file (gpointer key, gpointer value, gpointer user_data)
|
||||
GetTypesForSourceFileArgs *ud = (GetTypesForSourceFileArgs*)user_data;
|
||||
MonoDomain *domain = (MonoDomain*)key;
|
||||
|
||||
if (mono_domain_is_unloading (domain))
|
||||
return;
|
||||
|
||||
AgentDomainInfo *info = (AgentDomainInfo *)domain_jit_info (domain)->agent_info;
|
||||
|
||||
/* Update 'source_file_to_class' cache */
|
||||
@@ -6937,6 +6971,12 @@ get_types_for_source_file (gpointer key, gpointer value, gpointer user_data)
|
||||
}
|
||||
}
|
||||
|
||||
static void add_error_string (Buffer *buf, const char *str)
|
||||
{
|
||||
if (CHECK_PROTOCOL_VERSION (2, 56))
|
||||
buffer_add_string (buf, str);
|
||||
}
|
||||
|
||||
static ErrorCode
|
||||
vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
|
||||
{
|
||||
@@ -7241,6 +7281,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
|
||||
ignore_case = decode_byte (p, &p, end);
|
||||
|
||||
if (!mono_reflection_parse_type_checked (name, &info, error)) {
|
||||
add_error_string (buf, mono_error_get_message (error));
|
||||
mono_error_cleanup (error);
|
||||
g_free (name);
|
||||
mono_reflection_free_type_info (&info);
|
||||
@@ -7729,6 +7770,8 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
|
||||
case CMD_ASSEMBLY_GET_TYPE: {
|
||||
ERROR_DECL (error);
|
||||
char *s = decode_string (p, &p, end);
|
||||
char* original_s = g_strdup_printf ("\"%s\"", s);
|
||||
|
||||
gboolean ignorecase = decode_byte (p, &p, end);
|
||||
MonoTypeNameParse info;
|
||||
MonoType *t;
|
||||
@@ -7744,20 +7787,33 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
|
||||
mono_error_cleanup (error);
|
||||
t = NULL;
|
||||
} else {
|
||||
if (info.assembly.name)
|
||||
NOT_IMPLEMENTED;
|
||||
if (info.assembly.name) {
|
||||
mono_reflection_free_type_info (&info);
|
||||
g_free (s);
|
||||
mono_domain_set_fast (d, TRUE);
|
||||
char* error_msg = g_strdup_printf ("Unexpected assembly-qualified type %s was provided", original_s);
|
||||
add_error_string (buf, error_msg);
|
||||
g_free (error_msg);
|
||||
g_free (original_s);
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
t = mono_reflection_get_type_checked (alc, ass->image, ass->image, &info, ignorecase, TRUE, &type_resolve, error);
|
||||
if (!is_ok (error)) {
|
||||
mono_error_cleanup (error); /* FIXME don't swallow the error */
|
||||
mono_reflection_free_type_info (&info);
|
||||
g_free (s);
|
||||
mono_domain_set_fast (d, TRUE);
|
||||
char* error_msg = g_strdup_printf ("Invalid type name %s", original_s);
|
||||
add_error_string (buf, error_msg);
|
||||
g_free (error_msg);
|
||||
g_free (original_s);
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
buffer_add_typeid (buf, domain, t ? mono_class_from_mono_type_internal (t) : NULL);
|
||||
mono_reflection_free_type_info (&info);
|
||||
g_free (s);
|
||||
|
||||
g_free (original_s);
|
||||
mono_domain_set_fast (d, TRUE);
|
||||
|
||||
break;
|
||||
@@ -7814,6 +7870,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
|
||||
error_init (error);
|
||||
MonoClass* mono_class = mono_class_get_checked (ass->image, token, error);
|
||||
if (!is_ok (error)) {
|
||||
add_error_string (buf, mono_error_get_message (error));
|
||||
mono_error_cleanup (error);
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -7830,6 +7887,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
|
||||
error_init (error);
|
||||
MonoMethod* mono_method = mono_get_method_checked (ass->image, token, NULL, NULL, error);
|
||||
if (!is_ok (error)) {
|
||||
add_error_string (buf, mono_error_get_message (error));
|
||||
mono_error_cleanup (error);
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -8682,6 +8740,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
|
||||
|
||||
header = mono_method_get_header_checked (method, error);
|
||||
if (!header) {
|
||||
add_error_string (buf, mono_error_get_message (error));
|
||||
mono_error_cleanup (error); /* FIXME don't swallow the error */
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -9513,7 +9572,7 @@ string_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
|
||||
if (!is_ok (error)) {
|
||||
if (s)
|
||||
g_free (s);
|
||||
|
||||
add_error_string (buf, mono_error_get_message (error));
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
buffer_add_string (buf, s);
|
||||
|
||||
+61
-27
@@ -378,6 +378,9 @@ collect_domain_bp (gpointer key, gpointer value, gpointer user_data)
|
||||
CollectDomainData *ud = (CollectDomainData*)user_data;
|
||||
MonoMethod *m;
|
||||
|
||||
if (mono_domain_is_unloading (domain))
|
||||
return;
|
||||
|
||||
mono_domain_lock (domain);
|
||||
g_hash_table_iter_init (&iter, domain_jit_info (domain)->seq_points);
|
||||
while (g_hash_table_iter_next (&iter, (void**)&m, (void**)&seq_points)) {
|
||||
@@ -591,8 +594,26 @@ mono_de_clear_breakpoints_for_domain (MonoDomain *domain)
|
||||
/* Number of single stepping operations in progress */
|
||||
static int ss_count;
|
||||
|
||||
/* The single step request instance */
|
||||
static SingleStepReq *the_ss_req;
|
||||
/* The single step request instances */
|
||||
static GPtrArray *the_ss_reqs;
|
||||
|
||||
static void
|
||||
ss_req_init (void)
|
||||
{
|
||||
the_ss_reqs = g_ptr_array_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
ss_req_cleanup (void)
|
||||
{
|
||||
dbg_lock ();
|
||||
|
||||
g_ptr_array_free (the_ss_reqs, TRUE);
|
||||
|
||||
the_ss_reqs = NULL;
|
||||
|
||||
dbg_unlock ();
|
||||
}
|
||||
|
||||
/*
|
||||
* mono_de_start_single_stepping:
|
||||
@@ -717,18 +738,28 @@ ss_destroy (SingleStepReq *req)
|
||||
}
|
||||
|
||||
static SingleStepReq*
|
||||
ss_req_acquire (void)
|
||||
ss_req_acquire (MonoInternalThread *thread)
|
||||
{
|
||||
SingleStepReq *req;
|
||||
|
||||
SingleStepReq *req = NULL;
|
||||
dbg_lock ();
|
||||
req = the_ss_req;
|
||||
if (req)
|
||||
req->refcount ++;
|
||||
int i;
|
||||
for (i = 0; i < the_ss_reqs->len; ++i) {
|
||||
SingleStepReq *current_req = (SingleStepReq *)g_ptr_array_index (the_ss_reqs, i);
|
||||
if (current_req->thread == thread) {
|
||||
current_req->refcount ++;
|
||||
req = current_req;
|
||||
}
|
||||
}
|
||||
dbg_unlock ();
|
||||
return req;
|
||||
}
|
||||
|
||||
static int
|
||||
ss_req_count ()
|
||||
{
|
||||
return the_ss_reqs->len;
|
||||
}
|
||||
|
||||
static void
|
||||
mono_de_ss_req_release (SingleStepReq *req)
|
||||
{
|
||||
@@ -739,24 +770,31 @@ mono_de_ss_req_release (SingleStepReq *req)
|
||||
req->refcount --;
|
||||
if (req->refcount == 0)
|
||||
free = TRUE;
|
||||
dbg_unlock ();
|
||||
if (free) {
|
||||
if (req == the_ss_req)
|
||||
the_ss_req = NULL;
|
||||
g_ptr_array_remove (the_ss_reqs, req);
|
||||
ss_destroy (req);
|
||||
}
|
||||
dbg_unlock ();
|
||||
}
|
||||
|
||||
void
|
||||
mono_de_cancel_ss (SingleStepReq *req)
|
||||
{
|
||||
if (the_ss_reqs) {
|
||||
mono_de_ss_req_release (req);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mono_de_cancel_ss (void)
|
||||
mono_de_cancel_all_ss ()
|
||||
{
|
||||
if (the_ss_req) {
|
||||
mono_de_ss_req_release (the_ss_req);
|
||||
the_ss_req = NULL;
|
||||
int i;
|
||||
for (i = 0; i < the_ss_reqs->len; ++i) {
|
||||
SingleStepReq *current_req = (SingleStepReq *)g_ptr_array_index (the_ss_reqs, i);
|
||||
mono_de_ss_req_release (current_req);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mono_de_process_single_step (void *tls, gboolean from_signal)
|
||||
{
|
||||
@@ -774,21 +812,17 @@ mono_de_process_single_step (void *tls, gboolean from_signal)
|
||||
/* Skip the instruction causing the single step */
|
||||
rt_callbacks.begin_single_step_processing (ctx, from_signal);
|
||||
|
||||
if (rt_callbacks.try_process_suspend (tls, ctx))
|
||||
if (rt_callbacks.try_process_suspend (tls, ctx, FALSE))
|
||||
return;
|
||||
|
||||
/*
|
||||
* This can run concurrently with a clear_event_request () call, so needs locking/reference counts.
|
||||
*/
|
||||
ss_req = ss_req_acquire ();
|
||||
ss_req = ss_req_acquire (mono_thread_internal_current ());
|
||||
|
||||
if (!ss_req)
|
||||
// FIXME: A suspend race
|
||||
return;
|
||||
|
||||
if (mono_thread_internal_current () != ss_req->thread)
|
||||
goto exit;
|
||||
|
||||
ip = (guint8 *)MONO_CONTEXT_GET_IP (ctx);
|
||||
|
||||
ji = get_top_method_ji (ip, &domain, (gpointer*)&ip);
|
||||
@@ -1022,7 +1056,7 @@ mono_de_process_breakpoint (void *void_tls, gboolean from_signal)
|
||||
SeqPoint sp;
|
||||
gboolean found_sp;
|
||||
|
||||
if (rt_callbacks.try_process_suspend (tls, ctx))
|
||||
if (rt_callbacks.try_process_suspend (tls, ctx, TRUE))
|
||||
return;
|
||||
|
||||
ip = (guint8 *)MONO_CONTEXT_GET_IP (ctx);
|
||||
@@ -1488,7 +1522,7 @@ mono_de_ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, S
|
||||
return err;
|
||||
|
||||
// FIXME: Multiple requests
|
||||
if (the_ss_req) {
|
||||
if (ss_req_count () > 1) {
|
||||
err = rt_callbacks.handle_multiple_ss_requests ();
|
||||
|
||||
if (err == DE_ERR_NOT_IMPLEMENTED) {
|
||||
@@ -1519,8 +1553,7 @@ mono_de_ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, S
|
||||
err = rt_callbacks.ss_create_init_args (ss_req, &args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
the_ss_req = ss_req;
|
||||
g_ptr_array_add (the_ss_reqs, ss_req);
|
||||
|
||||
mono_de_ss_start (ss_req, &args);
|
||||
|
||||
@@ -1552,7 +1585,7 @@ mono_de_init (DebuggerEngineCallbacks *cbs)
|
||||
|
||||
domains_init ();
|
||||
breakpoints_init ();
|
||||
|
||||
ss_req_init ();
|
||||
mono_debugger_log_init ();
|
||||
}
|
||||
|
||||
@@ -1561,6 +1594,7 @@ mono_de_cleanup (void)
|
||||
{
|
||||
breakpoints_cleanup ();
|
||||
domains_cleanup ();
|
||||
ss_req_cleanup ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -232,7 +232,7 @@ mono_debugger_get_thread_state (DebuggerTlsData *ref);
|
||||
|
||||
typedef struct {
|
||||
MonoContext *(*tls_get_restore_state) (void *tls);
|
||||
gboolean (*try_process_suspend) (void *tls, MonoContext *ctx);
|
||||
gboolean (*try_process_suspend) (void *tls, MonoContext *ctx, gboolean from_breakpoint);
|
||||
gboolean (*begin_breakpoint_processing) (void *tls, MonoContext *ctx, MonoJitInfo *ji, gboolean from_signal);
|
||||
void (*begin_single_step_processing) (MonoContext *ctx, gboolean from_signal);
|
||||
|
||||
@@ -284,6 +284,7 @@ void mono_de_stop_single_stepping (void);
|
||||
void mono_de_process_breakpoint (void *tls, gboolean from_signal);
|
||||
void mono_de_process_single_step (void *tls, gboolean from_signal);
|
||||
DbgEngineErrorCode mono_de_ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilter filter, EventRequest *req);
|
||||
void mono_de_cancel_ss (void);
|
||||
void mono_de_cancel_ss (SingleStepReq *req);
|
||||
void mono_de_cancel_all_ss (void);
|
||||
|
||||
#endif
|
||||
@@ -181,6 +181,12 @@ emit_int32 (MonoDwarfWriter *w, int value)
|
||||
mono_img_writer_emit_int32 (w->w, value);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_symbol (MonoDwarfWriter *w, const char *symbol)
|
||||
{
|
||||
mono_img_writer_emit_symbol (w->w, symbol);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_symbol_diff (MonoDwarfWriter *w, const char *end, const char* start, int offset)
|
||||
{
|
||||
@@ -799,6 +805,7 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis
|
||||
w->cie_program = base_unwind_program;
|
||||
|
||||
emit_section_change (w, ".debug_abbrev", 0);
|
||||
emit_label (w, ".Ldebug_abbrev_start");
|
||||
emit_dwarf_abbrev (w, ABBREV_COMPILE_UNIT, DW_TAG_compile_unit, TRUE,
|
||||
compile_unit_attr, G_N_ELEMENTS (compile_unit_attr));
|
||||
emit_dwarf_abbrev (w, ABBREV_SUBPROGRAM, DW_TAG_subprogram, TRUE,
|
||||
@@ -842,7 +849,11 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis
|
||||
emit_symbol_diff (w, ".Ldebug_info_end", ".Ldebug_info_begin", 0); /* length */
|
||||
emit_label (w, ".Ldebug_info_begin");
|
||||
emit_int16 (w, 0x2); /* DWARF version 2 */
|
||||
#if !defined(TARGET_MACH)
|
||||
emit_symbol (w, ".Ldebug_abbrev_start"); /* .debug_abbrev offset */
|
||||
#else
|
||||
emit_int32 (w, 0); /* .debug_abbrev offset */
|
||||
#endif
|
||||
emit_byte (w, sizeof (target_mgreg_t)); /* address size */
|
||||
|
||||
/* Compilation unit */
|
||||
|
||||
@@ -66,7 +66,7 @@ static LONG CALLBACK seh_unhandled_exception_filter(EXCEPTION_POINTERS* ep)
|
||||
#endif
|
||||
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", NULL, NULL);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL, NULL);
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
@@ -876,7 +876,7 @@ altstack_handle_and_restore (MonoContext *ctx, MonoObject *obj, guint32 flags)
|
||||
|
||||
if (!ji || (!stack_ovf && !nullref)) {
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", ctx, NULL);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), ctx, NULL, NULL);
|
||||
// if couldn't dump or if mono_handle_native_crash returns, abort
|
||||
abort ();
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s
|
||||
}
|
||||
if (!ji)
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", (MonoContext*)sigctx, siginfo);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), (MonoContext*)sigctx, siginfo, sigctx);
|
||||
/* setup a call frame on the real stack so that control is returned there
|
||||
* and exception handling can continue.
|
||||
* The frame looks like:
|
||||
|
||||
@@ -67,7 +67,7 @@ static LONG CALLBACK seh_unhandled_exception_filter(EXCEPTION_POINTERS* ep)
|
||||
}
|
||||
#endif
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", NULL, NULL);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL, NULL);
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s
|
||||
MonoContext mctx;
|
||||
mono_sigctx_to_monoctx (sigctx, &mctx);
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", &mctx, siginfo);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, siginfo, sigctx);
|
||||
else
|
||||
abort ();
|
||||
}
|
||||
|
||||
@@ -3557,4 +3557,29 @@ L3:
|
||||
IL_0024: ret
|
||||
}
|
||||
|
||||
.method public hidebysig static !!T createinstance_intrins_primitive<.ctor T>() cil managed noinlining
|
||||
{
|
||||
.maxstack 8
|
||||
call !!0 [mscorlib]System.Activator::CreateInstance<!!0>()
|
||||
ret
|
||||
}
|
||||
|
||||
.method public static int32 test_0_createinstance_intrins_primitive () cil managed
|
||||
{
|
||||
.maxstack 8
|
||||
call !!0 Tests::createinstance_intrins_primitive<bool>()
|
||||
ldc.i4.0
|
||||
beq L1
|
||||
ldc.i4.1
|
||||
ret
|
||||
L1:
|
||||
call !!0 Tests::createinstance_intrins_primitive<int64>()
|
||||
ldc.i8 0
|
||||
beq L2
|
||||
ldc.i4.2
|
||||
ret
|
||||
L2:
|
||||
ldc.i4.0
|
||||
ret
|
||||
}
|
||||
}
|
||||
@@ -410,11 +410,14 @@ create_reloc (MonoImageWriter *acfg, const char *end, const char* start, int off
|
||||
BinReloc *reloc;
|
||||
reloc = (BinReloc *)mono_mempool_alloc0 (acfg->mempool, sizeof (BinReloc));
|
||||
reloc->val1 = mono_mempool_strdup (acfg->mempool, end);
|
||||
if (strcmp (start, ".") == 0) {
|
||||
reloc->val2_section = acfg->cur_section;
|
||||
reloc->val2_offset = acfg->cur_section->cur_offset;
|
||||
} else {
|
||||
reloc->val2 = mono_mempool_strdup (acfg->mempool, start);
|
||||
if (start)
|
||||
{
|
||||
if (strcmp (start, ".") == 0) {
|
||||
reloc->val2_section = acfg->cur_section;
|
||||
reloc->val2_offset = acfg->cur_section->cur_offset;
|
||||
} else {
|
||||
reloc->val2 = mono_mempool_strdup (acfg->mempool, start);
|
||||
}
|
||||
}
|
||||
reloc->offset = offset;
|
||||
reloc->section = acfg->cur_section;
|
||||
@@ -424,6 +427,13 @@ create_reloc (MonoImageWriter *acfg, const char *end, const char* start, int off
|
||||
return reloc;
|
||||
}
|
||||
|
||||
static void
|
||||
bin_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
|
||||
{
|
||||
create_reloc (acfg, symbol, NULL, 0);
|
||||
acfg->cur_section->cur_offset += 4;
|
||||
}
|
||||
|
||||
static void
|
||||
bin_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
|
||||
{
|
||||
@@ -1924,6 +1934,23 @@ asm_writer_emit_int32 (MonoImageWriter *acfg, int value)
|
||||
fprintf (acfg->fp, "%d", value);
|
||||
}
|
||||
|
||||
static void
|
||||
asm_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
|
||||
{
|
||||
if (acfg->mode != EMIT_LONG) {
|
||||
acfg->mode = EMIT_LONG;
|
||||
acfg->col_count = 0;
|
||||
}
|
||||
|
||||
symbol = get_label (symbol);
|
||||
|
||||
if ((acfg->col_count++ % 8) == 0)
|
||||
fprintf (acfg->fp, "\n\t%s ", AS_INT32_DIRECTIVE);
|
||||
else
|
||||
fprintf (acfg->fp, ",");
|
||||
fprintf (acfg->fp, "%s", symbol);
|
||||
}
|
||||
|
||||
static void
|
||||
asm_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
|
||||
{
|
||||
@@ -2213,6 +2240,19 @@ mono_img_writer_emit_int32 (MonoImageWriter *acfg, int value)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_img_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
|
||||
{
|
||||
#ifdef USE_BIN_WRITER
|
||||
if (acfg->use_bin_writer)
|
||||
bin_writer_emit_symbol (acfg, symbol);
|
||||
else
|
||||
asm_writer_emit_symbol (acfg, symbol);
|
||||
#else
|
||||
asm_writer_emit_symbol (acfg, symbol);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_img_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
|
||||
{
|
||||
|
||||
@@ -98,6 +98,8 @@ void mono_img_writer_emit_int16 (MonoImageWriter *w, int value);
|
||||
|
||||
void mono_img_writer_emit_int32 (MonoImageWriter *w, int value);
|
||||
|
||||
void mono_img_writer_emit_symbol (MonoImageWriter *w, const char *symbol);
|
||||
|
||||
void mono_img_writer_emit_symbol_diff (MonoImageWriter *w, const char *end, const char* start, int offset);
|
||||
|
||||
void mono_img_writer_emit_zero_bytes (MonoImageWriter *w, int num);
|
||||
|
||||
@@ -1635,6 +1635,9 @@ interp_init_delegate (MonoDelegate *del, MonoError *error)
|
||||
if (del->interp_method) {
|
||||
/* Delegate created by a call to ves_icall_mono_delegate_ctor_interp () */
|
||||
del->method = ((InterpMethod *)del->interp_method)->method;
|
||||
} if (del->method_ptr && !del->method) {
|
||||
/* Delegate created from methodInfo.MethodHandle.GetFunctionPointer() */
|
||||
del->interp_method = (InterpMethod *)del->method_ptr;
|
||||
} else if (del->method) {
|
||||
/* Delegate created dynamically */
|
||||
del->interp_method = mono_interp_get_imethod (del->object.vtable->domain, del->method, error);
|
||||
|
||||
+13
-6
@@ -1867,13 +1867,20 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
|
||||
method_context->method_inst->type_argc == 1 &&
|
||||
cmethod->is_inflated &&
|
||||
!mini_method_check_context_used (cfg, cmethod)) {
|
||||
MonoClass *arg0 = mono_class_from_mono_type_internal (method_context->method_inst->type_argv [0]);
|
||||
MonoType *t = method_context->method_inst->type_argv [0];
|
||||
MonoClass *arg0 = mono_class_from_mono_type_internal (t);
|
||||
if (m_class_is_valuetype (arg0) && !mono_class_has_default_constructor (arg0, FALSE)) {
|
||||
MONO_INST_NEW (cfg, ins, MONO_CLASS_IS_SIMD (cfg, arg0) ? OP_XZERO : OP_VZERO);
|
||||
ins->dreg = mono_alloc_dreg (cfg, STACK_VTYPE);
|
||||
ins->type = STACK_VTYPE;
|
||||
ins->klass = arg0;
|
||||
MONO_ADD_INS (cfg->cbb, ins);
|
||||
if (m_class_is_primitive (arg0)) {
|
||||
int dreg = alloc_dreg (cfg, mini_type_to_stack_type (cfg, t));
|
||||
mini_emit_init_rvar (cfg, dreg, t);
|
||||
ins = cfg->cbb->last_ins;
|
||||
} else {
|
||||
MONO_INST_NEW (cfg, ins, MONO_CLASS_IS_SIMD (cfg, arg0) ? OP_XZERO : OP_VZERO);
|
||||
ins->dreg = mono_alloc_dreg (cfg, STACK_VTYPE);
|
||||
ins->type = STACK_VTYPE;
|
||||
ins->klass = arg0;
|
||||
MONO_ADD_INS (cfg->cbb, ins);
|
||||
}
|
||||
return ins;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1399,10 +1399,10 @@ type_from_stack_type (MonoInst *ins) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static G_GNUC_UNUSED int
|
||||
type_to_stack_type (MonoCompile *cfg, MonoType *t)
|
||||
MonoStackType
|
||||
mini_type_to_stack_type (MonoCompile *cfg, MonoType *t)
|
||||
{
|
||||
t = mono_type_get_underlying_type (t);
|
||||
t = mini_type_get_underlying_type (t);
|
||||
switch (t->type) {
|
||||
case MONO_TYPE_I1:
|
||||
case MONO_TYPE_U1:
|
||||
@@ -1426,7 +1426,7 @@ type_to_stack_type (MonoCompile *cfg, MonoType *t)
|
||||
case MONO_TYPE_U8:
|
||||
return STACK_I8;
|
||||
case MONO_TYPE_R4:
|
||||
return cfg->r4_stack_type;
|
||||
return (MonoStackType)cfg->r4_stack_type;
|
||||
case MONO_TYPE_R8:
|
||||
return STACK_R8;
|
||||
case MONO_TYPE_VALUETYPE:
|
||||
@@ -1442,7 +1442,7 @@ type_to_stack_type (MonoCompile *cfg, MonoType *t)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return -1;
|
||||
return (MonoStackType)-1;
|
||||
}
|
||||
|
||||
static MonoClass*
|
||||
@@ -4370,8 +4370,8 @@ check_inline_caller_method_name_limit (MonoMethod *caller_method)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
emit_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype)
|
||||
void
|
||||
mini_emit_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype)
|
||||
{
|
||||
static double r8_0 = 0.0;
|
||||
static float r4_0 = 0.0;
|
||||
@@ -4433,7 +4433,7 @@ emit_dummy_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype)
|
||||
} else if (((t == MONO_TYPE_VAR) || (t == MONO_TYPE_MVAR)) && mini_type_var_is_vt (rtype)) {
|
||||
MONO_EMIT_NEW_DUMMY_INIT (cfg, dreg, OP_DUMMY_VZERO);
|
||||
} else {
|
||||
emit_init_rvar (cfg, dreg, rtype);
|
||||
mini_emit_init_rvar (cfg, dreg, rtype);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4445,11 +4445,11 @@ emit_init_local (MonoCompile *cfg, int local, MonoType *type, gboolean init)
|
||||
if (COMPILE_SOFT_FLOAT (cfg)) {
|
||||
MonoInst *store;
|
||||
int reg = alloc_dreg (cfg, (MonoStackType)var->type);
|
||||
emit_init_rvar (cfg, reg, type);
|
||||
mini_emit_init_rvar (cfg, reg, type);
|
||||
EMIT_NEW_LOCSTORE (cfg, store, local, cfg->cbb->last_ins);
|
||||
} else {
|
||||
if (init)
|
||||
emit_init_rvar (cfg, var->dreg, type);
|
||||
mini_emit_init_rvar (cfg, var->dreg, type);
|
||||
else
|
||||
emit_dummy_init_rvar (cfg, var->dreg, type);
|
||||
}
|
||||
@@ -4639,7 +4639,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
|
||||
if (bb->last_ins && bb->last_ins->opcode == OP_NOT_REACHED) {
|
||||
cfg->cbb = bb;
|
||||
|
||||
emit_init_rvar (cfg, rvar->dreg, fsig->ret);
|
||||
mini_emit_init_rvar (cfg, rvar->dreg, fsig->ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4653,7 +4653,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
|
||||
* set, so set it to a dummy value.
|
||||
*/
|
||||
if (!ret_var_set)
|
||||
emit_init_rvar (cfg, rvar->dreg, fsig->ret);
|
||||
mini_emit_init_rvar (cfg, rvar->dreg, fsig->ret);
|
||||
|
||||
EMIT_NEW_TEMPLOAD (cfg, ins, rvar->inst_c0);
|
||||
*sp++ = ins;
|
||||
@@ -8738,7 +8738,7 @@ calli_end:
|
||||
} else {
|
||||
if (m_class_is_valuetype (cmethod->klass)) {
|
||||
iargs [0] = mono_compile_create_var (cfg, m_class_get_byval_arg (cmethod->klass), OP_LOCAL);
|
||||
emit_init_rvar (cfg, iargs [0]->dreg, m_class_get_byval_arg (cmethod->klass));
|
||||
mini_emit_init_rvar (cfg, iargs [0]->dreg, m_class_get_byval_arg (cmethod->klass));
|
||||
EMIT_NEW_TEMPLOADA (cfg, *sp, iargs [0]->inst_c0);
|
||||
|
||||
alloc = NULL;
|
||||
|
||||
+18
-19
@@ -1786,6 +1786,9 @@ mono_summarize_unmanaged_stack (MonoThreadSummary *out)
|
||||
|
||||
if (out->unmanaged_frames [i].str_descr [0] != '\0')
|
||||
out->unmanaged_frames [i].unmanaged_data.has_name = TRUE;
|
||||
|
||||
out->hashes.offset_free_hash = summarize_offset_free_hash (out->hashes.offset_free_hash, frame);
|
||||
out->hashes.offset_rich_hash = summarize_offset_rich_hash (out->hashes.offset_rich_hash, frame);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3363,7 +3366,6 @@ print_stack_frame_to_string (StackFrameInfo *frame, MonoContext *ctx, gpointer d
|
||||
}
|
||||
|
||||
#ifndef MONO_CROSS_COMPILE
|
||||
static gboolean handle_crash_loop = FALSE;
|
||||
|
||||
/*
|
||||
* mono_handle_native_crash:
|
||||
@@ -3372,30 +3374,30 @@ static gboolean handle_crash_loop = FALSE;
|
||||
* printing diagnostic information and aborting.
|
||||
*/
|
||||
void
|
||||
mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info)
|
||||
mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, void *context)
|
||||
{
|
||||
MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
|
||||
|
||||
if (handle_crash_loop)
|
||||
return;
|
||||
|
||||
#ifdef MONO_ARCH_USE_SIGACTION
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
|
||||
/* Remove our SIGABRT handler */
|
||||
/* Mono has crashed - remove our handlers except SIGTERM, which is used by crash reporting */
|
||||
/* TODO: Combine with mono_runtime_cleanup_handlers (but with an option to not de-allocate anything) */
|
||||
if (mini_debug_options.handle_sigint) {
|
||||
g_assert (sigaction (SIGINT, &sa, NULL) != -1);
|
||||
}
|
||||
|
||||
g_assert (sigaction (SIGABRT, &sa, NULL) != -1);
|
||||
|
||||
/* On some systems we get a SIGILL when calling abort (), because it might
|
||||
* fail to raise SIGABRT */
|
||||
g_assert (sigaction (SIGFPE, &sa, NULL) != -1);
|
||||
g_assert (sigaction (SIGSYS, &sa, NULL) != -1);
|
||||
g_assert (sigaction (SIGSEGV, &sa, NULL) != -1);
|
||||
g_assert (sigaction (SIGQUIT, &sa, NULL) != -1);
|
||||
g_assert (sigaction (SIGBUS, &sa, NULL) != -1);
|
||||
g_assert (sigaction (SIGILL, &sa, NULL) != -1);
|
||||
|
||||
/* Remove SIGCHLD, it uses the finalizer thread */
|
||||
g_assert (sigaction (SIGCHLD, &sa, NULL) != -1);
|
||||
|
||||
/* Remove SIGQUIT, we are already dumping threads */
|
||||
g_assert (sigaction (SIGQUIT, &sa, NULL) != -1);
|
||||
|
||||
#endif
|
||||
@@ -3408,11 +3410,8 @@ mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLE
|
||||
}
|
||||
}
|
||||
|
||||
/* prevent infinite loops in crash handling */
|
||||
handle_crash_loop = TRUE;
|
||||
|
||||
/*
|
||||
* A SIGSEGV indicates something went very wrong so we can no longer depend
|
||||
* A crash indicates something went very wrong so we can no longer depend
|
||||
* on anything working. So try to print out lots of diagnostics, starting
|
||||
* with ones which have a greater chance of working.
|
||||
*/
|
||||
@@ -3438,13 +3437,13 @@ mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLE
|
||||
g_async_safe_printf ("=================================================================\n");
|
||||
}
|
||||
|
||||
mono_post_native_crash_handler (signal, mctx, info, mono_do_crash_chaining);
|
||||
mono_post_native_crash_handler (signal, mctx, info, mono_do_crash_chaining, context);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info)
|
||||
mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, void *context)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@@ -1169,6 +1169,8 @@ get_wrapper_shared_vtype (MonoType *t)
|
||||
if ((mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT)
|
||||
return NULL;
|
||||
mono_class_setup_fields (klass);
|
||||
if (mono_class_has_failure (klass))
|
||||
return NULL;
|
||||
|
||||
int num_fields = mono_class_get_field_count (klass);
|
||||
MonoClassField *klass_fields = m_class_get_fields (klass);
|
||||
@@ -2261,7 +2263,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
|
||||
if (mono_class_field_is_special_static (field)) {
|
||||
gpointer addr;
|
||||
|
||||
mono_class_vtable_checked (domain, klass, error);
|
||||
mono_class_vtable_checked (domain, field->parent, error);
|
||||
mono_error_assert_ok (error);
|
||||
|
||||
/* Return the TLS offset */
|
||||
@@ -3894,12 +3896,15 @@ shared_gparam_equal (gconstpointer ka, gconstpointer kb)
|
||||
MonoType*
|
||||
mini_get_shared_gparam (MonoType *t, MonoType *constraint)
|
||||
{
|
||||
MonoImageSet *set;
|
||||
MonoGenericParam *par = t->data.generic_param;
|
||||
MonoGSharedGenericParam *copy, key;
|
||||
MonoType *res;
|
||||
MonoImage *image = NULL;
|
||||
char *name;
|
||||
|
||||
set = mono_metadata_merge_image_sets (mono_metadata_get_image_set_for_type (t), mono_metadata_get_image_set_for_type (constraint));
|
||||
|
||||
memset (&key, 0, sizeof (key));
|
||||
key.parent = par;
|
||||
key.param.gshared_constraint = constraint;
|
||||
@@ -3911,23 +3916,24 @@ mini_get_shared_gparam (MonoType *t, MonoType *constraint)
|
||||
* Need a cache to ensure the newly created gparam
|
||||
* is unique wrt T/CONSTRAINT.
|
||||
*/
|
||||
mono_image_lock (image);
|
||||
if (!image->gshared_types) {
|
||||
image->gshared_types_len = MONO_TYPE_INTERNAL;
|
||||
image->gshared_types = g_new0 (GHashTable*, image->gshared_types_len);
|
||||
mono_image_set_lock (set);
|
||||
if (!set->gshared_types) {
|
||||
set->gshared_types_len = MONO_TYPE_INTERNAL;
|
||||
set->gshared_types = g_new0 (GHashTable*, set->gshared_types_len);
|
||||
}
|
||||
if (!image->gshared_types [constraint->type])
|
||||
image->gshared_types [constraint->type] = g_hash_table_new (shared_gparam_hash, shared_gparam_equal);
|
||||
res = (MonoType *)g_hash_table_lookup (image->gshared_types [constraint->type], &key);
|
||||
mono_image_unlock (image);
|
||||
if (!set->gshared_types [constraint->type])
|
||||
set->gshared_types [constraint->type] = g_hash_table_new (shared_gparam_hash, shared_gparam_equal);
|
||||
res = (MonoType *)g_hash_table_lookup (set->gshared_types [constraint->type], &key);
|
||||
mono_image_set_unlock (set);
|
||||
if (res)
|
||||
return res;
|
||||
copy = (MonoGSharedGenericParam *)mono_image_alloc0 (image, sizeof (MonoGSharedGenericParam));
|
||||
copy = (MonoGSharedGenericParam *)mono_image_set_alloc0 (set, sizeof (MonoGSharedGenericParam));
|
||||
memcpy (©->param, par, sizeof (MonoGenericParamFull));
|
||||
copy->param.info.pklass = NULL;
|
||||
constraint = mono_metadata_type_dup (image, constraint);
|
||||
// FIXME:
|
||||
constraint = mono_metadata_type_dup (NULL, constraint);
|
||||
name = get_shared_gparam_name (constraint->type, ((MonoGenericParamFull*)copy)->info.name);
|
||||
copy->param.info.name = mono_image_strdup (image, name);
|
||||
copy->param.info.name = mono_image_set_strdup (set, name);
|
||||
g_free (name);
|
||||
|
||||
copy->param.owner = par->owner;
|
||||
@@ -3938,12 +3944,10 @@ mini_get_shared_gparam (MonoType *t, MonoType *constraint)
|
||||
res = mono_metadata_type_dup (NULL, t);
|
||||
res->data.generic_param = (MonoGenericParam*)copy;
|
||||
|
||||
if (image) {
|
||||
mono_image_lock (image);
|
||||
/* Duplicates are ok */
|
||||
g_hash_table_insert (image->gshared_types [constraint->type], copy, res);
|
||||
mono_image_unlock (image);
|
||||
}
|
||||
mono_image_set_lock (set);
|
||||
/* Duplicates are ok */
|
||||
g_hash_table_insert (set->gshared_types [constraint->type], copy, res);
|
||||
mono_image_set_unlock (set);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -10715,7 +10715,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
|
||||
* result to 0 (indicating success). */
|
||||
LLVMWriteBitcodeToFile (module->lmodule, filename);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
{
|
||||
char *verifier_err;
|
||||
|
||||
|
||||
+16
-6
@@ -231,7 +231,7 @@ MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler)
|
||||
return;
|
||||
mono_sigctx_to_monoctx (ctx, &mctx);
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGABRT", &mctx, info);
|
||||
mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info, ctx);
|
||||
else
|
||||
abort ();
|
||||
}
|
||||
@@ -240,6 +240,7 @@ MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler)
|
||||
MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler)
|
||||
{
|
||||
#ifndef DISABLE_CRASH_REPORTING
|
||||
MONO_SIG_HANDLER_INFO_TYPE *info = MONO_SIG_HANDLER_GET_INFO ();
|
||||
MONO_SIG_HANDLER_GET_CONTEXT;
|
||||
|
||||
// Note: this is only run from the non-controlling thread
|
||||
@@ -252,7 +253,7 @@ MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler)
|
||||
// running. Returns FALSE on unrecoverable error.
|
||||
if (mono_dump_start ()) {
|
||||
// Process was killed from outside since crash reporting wasn't running yet.
|
||||
mono_handle_native_crash ("SIGTERM", &mctx, NULL);
|
||||
mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, NULL, ctx);
|
||||
} else {
|
||||
// Crash reporting already running and we got a second SIGTERM from as part of thread-summarizing
|
||||
if (!mono_threads_summarize_execute (&mctx, &output, &hashes, FALSE, NULL, 0))
|
||||
@@ -437,6 +438,7 @@ mono_runtime_posix_install_handlers (void)
|
||||
|
||||
sigset_t signal_set;
|
||||
sigemptyset (&signal_set);
|
||||
mono_load_signames ();
|
||||
if (mini_debug_options.handle_sigint) {
|
||||
add_signal_handler (SIGINT, mono_sigint_signal_handler, SA_RESTART);
|
||||
sigaddset (&signal_set, SIGINT);
|
||||
@@ -446,7 +448,7 @@ mono_runtime_posix_install_handlers (void)
|
||||
sigaddset (&signal_set, SIGFPE);
|
||||
add_signal_handler (SIGQUIT, sigquit_signal_handler, SA_RESTART);
|
||||
sigaddset (&signal_set, SIGQUIT);
|
||||
add_signal_handler (SIGILL, mono_sigill_signal_handler, 0);
|
||||
add_signal_handler (SIGILL, mono_crashing_signal_handler, 0);
|
||||
sigaddset (&signal_set, SIGILL);
|
||||
add_signal_handler (SIGBUS, mono_sigsegv_signal_handler, 0);
|
||||
sigaddset (&signal_set, SIGBUS);
|
||||
@@ -454,6 +456,8 @@ mono_runtime_posix_install_handlers (void)
|
||||
add_signal_handler (SIGUSR2, sigusr2_signal_handler, SA_RESTART);
|
||||
sigaddset (&signal_set, SIGUSR2);
|
||||
}
|
||||
add_signal_handler (SIGSYS, mono_crashing_signal_handler, 0);
|
||||
sigaddset (&signal_set, SIGSYS);
|
||||
|
||||
/* it seems to have become a common bug for some programs that run as parents
|
||||
* of many processes to block signal delivery for real time signals.
|
||||
@@ -498,6 +502,7 @@ mono_runtime_cleanup_handlers (void)
|
||||
remove_signal_handler (SIGBUS);
|
||||
if (mono_jit_trace_calls != NULL)
|
||||
remove_signal_handler (SIGUSR2);
|
||||
remove_signal_handler (SIGSYS);
|
||||
|
||||
remove_signal_handler (SIGABRT);
|
||||
|
||||
@@ -1022,10 +1027,10 @@ dump_native_stacktrace (const char *signal, MonoContext *mctx)
|
||||
g_async_safe_printf ("=================================================================\n");
|
||||
|
||||
if (!leave) {
|
||||
mono_summarize_timeline_start ();
|
||||
mono_summarize_timeline_start (signal);
|
||||
mono_summarize_toggle_assertions (TRUE);
|
||||
|
||||
int mono_max_summary_len = 500000;
|
||||
int mono_max_summary_len = 10000000;
|
||||
int mono_state_tmp_file_tag = 1;
|
||||
mono_state_alloc_mem (&merp_mem, mono_state_tmp_file_tag, mono_max_summary_len * sizeof (gchar));
|
||||
|
||||
@@ -1153,7 +1158,7 @@ mono_dump_native_crash_info (const char *signal, MonoContext *mctx, MONO_SIG_HAN
|
||||
}
|
||||
|
||||
void
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining)
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context)
|
||||
{
|
||||
if (!crash_chaining) {
|
||||
/*Android abort is a fluke, it doesn't abort, it triggers another segv. */
|
||||
@@ -1163,6 +1168,11 @@ mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
mono_chain_signal (info->si_signo, info, context);
|
||||
|
||||
// we remove Mono's signal handlers from crashing signals in mono_handle_native_crash(), so re-raising will now allow the OS to handle the crash
|
||||
// TODO: perhaps we can always use this to abort, instead of explicit exit()/abort() as we do above
|
||||
raise (info->si_signo);
|
||||
}
|
||||
#endif /* !MONO_CROSS_COMPILE */
|
||||
|
||||
|
||||
+16
-25
@@ -2358,6 +2358,7 @@ lookup_start:
|
||||
g_assert (vtable);
|
||||
if (!mono_runtime_class_init_full (vtable, error))
|
||||
return NULL;
|
||||
MONO_PROFILER_RAISE (jit_done, (method, info));
|
||||
return mono_create_ftnptr (target_domain, info->code_start);
|
||||
}
|
||||
}
|
||||
@@ -3227,11 +3228,8 @@ MONO_SIG_HANDLER_FUNC (, mono_sigfpe_signal_handler)
|
||||
|
||||
mono_sigctx_to_monoctx (ctx, &mctx);
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGFPE", &mctx, info);
|
||||
if (mono_do_crash_chaining) {
|
||||
mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
|
||||
goto exit;
|
||||
}
|
||||
mono_handle_native_crash (mono_get_signame (SIGFPE), &mctx, info, ctx);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mono_arch_handle_exception (ctx, exc);
|
||||
@@ -3240,7 +3238,7 @@ exit:
|
||||
MONO_EXIT_GC_UNSAFE_UNBALANCED;
|
||||
}
|
||||
|
||||
MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler)
|
||||
MONO_SIG_HANDLER_FUNC (, mono_crashing_signal_handler)
|
||||
{
|
||||
MonoContext mctx;
|
||||
MONO_SIG_HANDLER_INFO_TYPE *info = MONO_SIG_HANDLER_GET_INFO ();
|
||||
@@ -3251,12 +3249,11 @@ MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler)
|
||||
|
||||
mono_sigctx_to_monoctx (ctx, &mctx);
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGILL", &mctx, info);
|
||||
if (mono_do_crash_chaining) {
|
||||
mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_SIG_INFO) && !defined(HOST_WIN32) // info is a siginfo_t
|
||||
mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info, ctx);
|
||||
#else
|
||||
mono_handle_native_crash (mono_get_signame (SIGTERM), &mctx, info, ctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(MONO_ARCH_USE_SIGACTION) || defined(HOST_WIN32)
|
||||
@@ -3326,6 +3323,9 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
mono_aot_handle_pagefault (info->si_addr);
|
||||
return;
|
||||
}
|
||||
int signo = info->si_signo;
|
||||
#else
|
||||
int signo = SIGSEGV;
|
||||
#endif
|
||||
|
||||
/* The thread might no be registered with the runtime */
|
||||
@@ -3333,11 +3333,7 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
if (!mono_do_crash_chaining && mono_chain_signal (MONO_SIG_HANDLER_PARAMS))
|
||||
return;
|
||||
if (mono_dump_start())
|
||||
mono_handle_native_crash ("SIGSEGV", &mctx, info);
|
||||
if (mono_do_crash_chaining) {
|
||||
mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
|
||||
return;
|
||||
}
|
||||
mono_handle_native_crash (mono_get_signame (signo), &mctx, info, ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3376,7 +3372,7 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
} else {
|
||||
// FIXME: This shouldn't run on the altstack
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", &mctx, info);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, info, ctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -3387,19 +3383,14 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
return;
|
||||
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info);
|
||||
|
||||
if (mono_do_crash_chaining) {
|
||||
mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
|
||||
return;
|
||||
}
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info, ctx);
|
||||
}
|
||||
|
||||
if (mono_is_addr_implicit_null_check (fault_addr)) {
|
||||
mono_arch_handle_exception (ctx, NULL);
|
||||
} else {
|
||||
if (mono_dump_start ())
|
||||
mono_handle_native_crash ("SIGSEGV", &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info);
|
||||
mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info, ctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ void
|
||||
mono_dump_native_crash_info (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info);
|
||||
|
||||
void
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining);
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context);
|
||||
|
||||
gboolean
|
||||
mono_is_addr_implicit_null_check (void *addr);
|
||||
@@ -571,7 +571,7 @@ mono_is_addr_implicit_null_check (void *addr);
|
||||
#endif
|
||||
|
||||
void MONO_SIG_HANDLER_SIGNATURE (mono_sigfpe_signal_handler) ;
|
||||
void MONO_SIG_HANDLER_SIGNATURE (mono_sigill_signal_handler) ;
|
||||
void MONO_SIG_HANDLER_SIGNATURE (mono_crashing_signal_handler) ;
|
||||
void MONO_SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler);
|
||||
void MONO_SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) ;
|
||||
gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal);
|
||||
|
||||
@@ -1142,7 +1142,7 @@ mono_delegate_trampoline (host_mgreg_t *regs, guint8 *code, gpointer *arg, guint
|
||||
}
|
||||
}
|
||||
|
||||
if (tramp_info->method == NULL && delegate->target != NULL && method->flags & METHOD_ATTRIBUTE_VIRTUAL) {
|
||||
if (delegate->method_ptr == NULL && tramp_info->method == NULL && delegate->target != NULL && method->flags & METHOD_ATTRIBUTE_VIRTUAL) {
|
||||
/* tramp_info->method == NULL happens when someone asks us to JIT some delegate's
|
||||
* Invoke method (see compile_special). In that case if method is virtual, the target
|
||||
* could be some derived class, so we need to find the correct override.
|
||||
@@ -1326,7 +1326,7 @@ mono_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, M
|
||||
guint32 len;
|
||||
|
||||
if (mono_aot_only)
|
||||
code = mono_aot_create_specific_trampoline (mono_defaults.corlib, arg1, tramp_type, domain, &len);
|
||||
code = mono_aot_create_specific_trampoline (arg1, tramp_type, domain, &len);
|
||||
else
|
||||
code = mono_arch_create_specific_trampoline (arg1, tramp_type, domain, &len);
|
||||
mono_lldb_save_specific_trampoline_info (arg1, tramp_type, domain, code, len);
|
||||
|
||||
@@ -153,7 +153,7 @@ tls_get_restore_state (void *tls)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_process_suspend (void *tls, MonoContext *ctx)
|
||||
try_process_suspend (void *tls, MonoContext *ctx, gboolean from_breakpoint)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ process_breakpoint_events (void *_evts, MonoMethod *method, MonoContext *ctx, in
|
||||
BpEvents *evts = (BpEvents*)_evts;
|
||||
if (evts) {
|
||||
if (evts->is_ss)
|
||||
mono_de_cancel_ss ();
|
||||
mono_de_cancel_all_ss ();
|
||||
mono_wasm_fire_bp ();
|
||||
g_free (evts);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ ss_args_destroy (SingleStepArgs *ss_args)
|
||||
|
||||
static int
|
||||
handle_multiple_ss_requests (void) {
|
||||
mono_de_cancel_ss ();
|
||||
mono_de_cancel_all_ss ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ mono_runtime_install_handlers (void)
|
||||
#ifndef MONO_CROSS_COMPILE
|
||||
win32_seh_init();
|
||||
win32_seh_set_handler(SIGFPE, mono_sigfpe_signal_handler);
|
||||
win32_seh_set_handler(SIGILL, mono_sigill_signal_handler);
|
||||
win32_seh_set_handler(SIGILL, mono_crashing_signal_handler);
|
||||
win32_seh_set_handler(SIGSEGV, mono_sigsegv_signal_handler);
|
||||
if (mini_debug_options.handle_sigint)
|
||||
win32_seh_set_handler(SIGINT, mono_sigint_signal_handler);
|
||||
@@ -281,7 +281,7 @@ mono_dump_native_crash_info (const char *signal, MonoContext *mctx, MONO_SIG_HAN
|
||||
}
|
||||
|
||||
void
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining)
|
||||
mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context)
|
||||
{
|
||||
if (!crash_chaining)
|
||||
abort ();
|
||||
|
||||
+3
-1
@@ -2098,6 +2098,7 @@ guint mono_type_to_load_membase (MonoCompile *cfg, MonoType *type);
|
||||
guint mono_type_to_store_membase (MonoCompile *cfg, MonoType *type);
|
||||
guint32 mono_type_to_stloc_coerce (MonoType *type);
|
||||
guint mini_type_to_stind (MonoCompile* cfg, MonoType *type);
|
||||
MonoStackType mini_type_to_stack_type (MonoCompile *cfg, MonoType *t);
|
||||
MonoJitInfo* mini_lookup_method (MonoDomain *domain, MonoMethod *method, MonoMethod *shared);
|
||||
guint32 mono_reverse_branch_op (guint32 opcode);
|
||||
void mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id);
|
||||
@@ -2241,6 +2242,7 @@ void mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset,
|
||||
void mini_emit_memset (MonoCompile *cfg, int destreg, int offset, int size, int val, int align);
|
||||
void mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native);
|
||||
void mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass);
|
||||
void mini_emit_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype);
|
||||
int mini_emit_sext_index_reg (MonoCompile *cfg, MonoInst *index);
|
||||
MonoInst* mini_emit_ldelema_1_ins (MonoCompile *cfg, MonoClass *klass, MonoInst *arr, MonoInst *index, gboolean bcheck);
|
||||
MonoInst* mini_emit_get_gsharedvt_info_klass (MonoCompile *cfg, MonoClass *klass, MonoRgctxInfoType rgctx_type);
|
||||
@@ -2501,7 +2503,7 @@ typedef gboolean (*MonoJitStackWalk) (StackFrameInfo *frame, MonoCont
|
||||
|
||||
void mono_exceptions_init (void);
|
||||
gboolean mono_handle_exception (MonoContext *ctx, gpointer obj);
|
||||
void mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo);
|
||||
void mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, void *context);
|
||||
MONO_API void mono_print_thread_dump (void *sigctx);
|
||||
MONO_API void mono_print_thread_dump_from_ctx (MonoContext *ctx);
|
||||
void mono_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data);
|
||||
|
||||
+4
-12
@@ -72,20 +72,12 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin
|
||||
guint8*
|
||||
mono_arch_get_call_target (guint8 *code)
|
||||
{
|
||||
guint32 imm;
|
||||
int disp;
|
||||
|
||||
code -= 4;
|
||||
|
||||
imm = *(guint32*)code;
|
||||
guint32 ins = *(guint32 *)code;
|
||||
/* Should be a b/bl */
|
||||
g_assert (((imm >> 26) & 0x7) == 0x5);
|
||||
|
||||
disp = (imm & 0x3ffffff);
|
||||
if ((disp >> 25) != 0)
|
||||
/* Negative, sing extend to 32 bits */
|
||||
disp = disp | 0xfc000000;
|
||||
|
||||
if (((ins >> 26) & 0x1f) != 0x5)
|
||||
return NULL;
|
||||
gint32 disp = ((gint32)((ins & 0x3ffffff) << 6)) >> 6;
|
||||
return code + (disp * 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -3730,6 +3730,8 @@ sgen_gc_init (void)
|
||||
} else if (!strcmp (opt, "nursery-canaries")) {
|
||||
do_verify_nursery = TRUE;
|
||||
enable_nursery_canaries = TRUE;
|
||||
/* If aot code is used, allocation from there won't expect the layout with canaries enabled */
|
||||
sgen_set_use_managed_allocator (FALSE);
|
||||
} else if (!sgen_client_handle_gc_debug (opt)) {
|
||||
sgen_env_var_error (MONO_GC_DEBUG_NAME, "Ignoring.", "Unknown option `%s`.", opt);
|
||||
|
||||
|
||||
@@ -386,6 +386,7 @@ TESTS_CS_SRC= \
|
||||
interface.cs \
|
||||
interface-2.cs \
|
||||
dim-generic.cs \
|
||||
dim-issue-18917.cs \
|
||||
iface.cs \
|
||||
iface2.cs \
|
||||
iface3.cs \
|
||||
@@ -689,6 +690,7 @@ TESTS_CS_SRC= \
|
||||
monitor.cs \
|
||||
generic-xdomain.2.cs \
|
||||
threadpool-exceptions7.cs \
|
||||
threadpool-exceptions8.cs \
|
||||
cross-domain.cs \
|
||||
generic-unloading.2.cs \
|
||||
namedmutex-destroy-race.cs \
|
||||
@@ -724,6 +726,7 @@ TESTS_CS_SRC= \
|
||||
bug-gh-9507.cs \
|
||||
async-generic-enum.cs \
|
||||
null-blob-main.cs \
|
||||
rgctx-thread-static.cs \
|
||||
last-error.cs
|
||||
|
||||
# some tests fail to compile on mcs
|
||||
@@ -1108,6 +1111,12 @@ PLATFORM_DISABLED_TESTS += bug-58782-plain-throw.exe bug-58782-capture-and-throw
|
||||
|
||||
# see https://github.com/mono/mono/issues/9739
|
||||
PLATFORM_DISABLED_TESTS += verbose.exe
|
||||
|
||||
if ENABLE_CXX
|
||||
# see https://github.com/mono/mono/issues/18827
|
||||
PLATFORM_DISABLED_TESTS += bug-10127.exe
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -1386,6 +1395,7 @@ PROFILE_DISABLED_TESTS += \
|
||||
monitor.exe \
|
||||
generic-xdomain.2.exe \
|
||||
threadpool-exceptions7.exe \
|
||||
threadpool-exceptions8.exe \
|
||||
cross-domain.exe \
|
||||
generic-unloading.2.exe \
|
||||
appdomain-threadpool-unload.exe
|
||||
@@ -1599,6 +1609,7 @@ PROFILE_DISABLED_TESTS += \
|
||||
suspend-stress-test.exe \
|
||||
thread6.exe \
|
||||
threadpool-exceptions7.exe \
|
||||
threadpool-exceptions8.exe \
|
||||
unhandled-exception-7.exe \
|
||||
unhandled-exception-test-case.2.exe \
|
||||
unload-appdomain-on-shutdown.exe \
|
||||
|
||||
+36
-23
@@ -1,6 +1,33 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
public enum WasCalled {
|
||||
BaseWasCalled,
|
||||
DerivedWasCalled
|
||||
}
|
||||
|
||||
public delegate WasCalled Del1 (string s);
|
||||
public delegate WasCalled Del2 (string s);
|
||||
|
||||
public class Base
|
||||
{
|
||||
public virtual WasCalled Foo (string s)
|
||||
{
|
||||
Console.WriteLine ("Base.Foo called. Expected {0}", s);
|
||||
return WasCalled.BaseWasCalled;
|
||||
}
|
||||
}
|
||||
|
||||
public class Derived : Base
|
||||
{
|
||||
public override WasCalled Foo (string s)
|
||||
{
|
||||
Console.WriteLine ("Derived.Foo called. Expected {0}", s);
|
||||
return WasCalled.DerivedWasCalled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal class Program
|
||||
{
|
||||
public static int Main (string[] args)
|
||||
@@ -14,29 +41,15 @@ internal class Program
|
||||
// newobj Del2::.ctor
|
||||
Del2 f = new Del2 (b.Invoke);
|
||||
// should call Derived.Foo not Base.Foo
|
||||
var r = f ("abcd");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate int Del1 (string s);
|
||||
public delegate int Del2 (string s);
|
||||
|
||||
public class Base
|
||||
{
|
||||
public virtual int Foo (string s)
|
||||
{
|
||||
Console.WriteLine ("Base.Foo called. Bad");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public class Derived : Base
|
||||
{
|
||||
public override int Foo (string s)
|
||||
{
|
||||
Console.WriteLine ("Derived.Foo called. Good");
|
||||
var r = f ("Derived.Foo");
|
||||
if (r != WasCalled.DerivedWasCalled)
|
||||
return 1;
|
||||
// should call Base.Foo not Derived.Foo
|
||||
var boundDelegate = (Del2)Activator.CreateInstance (typeof (Del2), b, typeof (Base).GetMethod (nameof (Base.Foo)).MethodHandle.GetFunctionPointer());
|
||||
r = boundDelegate ("Base.Foo");
|
||||
if (r != WasCalled.BaseWasCalled)
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
|
||||
public interface IInterface
|
||||
{
|
||||
int getRet() { return -10; }
|
||||
}
|
||||
|
||||
public interface IInterface2 : IInterface
|
||||
{
|
||||
int IInterface.getRet() { return -1; }
|
||||
}
|
||||
|
||||
|
||||
public class AbstractClass : IInterface2
|
||||
{
|
||||
int IInterface.getRet() { return 0; }
|
||||
}
|
||||
|
||||
|
||||
public class FinalClass : AbstractClass
|
||||
{
|
||||
}
|
||||
|
||||
public class Test
|
||||
{
|
||||
public static int test_0_dim_18917()
|
||||
{
|
||||
var var0 = new FinalClass();
|
||||
var var4 = (IInterface2)var0;
|
||||
var var5 = var4.getRet();
|
||||
return var5;
|
||||
|
||||
}
|
||||
|
||||
public static int Main (string[] args) {
|
||||
return TestDriver.RunTests (typeof (Test), args);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include "../utils/mono-errno.h"
|
||||
#include "../utils/mono-compiler.h"
|
||||
|
||||
@@ -8011,6 +8012,64 @@ mono_test_MerpCrashUnhandledExceptionHook (void)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalTerm (void)
|
||||
{
|
||||
raise (SIGTERM);
|
||||
}
|
||||
|
||||
// for the rest of the signal tests, we use SIGTERM as a fallback
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalAbrt (void)
|
||||
{
|
||||
#if defined (SIGABRT)
|
||||
raise (SIGABRT);
|
||||
#else
|
||||
raise (SIGTERM);
|
||||
#endif
|
||||
}
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalFpe (void)
|
||||
{
|
||||
#if defined (SIGFPE)
|
||||
raise (SIGFPE);
|
||||
#else
|
||||
raise (SIGTERM);
|
||||
#endif
|
||||
}
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalBus (void)
|
||||
{
|
||||
#if defined (SIGBUS)
|
||||
raise (SIGBUS);
|
||||
#else
|
||||
raise (SIGTERM);
|
||||
#endif
|
||||
}
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalSegv (void)
|
||||
{
|
||||
#if defined (SIGSEGV)
|
||||
raise (SIGSEGV);
|
||||
#else
|
||||
raise (SIGTERM);
|
||||
#endif
|
||||
}
|
||||
|
||||
LIBTEST_API void STDCALL
|
||||
mono_test_MerpCrashSignalIll (void)
|
||||
{
|
||||
#if defined (SIGILL)
|
||||
raise (SIGILL);
|
||||
#else
|
||||
raise (SIGTERM);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern C
|
||||
#endif
|
||||
+210
-25
@@ -11,15 +11,35 @@ class C
|
||||
{
|
||||
class CrasherClass
|
||||
{
|
||||
public static List<Tuple<String, Action>> Crashers;
|
||||
public struct Crasher {
|
||||
public string Name {get;}
|
||||
public Action Action {get; }
|
||||
|
||||
public Action<object> Validator {get; }
|
||||
|
||||
public Crasher (string name, Action action, Action<object> validator = null)
|
||||
{
|
||||
Name = name;
|
||||
Action = action;
|
||||
Validator = validator;
|
||||
}
|
||||
}
|
||||
|
||||
public class ValidationException : Exception {
|
||||
public ValidationException () : base () {}
|
||||
public ValidationException (string msg) : base (msg) {}
|
||||
public ValidationException (string msg, Exception inner) : base (msg, inner) {}
|
||||
}
|
||||
|
||||
public static List<Crasher> Crashers;
|
||||
public static int StresserIndex;
|
||||
|
||||
static CrasherClass ()
|
||||
{
|
||||
Crashers = new List<Tuple<String, Action>> ();
|
||||
Crashers = new List<Crasher> ();
|
||||
|
||||
// Basic functionality
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashManaged", MerpCrashManaged));
|
||||
Crashers.Add(new Crasher ("MerpCrashManaged", MerpCrashManaged));
|
||||
// Run this test for stress tests
|
||||
//
|
||||
// I've ran a burn-in with all of them of
|
||||
@@ -28,16 +48,24 @@ class C
|
||||
// Feel free to change by moving this line.
|
||||
StresserIndex = Crashers.Count - 1;
|
||||
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashMalloc", MerpCrashMalloc));
|
||||
Crashers.Add(new Crasher ("MerpCrashMalloc", MerpCrashMalloc));
|
||||
Crashers.Add(new Crasher ("MerpCrashFailFast", MerpCrashFailFast, ValidateFailFastMsg));
|
||||
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashNullFp", MerpCrashNullFp));
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashExceptionHook", MerpCrashUnhandledExceptionHook));
|
||||
Crashers.Add(new Crasher ("MerpCrashNullFp", MerpCrashNullFp));
|
||||
Crashers.Add(new Crasher ("MerpCrashExceptionHook", MerpCrashUnhandledExceptionHook));
|
||||
|
||||
// Specific Edge Cases
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashDladdr", MerpCrashDladdr));
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashSnprintf", MerpCrashSnprintf));
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashDomainUnload", MerpCrashDomainUnload));
|
||||
Crashers.Add(new Tuple<String, Action> ("MerpCrashUnbalancedGCSafe", MerpCrashUnbalancedGCSafe));
|
||||
Crashers.Add(new Crasher ("MerpCrashDladdr", MerpCrashDladdr));
|
||||
Crashers.Add(new Crasher ("MerpCrashSnprintf", MerpCrashSnprintf));
|
||||
Crashers.Add(new Crasher ("MerpCrashDomainUnload", MerpCrashDomainUnload));
|
||||
Crashers.Add(new Crasher ("MerpCrashUnbalancedGCSafe", MerpCrashUnbalancedGCSafe));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalTerm", MerpCrashSignalTerm));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalTerm", MerpCrashSignalAbrt));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalKill", MerpCrashSignalFpe));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalKill", MerpCrashSignalBus));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalSegv", MerpCrashSignalSegv));
|
||||
Crashers.Add(new Crasher ("MerpCrashSignalIll", MerpCrashSignalIll));
|
||||
Crashers.Add(new Crasher ("MerpCrashTestBreadcrumbs", MerpCrashTestBreadcrumbs, validator: ValidateBreadcrumbs));
|
||||
}
|
||||
|
||||
public static void
|
||||
@@ -46,6 +74,37 @@ class C
|
||||
unsafe { Console.WriteLine("{0}", *(int*) -1); }
|
||||
}
|
||||
|
||||
const string failfastMsg = "abcd efgh";
|
||||
|
||||
public static void
|
||||
MerpCrashFailFast ()
|
||||
{
|
||||
Environment.FailFast (failfastMsg);
|
||||
}
|
||||
|
||||
public static void ValidateFailFastMsg (object json)
|
||||
{
|
||||
string s = jsonGetKeys (json, "payload", "failfast_message") as string;
|
||||
if (s != failfastMsg)
|
||||
throw new ValidationException (String.Format ("incorrect fail fast message (expected: {0}, got: {1})", failfastMsg, s));
|
||||
}
|
||||
|
||||
public static void ValidateBreadcrumbs (object json)
|
||||
{
|
||||
var monoType = Type.GetType ("Mono.Runtime", false);
|
||||
var m = monoType.GetMethod ("CheckCrashReportReason", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
var m_params = new object [] { "./", false };
|
||||
string o = (string)m.Invoke(null, m_params);
|
||||
if (o != "segv")
|
||||
throw new Exception ("Crash report reason should be 'segv'");
|
||||
|
||||
m = monoType.GetMethod ("CheckCrashReportHash", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
long hash = (long)m.Invoke (null, m_params);
|
||||
|
||||
if (hash == 0)
|
||||
throw new Exception ("Crash hash should not be zero");
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSnprintf ();
|
||||
|
||||
@@ -113,6 +172,60 @@ class C
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashUnhandledExceptionHook ();
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalTerm ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalTerm ()
|
||||
{
|
||||
mono_test_MerpCrashSignalTerm ();
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalAbrt ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalAbrt ()
|
||||
{
|
||||
mono_test_MerpCrashSignalAbrt ();
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalFpe ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalFpe ()
|
||||
{
|
||||
mono_test_MerpCrashSignalFpe ();
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalBus ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalBus ()
|
||||
{
|
||||
mono_test_MerpCrashSignalBus ();
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalSegv ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalSegv ()
|
||||
{
|
||||
mono_test_MerpCrashSignalSegv ();
|
||||
}
|
||||
|
||||
[DllImport("libtest")]
|
||||
public static extern void mono_test_MerpCrashSignalIll ();
|
||||
|
||||
public static void
|
||||
MerpCrashSignalIll ()
|
||||
{
|
||||
mono_test_MerpCrashSignalIll ();
|
||||
}
|
||||
|
||||
public static void
|
||||
MerpCrashUnhandledExceptionHook ()
|
||||
{
|
||||
@@ -125,6 +238,26 @@ class C
|
||||
Console.WriteLine ("And now to crash inside the hook");
|
||||
mono_test_MerpCrashUnhandledExceptionHook ();
|
||||
}
|
||||
|
||||
public static void
|
||||
MerpCrashTestBreadcrumbs ()
|
||||
{
|
||||
mono_test_MerpCrashSignalSegv ();
|
||||
}
|
||||
|
||||
|
||||
private static object jsonGetKey (object o, string key) => (o as Dictionary<string,object>)[key];
|
||||
private static object jsonGetKeys (object o, params string[] keys) {
|
||||
try {
|
||||
foreach (var key in keys) {
|
||||
o = jsonGetKey (o, key);
|
||||
}
|
||||
return o;
|
||||
} catch (KeyNotFoundException e) {
|
||||
throw new ValidationException (String.Format ("{0}, key not found, looking for key path [{1}]", e.ToString(), String.Join (", ", keys)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static string configDir = "./merp-crash-test/";
|
||||
@@ -133,7 +266,7 @@ class C
|
||||
CrashWithMerp (int testNum)
|
||||
{
|
||||
SetupCrash (configDir);
|
||||
CrasherClass.Crashers [Convert.ToInt32 (testNum)].Item2 ();
|
||||
CrasherClass.Crashers [Convert.ToInt32 (testNum)].Action ();
|
||||
}
|
||||
|
||||
public static string env = Environment.GetEnvironmentVariable ("MONO_PATH");
|
||||
@@ -161,10 +294,8 @@ class C
|
||||
}
|
||||
|
||||
public static void
|
||||
TestValidate (string configDir, bool silent)
|
||||
TestValidate (string configDir, bool silent, Action<object> validator = null)
|
||||
{
|
||||
DumpLogCheck ();
|
||||
|
||||
var xmlFilePath = String.Format("{0}CustomLogsMetadata.xml", configDir);
|
||||
var paramsFilePath = String.Format("{0}MERP.uploadparams.txt", configDir);
|
||||
var crashFilePath = String.Format("{0}lastcrashlog.txt", configDir);
|
||||
@@ -204,8 +335,12 @@ class C
|
||||
Console.WriteLine("Validating: {0}", crashFile);
|
||||
try {
|
||||
var obj = checker.DeserializeObject (crashFile);
|
||||
if (validator is object)
|
||||
validator (obj);
|
||||
} catch (CrasherClass.ValidationException e) {
|
||||
throw new Exception (String.Format ("Validation failed '{0}', json: {1}", e.Message, crashFile));
|
||||
} catch (Exception e) {
|
||||
throw new Exception (String.Format ("Invalid json: {0}", crashFile));
|
||||
throw new Exception (String.Format ("Invalid json ({0}:{1}): {2}", e.GetType(), e.Message, crashFile));
|
||||
}
|
||||
|
||||
File.Delete (crashFilePath);
|
||||
@@ -214,6 +349,8 @@ class C
|
||||
Console.WriteLine ("Crash file {0} missing", crashFilePath);
|
||||
}
|
||||
|
||||
DumpLogCheck (expected_level: "MerpInvoke"); // we are expecting merp invoke to fail
|
||||
|
||||
if (!xmlFileExists)
|
||||
throw new Exception (String.Format ("Did not produce {0}", xmlFilePath));
|
||||
|
||||
@@ -244,7 +381,7 @@ class C
|
||||
convert.Invoke(null, new object[] { null });
|
||||
}
|
||||
|
||||
static void DumpLogCheck ()
|
||||
static void DumpLogCheck (string expected_level = "Done")
|
||||
{
|
||||
var monoType = Type.GetType ("Mono.Runtime", false);
|
||||
var convert = monoType.GetMethod("CheckCrashReportLog", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
@@ -252,11 +389,17 @@ class C
|
||||
// Value of enum
|
||||
string [] levels = new string [] { "None", "Setup", "SuspendHandshake", "UnmanagedStacks", "ManagedStacks", "StateWriter", "StateWriterDone", "MerpWriter", "MerpInvoke", "Cleanup", "Done", "DoubleFault" };
|
||||
|
||||
if ("MerpInvoke" == levels [result]) {
|
||||
Console.WriteLine ("Merp invoke command failed, expected failure?");
|
||||
} else if ("Done" != levels [result]) {
|
||||
throw new Exception (String.Format ("Crash level not done, failed in stage: {0}", levels [result]));
|
||||
}
|
||||
if (expected_level != levels [result])
|
||||
throw new Exception (String.Format ("Crash level {0} does not match expected {1}", levels [result], expected_level));
|
||||
|
||||
// also clear hash and reason breadcrumbs
|
||||
convert = monoType.GetMethod("CheckCrashReportHash", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
var hash_result = (long) convert.Invoke(null, new object[] { "./", true });
|
||||
convert = monoType.GetMethod("CheckCrashReportReason", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
var reason_result = (string) convert.Invoke(null, new object[] { "./", true });
|
||||
|
||||
if (reason_result == string.Empty)
|
||||
throw new Exception("Crash reason should not be an empty string");
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +414,7 @@ class C
|
||||
pi.Environment ["MONO_PATH"] = env;
|
||||
|
||||
if (!silent) {
|
||||
Console.WriteLine ("Running {0}", CrasherClass.Crashers [testNum].Item1);
|
||||
Console.WriteLine ("Running {0}", CrasherClass.Crashers [testNum].Name);
|
||||
Console.WriteLine ("MONO_PATH={0} {1} {2} {3}", env, runtime, asm, testNum);
|
||||
}
|
||||
|
||||
@@ -286,12 +429,46 @@ class C
|
||||
var process = Diag.Process.Start (pi);
|
||||
process.WaitForExit ();
|
||||
|
||||
TestValidate (configDir, silent);
|
||||
TestValidate (configDir, silent, CrasherClass.Crashers [testNum].Validator);
|
||||
} finally {
|
||||
Cleanup (configDir);
|
||||
}
|
||||
}
|
||||
|
||||
public static void TestManagedException ()
|
||||
{
|
||||
if (Directory.Exists (configDir)) {
|
||||
Console.WriteLine ("Cleaning up left over configDir {0}", configDir);
|
||||
Cleanup (configDir);
|
||||
}
|
||||
Directory.CreateDirectory (configDir);
|
||||
|
||||
SetupCrash (configDir);
|
||||
var monoType = Type.GetType ("Mono.Runtime", false);
|
||||
var m = monoType.GetMethod ("ExceptionToState", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
var exception = new Exception ("test managed exception");
|
||||
var m_params = new object[] { exception };
|
||||
|
||||
var result = m.Invoke (null, m_params) as Tuple<String, ulong, ulong>;
|
||||
DumpLogCheck (expected_level: "StateWriterDone");
|
||||
Cleanup (configDir);
|
||||
}
|
||||
|
||||
public static Exception RunManagedExceptionTest ()
|
||||
{
|
||||
Console.WriteLine ("Testing ExceptionToState()...");
|
||||
Exception exception_test_failure = null;
|
||||
|
||||
try {
|
||||
TestManagedException();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int Main (string [] args)
|
||||
{
|
||||
if (args.Length == 0) {
|
||||
@@ -316,20 +493,28 @@ class C
|
||||
}
|
||||
}
|
||||
|
||||
// Also test sending a managed exception
|
||||
Exception exception_test_failure = RunManagedExceptionTest ();
|
||||
|
||||
Console.WriteLine ("\n\n##################");
|
||||
Console.WriteLine ("Merp Test Results:");
|
||||
Console.WriteLine ("##################\n\n");
|
||||
|
||||
if (exception_test_failure != null)
|
||||
{
|
||||
Console.WriteLine ("Sending managed exception to MERP failed: {0}\n{1}\n", exception_test_failure.Message, exception_test_failure.StackTrace);
|
||||
}
|
||||
|
||||
if (failure_count > 0) {
|
||||
for (int i=0; i < CrasherClass.Crashers.Count; i++) {
|
||||
if (failures [i] != null) {
|
||||
Console.WriteLine ("Crash reporter failed test {0}", CrasherClass.Crashers [i].Item1);
|
||||
Console.WriteLine ("Crash reporter failed test {0}", CrasherClass.Crashers [i].Name);
|
||||
Console.WriteLine ("Cause: {0}\n{1}\n", failures [i].Message, failures [i].StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (failure_count > 0)
|
||||
if (failure_count > 0 || exception_test_failure != null)
|
||||
return 1;
|
||||
|
||||
Console.WriteLine ("\n\n##################");
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class TlsClass<T> {
|
||||
[ThreadStatic]
|
||||
public static string staticTls;
|
||||
}
|
||||
|
||||
public class AccessClass<T> {
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public string GetStatic ()
|
||||
{
|
||||
// Get field offset through rgctx_fetch of a class not yet initialized
|
||||
return TlsClass<T>.staticTls;
|
||||
}
|
||||
}
|
||||
|
||||
public class Program {
|
||||
|
||||
public static int Main (string[] args)
|
||||
{
|
||||
AccessClass<string> ac1 = new AccessClass<string> ();
|
||||
if (ac1.GetStatic () != null)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Tests {
|
||||
|
||||
public static int Main (string[] args) {
|
||||
runner ();
|
||||
return 63; // should not be reached
|
||||
}
|
||||
|
||||
public static void runner () {
|
||||
// need to run the test in a domain so that we can deal with unhandled exceptions
|
||||
var ad = AppDomain.CreateDomain ("Inner Domain");
|
||||
var helperType = typeof(TaskAwaiterOnCompletedHelper);
|
||||
var helper = (TaskAwaiterOnCompletedHelper)ad.CreateInstanceAndUnwrap (helperType.Assembly.ToString(), helperType.FullName);
|
||||
var holder = new ResultHolder ();
|
||||
helper.TheTest (holder);
|
||||
// HACK: If everything went well, a thread is running in the other domain and is blocked in OnUnhandled
|
||||
// waiting for AllDone(). Don't send it. Instead just exit without waiting. If we send AllDone, the
|
||||
// process will terminate with a 255. Don't try to unload the domain either, since the other thread
|
||||
// will never finish.
|
||||
//
|
||||
//helper.AllDone();
|
||||
//AppDomain.Unload (ad);
|
||||
Environment.Exit (holder.Result);
|
||||
}
|
||||
|
||||
public class ResultHolder : MarshalByRefObject {
|
||||
public ResultHolder () { }
|
||||
|
||||
public int Result { get; set; }
|
||||
}
|
||||
|
||||
public class TaskAwaiterOnCompletedHelper : MarshalByRefObject {
|
||||
|
||||
public class SpecialExn : Exception {
|
||||
public SpecialExn () : base () {}
|
||||
}
|
||||
|
||||
public void TheTest (ResultHolder holder)
|
||||
{
|
||||
this.holder = holder;
|
||||
holder.Result = TheRealTest ();
|
||||
}
|
||||
|
||||
ResultHolder holder;
|
||||
|
||||
public int TheRealTest ()
|
||||
{
|
||||
// Regression test for https://github.com/mono/mono/issues/19166
|
||||
//
|
||||
// Check that if in a call to
|
||||
// t.GetAwaiter().OnCompleted(cb) the callback cb
|
||||
// throws, that the exception's stack trace includes
|
||||
// the method that threw and not just the task
|
||||
// machinery's frames.
|
||||
|
||||
// Calling "WhenCompleted" will throw "SpecialExn"
|
||||
//
|
||||
// If "OnUhandled" is installed as an unhandled exception handler, it will
|
||||
// capture the stack trace of the SpecialExn and allow WaitForExn() to finish waiting.
|
||||
// The stack trace is expected to include ThrowerMethodInfo
|
||||
|
||||
var helper = this;
|
||||
var d = new UnhandledExceptionEventHandler (helper.OnUnhandled);
|
||||
AppDomain.CurrentDomain.UnhandledException += d;
|
||||
|
||||
// this is TaskToApm.Begin (..., callback) where the callback is helper.WhenCompleted
|
||||
Task.Delay (100).GetAwaiter().OnCompleted (helper.WhenCompleted);
|
||||
|
||||
var wasSet = helper.WaitForExn (10000); // wait upto 10 seconds for the task to throw
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException -= d;
|
||||
|
||||
if (!wasSet) {
|
||||
Console.WriteLine ("event not set, no exception thrown?");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
private ManualResetEventSlim coord;
|
||||
private ManualResetEventSlim coord2;
|
||||
|
||||
private StackFrame[] frames;
|
||||
|
||||
public TaskAwaiterOnCompletedHelper ()
|
||||
{
|
||||
coord = new ManualResetEventSlim ();
|
||||
coord2 = new ManualResetEventSlim ();
|
||||
}
|
||||
|
||||
public MethodBase ThrowerMethodInfo => typeof(TaskAwaiterOnCompletedHelper).GetMethod (nameof (WhenCompletedThrower));
|
||||
|
||||
[MethodImpl (MethodImplOptions.NoInlining)]
|
||||
public void WhenCompleted ()
|
||||
{
|
||||
WhenCompletedThrower ();
|
||||
}
|
||||
|
||||
[MethodImpl (MethodImplOptions.NoInlining)]
|
||||
public void WhenCompletedThrower ()
|
||||
{
|
||||
throw new SpecialExn ();
|
||||
}
|
||||
|
||||
public void OnUnhandled (object sender, UnhandledExceptionEventArgs args)
|
||||
{
|
||||
if (args.ExceptionObject is SpecialExn exn) {
|
||||
try {
|
||||
var trace = new StackTrace (exn);
|
||||
frames = trace.GetFrames ();
|
||||
if (frames == null) {
|
||||
holder.Result = 2;
|
||||
return;
|
||||
}
|
||||
Console.WriteLine ("got {0} frames ", frames.Length);
|
||||
bool found = false;
|
||||
foreach (var frame in frames) {
|
||||
if (frame.GetMethod ().Equals (ThrowerMethodInfo)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
Console.WriteLine ("expected to see {0} in stack trace, but it wasn't there", ThrowerMethodInfo.ToString());
|
||||
holder.Result = 3;
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
coord.Set ();
|
||||
|
||||
coord2.Wait ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StackFrame[] CapturedStackTraceFrames => frames;
|
||||
|
||||
|
||||
public bool WaitForExn (int timeoutMilliseconds)
|
||||
{
|
||||
return coord.Wait (timeoutMilliseconds);
|
||||
}
|
||||
|
||||
public void AllDone ()
|
||||
{
|
||||
coord2.Set ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
*.pyc
|
||||
@@ -1,5 +1,4 @@
|
||||
This is a tool to generate offsets file for use by the mono cross compilers.
|
||||
|
||||
It depends on python and libclang. The 'clang' directory contains the python bindings to libclang, they are taken from:
|
||||
https://github.com/llvm/llvm-project/commits/master/clang/bindings/python/clang
|
||||
rev 8a12e40185cd0ce7031e6abab4af12e6fc923110
|
||||
https://github.com/llvm/llvm-project/tree/8a12e40185cd0ce7031e6abab4af12e6fc923110/clang/bindings/python/clang
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -206,6 +206,7 @@ monoutils_sources = \
|
||||
bsearch.h \
|
||||
bsearch.c \
|
||||
mono-signal-handler.h \
|
||||
mono-signal-handler.c \
|
||||
mono-conc-hashtable.h \
|
||||
mono-conc-hashtable.c \
|
||||
json.h \
|
||||
|
||||
+19
-6
@@ -40,6 +40,7 @@
|
||||
#include <mono/utils/json.h>
|
||||
#include <mono/utils/mono-state.h>
|
||||
#include <utils/mono-threads-debug.h>
|
||||
#include <utils/mono-signal-handler.h>
|
||||
|
||||
static const char *
|
||||
kernel_version_string (void)
|
||||
@@ -144,7 +145,8 @@ typedef enum
|
||||
MERP_EXC_SIGFPE = 7 ,
|
||||
MERP_EXC_SIGTRAP = 8,
|
||||
MERP_EXC_SIGKILL = 9,
|
||||
MERP_EXC_HANG = 10
|
||||
MERP_EXC_HANG = 10,
|
||||
MERP_EXC_MANAGED_EXCEPTION = 11
|
||||
} MERPExcType;
|
||||
|
||||
typedef struct {
|
||||
@@ -261,6 +263,8 @@ get_merp_exctype (MERPExcType exc)
|
||||
return "0x04000000";
|
||||
case MERP_EXC_HANG:
|
||||
return "0x02000000";
|
||||
case MERP_EXC_MANAGED_EXCEPTION:
|
||||
return "0x05000000";
|
||||
case MERP_EXC_NONE:
|
||||
// Exception type documented as optional, not optional
|
||||
g_assert_not_reached ();
|
||||
@@ -272,23 +276,32 @@ get_merp_exctype (MERPExcType exc)
|
||||
static MERPExcType
|
||||
parse_exception_type (const char *signal)
|
||||
{
|
||||
if (!strcmp (signal, "SIGSEGV"))
|
||||
if (!strcmp (signal, mono_get_signame (SIGSEGV)))
|
||||
return MERP_EXC_SIGSEGV;
|
||||
|
||||
if (!strcmp (signal, "SIGFPE"))
|
||||
if (!strcmp (signal, mono_get_signame (SIGFPE)))
|
||||
return MERP_EXC_SIGFPE;
|
||||
|
||||
if (!strcmp (signal, "SIGILL"))
|
||||
if (!strcmp (signal, mono_get_signame (SIGILL)))
|
||||
return MERP_EXC_SIGILL;
|
||||
|
||||
if (!strcmp (signal, "SIGABRT"))
|
||||
if (!strcmp (signal, mono_get_signame (SIGABRT)))
|
||||
return MERP_EXC_SIGABRT;
|
||||
|
||||
if (!strcmp (signal, mono_get_signame (SIGTRAP)))
|
||||
return MERP_EXC_SIGTRAP;
|
||||
|
||||
if (!strcmp (signal, mono_get_signame (SIGSYS)))
|
||||
return MERP_EXC_SIGSYS;
|
||||
|
||||
// Force quit == hang?
|
||||
// We need a default for this
|
||||
if (!strcmp (signal, "SIGTERM"))
|
||||
if (!strcmp (signal, mono_get_signame (SIGTERM)))
|
||||
return MERP_EXC_HANG;
|
||||
|
||||
if (!strcmp (signal, "MANAGED_EXCEPTION"))
|
||||
return MERP_EXC_MANAGED_EXCEPTION;
|
||||
|
||||
// FIXME: There are no other such signal
|
||||
// strings passed to mono_handle_native_crash at the
|
||||
// time of writing this
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "config.h"
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include "mono/utils/mono-signal-handler.h"
|
||||
|
||||
struct mono_sigpair
|
||||
{
|
||||
int signo;
|
||||
const char* signame;
|
||||
};
|
||||
|
||||
#if !defined (HAVE_SYSSIGNAME)
|
||||
static struct mono_sigpair mono_signames[] =
|
||||
{
|
||||
{SIGABRT, "SIGABRT"},
|
||||
#if defined (SIGKILL)
|
||||
{SIGKILL, "SIGKILL"},
|
||||
#endif
|
||||
#if defined (SIGTRAP)
|
||||
{SIGTRAP, "SIGTRAP"},
|
||||
#endif
|
||||
#if defined (SIGSYS)
|
||||
{SIGSYS, "SIGSYS"},
|
||||
#endif
|
||||
{SIGSEGV, "SIGSEGV"},
|
||||
#if defined (SIGQUIT)
|
||||
{SIGQUIT, "SIGQUIT"},
|
||||
#endif
|
||||
{SIGFPE, "SIGFPE"},
|
||||
{SIGILL, "SIGILL"},
|
||||
#if defined (SIGBUS)
|
||||
{SIGBUS, "SIGBUS"} // How come this is seems not available on Android, but is used unconditionally in mini-posix.c:mono_runtime_posix_install_handlers ?
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct mono_sigpair *sigpair_buf;
|
||||
static int sigpair_buflen;
|
||||
|
||||
void
|
||||
mono_load_signames ()
|
||||
{
|
||||
if (sigpair_buf)
|
||||
return;
|
||||
#if defined (HAVE_SYSSIGNAME)
|
||||
sigpair_buflen = sizeof (sys_signame) / sizeof (sys_signame [0]);
|
||||
sigpair_buf = (struct mono_sigpair *) g_malloc (sigpair_buflen * sizeof (struct mono_sigpair));
|
||||
struct mono_sigpair *cur = sigpair_buf;
|
||||
for (int i = 0; i < sigpair_buflen; ++i)
|
||||
{
|
||||
cur->signo = i;
|
||||
cur->signame = sys_signame [i];
|
||||
cur++;
|
||||
}
|
||||
|
||||
#else
|
||||
sigpair_buflen = sizeof (mono_signames) / sizeof (mono_signames [0]);
|
||||
sigpair_buf = mono_signames;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
const char *
|
||||
mono_get_signame (int signo)
|
||||
{
|
||||
const char *result = "UNKNOWN";
|
||||
struct mono_sigpair *cur = sigpair_buf;
|
||||
for (int i = 0; i < sigpair_buflen; ++i)
|
||||
{
|
||||
if (cur->signo == signo)
|
||||
{
|
||||
result = cur->signame;
|
||||
break;
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user