SBProcess.h revision fb9cee64303d36d6fe5d87e63dd8701d1ddb70a9
16d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)//===-- SBProcess.h ---------------------------------------------*- C++ -*-===// 26d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// 36d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// The LLVM Compiler Infrastructure 46d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// 56d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source 66d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// License. See LICENSE.TXT for details. 76d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// 86d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)//===----------------------------------------------------------------------===// 96d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 106d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#ifndef LLDB_SBProcess_h_ 116d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#define LLDB_SBProcess_h_ 126d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 136d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include "lldb/API/SBDefines.h" 146d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include "lldb/API/SBError.h" 156d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include "lldb/API/SBTarget.h" 166d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include <stdio.h> 176d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 186d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)namespace lldb { 196d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 206d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)class SBEvent; 216d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 226d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)class SBProcess 236d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles){ 246d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)public: 256d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) //------------------------------------------------------------------ 266d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) /// Broadcaster event bits definitions. 276d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) //------------------------------------------------------------------ 286d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) enum 296d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) { 306d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) eBroadcastBitStateChanged = (1 << 0), 316d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) eBroadcastBitInterrupt = (1 << 1), 326d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) eBroadcastBitSTDOUT = (1 << 2), 336d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) eBroadcastBitSTDERR = (1 << 3), 346d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) eBroadcastBitProfileData = (1 << 4) 356d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) }; 366d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 376d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) SBProcess (); 386d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 396d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) SBProcess (const lldb::SBProcess& rhs); 406d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 416d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) const lldb::SBProcess& 426d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) operator = (const lldb::SBProcess& rhs); 436d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 446d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) SBProcess (const lldb::ProcessSP &process_sp); 456d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 466d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) ~SBProcess(); 476d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 486d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) static const char * 496d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetBroadcasterClassName (); 506d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 516d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) const char * 526d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetPluginName (); 536d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 546d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) const char * 556d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetShortPluginName (); 566d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 576d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) void 586d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) Clear (); 596d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 606d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) bool 616d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) IsValid() const; 626d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 636d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) lldb::SBTarget 646d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetTarget() const; 656d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 666d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) lldb::ByteOrder 676d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetByteOrder() const; 686d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 696d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) size_t 706d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) PutSTDIN (const char *src, size_t src_len); 716d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 726d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) size_t 736d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetSTDOUT (char *dst, size_t dst_len) const; 746d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 756d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) size_t 766d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetSTDERR (char *dst, size_t dst_len) const; 776d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 786d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) size_t 796d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) GetAsyncProfileData(char *dst, size_t dst_len) const; 806d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 816d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) void 826d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) ReportEventState (const lldb::SBEvent &event, FILE *out) const; 83 84 void 85 AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result); 86 87 //------------------------------------------------------------------ 88 /// Remote connection related functions. These will fail if the 89 /// process is not in eStateConnected. They are intended for use 90 /// when connecting to an externally managed debugserver instance. 91 //------------------------------------------------------------------ 92 bool 93 RemoteAttachToProcessWithID (lldb::pid_t pid, 94 lldb::SBError& error); 95 96 bool 97 RemoteLaunch (char const **argv, 98 char const **envp, 99 const char *stdin_path, 100 const char *stdout_path, 101 const char *stderr_path, 102 const char *working_directory, 103 uint32_t launch_flags, 104 bool stop_at_entry, 105 lldb::SBError& error); 106 107 //------------------------------------------------------------------ 108 // Thread related functions 109 //------------------------------------------------------------------ 110 uint32_t 111 GetNumThreads (); 112 113 lldb::SBThread 114 GetThreadAtIndex (size_t index); 115 116 lldb::SBThread 117 GetThreadByID (lldb::tid_t sb_thread_id); 118 119 lldb::SBThread 120 GetThreadByIndexID (uint32_t index_id); 121 122 lldb::SBThread 123 GetSelectedThread () const; 124 125 bool 126 SetSelectedThread (const lldb::SBThread &thread); 127 128 bool 129 SetSelectedThreadByID (lldb::tid_t tid); 130 131 bool 132 SetSelectedThreadByIndexID (uint32_t index_id); 133 134 //------------------------------------------------------------------ 135 // Stepping related functions 136 //------------------------------------------------------------------ 137 138 lldb::StateType 139 GetState (); 140 141 int 142 GetExitStatus (); 143 144 const char * 145 GetExitDescription (); 146 147 lldb::pid_t 148 GetProcessID (); 149 150 uint32_t 151 GetAddressByteSize() const; 152 153 lldb::SBError 154 Destroy (); 155 156 lldb::SBError 157 Continue (); 158 159 lldb::SBError 160 Stop (); 161 162 lldb::SBError 163 Kill (); 164 165 lldb::SBError 166 Detach (); 167 168 lldb::SBError 169 Signal (int signal); 170 171 void 172 SendAsyncInterrupt(); 173 174 size_t 175 ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error); 176 177 size_t 178 WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error); 179 180 size_t 181 ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error); 182 183 uint64_t 184 ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error); 185 186 lldb::addr_t 187 ReadPointerFromMemory (addr_t addr, lldb::SBError &error); 188 189 // Events 190 static lldb::StateType 191 GetStateFromEvent (const lldb::SBEvent &event); 192 193 static bool 194 GetRestartedFromEvent (const lldb::SBEvent &event); 195 196 static lldb::SBProcess 197 GetProcessFromEvent (const lldb::SBEvent &event); 198 199 static bool 200 EventIsProcessEvent (const lldb::SBEvent &event); 201 202 lldb::SBBroadcaster 203 GetBroadcaster () const; 204 205 static const char * 206 GetBroadcasterClass (); 207 208 bool 209 GetDescription (lldb::SBStream &description); 210 211 uint32_t 212 GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const; 213 214 uint32_t 215 LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error); 216 217 lldb::SBError 218 UnloadImage (uint32_t image_token); 219 220protected: 221 friend class SBAddress; 222 friend class SBBreakpoint; 223 friend class SBBreakpointLocation; 224 friend class SBCommandInterpreter; 225 friend class SBDebugger; 226 friend class SBFunction; 227 friend class SBModule; 228 friend class SBTarget; 229 friend class SBThread; 230 friend class SBValue; 231 232 lldb::ProcessSP 233 GetSP() const; 234 235 void 236 SetSP (const lldb::ProcessSP &process_sp); 237 238 lldb::ProcessWP m_opaque_wp; 239}; 240 241} // namespace lldb 242 243#endif // LLDB_SBProcess_h_ 244