|
yast2-core
|
00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YCPDebugger.h 00014 00015 Author: Arvin Schnell <arvin@suse.de> 00016 Maintainer: Arvin Schnell <arvin@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 /* 00022 * Debugger for YCP 00023 */ 00024 00025 #ifndef YCPDebugger_h 00026 #define YCPDebugger_h 00027 00028 #include <string> 00029 #include <vector> 00030 00031 #include "ycp/y2log.h" 00032 #include "ycp/YCPElement.h" 00033 00034 class YCPDebugger 00035 { 00036 public: 00037 00043 YCPDebugger (bool); 00044 00048 ~YCPDebugger (); 00049 00053 enum EntryPoint { Interpreter, Block }; 00054 00059 void debug (EntryPoint, const YCPElement &); 00060 00061 private: 00062 00066 string last_command; 00067 00071 bool wait_for_frontend; 00072 00073 private: 00074 00078 struct Position 00079 { 00080 string file; 00081 int line; 00082 00083 void setpos (const string &, int); 00084 }; 00085 00089 struct Breakpoint : public Position 00090 { 00091 bool tmpinactive; 00092 }; 00093 00097 vector <Breakpoint> breakpoints; 00098 00102 void add_breakpoint (const string &, int); 00103 00108 bool delete_breakpoint (const string &, int); 00109 00114 bool check_breakpoints (const string &, int); 00115 00119 void list_breakpoints (); 00120 00124 void list_source (const char *); 00125 00129 void create_socket (); 00130 00135 void check_socket (bool); 00136 00140 int sock; 00141 00146 int fd; 00147 00152 string read_line (bool) const; 00153 00157 void write_line (const char *, ...) const 00158 __attribute__ ((format (printf, 2, 3))); 00159 00163 void write_prompt () const; 00164 00169 bool handle_command (const string &, const YCPElement &elem); 00170 00174 bool single_mode; 00175 00179 int hold_level; 00180 00184 Position leave_position; 00185 00189 bool close_request; 00190 00195 struct Settings 00196 { 00197 Settings () { reset (); } 00198 void reset (); 00199 00200 bool ignorescr; 00201 bool printtoken; 00202 }; 00203 00207 Settings settings; 00208 00212 bool print_variable (const string &); 00213 00217 void print_scope (); 00218 00224 bool ignore (EntryPoint, const YCPElement &); 00225 }; 00226 00227 #endif // YCPDebugger_h
1.7.3