Skip to content
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

[mobile][diagnostics] Format native crash output using llvm-symbolizer markup #103132

Open
lambdageek opened this issue Jun 6, 2024 · 6 comments
Labels
area-Diagnostics-mono enhancement Product code improvement that does NOT require public API changes/additions os-android
Milestone

Comments

@lambdageek
Copy link
Member

Use case:

I'm a C# android developer. I am capable of reproducing a native crash in my app and I can run adb log. In addition to the standard android crash dump summary, I would like the .NET runtime to print out its own view of a native backtrace using llvm-symbolizer markup so that I can use that output together with dotnet-symbol to view native stack traces that include line number information.

There's three tasks here:

  1. Modify dump_native_stacktrace to use {{bt:...}} markup to print stack frame addresses.
  2. Emit {{module:}} and {{mmap:...:load:...}} markup to print out the ELF BuildId of each module and the memory map info for each loaded that appears in the stack traces (probably dladdr and some kind of dlinfo will get this data)
  3. Modify dump_native_stacktrace to use "unwind.h" and _Unwind_backtrace on Android to iterate over stack frames. (Android doesn't have backtrace that we use on other platforms)
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jun 6, 2024
Copy link
Contributor

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

@lambdageek
Copy link
Member Author

/cc @mdh1418

@lambdageek
Copy link
Member Author

To get the build ids, I guess you need to do a dl_iterate_phdr and look through each dl_phdr_info's dl_phdr with p_type == PT_NOTE and then for BuildID note. there is some useful example at https://github.com/mattst88/build-id

@hoyosjs hoyosjs added the enhancement Product code improvement that does NOT require public API changes/additions label Jun 10, 2024
@tommcdon
Copy link
Member

Possible workaround - dotnet/android#8832 (comment)

@tommcdon tommcdon added this to the Future milestone Jun 11, 2024
@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Jun 11, 2024
@lambdageek
Copy link
Member Author

Potential duplicate issues:

These issues are about managed stack traces and adding line number info to android logs based on MVID of the managed stack frames. The current issue is about unmanaged stack traces.

Possible workaround - dotnet/android#8832 (comment)

That workaround is just about displaying the unmanaged stack traces (likely with missing symbol names) - currently the runtime just swallows its own attempts at printing those. After the workaround there is still the question of how to ensure that it's possible to get the symbol names for the native addresses that appear in the log. (ie: the current issue is about enhancing the workaround)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Diagnostics-mono enhancement Product code improvement that does NOT require public API changes/additions os-android
Projects
None yet
Development

No branches or pull requests

4 participants