-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Android CoreCLR] Log managed callstacks on native crash #123824
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2739,13 +2739,22 @@ static void DoNotOptimize(const void* p) | |
| --*/ | ||
| #ifdef HOST_ANDROID | ||
| #include <minipal/log.h> | ||
| extern "C" void LogCallstackForAndroidNativeCrash() __attribute__((weak)); | ||
| VOID | ||
| PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, void* context, bool serialize) | ||
| { | ||
| // Preserve context pointer to prevent optimization | ||
| DoNotOptimize(&context); | ||
|
|
||
| // TODO: Dump all managed threads callstacks into logcat and/or file? | ||
| if (LogCallstackForAndroidNativeCrash != nullptr) | ||
| { | ||
| minipal_log_write_fatal("\n=================================================================\n"); | ||
| minipal_log_write_fatal("\tManaged Stacktrace:\n"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should something more self-explanatory than just "Managed stacktrace:". Maybe something like "Crash in native code".
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought PROCCreateCrashDumpIfEnabled also gets hit for unhandled managed exceptions. Would it still be fine to classify that as crash in native code? Maybe also |
||
| minipal_log_write_fatal("=================================================================\n"); | ||
| LogCallstackForAndroidNativeCrash(); | ||
| minipal_log_write_fatal("=================================================================\n"); | ||
| } | ||
|
|
||
| // TODO: Dump stress log into logcat and/or file when enabled? | ||
| minipal_log_write_fatal("Aborting process.\n"); | ||
| } | ||
|
|
||
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.
Do we need the
========================separators? We do not use a separators like that anywhere else in CoreCLR.Uh oh!
There was an error while loading. Please reload this page.
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 they're not needed, I had initially just used the format that Android Mono was using
runtime/src/mono/mono/mini/mini-exceptions.c
Lines 3005 to 3011 in 2772854