android_system_core/debuggerd/include/debuggerd/protocol.h
Josh Gao cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00

63 lines
1.9 KiB
C++

/*
* 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 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;
};
// Sent either immediately upon failure, or when the intercept has been used.
struct InterceptResponse {
uint8_t success; // 0 or 1
char error_message[127]; // always null-terminated
};