yast2-core
Debugger.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: Debugger.h
14 
15  Author: Stanislav Visnovsky <visnov@suse.cz>
16  Maintainer: Stanislav Visnovsky <visnov@suse.cz>
17 
18 /-*/
19 // -*- c++ -*-
20 
21 #ifndef Debugger_h
22 #define Debugger_h
23 
24 #include <stdio.h>
25 #include <list>
26 #include <string>
27 #include <y2/SymbolEntry.h>
28 
29 class Y2Namespace;
30 
34 class Debugger
35 {
36 public:
37  typedef enum {
47  } command_t;
48 
49 private:
50  int m_socket, m_ns;
51  FILE *m_descriptor;
53  std::string m_outputstash;
54 
55  bool m_tracing;
56 
57  typedef struct {
59  bool tracing;
60  } stackitem_t;
61 
62  std::list<stackitem_t> m_blockstack;
63 
64  bool m_remote;
65 
66 public:
67 
68  Debugger ();
69 
70  ~Debugger ();
71 
75  bool initialize (bool remote);
76  bool initializeRemote ();
77  bool initializeLocal ();
78 
85  bool processInput (command_t &command, std::list<std::string> &arguments);
86 
87  bool sendOutput (std::string output );
88 
89  // save the text for the next output sending
90  void stashOutput (std::string output );
91 
92  command_t lastCommand () const { return m_last_command; }
93 
94  // sets the last command to be c_step, enables tracing of the next block to be
95  // entered
96  void setTracing ();
97  void setTracing (bool enable);
98 
99  void setBreakpoint (std::list<std::string> &arguments);
100  void removeBreakpoint (std::list<std::string> &arguments);
101  void generateBacktrace ();
102  void printVariable (std::string variable_name);
103  void setVariable (std::string arg);
104 
105  void enableTracing (Y2Namespace* block, bool enable);
106  bool tracing (Y2Namespace* block) const;
107  bool tracing () const;
108 
109  void pushBlock (Y2Namespace* block, bool tracing);
110  void popBlock ();
111 
112 private:
113  SymbolEntryPtr findSymbol (std::string name);
114 };
115 
116 #endif // Debugger_h
bool sendOutput(std::string output)
Definition: Debugger.cc:506
void enableTracing(Y2Namespace *block, bool enable)
Definition: Debugger.cc:525
void printVariable(std::string variable_name)
Definition: Debugger.cc:327
void output(const std::string &s, int fd)
Definition: tty_wrapper.cc:78
Definition: Debugger.h:39
void setVariable(std::string arg)
Definition: Debugger.cc:347
command_t m_last_command
Definition: Debugger.h:52
command_t
Definition: Debugger.h:37
void popBlock()
Definition: Debugger.cc:554
int m_socket
Definition: Debugger.h:50
bool m_remote
Definition: Debugger.h:64
Definition: Debugger.h:40
FILE * m_descriptor
Definition: Debugger.h:51
Definition: Debugger.h:43
bool initializeRemote()
Definition: Debugger.cc:123
Definition: Debugger.h:45
Definition: Debugger.h:44
Debugger singleton to keep debugging-related status.
Definition: Debugger.h:34
void stashOutput(std::string output)
Definition: Debugger.cc:520
std::list< stackitem_t > m_blockstack
Definition: Debugger.h:62
Y2Namespace * ns
Definition: Debugger.h:58
bool initialize(bool remote)
Definition: Debugger.cc:64
~Debugger()
Definition: Debugger.cc:52
bool tracing
Definition: Debugger.h:59
void pushBlock(Y2Namespace *block, bool tracing)
Definition: Debugger.cc:545
int m_ns
Definition: Debugger.h:50
std::string m_outputstash
Definition: Debugger.h:53
void generateBacktrace()
Definition: Debugger.cc:233
Definition: Debugger.h:42
Definition: Debugger.h:46
void setBreakpoint(std::list< std::string > &arguments)
Definition: Debugger.cc:176
void removeBreakpoint(std::list< std::string > &arguments)
Definition: Debugger.cc:207
bool processInput(command_t &command, std::list< std::string > &arguments)
Read the input from controlling socket and act accordingly.
Definition: Debugger.cc:386
void setTracing()
Definition: Debugger.cc:170
Definition: Y2Namespace.h:43
bool m_tracing
Definition: Debugger.h:55
SymbolEntryPtr findSymbol(std::string name)
Definition: Debugger.cc:270
Definition: Debugger.h:57
bool tracing() const
Definition: Debugger.cc:559
Definition: Debugger.h:41
command_t lastCommand() const
Definition: Debugger.h:92
Definition: Debugger.h:38
bool initializeLocal()
Definition: Debugger.cc:70
Debugger()
Definition: Debugger.cc:44

Generated on a sunny day for yast2-core by doxygen 1.8.8