forked from robertknight/Qt-Inspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GdbLibraryInjector.h
42 lines (32 loc) · 1003 Bytes
/
GdbLibraryInjector.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
#pragma once
#include "Injector.h"
#include <QtCore/QStringList>
class QProcess;
class QTextStream;
/** Injector which uses GDB to attach to an external process,
* load a library it and then invoke a specified
* entry point in the library.
*/
class GdbLibraryInjector : public Injector
{
public:
// implements Injector
bool startAndInject(const QString& program, const QStringList& args,
const QString& libraryPath, const QString& entryPoint,
int* pid);
bool inject(int pid, const QString& libraryPath, const QString& entryPoint);
private:
struct TargetInfo
{
TargetInfo()
: pid(0)
{}
int pid;
QString program;
QStringList args;
};
bool inject(const TargetInfo& target, const QString& libraryPath, const QString& entryPoint,
int* outPid);
void logToFile(QProcess* gdbProcess, QTextStream* stream);
bool readGdbResponse(QTextStream* gdbStream, const QString& command, QStringList* lines);
};