Path: blob/main/contrib/llvm-project/lldb/source/Utility/State.cpp
39587 views
//===-- State.cpp ---------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Utility/State.h"910using namespace lldb;11using namespace lldb_private;1213const char *lldb_private::StateAsCString(StateType state) {14switch (state) {15case eStateInvalid:16return "invalid";17case eStateUnloaded:18return "unloaded";19case eStateConnected:20return "connected";21case eStateAttaching:22return "attaching";23case eStateLaunching:24return "launching";25case eStateStopped:26return "stopped";27case eStateRunning:28return "running";29case eStateStepping:30return "stepping";31case eStateCrashed:32return "crashed";33case eStateDetached:34return "detached";35case eStateExited:36return "exited";37case eStateSuspended:38return "suspended";39}40return "unknown";41}4243const char *lldb_private::GetPermissionsAsCString(uint32_t permissions) {44switch (permissions) {45case 0:46return "---";47case ePermissionsWritable:48return "-w-";49case ePermissionsReadable:50return "r--";51case ePermissionsExecutable:52return "--x";53case ePermissionsReadable | ePermissionsWritable:54return "rw-";55case ePermissionsReadable | ePermissionsExecutable:56return "r-x";57case ePermissionsWritable | ePermissionsExecutable:58return "-wx";59case ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable:60return "rwx";61default:62break;63}64return "???";65}6667bool lldb_private::StateIsRunningState(StateType state) {68switch (state) {69case eStateAttaching:70case eStateLaunching:71case eStateRunning:72case eStateStepping:73return true;7475case eStateConnected:76case eStateDetached:77case eStateInvalid:78case eStateUnloaded:79case eStateStopped:80case eStateCrashed:81case eStateExited:82case eStateSuspended:83break;84}85return false;86}8788bool lldb_private::StateIsStoppedState(StateType state, bool must_exist) {89switch (state) {90case eStateInvalid:91case eStateConnected:92case eStateAttaching:93case eStateLaunching:94case eStateRunning:95case eStateStepping:96case eStateDetached:97break;9899case eStateUnloaded:100case eStateExited:101return !must_exist;102103case eStateStopped:104case eStateCrashed:105case eStateSuspended:106return true;107}108return false;109}110111112