~ubuntu-branches/ubuntu/karmic/codelite/karmic

« back to all changes in this revision

Viewing changes to Interfaces/debugger.h

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-08-15 17:42:43 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090815174243-nlb9ikgigbiybz12
Tags: 1.0.2893+dfsg-0ubuntu1
* debian/rules:
  + Tidy up get-orig-source rule
* debian/control:
  + Bump Standards-Version
  + Change Maintainer email address to @ubuntu.com
  + Drop cdbs build-dependency
* debian/copyright:
  + Update to DEP-5 format
* debian/patches/00_add-fPIC.patch:
  + Dropped, fix upstream
* Closes LP: #413992

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#ifndef DEBUGGER_H
26
26
#define DEBUGGER_H
27
27
 
 
28
#include "archive.h"
 
29
#include "serialized_object.h"
 
30
 
28
31
#include "wx/string.h"
29
32
#include "wx/arrstr.h"
30
33
#include "wx/event.h"
73
76
typedef std::vector<StackEntry> StackEntryArray;
74
77
typedef std::vector<ThreadEntry> ThreadEntryArray;
75
78
 
76
 
class BreakpointInfo
 
79
class BreakpointInfo: public SerializedObject
77
80
{
78
81
public:
79
82
        // Where the bp is: file/lineno, function name (e.g. main()) or the memory location
140
143
                        && (ignore_number == BI.ignore_number) && (conditions == BI.conditions) && (commandlist == BI.commandlist) && (is_temp == BI.is_temp)
141
144
                        && (bp_type==BP_type_watchpt ? (watchpoint_type == BI.watchpoint_type) : true) && (!function_name.IsEmpty() ? (regex == BI.regex) : true));
142
145
        }
 
146
 
 
147
protected:
 
148
        // SerializedObject interface
 
149
        virtual void Serialize(Archive& arch) {
 
150
                arch.Write(wxT("file"), file);
 
151
                arch.Write(wxT("lineno"), lineno);
 
152
                arch.Write(wxT("function_name"), function_name);
 
153
                arch.Write(wxT("memory_address"), memory_address);
 
154
                arch.Write(wxT("bp_type"), bp_type);
 
155
                arch.Write(wxT("watchpoint_type"), watchpoint_type);
 
156
                arch.Write(wxT("watchpt_data"), watchpt_data);
 
157
                arch.Write(wxT("commandlist"), commandlist);
 
158
                arch.Write(wxT("regex"), regex);
 
159
                arch.Write(wxT("is_temp"), is_temp);
 
160
                arch.Write(wxT("internal_id"), internal_id);
 
161
                arch.Write(wxT("debugger_id"), debugger_id);
 
162
                arch.Write(wxT("is_enabled"), is_enabled);
 
163
                arch.Write(wxT("ignore_number"), (int)ignore_number);
 
164
                arch.Write(wxT("conditions"), conditions);
 
165
        }
 
166
 
 
167
        virtual void DeSerialize(Archive& arch) {
 
168
                arch.Read(wxT("file"), file);
 
169
                arch.Read(wxT("lineno"), lineno);
 
170
                arch.Read(wxT("function_name"), function_name);
 
171
                arch.Read(wxT("memory_address"), memory_address);
 
172
                arch.Read(wxT("bp_type"), (int&)bp_type);
 
173
                arch.Read(wxT("watchpoint_type"), (int&)watchpoint_type);
 
174
                arch.Read(wxT("watchpt_data"), watchpt_data);
 
175
                arch.Read(wxT("commandlist"), commandlist);
 
176
                arch.Read(wxT("regex"), regex);
 
177
                arch.Read(wxT("is_temp"), is_temp);
 
178
                arch.Read(wxT("internal_id"), internal_id);
 
179
                arch.Read(wxT("debugger_id"), debugger_id);
 
180
                arch.Read(wxT("is_enabled"), is_enabled);
 
181
                arch.Read(wxT("ignore_number"), (int&)ignore_number);
 
182
                arch.Read(wxT("conditions"), conditions);
 
183
        }
 
184
        //
 
185
};
 
186
 
 
187
/**
 
188
 * @class BreakpointInfoArray a wrapper class to allow saving and reading breakpoint array to and
 
189
 * from the disk
 
190
 * @author eran
 
191
 * @date 07/06/09
 
192
 * @file debugger.h
 
193
 * @brief
 
194
 */
 
195
class BreakpointInfoArray : public SerializedObject
 
196
{
 
197
        std::vector<BreakpointInfo> m_breakpoints;
 
198
public:
 
199
        BreakpointInfoArray() {
 
200
        }
 
201
 
 
202
        virtual ~BreakpointInfoArray() {
 
203
        }
 
204
 
 
205
        BreakpointInfoArray& operator=(const std::vector<BreakpointInfo> &breakpoints) {
 
206
                m_breakpoints = breakpoints;
 
207
                return *this;
 
208
        }
 
209
 
 
210
        void SetBreakpoints(const std::vector<BreakpointInfo>& breakpoints) {
 
211
                this->m_breakpoints = breakpoints;
 
212
        }
 
213
        const std::vector<BreakpointInfo>& GetBreakpoints() const {
 
214
                return m_breakpoints;
 
215
        }
 
216
 
 
217
public:
 
218
        virtual void DeSerialize(Archive& arch) {
 
219
 
 
220
                size_t bt_count(0);
 
221
                m_breakpoints.clear();
 
222
                arch.Read(wxT("Count"), bt_count);
 
223
 
 
224
                for (size_t i=0; i<bt_count; i++) {
 
225
                        wxString name = wxString::Format(wxT("Breakpoint%d"), i);
 
226
                        BreakpointInfo bkpt;
 
227
                        arch.Read(name, (SerializedObject*)&bkpt);
 
228
                        m_breakpoints.push_back( bkpt );
 
229
                }
 
230
        }
 
231
 
 
232
        virtual void Serialize(Archive &arch) {
 
233
 
 
234
                arch.Write(wxT("Count"), (size_t)m_breakpoints.size());
 
235
                for (size_t i=0; i<m_breakpoints.size(); i++) {
 
236
                        wxString name = wxString::Format(wxT("Breakpoint%d"), i);
 
237
                        arch.Write(name, (SerializedObject*)&m_breakpoints.at(i));
 
238
                }
 
239
 
 
240
        }
143
241
};
144
242
 
145
243
class DebuggerInformation
171
269
#else
172
270
                        , consoleCommand(wxT(""))
173
271
#endif
174
 
                        , useRelativeFilePaths(false)
175
 
        {}
 
272
                        , useRelativeFilePaths(false) {}
176
273
        ~DebuggerInformation() {}
177
274
};
178
275
 
301
398
        /**
302
399
         * \brief set break point at given file and line, or function
303
400
         */
304
 
        virtual bool Break(BreakpointInfo& bp) = 0;
 
401
        virtual bool Break(const BreakpointInfo& bp) = 0;
305
402
        /**
306
403
         * \brief remove breakpoint from given file and line
307
404
         */