mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
2946cd7010
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
111 lines
2.5 KiB
C++
111 lines
2.5 KiB
C++
//===-- State.cpp -----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/Utility/State.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";
|
|
}
|
|
return "unknown";
|
|
}
|
|
|
|
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:
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::StateIsStoppedState(StateType state, bool must_exist) {
|
|
switch (state) {
|
|
case eStateInvalid:
|
|
case eStateConnected:
|
|
case eStateAttaching:
|
|
case eStateLaunching:
|
|
case eStateRunning:
|
|
case eStateStepping:
|
|
case eStateDetached:
|
|
break;
|
|
|
|
case eStateUnloaded:
|
|
case eStateExited:
|
|
return !must_exist;
|
|
|
|
case eStateStopped:
|
|
case eStateCrashed:
|
|
case eStateSuspended:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|