blob: 60010b3d94fec9546aeda890ae85e26667d47759 [file] [log] [blame]
// 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.
#include "garnet/lib/debug_ipc/protocol.h"
#include "lib/fxl/logging.h"
#if defined(__Fuchsia__)
#include <zircon/types.h>
// If this static assertion fails, then we have to redefine
// debug_ipc::zx_status_t appropriately.
static_assert(std::is_same<::zx_status_t, debug_ipc::zx_status_t>::value);
#endif
namespace debug_ipc {
constexpr uint32_t MsgHeader::kSerializedHeaderSize;
constexpr uint64_t HelloReply::kStreamSignature;
constexpr uint32_t HelloReply::kCurrentVersion;
const char* MsgHeader::TypeToString(MsgHeader::Type type) {
switch (type) {
case MsgHeader::Type::kNone:
return "None";
case MsgHeader::Type::kHello:
return "Hello";
case MsgHeader::Type::kLaunch:
return "Launch";
case MsgHeader::Type::kKill:
return "Kill";
case MsgHeader::Type::kAttach:
return "Attach";
case MsgHeader::Type::kDetach:
return "Detach";
case MsgHeader::Type::kModules:
return "Modules";
case MsgHeader::Type::kSymbolTables:
return "SymbolTables";
case MsgHeader::Type::kPause:
return "Pause";
case MsgHeader::Type::kQuitAgent:
return "QuitAgent";
case MsgHeader::Type::kResume:
return "Resume";
case MsgHeader::Type::kProcessTree:
return "ProcessTree";
case MsgHeader::Type::kThreads:
return "Threads";
case MsgHeader::Type::kReadMemory:
return "ReadMemory";
case MsgHeader::Type::kWriteMemory:
return "WriteMemory";
case MsgHeader::Type::kReadRegisters:
return "ReadRegisters";
case MsgHeader::Type::kWriteRegisters:
return "WriteRegisters";
case MsgHeader::Type::kAddOrChangeBreakpoint:
return "AddOrChangeBreakpoint";
case MsgHeader::Type::kRemoveBreakpoint:
return "RemoveBreakpoint";
case MsgHeader::Type::kThreadStatus:
return "ThreadStatus";
case MsgHeader::Type::kAddressSpace:
return "AddressSpace";
case MsgHeader::Type::kJobFilter:
return "JobFilter";
case MsgHeader::Type::kNotifyProcessExiting:
return "NotifyProcessExiting";
case MsgHeader::Type::kNotifyProcessStarting:
return "NotifyProcessStarting";
case MsgHeader::Type::kNotifyThreadStarting:
return "NotifyThreadStarting";
case MsgHeader::Type::kNotifyThreadExiting:
return "NotifyThreadExiting";
case MsgHeader::Type::kNotifyException:
return "NotifyException";
case MsgHeader::Type::kNotifyModules:
return "NotifyModules";
case MsgHeader::Type::kNumMessages:
return "NumMessages";
}
FXL_NOTREACHED();
return nullptr;
}
const char* NotifyException::TypeToString(NotifyException::Type type) {
switch (type) {
case NotifyException::Type::kNone:
return "None";
case NotifyException::Type::kGeneral:
return "General";
case NotifyException::Type::kHardware:
return "Hardware";
case NotifyException::Type::kSingleStep:
return "Single Step";
case NotifyException::Type::kSoftware:
return "Software";
case NotifyException::Type::kSynthetic:
return "Synthetic";
case NotifyException::Type::kLast:
return "kLast";
}
FXL_NOTREACHED();
return nullptr;
}
const char* InferiorTypeToString(InferiorType type) {
switch (type) {
case InferiorType::kBinary:
return "kBinary";
case InferiorType::kComponent:
return "kComponent";
case InferiorType::kLast:
return "kLast";
}
FXL_NOTREACHED();
return nullptr;
}
} // namespace debug_ipc