diff options
author | Narayan Kamath <narayan@google.com> | 2017-05-10 10:58:59 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2017-05-22 16:55:21 +0100 |
commit | 2d377cd6888775fe682e49a1ac34a3a6feb78708 (patch) | |
tree | 8821a7f29085d838f37d29e8cea22ae0c2998dfe /debuggerd/protocol.h | |
parent | 62db5fcee052980759ecb977cab4c63491e01e56 (diff) | |
download | core-2d377cd6888775fe682e49a1ac34a3a6feb78708.tar.gz core-2d377cd6888775fe682e49a1ac34a3a6feb78708.tar.bz2 core-2d377cd6888775fe682e49a1ac34a3a6feb78708.zip |
tombstoned: Add a shared library version of libtombstoned_client...
.. for ART and the frameworks to link against. In the new stack dumping
scheme (see related bug), the Java runtime will communicate with
tombstoned in order to obtain a FD to which it can write its traces.
Also move things around to separate headers that are private
implementation details from headers that constitute the public debuggerd
API. There are currently only three such headers :
- tombstoned/tombstoned.h
- debuggerd/client.h
- debuggerd/handler.h
Bug: 32064548
Test: make
Change-Id: If1b8578550e373d84828b180bbe585f1088d1aa3
Diffstat (limited to 'debuggerd/protocol.h')
-rw-r--r-- | debuggerd/protocol.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/debuggerd/protocol.h b/debuggerd/protocol.h new file mode 100644 index 000000000..144efc8f7 --- /dev/null +++ b/debuggerd/protocol.h @@ -0,0 +1,70 @@ +/* + * Copyright 2016, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <stdint.h> + +// Sockets in the ANDROID_SOCKET_NAMESPACE_RESERVED namespace. +// Both sockets are SOCK_SEQPACKET sockets, so no explicit length field is needed. +constexpr char kTombstonedCrashSocketName[] = "tombstoned_crash"; +constexpr char kTombstonedJavaTraceSocketName[] = "tombstoned_java_trace"; +constexpr char kTombstonedInterceptSocketName[] = "tombstoned_intercept"; + +enum class CrashPacketType : uint8_t { + // Initial request from crash_dump. + kDumpRequest = 0, + + // Notification of a completed crash dump. + // Sent after a dump is completed and the process has been untraced, but + // before it has been resumed with SIGCONT. + kCompletedDump, + + // Responses to kRequest. + // kPerformDump sends along an output fd via cmsg(3). + kPerformDump = 128, + kAbortDump, +}; + +struct DumpRequest { + int32_t pid; +}; + +// The full packet must always be written, regardless of whether the union is used. +struct TombstonedCrashPacket { + CrashPacketType packet_type; + union { + DumpRequest dump_request; + } packet; +}; + +// Comes with a file descriptor via SCM_RIGHTS. +// This packet should be sent before an actual dump happens. +struct InterceptRequest { + int32_t pid; +}; + +enum class InterceptStatus : uint8_t { + kFailed, + kStarted, + kRegistered, +}; + +// Sent either immediately upon failure, or when the intercept has been used. +struct InterceptResponse { + InterceptStatus status; + char error_message[127]; // always null-terminated +}; |