-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVgdbComm.h
71 lines (39 loc) · 1.6 KB
/
VgdbComm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// VgdbComm.cpp
// Implements the VgdbComm class representing an interface to communicate with a vgdb
#ifndef VGDBCOMM_H
#define VGDBCOMM_H
#include <vector>
#include <QObject>
class VgdbComm
{
public:
/** Type used to describe a single instance of a process being run under Valgrind's Massif tool. */
typedef std::pair<qint64, QString> InstanceDesc;
VgdbComm();
/** Checks whether vgdb is available on this system.
Returns true if vgdb is available, false if not. */
static bool checkAvailability();
/** Returns the descriptions of running valgrind instances.
Returns a vector of pairs, each pair describes one instance as a pid and command. */
static std::vector<InstanceDesc> listRunningInstances();
/** Captures a snapshot of the instance specified by its Pid, into a file. */
static bool captureSnapshot(
quint64 a_InstancePid,
const QString & a_FileName,
QByteArray & a_StdOut,
QByteArray & a_StdErr
);
/** Launches a new valgrind massif instance for the specified executable, passing the parameters to it.
Returns the pid of the new instance on success, -1 on error.
The process is started detached, so that it continues running even if VMD terminates. */
static qint64 launchNewInstance(
const QString & a_Executable,
const QString & a_Parameters,
const QString & a_StartFolder
);
protected:
/** Runs vgdb with the specified parameters, and captures its stdout and stderr.
Returns the process exit code, or -1 if the process errored. */
static int runVgdbCommand(const QStringList & a_Command, QByteArray & a_StdOut, QByteArray & a_StdErr);
};
#endif // VGDBCOMM_H