blob: 741df1fe6447a10a0f9d7b394b9a37e3f353599e [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- State.cpp -----------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// C Includes
11// C++ Includes
12// Other libraries and framework includes
13// Project includes
14#include "lldb/Core/State.h"
Eli Friedman88966972010-06-09 08:50:27 +000015#include <stdio.h>
Chris Lattner30fdc8d2010-06-08 16:52:24 +000016
17using namespace lldb;
18using namespace lldb_private;
19
20const char *
21lldb_private::StateAsCString (StateType state)
22{
23 switch (state)
24 {
25 case eStateInvalid: return "Invalid";
26 case eStateUnloaded: return "Unloaded";
27 case eStateAttaching: return "Attaching";
28 case eStateLaunching: return "Launching";
29 case eStateStopped: return "Stopped";
30 case eStateRunning: return "Running";
31 case eStateStepping: return "Stepping";
32 case eStateCrashed: return "Crashed";
33 case eStateDetached: return "Detached";
34 case eStateExited: return "Exited";
35 case eStateSuspended: return "Suspended";
36 }
37 static char unknown_state_string[64];
38 snprintf(unknown_state_string, sizeof (unknown_state_string), "StateType = %i", state);
39 return unknown_state_string;
40}
41
42bool
43lldb_private::StateIsRunningState (StateType state)
44{
45 switch (state)
46 {
47 case eStateAttaching:
48 case eStateLaunching:
49 case eStateRunning:
50 case eStateStepping:
51 return true;
52
53 case eStateDetached:
54 case eStateInvalid:
55 case eStateUnloaded:
56 case eStateStopped:
57 case eStateCrashed:
58 case eStateExited:
59 case eStateSuspended:
60 default:
61 break;
62 }
63 return false;
64}
65
66bool
67lldb_private::StateIsStoppedState (StateType state)
68{
69 switch (state)
70 {
71 case eStateInvalid:
72 case eStateAttaching:
73 case eStateLaunching:
74 case eStateRunning:
75 case eStateStepping:
76 case eStateDetached:
77 default:
78 break;
79
80 case eStateUnloaded:
81 case eStateStopped:
82 case eStateCrashed:
83 case eStateExited:
84 case eStateSuspended:
85 return true;
86 }
87 return false;
88}