[profiler] Fix log profiling of native to managed wrappers (mono/mono#17740)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Thu, 7 Nov 2019 16:42:52 +0000 (11:42 -0500)
committerGitHub <noreply@github.com>
Thu, 7 Nov 2019 16:42:52 +0000 (11:42 -0500)
commit0e0833d7b523be11f557dcbb08af4ed2af2fa235
tree2fc9e43389830c9ea8420f06ed2245cf66df3d85
parenta5cb7684d18e2a6c19deb9709704e0029fb37803
[profiler] Fix log profiling of native to managed wrappers (mono/mono#17740)

* [profiler] Add test case for pinvokes and reverse pinvokes

* [profiler] Fix crash in native to managed wrappers

When we call back to managed from a pinvoke, we're in GC Safe mode and the
profiler instrumentation is inserted in the wrapper before it does the
transition to GC Unsafe.  So we need an extra transition before the profiler
calls its locking functions

Fixes https://github.com/mono/mono/issues/17687

* [coop] Mark internal GC Unsafe functions with MONO_PROFILER_API

Allow the profiler to transition to GC Unsafe mode

* [profiler] ptestrunner.pl fix profiler modules directory

we used to specify mono/mini/.libs but that's not where the profiler plugins live, they're in mono/profiler/.libs.   We probably picked up the profiler plugins from the system Mono install.

Commit migrated from https://github.com/mono/mono/commit/2c56ac54c05b2fca5daa3629c337001c35fae40b
src/mono/mono/profiler/Makefile.am
src/mono/mono/profiler/log.c
src/mono/mono/profiler/proftest-pinvokes.c [new file with mode: 0644]
src/mono/mono/profiler/ptestrunner.pl
src/mono/mono/profiler/test-pinvokes.cs [new file with mode: 0644]
src/mono/mono/utils/mono-threads-api.h
src/mono/mono/utils/mono-threads-coop.h