[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