2
* Low level GDB interface.
4
* Copyright 2007 Vladimir Prus <ghost@cs.msu.su>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as
8
* published by the Free Software Foundation; either version 2 of the
9
* License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public
17
* License along with this program; if not, write to the
18
* Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
#ifndef GDB_H_d5c9cb274cbad688fe7a507a84f6633b
23
#define GDB_H_d5c9cb274cbad688fe7a507a84f6633b
26
#include "mi/miparser.h"
27
#include "gdbcommand.h"
39
class GDB : public QObject
45
/** Starts GDB. This should be done after connecting to all
46
signals the client is interested in. */
47
void start(KConfigGroup& config);
49
/** Executes a command. This method may be called at
50
most once each time 'ready' is emitted. When the
51
GDB instance is just constructed, one should wait
54
The ownership of 'command' is transferred to GDB. */
55
void execute(GDBCommand* command);
57
/** Returns true if 'execute' can be called immediately. */
60
/** FIXME: temporary, to be eliminated. */
61
GDBCommand* currentCommand() const;
63
/** Arrange to gdb to stop doing whatever it's doing,
64
and start waiting for a command.
65
FIXME: probably should make sure that 'ready' is
66
emitted, or something. */
73
/** Emitted when debugger becomes ready -- i.e. when
74
isReady call will return true. */
77
/** Emitted when GDB itself exits. This could happen because
78
it just crashed due to internal bug, or we killed it
82
/** Emitted when GDB reports stop, with 'r' being the
83
data provided by GDB. */
84
void programStopped(const GDBMI::ResultRecord& r);
86
/** Emitted when GDB believes that the program is running. */
87
void programRunning();
89
/** Emitted for each MI stream record found. Presently only
90
used to recognize some CLI messages that mean that the program
92
FIXME: connect to parseCliLine
94
void streamRecord(const GDBMI::StreamRecord& s);
96
/** FIXME: temporary, to be eliminated. */
97
void resultRecord(const GDBMI::ResultRecord& s);
99
/** Reports a general MI notification. */
100
void notification(const GDBMI::ResultRecord& n);
102
/** Emitted for error that is not handled by the
103
command being executed. */
104
void error(const GDBMI::ResultRecord& s);
106
/** Reports output from the running application.
107
Generally output will only be available when
108
using remote GDB targets. When running locally,
109
the output will either appear on GDB stdout, and
110
ignored, or routed via pty. */
111
void applicationOutput(const QString& s);
113
/** Reports output of a command explicitly typed by
114
the user, or output from .gdbinit commands. */
115
void userCommandOutput(const QString& s);
117
/** Reports output of a command issued internally
118
by KDevelop. At the moment, stderr output from
119
GDB and the 'log' MI channel will be also routed here. */
120
void internalCommandOutput(const QString& s);
123
void readyReadStandardOutput();
124
void readyReadStandardError();
125
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
126
void processErrored(QProcess::ProcessError);
129
void processLine(const QByteArray& line);
136
GDBCommand* currentCmd_;
140
/** The unprocessed output from gdb. Output is
141
processed as soon as we see newline. */