dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.17k stars 4.72k forks source link

[mono] Log profiler does not build correctly in Debug configuration #57315

Open lambdageek opened 3 years ago

lambdageek commented 3 years ago

On platforms (like Android) where we use dynamic loading, the Debug configuration builds the profler with missing symbols like m_class_get_name_space.

This is because in the debug configuration we enable CHECKED_BUILD_PRIVATE_TYPES which makes the class getters into non-inlined functions. Those functions are not exported, so they're not visible in dynamic libraries like the log profiler.

https://github.com/dotnet/runtime/blob/41e93d4be00457c799d38389ae835658b7377809/src/mono/mono/metadata/class-internals.h#L291-L299

We should either mark the functions as MONO_PROFILER_API in the Debug configuration, or decide that the profiler should use the public APIs like mono_class_get_name_space instead.

One complication is that normally mono_class_get_name_space is MONO_RT_EXTERNAL_ONLY which prevents it from being used in the runtime itself. So we'd need to say "actually, the profiler is not the runtime". I'm not sure if that's a good idea.

This affects the debug configuration only. Release build get static inline, so the getters are not symbols.

ghost commented 3 years ago

Tagging subscribers to this area: @directhex See info in area-owners.md if you want to be subscribed.

Issue Details
On platforms (like Android) where we use dynamic loading, the Debug configuration builds the profler with missing symbols like `m_class_get_name_space`. This is because in the debug configuration we enable `CHECKED_BUILD_PRIVATE_TYPES` which makes the class getters into non-inlined functions. Those functions are not exported, so they're not visible in dynamic libraries like the log profiler. https://github.com/dotnet/runtime/blob/41e93d4be00457c799d38389ae835658b7377809/src/mono/mono/metadata/class-internals.h#L291-L299 We should either mark the functions as `MONO_PROFILER_API` in the Debug configuration, or decide that the profiler should use the public APIs like `mono_class_get_name_space` instead. One complication is that normally `mono_class_get_name_space` is `MONO_RT_EXTERNAL_ONLY` which prevents it from being used in the runtime itself. So we'd need to say "actually, the profiler is not the runtime". I'm not sure if that's a good idea. This affects the debug configuration only. Release build get `static inline`, so the getters are not symbols.
Author: lambdageek
Assignees: -
Labels: `area-Infrastructure-mono`
Milestone: 7.0.0
lateralusX commented 2 years ago

@lambdageek Is this still relevant or something that can be pused to future or closed?