mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 13:41:43 +00:00
creport: update for 11.0.0 behavior
This commit is contained in:
parent
3b5dff0f83
commit
8dcb07152e
3 changed files with 27 additions and 19 deletions
|
@ -288,7 +288,7 @@ namespace ams::creport {
|
|||
svcReadDebugProcessMemory(this->dying_message, this->debug_handle, this->dying_message_address, this->dying_message_size);
|
||||
}
|
||||
|
||||
void CrashReport::SaveReport() {
|
||||
void CrashReport::SaveReport(bool enable_screenshot) {
|
||||
/* Try to ensure path exists. */
|
||||
TryCreateReportDirectories();
|
||||
|
||||
|
@ -333,6 +333,9 @@ namespace ams::creport {
|
|||
this->dying_message = nullptr;
|
||||
|
||||
/* Try to take a screenshot. */
|
||||
/* NOTE: Nintendo validates that enable_screenshot is true here, and validates that the application id is not in a blacklist. */
|
||||
/* Since we save reports only locally and do not send them via telemetry, we will skip this. */
|
||||
AMS_UNUSED(enable_screenshot);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
|
||||
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
|
||||
if (capssc_holder) {
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace ams::creport {
|
|||
|
||||
void BuildReport(os::ProcessId process_id, bool has_extra_info);
|
||||
void GetFatalContext(::FatalCpuContext *out) const;
|
||||
void SaveReport();
|
||||
void SaveReport(bool enable_screenshot);
|
||||
private:
|
||||
void ProcessExceptions();
|
||||
void ProcessDyingMessage();
|
||||
|
|
|
@ -100,33 +100,38 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Parse crashed PID. */
|
||||
os::ProcessId crashed_pid = creport::ParseProcessIdArgument(argv[0]);
|
||||
/* Parse arguments. */
|
||||
const os::ProcessId crashed_pid = creport::ParseProcessIdArgument(argv[0]);
|
||||
const bool has_extra_info = argv[1][0] == '1';
|
||||
const bool enable_screenshot = argc >= 3 && argv[2][0] == '1';
|
||||
const bool enable_jit_debug = argc >= 4 && argv[3][0] == '1';
|
||||
|
||||
/* Initialize the crash report. */
|
||||
g_crash_report.Initialize();
|
||||
|
||||
/* Try to debug the crashed process. */
|
||||
g_crash_report.BuildReport(crashed_pid, argv[1][0] == '1');
|
||||
g_crash_report.BuildReport(crashed_pid, has_extra_info);
|
||||
if (!g_crash_report.IsComplete()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Save report to file. */
|
||||
g_crash_report.SaveReport();
|
||||
g_crash_report.SaveReport(enable_screenshot);
|
||||
|
||||
/* Try to terminate the process. */
|
||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||
/* On 10.0.0+, use pgl to terminate. */
|
||||
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
||||
if (pgl_holder) {
|
||||
pgl::TerminateProcess(crashed_pid);
|
||||
}
|
||||
} else {
|
||||
/* On < 10.0.0, use ns:dev to terminate. */
|
||||
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
||||
if (ns_holder) {
|
||||
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
||||
/* If we should, try to terminate the process. */
|
||||
if (hos::GetVersion() < hos::Version_11_0_0 || !enable_jit_debug) {
|
||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||
/* On 10.0.0+, use pgl to terminate. */
|
||||
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
||||
if (pgl_holder) {
|
||||
pgl::TerminateProcess(crashed_pid);
|
||||
}
|
||||
} else {
|
||||
/* On < 10.0.0, use ns:dev to terminate. */
|
||||
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
||||
if (ns_holder) {
|
||||
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +140,7 @@ int main(int argc, char **argv) {
|
|||
if (g_crash_report.IsApplication()) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
} else if (argv[1][0] == '1') {
|
||||
} else if (has_extra_info) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue