Zoltan Varga [Sat, 3 Sep 2016 00:59:20 +0000 (02:59 +0200)]
[runtime] Fix a C&P problem introduced by
d4052c556399c2ef72c79088c05a8ad6913647a6.
Zoltan Varga [Sat, 27 Aug 2016 22:27:47 +0000 (00:27 +0200)]
[SRE] Remove empty TypeBuilder:setup_generic_class () icall.
Zoltan Varga [Sat, 27 Aug 2016 22:24:31 +0000 (00:24 +0200)]
[runtime] Remove the stub of ves_icall_TypeBuilder_create_internal_class ().
Zoltan Varga [Fri, 2 Sep 2016 19:30:05 +0000 (21:30 +0200)]
[corlib] Fix the signature of a few SRE icalls, they already receive a TypeBuilder as the 'this' argument.
Aleksey Kliger (λgeek) [Fri, 2 Sep 2016 14:31:42 +0000 (10:31 -0400)]
Merge pull request #3446 from lambdageek/bug-42584
[loader] Check for ReferenceAssemblyAttribute when loading
Marek Safar [Fri, 2 Sep 2016 14:21:25 +0000 (16:21 +0200)]
[mcs] Adjust correctly newline counter inside pragma warning
Marek Safar [Fri, 2 Sep 2016 13:37:56 +0000 (15:37 +0200)]
[corlib] Add timeout to failing test
Marek Safar [Fri, 2 Sep 2016 13:01:32 +0000 (15:01 +0200)]
Merge pull request #3506 from ntherning/make-ZoneTest-succeed-on-mono-on-windows
Make Zone.CreateFromUrl() work with URLs like file://C:\foo\bar
Marek Safar [Fri, 2 Sep 2016 09:25:15 +0000 (11:25 +0200)]
Merge pull request #3452 from ntherning/fix-AppDomainSetupTest-on-windows
Validate AppDomainSetup.ApplicationBase path more like .NET does
Marek Safar [Fri, 2 Sep 2016 09:01:17 +0000 (11:01 +0200)]
[System.Core] Allow TryConvert to return null for any reference types (not only object). Fixes #41509
Aleksey Kliger [Fri, 26 Aug 2016 18:10:25 +0000 (14:10 -0400)]
[runtime] Check for ReferenceAssemblyAttribute when loading for execution.
Aleksey Kliger [Thu, 25 Aug 2016 21:16:05 +0000 (17:16 -0400)]
[loader] Tests for RefereceAssemblyAttribute support
Aleksey Kliger [Tue, 23 Aug 2016 15:51:39 +0000 (11:51 -0400)]
[runtime] Add mono_assembly_get_reference_assembly_attribute
Checks whether the given assembly has the
System.Runtime.CompilerServices.ReferenceAssemblyAttribute applied.
Rodrigo Kumpera [Thu, 1 Sep 2016 21:49:32 +0000 (17:49 -0400)]
Merge pull request #3455 from kumpera/abort_cctor
[runtime] Don't abort .cctors. Fixes #43320
Ludovic Henry [Thu, 1 Sep 2016 19:22:51 +0000 (21:22 +0200)]
[mono-threads] Factor common platform create thread code (#3484)
Miguel de Icaza [Thu, 1 Sep 2016 16:58:48 +0000 (12:58 -0400)]
Bundle other options (#3501)
* [mkbundle] add support for baking environment variables, make endian-independent
* [runtime] Bundle support, implement missing stream processing
Alexander Köplinger [Thu, 1 Sep 2016 16:17:46 +0000 (18:17 +0200)]
Merge pull request #3498 from mattleibow/bug-41723
[Mono.Data.Sqlite] Added checks for entry point existence
Niklas Therning [Thu, 1 Sep 2016 14:43:50 +0000 (16:43 +0200)]
Make Zone.CreateFromUrl() work with URLs like file://C:\foo\bar
On Windows the test used URLs like `file://C:\tmp\foo` which the
Mono.Security.Uri class was incapable of parsing. System.Uri from
referencesource parses such URLs just fine. This patch fixes the Uri class to
be able to parse such URLs. It also changes the Zone class to not throw an
exception if the Zone.CreateFromUrl() method is passed an invalid URL. Instead
the zone is set to NoZone. This seems to be how Zone in .NET behaves.
Niklas Therning [Thu, 1 Sep 2016 14:41:58 +0000 (16:41 +0200)]
Merge pull request #3503 from ntherning/fix-MarshalTest.GetHINSTANCE-on-mono-windows
Ignore the MarshalTest.GetHINSTANCE() test on Mono on Windows
Niklas Therning [Thu, 1 Sep 2016 14:41:17 +0000 (16:41 +0200)]
Merge pull request #3504 from ntherning/fix-PropertyInfoTest.ConstantValue-fails-to-delete-locked-file-on-windows
PropertyInfoTest.ConstantValue() shouldn't fail if temp file cannot be deleted
Niklas Therning [Thu, 1 Sep 2016 14:30:40 +0000 (16:30 +0200)]
PropertyInfoTest.ConstantValue() shouldn't fail if temp file cannot be deleted
Happens when running this test on Windows. Just swallow the exception if the
File.Delete() fails.
Niklas Therning [Thu, 1 Sep 2016 14:25:01 +0000 (16:25 +0200)]
Ignore the MarshalTest.GetHINSTANCE() test on Mono on Windows
Won't work on Mono even when running on Windows.
Matthew Leibowitz [Thu, 1 Sep 2016 14:02:44 +0000 (16:02 +0200)]
[Mono.Data.Sqlite] Using the Version class to do the version comparison correctly
Miguel de Icaza [Thu, 1 Sep 2016 13:22:16 +0000 (09:22 -0400)]
Typo fix
Jo Shields [Thu, 1 Sep 2016 13:21:15 +0000 (14:21 +0100)]
Add a man page for cert-sync (#3424)
Zoltan Varga [Thu, 1 Sep 2016 11:34:00 +0000 (13:34 +0200)]
[runtime] Add a mono_threads_close_thread_handle () function and use it to close thread handles instead of CloseHandle (). (#3497)
Bernhard Urban [Thu, 1 Sep 2016 05:22:17 +0000 (07:22 +0200)]
Merge pull request #3492 from lewurm/fix-insert-insn
[mini] emit sequence point before branching off for tail call [was: respect seq points when adding instruction at end of block]
monojenkins [Thu, 1 Sep 2016 02:40:12 +0000 (03:40 +0100)]
Merge pull request #3499 from kumpera/fix_logging
[logging] Ensure glib logging redirection and remove unwanted new pub api functions.
Matthew Leibowitz [Thu, 1 Sep 2016 02:09:00 +0000 (04:09 +0200)]
[Mono.Data.Sqlite] Instead of try/catch and dlopen/dlsym, use a cross-platform, correct way of determining API features: version
Rodrigo Kumpera [Thu, 1 Sep 2016 00:49:48 +0000 (17:49 -0700)]
[threading] Update comments.
Rodrigo Kumpera [Wed, 31 Aug 2016 00:12:22 +0000 (17:12 -0700)]
[runtime] Introduce abort protected blocks. Use it within async invokes and unhandled exceptions.
There are a few places in the runtime that should not be aborted as it would render it unusable.
cctor execution was the initial trigger for this changeset, but then edge triggering of TAE turned out
to expose this issue on other places.
This patch introduces those regions and apply them to the following places:
ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke: Not delivering the completed CB
screws up any completion logic the user setup up.
mono_unhandled_exception: Protect delivery of the unhandled exception. Can't fail during it or we'll
effectively double fault and abort.
Rodrigo Kumpera [Thu, 25 Aug 2016 23:51:25 +0000 (16:51 -0700)]
[runtime] Add test for the interactions between thread abort and .cctors.
This covers bug #43320
Rodrigo Kumpera [Thu, 25 Aug 2016 23:39:50 +0000 (16:39 -0700)]
[runtime] Don't start aborting a thread if it's running any .cctor. Fixes #43320.
A thread abort must not start if the thread is running a .cctor.
OTOH, if the cctor self aborts, it should start.
Threads now track how many cctors they are running in the cctor_exec_depth variable.
The abort machinery (in async_abort_critical) checks that flag and bail from
starting the abort.
The cctor code (in mono_runtime_class_init_full) ensures that cctor_exec_depth is bumped
around execution of the cctor itself. Additionally, error handling was cleaned up as it was pretty
inconsistent.
Rodrigo Kumpera [Thu, 25 Aug 2016 23:37:36 +0000 (16:37 -0700)]
[runtime] Add mono_current_thread_has_handle_block_guard callback to the runtime EH callbacks.
This callback allows the runtime to query mini on whether there's a block guard in play.
It allows for the runtime to correctly decide when to start an abort.
Rodrigo Kumpera [Thu, 1 Sep 2016 00:37:35 +0000 (17:37 -0700)]
[logging] Ensure that glib logging goes through the new logging mechanics and that the domain prefix is preserved.
Call g_log_set_default_handler in mono_trace_set_log_handler and mono_trace_set_log_handler_internal to ensure that g_ logging is properly routed.
Additionally, change the internal logging callback to take the log message as a single string to simplify things.
Matthew Leibowitz [Wed, 31 Aug 2016 23:28:06 +0000 (01:28 +0200)]
[Mono.Data.Sqlite] Make the fields read-only
Matthew Leibowitz [Wed, 31 Aug 2016 23:25:04 +0000 (01:25 +0200)]
[Mono.Data.Sqlite] Added iOS specific checks for entry point existence:
- using dlfcn.dlsym to avoid P/Invoke exceptions
Rodrigo Kumpera [Wed, 31 Aug 2016 23:23:21 +0000 (16:23 -0700)]
[logging] Move internals that were landed in public headers by mistake.
Zoltan Varga [Wed, 31 Aug 2016 23:15:34 +0000 (01:15 +0200)]
[runtime] Fix a warning.
Alex Rønne Petersen [Wed, 31 Aug 2016 23:03:55 +0000 (01:03 +0200)]
[profiler] Fix some off-by-ones in header size calculation.
Alex Rønne Petersen [Wed, 31 Aug 2016 23:03:41 +0000 (01:03 +0200)]
Merge pull request #3493 from alexrp/master
Follow-up PR for #3481
Zoltan Varga [Wed, 31 Aug 2016 22:59:30 +0000 (00:59 +0200)]
[corlib] Disable CS0169 for RuntimeStructs.cs.
Zoltan Varga [Wed, 31 Aug 2016 22:56:52 +0000 (00:56 +0200)]
[llvm] Error out when using --aot=llvmonly in a runtime compiled without llvm.
Zoltan Varga [Wed, 31 Aug 2016 22:41:12 +0000 (00:41 +0200)]
[arm] Make mono_arch_get_call_target () work on direct branches too, previously it returned NULL, which broke the code in handle_thunk () for tail calls.
Alex Rønne Petersen [Wed, 31 Aug 2016 19:12:54 +0000 (21:12 +0200)]
[profiler] Include arguments, architecture, and OS in format header.
Bumped the major/minor version to 1.0 for this change.
Alex Rønne Petersen [Wed, 31 Aug 2016 19:12:16 +0000 (21:12 +0200)]
[profiler] Fix dump_header () to do fflush () in all non-gzip code paths.
Alex Rønne Petersen [Wed, 31 Aug 2016 19:09:56 +0000 (21:09 +0200)]
[runtime] Export API functions to get arch/os/wordsize strings.
Alex Rønne Petersen [Wed, 31 Aug 2016 17:39:00 +0000 (19:39 +0200)]
[profiler] Remove duplicate #include.
Alex Rønne Petersen [Wed, 31 Aug 2016 11:06:33 +0000 (13:06 +0200)]
[profiler] Update documentation for time fields.
Alex Rønne Petersen [Wed, 31 Aug 2016 08:26:34 +0000 (10:26 +0200)]
[profiler] Document the TYPE_EXCEPTION format.
Alex Rønne Petersen [Wed, 31 Aug 2016 08:11:09 +0000 (10:11 +0200)]
[profiler] Clean up some enums a bit. No format change.
Alex Rønne Petersen [Wed, 31 Aug 2016 07:49:19 +0000 (09:49 +0200)]
[profiler] Update documentation on the backtrace format.
Alex Rønne Petersen [Wed, 31 Aug 2016 07:39:42 +0000 (09:39 +0200)]
[profiler] Pump the hazard free queue when shutting down.
Alex Rønne Petersen [Wed, 31 Aug 2016 07:35:45 +0000 (09:35 +0200)]
[utils/hp] Export mono_thread_hazardous_try_free_all () for use in the profiler.
Alex Rønne Petersen [Wed, 31 Aug 2016 07:34:04 +0000 (09:34 +0200)]
[utils/hp] Keep pumping the free queue even when we encounter hazardous items.
Previously, a single item being hazardous for a while could completely block
pumping of the queue. This fixes that.
Zoltan Varga [Wed, 31 Aug 2016 22:25:21 +0000 (00:25 +0200)]
[runtime] Fix the method stored in the WrapperInfo for delegate-invoke wrappers for shared methods. Fixes #43696.
Bernhard Urban [Wed, 31 Aug 2016 20:36:19 +0000 (22:36 +0200)]
[mini] emit sequence point before branching off for tail call
Niklas Therning [Wed, 31 Aug 2016 20:08:29 +0000 (22:08 +0200)]
Merge pull request #3473 from ntherning/fix-thread-double-close-handle-on-appdomain-unload
Fix for double CloseHandle() on AppDomain unload
Niklas Therning [Wed, 31 Aug 2016 18:22:13 +0000 (20:22 +0200)]
Merge pull request #3496 from ntherning/fix-heap-corruption-on-windows
Fixes two heap corruptions in the corlib tests on Windows
Aleksey Kliger (λgeek) [Wed, 31 Aug 2016 17:23:52 +0000 (13:23 -0400)]
Merge pull request #3395 from lambdageek/dev/handles-strings
[runtime] Use coop handles in some String-returning icalls
Niklas Therning [Wed, 31 Aug 2016 16:40:41 +0000 (18:40 +0200)]
Fixes two heap corruptions in the corlib tests on Windows
The patch of mono/metadata/marshal.c makes sure that
Marshal.StringToHGlobalAnsi() allocates a memory area for the returned C
string which is at least as large as the length of the string object. This is
the behavior on non-Windows platforms. Without this patch the
MarshalTest.StringToHGlobalAnsiWithNullValues() test wrote outside of a memory
area and corrupted the heap which later on caused a heap corruption crash when
running the corlib test suite on Windows.
The patch of mono/metadata/mono-security.c fixes the freeing of the memory
returned by GetNamedSecurityInfoW(). When GetNamedSecurityInfoW() is used to
request a DACL one must also pass an argument for the ppSecurityDescriptor
parameter and this is the one that should be freed later on, not the pointer
to the DACL as the original code used to free. Before this patch
DSACryptoServiceProviderTest.UseMachineKeyStore() crashed because of a heap
corruption.
Marek Safar [Wed, 31 Aug 2016 14:10:56 +0000 (16:10 +0200)]
Bump cecil
Alexander Köplinger [Wed, 31 Aug 2016 11:52:49 +0000 (13:52 +0200)]
Merge pull request #3494 from akoeplinger/netstd-fixes
Expose a few more types/methods for netstandard
Alexander Köplinger [Wed, 31 Aug 2016 11:33:53 +0000 (13:33 +0200)]
[corlib] Add Environment APIs that take EnvironmentVariableTarget on mobile
We only do something when target is "Process", this matches CoreFX behavior.
Alexander Köplinger [Wed, 31 Aug 2016 11:15:14 +0000 (13:15 +0200)]
[System.Core] Add a couple of System.IO.Pipes classes to the mobile profiles
These are required for netstandard parity.
Marek Safar [Wed, 31 Aug 2016 10:11:30 +0000 (12:11 +0200)]
[System] HttpWebRequest::Headers setter was only setting local variable. Fixes #42408
Bernhard Urban [Wed, 31 Aug 2016 09:45:58 +0000 (11:45 +0200)]
Merge pull request #3470 from lewurm/fix-aot-compiler-toolchain-ld-invoke
[aot] fix linker invocation
Marek Safar [Wed, 31 Aug 2016 05:57:02 +0000 (07:57 +0200)]
Merge pull request #3487 from marek-safar/rs-Threading
[corlib] Flow CultureInfo from parent thread. Fixes #43193
Marek Safar [Wed, 31 Aug 2016 05:52:38 +0000 (07:52 +0200)]
Merge pull request #3489 from akoeplinger/fix-latin1-surrogatepair
[corlib] Fix replacement of UTF-16 surrogate pairs in Latin1Encoding
Zoltan Varga [Wed, 31 Aug 2016 00:56:54 +0000 (02:56 +0200)]
Only set the attached flag when a client attaches (#3490)
In defer mode, the debugger thread is started as soon as possible before
any clients are attached, but the debugger is_attached flag was being set
immediately. This would cause the runtime (and the System.Diagnostics.Debugger
class) to wrongly report a client as being attached.
Originally fixed in the Unity fork here: https://github.com/Unity-Technologies/mono/commit/
797a210e0f2416d779c448bb9e03bb16933e261f
Josh Peterson [Tue, 30 Aug 2016 15:00:32 +0000 (11:00 -0400)]
Only set the attached flag when a client attaches
In defer mode, the debugger thread is started as soon as possible before
any clients are attached, but the debugger is_attached flag was being set
immediately. This would cause the runtime (and the System.Diagnostics.Debugger
class) to wrongly report a client as being attached.
Originally fixed in the Unity fork here: https://github.com/Unity-Technologies/mono/commit/
797a210e0f2416d779c448bb9e03bb16933e261f
Rodrigo Kumpera [Tue, 30 Aug 2016 22:44:20 +0000 (15:44 -0700)]
Merge pull request #3488 from Unity-Technologies/threadpool-unhandled-exception-policy-legacy
Always clear thread abort exception for internal/threadpool threads
Alex Rønne Petersen [Tue, 30 Aug 2016 22:23:43 +0000 (00:23 +0200)]
Merge pull request #3481 from alexrp/master
Even more profiler fixes/improvements
Alex Rønne Petersen [Tue, 30 Aug 2016 19:47:14 +0000 (21:47 +0200)]
Merge pull request #3464 from alexrp/arm64-native-atomics
[runtime] Fix C and LLVM atomics on ARM64
Alex Rønne Petersen [Sun, 28 Aug 2016 15:12:19 +0000 (17:12 +0200)]
[utils] Remove ia64-specific atomics/membar code.
All ia64 compilers have intrinsics that we use. Also, this ia64 code was very
out of date (missing many functions we use now) so it wouldn't compile anyway.
Alex Rønne Petersen [Sun, 28 Aug 2016 14:52:21 +0000 (16:52 +0200)]
[llvm] Fix atomic opcodes on ARM64 to emit correct fences.
This is a workaround. It's needed for the same reason that we need the fix for
Clang's atomic intrinsics in mono/utils/atomic.h.
Alex Rønne Petersen [Sun, 28 Aug 2016 12:50:38 +0000 (14:50 +0200)]
[utils/atomic] Fix native atomic intrinsics on buggy ARM64 compilers.
See the comment in atomic.h for details.
Alex Rønne Petersen [Sun, 28 Aug 2016 12:50:09 +0000 (14:50 +0200)]
[utils] Add a MONO_GNUC_VERSION macro.
Marek Safar [Tue, 30 Aug 2016 15:00:35 +0000 (17:00 +0200)]
[corlib] Flow CultureInfo from parent thread. Fixes #43193
Alexander Köplinger [Tue, 30 Aug 2016 18:25:37 +0000 (20:25 +0200)]
[corlib] Fix replacement of UTF-16 surrogate pairs in Latin1Encoding
When encoding a UTF-16 C# string into bytes using "latin-1"/"iso-8859-1" encoding we were
not properly taking surrogate pairs into account. MSDN[1] provides a good introduction about the topic.
For example, this string would fail to encode and throw an IndexOutOfRangeException: "\ud83d\ude0a "
However, this string would not: "\ud83d\ude0a" (note missing space at the end). More on that later.
In https://bugzilla.xamarin.com/show_bug.cgi?id=42887 it was noted that encoding the string
didn't cause the exception on Mono 2.10.8.1 and 3.2.8. Indeed, it doesn't happen until Mono 4.0
where we switched most of the string code to referencesources.
While looking at the output of `Encoding.GetEncoding("latin1").GetBytes("\ud83d\ude0a ")` on the
"working" Mono verions I noticed that they essentially returned wrong results, e.g.:
```
csharp> Encoding.GetEncoding("latin1").GetBytes("\ud83d\ude0a ")
{ 63, 32, 0 }
```
This is wrong, because a) there's only one 63 (i.e. the '?' question mark char which is used as
a replacement char whenever the target encoding doesn't support a specific char,
and b) there is a trailing '\0' which should not be there.
Checking on .NET confirms the expected result: { 63, 63, 32 } i.e. '?? '
Back to the IndexOutOfRangeException in Mono 4.0+: digging into Latin1Encoding.InternalGetBytes() it
turns out that when we detect a surrogate pair we were incrementing charIndex, but we didn't decrement count.
This means that after the fallback characters (the two '?') were added we would still try to encode one more
char in the loop even though we're already at the end of the string, resulting in the exception.
For the "\ud83d\ude0a" example we would not hit the `count > 1` code path which made it work in this case.
Adding the decrement fixes the bug and makes the code consistent with MonoEncoding.cs[2].
The reason why it "worked" in earlier Mono versions was that we had a very simple EncoderReplacementFallbackBuffer
implementation[3] which only output a single '?' for the surrogate pair:
```
csharp> var buf = Encoding.GetEncoding("latin1").EncoderFallback.CreateFallbackBuffer()
csharp> buf.Fallback((char)0xD800, (char)0xDC00, 0)
true
csharp> buf.GetNextChar()
'?'
csharp> buf.GetNextChar()
'\x0
csharp> buf.Fallback((char)0xD800, (char)0xDC00, 0)
true
csharp> buf.GetNextChar()
'?'
csharp> buf.GetNextChar()
'?'
csharp> buf.GetNextChar()
'\x0'
```
This means that for the "\ud83d\ude0a " example from above we would only add one '?' character
for the surrogate pair to the result buffer, then the space and then we'd be done, leaving the
uninitialized array value 0 in the buffer on index 2.
I added tests for Latin1Encoding, mostly copied from ASCIIEncoding with additions for these
specific cases.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=42887
[1] https://msdn.microsoft.com/en-us/library/ms404377(v=vs.110).aspx
[2] https://github.com/mono/mono/blob/
5b69e839e12b3d3512f310aa5a0e873346d7e50e/mcs/class/I18N/Common/MonoEncoding.cs#L62-L66
[3] https://github.com/mono/mono/blob/mono-3.12.0-branch/mcs/class/corlib/System.Text/EncoderReplacementFallbackBuffer.cs
Marek Safar [Tue, 30 Aug 2016 17:05:29 +0000 (19:05 +0200)]
Merge pull request #3477 from Unity-Technologies/create-delegate-exception
Throw an ArgumentException when a delegate is bound to an open generi…
Jonathan Chambers [Tue, 30 Aug 2016 15:32:53 +0000 (11:32 -0400)]
Reset thread abort exception for internal threads regardless of unhandled exception policy.
Josh Peterson [Tue, 30 Aug 2016 14:46:02 +0000 (10:46 -0400)]
Make improvments after code review:
* Use mono_set_pending_exception instead of mono_raise_exception
* Make the test an nunit test instead of a runtime test.
Ludovic Henry [Tue, 30 Aug 2016 10:45:53 +0000 (12:45 +0200)]
[mono-threads] Use create_suspended_sem on windows (#3482)
Marek Safar [Tue, 30 Aug 2016 09:02:43 +0000 (11:02 +0200)]
Merge pull request #3483 from alexavator/bugfix-keepalive
[System] Set KeepAlive flag for HttpWebRequest
Pozdeev [Tue, 30 Aug 2016 08:36:21 +0000 (13:36 +0500)]
[System] Set KeepAlive flag for HttpWebRequest
Ludovic Henry [Tue, 30 Aug 2016 08:24:12 +0000 (10:24 +0200)]
[pedump] Fix assertion error
We would previously observe the following crash:
```
ludovic-laptop :: ~/Xamarin/mono ‹
16c07b5› » (cd tools/pedump && MONO_PATH=../../mcs/class/lib/net_4_x lldb -- ./pedump --verify metadata,code ../.././mono/tests/xdomain-threads.exe)
(lldb) target create "./pedump"
Current executable set to './pedump' (x86_64).
(lldb) settings set -- target.run-args "--verify" "metadata,code" "../.././mono/tests/xdomain-threads.exe"
(lldb) r
Process 14407 launched: './pedump' (x86_64)
mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
Process 14407 stopped
* thread #1: tid = 0x27c9715, 0x00007fff93cfcf06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff93cfcf06 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff93cfcf06 <+10>: jae 0x7fff93cfcf10 ; <+20>
0x7fff93cfcf08 <+12>: movq %rax, %rdi
0x7fff93cfcf0b <+15>: jmp 0x7fff93cf77cd ; cerror_nocancel
0x7fff93cfcf10 <+20>: retq
(lldb) bt
* thread #1: tid = 0x27c9715, 0x00007fff93cfcf06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fff93cfcf06 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff8b9b74ec libsystem_pthread.dylib`pthread_kill + 90
frame #2: 0x00007fff908d56e7 libsystem_c.dylib`abort + 129
frame #3: 0x000000010022da6a pedump`monoeg_log_default_handler(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, message="mono_os_mutex_lock: pthread_mutex_lock failed with \"Invalid argument\" (22)", unused_data=0x0000000000000000) + 202 at goutput.c:231
frame #4: 0x000000010022d98d pedump`monoeg_g_logv(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="%s: pthread_mutex_lock failed with \"%s\" (%d)", args=0x00007fff5fbff4a0) + 109 at goutput.c:111
frame #5: 0x000000010022dbd9 pedump`monoeg_g_log(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="%s: pthread_mutex_lock failed with \"%s\" (%d)") + 361 at goutput.c:121
frame #6: 0x000000010022301e pedump`mono_os_mutex_lock(mutex=0x00000001002ec630) + 110 at mono-os-mutex.h:98
frame #7: 0x0000000100223a66 pedump`mono_w32handle_new(type=MONO_W32HANDLE_PROCESS, handle_specific=0x00007fff5fbff540) + 246 at w32handle.c:440
frame #8: 0x00000001001ef8bb pedump`_wapi_processes_init + 123 at processes.c:1149
frame #9: 0x00000001001fbcc3 pedump`wapi_init + 19 at wapi.c:23
frame #10: 0x0000000100116486 pedump`mono_init_internal(filename="pedump", exe_filename=0x0000000000000000, runtime_version="v4.0.30319") + 102 at domain.c:528
frame #11: 0x0000000100117124 pedump`mono_init_version(domain_name="pedump", version="v4.0.30319") + 36 at domain.c:868
frame #12: 0x0000000100001496 pedump`verify_image_file(fname="../.././mono/tests/xdomain-threads.exe") + 678 at pedump.c:466
frame #13: 0x0000000100000f87 pedump`main(argc=4, argv=0x00007fff5fbff9a0) + 1095 at pedump.c:708
frame #14: 0x00007fff93e655ad libdyld.dylib`start + 1
```
That would be because the w32handle wouldn't be initialized before calling into `wapi_init` which allocates w32handle.
Ludovic Henry [Tue, 30 Aug 2016 08:04:32 +0000 (10:04 +0200)]
Merge pull request #3476 from lambdageek/fix-conc-ht
[test-conc-hashtable] Init w32 handles. Fixes OSX+coop.
Alex Rønne Petersen [Sun, 28 Aug 2016 18:25:10 +0000 (20:25 +0200)]
[profiler] Reject heapshot requests if we're not in on-demand mode.
Previously, we would try to satisfy the heapshot request every single time
process_requests () was invoked, but since heap_walk () would never unset
heapshot_requested, we'd end up doing GCs over and over, causing massive
overhead.
Alex Rønne Petersen [Tue, 30 Aug 2016 07:59:17 +0000 (09:59 +0200)]
[profiler] Process on-demand heapshot requests on the finalizer thread.
This way, we avoid attempting to fully attached the helper thread when it's
already a tools thread, which can lead to all sorts of problems.
Alex Rønne Petersen [Tue, 30 Aug 2016 07:57:14 +0000 (09:57 +0200)]
[profiler] Add GC finalization events to the format.
Alex Rønne Petersen [Sun, 28 Aug 2016 17:41:18 +0000 (19:41 +0200)]
[gc] Expose mono_gc_pending_finalizers () and mono_gc_finalize_notify () as public API.
We need these in the profiler, but they are also generally useful functions
that embedders may very well want to use.
Alex Rønne Petersen [Sun, 28 Aug 2016 17:22:22 +0000 (19:22 +0200)]
[profiler] Add GC finalization callbacks to the profiler API.
Alex Rønne Petersen [Sun, 28 Aug 2016 18:38:51 +0000 (20:38 +0200)]
[profiler] Initialize counters in the runtime_initialized () callback.
This way, we don't have to depend on the counters subsystem having been
initialized when the profiler library is loaded (very early).
Alex Rønne Petersen [Tue, 30 Aug 2016 06:32:50 +0000 (08:32 +0200)]
[profiler] Normalize time fields in the format.
All events now come with a time field right after the event byte, and it is
encoded in the same way for all events (based on LogBuffer.time_base).
This allows readers to queue up events until a sync point event, then sort all
of those events by time, and process them in the order they were actually
written in.
Alex Rønne Petersen [Sun, 28 Aug 2016 10:36:40 +0000 (12:36 +0200)]
[profiler] Make the comment in proflog.c only represent the latest version of the format.
Maintaining it for every format version is getting unwieldy and most readers
likely won't care about ancient format versions. Further, we haven't really
stabilized the format yet, so documenting every iteration of it doesn't make
a whole lot of sense. Finally, if somebody does care about older versions,
they can simply look in decode.c to see how mprof-report deals with them.
Alex Rønne Petersen [Sun, 28 Aug 2016 09:13:08 +0000 (11:13 +0200)]
[profiler] Fix a few format bloat and encoding issues since we're bumping the format version.
* Methods in backtraces are now properly encoded based on the method_base
rather than the ptr_base.
* The unused IL and native offset fields in TYPE_SAMPLE_HIT's backtrace frame
format have been removed.
* The unused flags fields in the backtrace format and in metadata events have
been removed.
* Changed a number of fields to be encoded as a single byte instead of LEB128.
Alex Rønne Petersen [Wed, 17 Aug 2016 05:50:24 +0000 (07:50 +0200)]
[profiler] Emit sync point events when flushing all buffers.
These events basically establish points in the event stream where all previous
events can be processed and a complete view of the profiling state can be
formed. For instance, if an allocation event for object A of type T was seen
before a sync point, then it's guaranteed that the class load event for T also
came before that sync point (although it may have arrived after the allocation
event for A).
Alex Rønne Petersen [Wed, 17 Aug 2016 05:01:25 +0000 (07:01 +0200)]
[profiler] Acquire the exclusive buffer lock after the suspend lock.
This prevents possible STW deadlocks.
Alex Rønne Petersen [Wed, 3 Aug 2016 12:28:43 +0000 (14:28 +0200)]
[profiler] Only flush buffers when they exceed the base capacity.
Other than timely arrival, there was never really a need to force buffers to be
flushed at these arbitrary points. Now that we flush all buffers periodically,
that reason is no longer relevant.