|
yast2-core
|
00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: Debugger.h 00014 00015 Author: Stanislav Visnovsky <visnov@suse.cz> 00016 Maintainer: Stanislav Visnovsky <visnov@suse.cz> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 #ifndef Debugger_h 00022 #define Debugger_h 00023 00024 #include <stdio.h> 00025 #include <list> 00026 #include <string> 00027 #include <y2/SymbolEntry.h> 00028 00029 class Y2Namespace; 00030 00034 class Debugger 00035 { 00036 public: 00037 typedef enum { 00038 c_unknown, 00039 c_next, 00040 c_step, 00041 c_continue, 00042 c_print, 00043 c_backtrace, 00044 c_breakpoint, 00045 c_removebreakpoint, 00046 c_setvalue 00047 } command_t; 00048 00049 private: 00050 int m_socket, m_ns; 00051 FILE *m_descriptor; 00052 command_t m_last_command; 00053 std::string m_outputstash; 00054 00055 bool m_tracing; 00056 00057 typedef struct { 00058 Y2Namespace* ns; 00059 bool tracing; 00060 } stackitem_t; 00061 00062 std::list<stackitem_t> m_blockstack; 00063 00064 bool m_remote; 00065 00066 public: 00067 00068 Debugger (); 00069 00070 ~Debugger (); 00071 00075 bool initialize (bool remote); 00076 bool initializeRemote (); 00077 bool initializeLocal (); 00078 00085 bool processInput (command_t &command, std::list<std::string> &arguments); 00086 00087 bool sendOutput (std::string output ); 00088 00089 // save the text for the next output sending 00090 void stashOutput (std::string output ); 00091 00092 command_t lastCommand () const { return m_last_command; } 00093 00094 // sets the last command to be c_step, enables tracing of the next block to be 00095 // entered 00096 void setTracing (); 00097 void setTracing (bool enable); 00098 00099 void setBreakpoint (std::list<std::string> &arguments); 00100 void removeBreakpoint (std::list<std::string> &arguments); 00101 void generateBacktrace (); 00102 void printVariable (std::string variable_name); 00103 void setVariable (std::string arg); 00104 00105 void enableTracing (Y2Namespace* block, bool enable); 00106 bool tracing (Y2Namespace* block) const; 00107 bool tracing () const; 00108 00109 void pushBlock (Y2Namespace* block, bool tracing); 00110 void popBlock (); 00111 00112 private: 00113 SymbolEntryPtr findSymbol (std::string name); 00114 }; 00115 00116 #endif // Debugger_h
1.7.5.1