-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[android] Make native debugging test apps a little easier #112993
Conversation
To native debug the runtime in android studio, all runtime native lib symbols need to end in .so as opposed to .dbg. We have yet to find the way for Android Studio to automatically pick this up and so you have to manually associate libs to symbol lib in the UI. The UI filters based on .so and that is the reason for the rename. This change adds a target in the test build where it'll copy .dbg files into the apk lib/arch folder and rename the extension to .so. When you build the test, you can open the apk in Android Studio and you won't have to hunt very far to associate the symbol libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR streamlines the native debugging process for Android test apps by copying .dbg files and renaming them to .so, enabling Android Studio to more easily associate the symbol libraries.
- Adds a new conditional block to copy and rename .dbg files to .so
- Integrates the newly renamed files into the APK using the AAPT tool
Reviewed Changes
File | Description |
---|---|
src/tasks/AndroidAppBuilder/ApkBuilder.cs | Adds logic to duplicate .dbg files with a .so extension for native debugging support |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR simplifies native debugging of Android test apps by automatically copying and renaming .dbg files to .so files so that Android Studio can easily associate symbol libraries.
- Adds a conditional branch to copy the debug symbols as .so files
- Invokes AAPT to include the renamed debug symbols in the APK
Reviewed Changes
File | Description |
---|---|
src/tasks/AndroidAppBuilder/ApkBuilder.cs | Adds logic to copy .dbg files as .so files and update the APK accordingly |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
|
||
if (!StripDebugSymbols) | ||
{ | ||
// symbol files need to end in .so.so so they'll show up in android studio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment mentions '.so.so' which appears to be a typo given that the file is renamed to '.so'. Consider updating the comment to match the intended behavior.
// symbol files need to end in .so.so so they'll show up in android studio | |
// symbol files need to end in .so so they'll show up in android studio |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
if (!StripDebugSymbols) | ||
{ | ||
// symbol files need to end in .so.so so they'll show up in android studio | ||
string debugLib = dynamicLib + ".dbg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .dbg
extension Windows-specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, linux specific I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the symbols are for the target, not host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I'm a fan of this, why not just tell people to disable symbol stripping ?
@@ -493,6 +493,20 @@ public ApkBuilder(TaskLoggingHelper logger) | |||
// NOTE: we can run android-strip tool from NDK to shrink native binaries here even more. | |||
|
|||
File.Copy(dynamicLib, Path.Combine(OutputDir, destRelative), true); | |||
|
|||
if (!StripDebugSymbols) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is backwards, it should only do this if debug symbols are stripped otherwise they'll be embedded.
this also shouldn't be done in librarybuilder mode
At least on coreclr it doesn't work. Possibly something to fix but in the meantime this is helpful. |
After another pass, |
This change adds block in the AndroidAppBuilder where it'll copy .dbg files into the apk lib/arch folder and rename the extension to .so. When you build the test, you can open the apk in Android Studio and you won't have to hunt very far to manually associate the symbol libraries.
To native debug the runtime in android studio, all runtime native lib symbols need to end in .so as opposed to .dbg. We have yet to find a way for Android Studio to automatically pick this up and so you have to manually associate libs to symbol libs in the UI. The UI filters based on .so and that is the reason for the rename.