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"
37
class GDB : public QObject
43
/** Starts GDB. This should be done after connecting to all
44
signals the client is interested in. */
47
/** Executes a command. This method may be called at
48
most once each time 'ready' is emitted. When the
49
GDB instance is just constructed, one should wait
52
The ownership of 'command' is transferred to GDB. */
53
void execute(GDBCommand* command);
55
/** Returns true if 'execute' can be called immediately. */
58
/** FIXME: temporary, to be eliminated. */
59
GDBCommand* currentCommand() const;
61
/** Arrange to gdb to stop doing whatever it's doing,
62
and start waiting for a command.
63
FIXME: probably should make sure that 'ready' is
64
emitted, or something. */
71
/** Emitted when debugger becomes ready -- i.e. when
72
isReady call will return true. */
75
/** Emitted when GDB itself exits. This could happen because
76
it just crashed due to internal bug, or we killed it
80
/** Emitted when GDB reports stop, with 'r' being the
81
data provided by GDB. */
82
void programStopped(const GDBMI::ResultRecord& r);
84
/** Emitted when GDB believes that the program is running. */
85
void programRunning();
87
/** Emitted for each MI stream record found. Presently only
88
used to recognize some CLI messages that mean that the program
90
FIXME: connect to parseCliLine
92
void streamRecord(const GDBMI::StreamRecord& s);
94
/** FIXME: temporary, to be eliminated. */
95
void resultRecord(const GDBMI::ResultRecord& s);
97
/** Emitted for error that is not handled by the
98
command being executed. */
99
void error(const GDBMI::ResultRecord& s);
101
/** Reports output from the running application.
102
Generally output will only be available when
103
using remote GDB targets. When running locally,
104
the output will either appear on GDB stdout, and
105
ignored, or routed via pty. */
106
void applicationOutput(const QString& s);
108
/** Reports output of a command explicitly typed by
109
the user, or output from .gdbinit commands. */
110
void userCommandOutput(const QString& s);
112
/** Reports output of a command issued internally
113
by KDevelop. At the moment, stderr output from
114
GDB and the 'log' MI channel will be also routed here. */
115
void internalCommandOutput(const QString& s);
118
void readyReadStandardOutput();
119
void readyReadStandardError();
120
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
121
void processErrored(QProcess::ProcessError);
124
void processLine(const QByteArray& line);
131
GDBCommand* currentCmd_;
135
/** The unprocessed output from gdb. Output is
136
processed as soon as we see newline. */