mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 07:57:36 +08:00
the FormatManager class. Modified the format arguments in any commands to be able to use a single character format, or a full format name, or a partial format name if no full format names match. Modified any code that was displaying formats to use the new FormatManager calls so that our help text and errors never get out of date. Modified the display of the "type format list" command to be a bit more human readable by showing the format as a format string rather than the single character format char. llvm-svn: 133765
116 lines
3.0 KiB
C++
116 lines
3.0 KiB
C++
//===-- State.cpp -----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// C Includes
|
|
// C++ Includes
|
|
// Other libraries and framework includes
|
|
// Project includes
|
|
#include "lldb/Core/State.h"
|
|
#include <stdio.h>
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
const char *
|
|
lldb_private::StateAsCString (StateType state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case eStateInvalid: return "invalid";
|
|
case eStateUnloaded: return "unloaded";
|
|
case eStateConnected: return "connected";
|
|
case eStateAttaching: return "attaching";
|
|
case eStateLaunching: return "launching";
|
|
case eStateStopped: return "stopped";
|
|
case eStateRunning: return "running";
|
|
case eStateStepping: return "stepping";
|
|
case eStateCrashed: return "crashed";
|
|
case eStateDetached: return "detached";
|
|
case eStateExited: return "exited";
|
|
case eStateSuspended: return "suspended";
|
|
}
|
|
static char unknown_state_string[64];
|
|
snprintf(unknown_state_string, sizeof (unknown_state_string), "StateType = %i", state);
|
|
return unknown_state_string;
|
|
}
|
|
|
|
const char *
|
|
lldb_private::GetPermissionsAsCString (uint32_t permissions)
|
|
{
|
|
switch (permissions)
|
|
{
|
|
case 0: return "---";
|
|
case ePermissionsWritable: return "-w-";
|
|
case ePermissionsReadable: return "r--";
|
|
case ePermissionsExecutable: return "--x";
|
|
case ePermissionsReadable |
|
|
ePermissionsWritable: return "rw-";
|
|
case ePermissionsReadable |
|
|
ePermissionsExecutable: return "r-x";
|
|
case ePermissionsWritable |
|
|
ePermissionsExecutable: return "-wx";
|
|
case ePermissionsReadable |
|
|
ePermissionsWritable |
|
|
ePermissionsExecutable: return "rwx";
|
|
default:
|
|
break;
|
|
}
|
|
return "???";
|
|
}
|
|
|
|
bool
|
|
lldb_private::StateIsRunningState (StateType state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case eStateAttaching:
|
|
case eStateLaunching:
|
|
case eStateRunning:
|
|
case eStateStepping:
|
|
return true;
|
|
|
|
case eStateConnected:
|
|
case eStateDetached:
|
|
case eStateInvalid:
|
|
case eStateUnloaded:
|
|
case eStateStopped:
|
|
case eStateCrashed:
|
|
case eStateExited:
|
|
case eStateSuspended:
|
|
default:
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool
|
|
lldb_private::StateIsStoppedState (StateType state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case eStateInvalid:
|
|
case eStateConnected:
|
|
case eStateAttaching:
|
|
case eStateLaunching:
|
|
case eStateRunning:
|
|
case eStateStepping:
|
|
case eStateDetached:
|
|
default:
|
|
break;
|
|
|
|
case eStateUnloaded:
|
|
case eStateStopped:
|
|
case eStateCrashed:
|
|
case eStateExited:
|
|
case eStateSuspended:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|