mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-28 01:20:58 +01:00
creport: update for 11.0.0 behavior
This commit is contained in:
parent
3b5dff0f83
commit
8dcb07152e
@ -288,7 +288,7 @@ namespace ams::creport {
|
|||||||
svcReadDebugProcessMemory(this->dying_message, this->debug_handle, this->dying_message_address, this->dying_message_size);
|
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. */
|
/* Try to ensure path exists. */
|
||||||
TryCreateReportDirectories();
|
TryCreateReportDirectories();
|
||||||
|
|
||||||
@ -333,6 +333,9 @@ namespace ams::creport {
|
|||||||
this->dying_message = nullptr;
|
this->dying_message = nullptr;
|
||||||
|
|
||||||
/* Try to take a screenshot. */
|
/* 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()) {
|
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
|
||||||
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
|
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
|
||||||
if (capssc_holder) {
|
if (capssc_holder) {
|
||||||
|
@ -91,7 +91,7 @@ namespace ams::creport {
|
|||||||
|
|
||||||
void BuildReport(os::ProcessId process_id, bool has_extra_info);
|
void BuildReport(os::ProcessId process_id, bool has_extra_info);
|
||||||
void GetFatalContext(::FatalCpuContext *out) const;
|
void GetFatalContext(::FatalCpuContext *out) const;
|
||||||
void SaveReport();
|
void SaveReport(bool enable_screenshot);
|
||||||
private:
|
private:
|
||||||
void ProcessExceptions();
|
void ProcessExceptions();
|
||||||
void ProcessDyingMessage();
|
void ProcessDyingMessage();
|
||||||
|
@ -100,33 +100,38 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse crashed PID. */
|
/* Parse arguments. */
|
||||||
os::ProcessId crashed_pid = creport::ParseProcessIdArgument(argv[0]);
|
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. */
|
/* Initialize the crash report. */
|
||||||
g_crash_report.Initialize();
|
g_crash_report.Initialize();
|
||||||
|
|
||||||
/* Try to debug the crashed process. */
|
/* 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()) {
|
if (!g_crash_report.IsComplete()) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save report to file. */
|
/* Save report to file. */
|
||||||
g_crash_report.SaveReport();
|
g_crash_report.SaveReport(enable_screenshot);
|
||||||
|
|
||||||
/* Try to terminate the process. */
|
/* If we should, try to terminate the process. */
|
||||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
if (hos::GetVersion() < hos::Version_11_0_0 || !enable_jit_debug) {
|
||||||
/* On 10.0.0+, use pgl to terminate. */
|
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||||
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
/* On 10.0.0+, use pgl to terminate. */
|
||||||
if (pgl_holder) {
|
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
||||||
pgl::TerminateProcess(crashed_pid);
|
if (pgl_holder) {
|
||||||
}
|
pgl::TerminateProcess(crashed_pid);
|
||||||
} else {
|
}
|
||||||
/* On < 10.0.0, use ns:dev to terminate. */
|
} else {
|
||||||
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
/* On < 10.0.0, use ns:dev to terminate. */
|
||||||
if (ns_holder) {
|
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
||||||
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
if (ns_holder) {
|
||||||
|
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +140,7 @@ int main(int argc, char **argv) {
|
|||||||
if (g_crash_report.IsApplication()) {
|
if (g_crash_report.IsApplication()) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
} else if (argv[1][0] == '1') {
|
} else if (has_extra_info) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user