| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.crash; |
| |
| using fuchsia.mem; |
| using zx; |
| |
| const uint32 MAX_COMPONENT_URL_LENGTH = 4096; |
| const uint32 MAX_EXCEPTION_MSG_LENGTH = 4096; |
| |
| // Enumerates the languages with managed runtimes for which we might want a |
| // specific handling of the thrown exceptions. |
| enum ManagedRuntimeLanguage { |
| UNKNOWN_LANGUAGE = 0; |
| OTHER_LANGUAGE = 1; |
| DART = 2; |
| }; |
| |
| // Analyzes crashed processes, string exceptions from managed runtimes or |
| // kernel panic crashlogs. |
| [Discoverable, Layout = "Simple"] |
| interface Analyzer { |
| // Requests that the crash analyzer handles the exception thrown by the |
| // given |thread| in |process|. |
| // This method is responsible for resuming or stopping the thread once the |
| // analyze is done. |
| // |
| // The behavior of this method varies depending on the implementation, but |
| // a typical implementation might print a crash dump to the system log or |
| // upload a crash report to a server. |
| // |
| // |exception_port| is the port on which the exception was delivered and |
| // can be passed to zx_task_resume_from_exception(). |
| HandleNativeException(handle<process> process, |
| handle<thread> thread, |
| handle<port> exception_port) |
| -> (zx.status status); |
| |
| // Requests that the crash analyzer handles the exception thrown in the |
| // managed runtime for the given |language|. |
| // |
| // The |language| might influenced how the exception message or stack trace |
| // are processed or parsed. |
| // |
| // The behavior of this method varies depending on the implementation, but |
| // a typical implementation might print the exception message and stack |
| // trace to the system log or upload a crash report to a server. |
| HandleManagedRuntimeException(ManagedRuntimeLanguage language, |
| string:MAX_COMPONENT_URL_LENGTH componentUrl, |
| string:MAX_EXCEPTION_MSG_LENGTH exception, |
| fuchsia.mem.Buffer stackTrace) |
| -> (zx.status status); |
| |
| // Requests that the crash analyzer processes the kernel panic crash log. |
| // |
| // The behavior of this method varies depending on the implementation, but |
| // a typical implementation might print the crash log to the system log or |
| // upload a crash report to a server with the log as attachment. |
| ProcessKernelPanicCrashlog(fuchsia.mem.Buffer crashlog) -> (zx.status status); |
| }; |