Commit a7b5768
authored
[native] Native call tracing infra + native build system overhaul (#8857)
Context: #8800
Context: 8bc7a3e
Context: 6836818
Context: libunwind/libunwind#702
Begin adding native method call tracing infrastructure based on
[libunwind][0], initially used in tracing the reasons for why
[Blazor][1] apps break when LLVM marshal methods are enabled
(8bc7a3e, 6836818). The utility of such infrastructure, however,
is beyond just that particular task; it should be available for
general use by both us and applications.
Method call tracing support is not enabled by default.
To enable it, set the `$(_AndroidEnableNativeStackTracing)` MSBuild
property to `true`. This will enable the ability to print native,
managed and Java stack traces by invoking the `monodroid_log_traces`
function from either managed or native application code.
Additionally, change the directory layout for native code.
Previously, `src/monodroid` would produce *five* native libs:
* `libmono-android.debug.so`
* `libmono-android.release.so`
* `libxa-internal-api.so`
* `libxamarin-app.so`
* `libxamarin-debug-app-helper.so`
This made for a large `src/monodroid/CMakeLists.txt`, complicating
maintenance. We had considered trying to move these into separate
`src/LIBRARY-NAME` directories, but it makes things easier with
CMake if we introduce an intermediate directory.
Introduce a new `src/native` directory, to hold native binaries:
* `src/native/monodroid`: new location for `libmono-android.*.so`
* `src/native/xamarin-debug-app-helper`: source for
`libxamarin-debug-app-helper.so`, containing code moved from
previous `src/monodroid`
* `src/native/xamarin-app-stub`: source for the "stub"
`libxamarin-app.so`; the "real" one is produced in the app build.
Some `src/native/*` directories produce libraries (`.so` files). and
some produce *static* archives (`.a` files) to simplify using code
across native libraries.
A [cmake-presets file][2] is processed by `xaprepare`, to create a
`src/native/CMakePresets.json` which contains all the version-specific
bits replacements such as Android API levels, paths to utilities etc.
Developers can create a `src/native/CMakeUserPresets.json` file to
provide local modifications to config options within
`src/native/CMakePresets.json.in`.
Other changes:
* `src/native/libunwind/fixes/aarch64/Gos-linux.c` is an altered
copy of [`libunwind/src/aarch64/Gos-linux.c`][3] in order to
workaround libunwind/libunwind#702.
* *Begin* turning some instance member functions into static member
functions, as we don't otherwise need instances of those classes.
* Begin using `std::source_location` for better crash messages,
instead of using `__FILE__` and `__LINE__`.
* Fix endless recursion from a typo in `Util::ends_with()` overload.
[0]: https://github.com/libunwind/libunwind
[1]: https://learn.microsoft.com/aspnet/core/blazor/hybrid/tutorials/maui?view=aspnetcore-8.0
[2]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
[3]: https://github.com/libunwind/libunwind/blob/9cc4d98b22ae57bc1d8c253988feb85d4298a634/src/aarch64/Gos-linux.c1 parent 478de4c commit a7b5768
File tree
132 files changed
+4561
-3072
lines changed- .gdn/policheck
- build-tools
- cmake
- create-packs
- scripts
- xaprepare/xaprepare
- ConfigAndData
- Steps
- external
- src
- Mono.Android/Android.Runtime
- Xamarin.Android.Build.Tasks
- Microsoft.Android.Sdk/targets
- Tests/Xamarin.ProjectTools/Resources/Base
- monodroid
- jni
- native
- java-interop
- libstub
- libunwind
- fixes/aarch64
- lz4
- monodroid
- win32
- runtime-base
- tracing
- xamarin-app-stub
- xamarin-debug-app-helper
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
132 files changed
+4561
-3072
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
| 127 | + | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
This file was deleted.
0 commit comments