parent
a9d32ce742
commit
f2504e1f43
|
@ -211,7 +211,7 @@ void CompilerManager::run(const QString &filename, const QString &arguments, con
|
|||
}
|
||||
ExecutableRunner * execRunner;
|
||||
if (programHasConsole(filename)) {
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
int consoleFlag=0;
|
||||
if (redirectInput)
|
||||
consoleFlag |= RPF_REDIRECT_INPUT;
|
||||
|
|
|
@ -25,6 +25,7 @@ Debugger::Debugger(QObject *parent) : QObject(parent)
|
|||
mRegisterModel = new RegisterModel(this);
|
||||
mExecuting = false;
|
||||
mReader = nullptr;
|
||||
mTarget = nullptr;
|
||||
mCommandChanged = false;
|
||||
mLeftPageIndexBackup = -1;
|
||||
|
||||
|
@ -32,7 +33,7 @@ Debugger::Debugger(QObject *parent) : QObject(parent)
|
|||
this, &Debugger::fetchVarChildren);
|
||||
}
|
||||
|
||||
bool Debugger::start()
|
||||
bool Debugger::start(const QString& inferior)
|
||||
{
|
||||
Settings::PCompilerSet compilerSet = pSettings->compilerSets().defaultSet();
|
||||
if (!compilerSet) {
|
||||
|
@ -61,7 +62,32 @@ bool Debugger::start()
|
|||
tr("Can''t find debugger in : \"%1\"").arg(debuggerPath));
|
||||
return false;
|
||||
}
|
||||
if (pSettings->debugger().useGDBServer()) {
|
||||
if (!isTextAllAscii(compilerSet->debugServer())) {
|
||||
mExecuting = false;
|
||||
QMessageBox::critical(pMainWindow,
|
||||
tr("GDB Server path error"),
|
||||
tr("GDB Server's path \"%1\" contains non-ascii characters.")
|
||||
.arg(compilerSet->debugServer())
|
||||
+ "<br />"
|
||||
+ tr("This prevents it from executing."));
|
||||
return false;
|
||||
}
|
||||
if (!fileExists(compilerSet->debugServer())) {
|
||||
mExecuting = false;
|
||||
QMessageBox::critical(pMainWindow,
|
||||
tr("GDB Server not exists"),
|
||||
tr("Can''t find gdb server in : \"%1\"").arg(compilerSet->debugServer()));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
mWatchModel->resetAllVarInfos();
|
||||
if (pSettings->debugger().useGDBServer()) {
|
||||
mTarget = new DebugTarget(inferior,compilerSet->debugServer(),pSettings->debugger().GDBServerPort());
|
||||
mTarget->start();
|
||||
mTarget->waitStart();
|
||||
}
|
||||
mReader = new DebugReader(this);
|
||||
mReader->setDebuggerPath(debuggerPath);
|
||||
connect(mReader, &QThread::finished,this,&Debugger::clearUpReader);
|
||||
|
@ -120,10 +146,16 @@ void Debugger::clearUpReader()
|
|||
if (mExecuting) {
|
||||
mExecuting = false;
|
||||
|
||||
if (mTarget) {
|
||||
mTarget->deleteLater();
|
||||
mTarget = nullptr;
|
||||
}
|
||||
//stop debugger
|
||||
mReader->deleteLater();
|
||||
mReader=nullptr;
|
||||
|
||||
|
||||
|
||||
if (pMainWindow->cpuDialog()!=nullptr) {
|
||||
pMainWindow->cpuDialog()->close();
|
||||
}
|
||||
|
@ -1288,7 +1320,7 @@ void DebugReader::run()
|
|||
QString arguments = "--interpret=mi --silent";
|
||||
QString workingDir = QFileInfo(mDebuggerPath).path();
|
||||
|
||||
mProcess = new QProcess();
|
||||
mProcess = std::make_shared<QProcess>();
|
||||
mProcess->setProgram(cmd);
|
||||
mProcess->setArguments(QProcess::splitCommand(arguments));
|
||||
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
@ -1307,7 +1339,7 @@ void DebugReader::run()
|
|||
}
|
||||
mProcess->setWorkingDirectory(workingDir);
|
||||
|
||||
connect(mProcess, &QProcess::errorOccurred,
|
||||
connect(mProcess.get(), &QProcess::errorOccurred,
|
||||
[&](){
|
||||
errorOccurred= true;
|
||||
});
|
||||
|
@ -2174,3 +2206,103 @@ void RegisterModel::clear()
|
|||
mRegisterValues.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
DebugTarget::DebugTarget(
|
||||
const QString &inferior,
|
||||
const QString &GDBServer,
|
||||
int port,
|
||||
QObject *parent):
|
||||
QThread(parent),
|
||||
mInferior(inferior),
|
||||
mGDBServer(GDBServer),
|
||||
mPort(port),
|
||||
mStop(false),
|
||||
mStartSemaphore(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DebugTarget::stopDebug()
|
||||
{
|
||||
mStop = true;
|
||||
}
|
||||
|
||||
void DebugTarget::waitStart()
|
||||
{
|
||||
mStartSemaphore.acquire(1);
|
||||
}
|
||||
|
||||
void DebugTarget::run()
|
||||
{
|
||||
mStop = false;
|
||||
bool errorOccurred = false;
|
||||
|
||||
//find first available port
|
||||
QString cmd;
|
||||
QString arguments;
|
||||
#ifdef Q_OS_WIN
|
||||
cmd= mGDBServer;
|
||||
arguments = QString(" localhost:%1 \"%2\"").arg(mPort).arg(mInferior);
|
||||
#else
|
||||
cmd= "/usr/bin/x-terminal-emulator";
|
||||
arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior);
|
||||
#endif
|
||||
QString workingDir = QFileInfo(mInferior).path();
|
||||
|
||||
mProcess = std::make_shared<QProcess>();
|
||||
mProcess->setProgram(cmd);
|
||||
mProcess->setArguments(QProcess::splitCommand(arguments));
|
||||
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||
QString cmdDir = extractFileDir(cmd);
|
||||
if (!cmdDir.isEmpty()) {
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString path = env.value("PATH");
|
||||
cmdDir.replace("/",QDir::separator());
|
||||
if (path.isEmpty()) {
|
||||
path = cmdDir;
|
||||
} else {
|
||||
path = cmdDir + PATH_SEPARATOR + path;
|
||||
}
|
||||
env.insert("PATH",path);
|
||||
mProcess->setProcessEnvironment(env);
|
||||
}
|
||||
mProcess->setWorkingDirectory(workingDir);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
mProcess->setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){
|
||||
if (programHasConsole(mInferior)) {
|
||||
args->flags |= CREATE_NEW_CONSOLE;
|
||||
args->flags &= ~CREATE_NO_WINDOW;
|
||||
}
|
||||
args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES;
|
||||
});
|
||||
#endif
|
||||
|
||||
connect(mProcess.get(), &QProcess::errorOccurred,
|
||||
[&](){
|
||||
errorOccurred= true;
|
||||
});
|
||||
mProcess->start();
|
||||
mProcess->waitForStarted(5000);
|
||||
mStartSemaphore.release(1);
|
||||
while (true) {
|
||||
mProcess->waitForFinished(1);
|
||||
if (mProcess->state()!=QProcess::Running) {
|
||||
break;
|
||||
}
|
||||
if (mStop) {
|
||||
mProcess->closeReadChannel(QProcess::StandardOutput);
|
||||
mProcess->closeReadChannel(QProcess::StandardError);
|
||||
mProcess->closeWriteChannel();
|
||||
mProcess->terminate();
|
||||
mProcess->kill();
|
||||
break;
|
||||
}
|
||||
if (errorOccurred)
|
||||
break;
|
||||
msleep(1);
|
||||
}
|
||||
if (errorOccurred) {
|
||||
emit processError(mProcess->error());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ private:
|
|||
|
||||
|
||||
class DebugReader;
|
||||
class DebugTarget;
|
||||
class Editor;
|
||||
|
||||
using PDebugReader = std::shared_ptr<DebugReader>;
|
||||
|
@ -190,7 +191,7 @@ class Debugger : public QObject
|
|||
public:
|
||||
explicit Debugger(QObject *parent = nullptr);
|
||||
// Play/pause
|
||||
bool start();
|
||||
bool start(const QString& inferior);
|
||||
void sendCommand(const QString& command, const QString& params,
|
||||
DebugCommandSource source = DebugCommandSource::Other);
|
||||
bool commandRunning();
|
||||
|
@ -264,9 +265,34 @@ private:
|
|||
WatchModel *mWatchModel;
|
||||
RegisterModel *mRegisterModel;
|
||||
DebugReader *mReader;
|
||||
DebugTarget *mTarget;
|
||||
int mLeftPageIndexBackup;
|
||||
};
|
||||
|
||||
class DebugTarget: public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DebugTarget(const QString& inferior,
|
||||
const QString& GDBServer,
|
||||
int port,
|
||||
QObject *parent = nullptr);
|
||||
void stopDebug();
|
||||
void waitStart();
|
||||
signals:
|
||||
void processError(QProcess::ProcessError error);
|
||||
private:
|
||||
QString mInferior;
|
||||
QString mGDBServer;
|
||||
int mPort;
|
||||
bool mStop;
|
||||
std::shared_ptr<QProcess> mProcess;
|
||||
QSemaphore mStartSemaphore;
|
||||
|
||||
// QThread interface
|
||||
protected:
|
||||
void run() override;
|
||||
};
|
||||
|
||||
class DebugReader : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -388,7 +414,7 @@ private:
|
|||
//fOnInvalidateAllVars: TInvalidateAllVarsEvent;
|
||||
bool mCmdRunning;
|
||||
PDebugCommand mCurrentCmd;
|
||||
QProcess* mProcess;
|
||||
std::shared_ptr<QProcess> mProcess;
|
||||
|
||||
//fWatchView: TTreeView;
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
#include "platform.h"
|
||||
#include "parser/parserutils.h"
|
||||
#include "editorlist.h"
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
class WindowLogoutEventFilter : public QAbstractNativeEventFilter {
|
||||
|
||||
// QAbstractNativeEventFilter interface
|
||||
|
@ -158,7 +158,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
mainWindow.show();
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
WindowLogoutEventFilter filter;
|
||||
app.installNativeEventFilter(&filter);
|
||||
#endif
|
||||
|
|
|
@ -1552,7 +1552,7 @@ void MainWindow::debug()
|
|||
|
||||
// mDebugger->setUseUTF8(e->fileEncoding() == ENCODING_UTF8 || e->fileEncoding() == ENCODING_UTF8_BOM);
|
||||
|
||||
if (!mDebugger->start())
|
||||
if (!mDebugger->start(filePath))
|
||||
return;
|
||||
filePath.replace('\\','/');
|
||||
mDebugger->sendCommand("-file-exec-and-symbols", '"' + filePath + '"');
|
||||
|
@ -1629,10 +1629,10 @@ void MainWindow::debug()
|
|||
}
|
||||
|
||||
prepareDebugger();
|
||||
|
||||
if (!mDebugger->start())
|
||||
QString filePath = debugFile.filePath().replace('\\','/');
|
||||
if (!mDebugger->start(filePath))
|
||||
return;
|
||||
mDebugger->sendCommand("-file-exec-and-symbols", QString("\"%1\"").arg(debugFile.filePath().replace('\\','/')));
|
||||
mDebugger->sendCommand("-file-exec-and-symbols", QString("\"%1\"").arg(filePath));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1662,42 +1662,23 @@ void MainWindow::debug()
|
|||
mDebugger->sendCommand("-enable-pretty-printing","");
|
||||
mDebugger->sendCommand("-data-list-register-names","");
|
||||
mDebugger->sendCommand("-gdb-set", "width 0"); // don't wrap output, very annoying
|
||||
#ifdef Q_OS_WIN
|
||||
mDebugger->sendCommand("-gdb-set", "new-console on");
|
||||
#elif defined(Q_OS_LINUX)
|
||||
mDebugger->sendCommand("tty", "/dev/pts/11");
|
||||
#else
|
||||
#endif
|
||||
mDebugger->sendCommand("-gdb-set", "confirm off");
|
||||
mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements
|
||||
mDebugger->sendCommand("-gdb-set", "print elements 0"); // don't limit elements
|
||||
mDebugger->sendCommand("-environment-cd", excludeTrailingPathDelimiter(debugFile.path())); // restore working directory
|
||||
if (!debugInferiorhasBreakpoint()) {
|
||||
switch(getCompileTarget()) {
|
||||
case CompileTarget::None:
|
||||
return;
|
||||
case CompileTarget::File:
|
||||
mDebugger->sendCommand("-exec-run", "--start");
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
mDebugger->sendCommand("-exec-run", "--start");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (pSettings->debugger().useGDBServer()) {
|
||||
mDebugger->sendCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort()));
|
||||
mDebugger->sendCommand("-exec-continue","");
|
||||
} else {
|
||||
#ifdef Q_OS_WIN
|
||||
mDebugger->sendCommand("-gdb-set", "new-console on");
|
||||
#endif
|
||||
if (!debugInferiorhasBreakpoint()) {
|
||||
mDebugger->sendCommand("-exec-run", "--start");
|
||||
} else {
|
||||
switch(getCompileTarget()) {
|
||||
case CompileTarget::None:
|
||||
return;
|
||||
case CompileTarget::File:
|
||||
mDebugger->sendCommand("-exec-run","");
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
mDebugger->sendCommand("-exec-run","");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3979,7 +3960,7 @@ void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int tot
|
|||
// ui->lblProblem->setText(mOJProblemModel.getProblemTitle());
|
||||
}
|
||||
|
||||
void MainWindow::onOJProblemCaseNewOutputLineGetted(const QString &id, const QString &line)
|
||||
void MainWindow::onOJProblemCaseNewOutputLineGetted(const QString &, const QString &line)
|
||||
{
|
||||
ui->txtProblemCaseOutput->append(line);
|
||||
}
|
||||
|
|
|
@ -506,7 +506,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
|
|
@ -1167,7 +1167,7 @@ void Settings::Editor::doLoad()
|
|||
mRightEdgeLineColor = colorValue("right_edge_line_color",QColorConstants::Svg::yellow);
|
||||
|
||||
//Font
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
mFontName = stringValue("font_name","consolas");
|
||||
#else
|
||||
mFontName = stringValue("font_name","Dejavu Sans Mono");
|
||||
|
@ -1186,7 +1186,7 @@ void Settings::Editor::doLoad()
|
|||
mGutterLineNumbersStartZero = boolValue("gutter_line_numbers_start_zero",false);
|
||||
mGutterUseCustomFont = boolValue("gutter_use_custom_font",false);
|
||||
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
mGutterFontName = stringValue("gutter_font_name","consolas");
|
||||
#else
|
||||
mGutterFontName = stringValue("gutter_font_name","Dejavu Sans Mono");
|
||||
|
@ -1339,10 +1339,10 @@ Settings::CompilerSet::CompilerSet(const QString& compilerFolder):
|
|||
mStaticLink(true)
|
||||
{
|
||||
if (!compilerFolder.isEmpty()) {
|
||||
setProperties(compilerFolder+"/bin");
|
||||
setProperties(compilerFolder);
|
||||
|
||||
//manually set the directories
|
||||
setDirectories(compilerFolder+"/bin");
|
||||
setDirectories(compilerFolder);
|
||||
|
||||
setExecutables();
|
||||
|
||||
|
@ -1915,6 +1915,7 @@ void Settings::CompilerSet::setExecutables()
|
|||
mCCompiler = findProgramInBinDirs(GCC_PROGRAM);
|
||||
mCppCompiler = findProgramInBinDirs(GPP_PROGRAM);
|
||||
mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
||||
mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM);
|
||||
mMake = findProgramInBinDirs(MAKE_PROGRAM);
|
||||
mResourceCompiler = findProgramInBinDirs(WINDRES_PROGRAM);
|
||||
mProfiler = findProgramInBinDirs(GPROF_PROGRAM);
|
||||
|
@ -2255,6 +2256,16 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
|
|||
return result.trimmed();
|
||||
}
|
||||
|
||||
const QString &Settings::CompilerSet::debugServer() const
|
||||
{
|
||||
return mDebugServer;
|
||||
}
|
||||
|
||||
void Settings::CompilerSet::setDebugServer(const QString &newDebugServer)
|
||||
{
|
||||
mDebugServer = newDebugServer;
|
||||
}
|
||||
|
||||
int Settings::CompilerSet::compilerSetType() const
|
||||
{
|
||||
return mCompilerSetType;
|
||||
|
@ -2384,12 +2395,12 @@ static void setProfileOptions(Settings::PCompilerSet pSet) {
|
|||
pSet->setStaticLink(false);
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::addSets(const QString &folder)
|
||||
bool Settings::CompilerSets::addSets(const QString &folder)
|
||||
{
|
||||
if (!directoryExists(folder))
|
||||
return;
|
||||
if (!fileExists(includeTrailingPathDelimiter(folder)+"bin"+QDir::separator()+GCC_PROGRAM)) {
|
||||
return;
|
||||
return false;
|
||||
if (!fileExists(includeTrailingPathDelimiter(folder)+GCC_PROGRAM)) {
|
||||
return false;
|
||||
}
|
||||
// Default, release profile
|
||||
PCompilerSet baseSet = addSet(folder);
|
||||
|
@ -2436,6 +2447,7 @@ void Settings::CompilerSets::addSets(const QString &folder)
|
|||
setProfileOptions(baseSet);
|
||||
|
||||
mDefaultIndex = mList.size() - 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::clearSets()
|
||||
|
@ -2452,18 +2464,14 @@ void Settings::CompilerSets::clearSets()
|
|||
void Settings::CompilerSets::findSets()
|
||||
{
|
||||
clearSets();
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW32");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW64");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW32"+QDir::separator()+"bin");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW64"+QDir::separator()+"bin");
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString path = env.value("PATH");
|
||||
QStringList pathList = path.split(PATH_SEPARATOR);
|
||||
foreach (const QString& s, pathList){
|
||||
if (s.endsWith(QString(QDir::separator())+"bin")) {
|
||||
QString temp = s.mid(0,s.length()-4);
|
||||
qDebug()<<temp;
|
||||
addSets(temp);
|
||||
}
|
||||
addSets(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2655,6 +2663,7 @@ void Settings::CompilerSets::saveSet(int index)
|
|||
savePath("ccompiler", pSet->CCompiler());
|
||||
savePath("cppcompiler", pSet->cppCompiler());
|
||||
savePath("debugger", pSet->debugger());
|
||||
savePath("debug_server", pSet->debugServer());
|
||||
savePath("make", pSet->make());
|
||||
savePath("windres", pSet->resourceCompiler());
|
||||
savePath("profiler", pSet->profiler());
|
||||
|
@ -2719,6 +2728,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
|||
pSet->setCCompiler(loadPath("ccompiler"));
|
||||
pSet->setCppCompiler(loadPath("cppcompiler"));
|
||||
pSet->setDebugger(loadPath("debugger"));
|
||||
pSet->setDebugServer(loadPath("debug_server"));
|
||||
pSet->setMake(loadPath("make"));
|
||||
pSet->setResourceCompiler(loadPath("windres"));
|
||||
pSet->setProfiler(loadPath("profiler"));
|
||||
|
@ -3039,7 +3049,7 @@ void Settings::Executor::doLoad()
|
|||
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
||||
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
mCaseEditorFontName = stringValue("case_editor_font_name","consolas");
|
||||
#else
|
||||
mCaseEditorFontName = stringValue("case_editor_font_name","Dejavu Sans Mono");
|
||||
|
@ -3144,6 +3154,26 @@ void Settings::Debugger::setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSigna
|
|||
mOpenCPUInfoWhenSignaled = newOpenCPUInfoWhenSignaled;
|
||||
}
|
||||
|
||||
bool Settings::Debugger::useGDBServer() const
|
||||
{
|
||||
return mUseGDBServer;
|
||||
}
|
||||
|
||||
void Settings::Debugger::setUseGDBServer(bool newUseGDBServer)
|
||||
{
|
||||
mUseGDBServer = newUseGDBServer;
|
||||
}
|
||||
|
||||
int Settings::Debugger::GDBServerPort() const
|
||||
{
|
||||
return mGDBServerPort;
|
||||
}
|
||||
|
||||
void Settings::Debugger::setGDBServerPort(int newGDBServerPort)
|
||||
{
|
||||
mGDBServerPort = newGDBServerPort;
|
||||
}
|
||||
|
||||
bool Settings::Debugger::autosaveBreakpoints() const
|
||||
{
|
||||
return mAutosaveBreakpoints;
|
||||
|
@ -3199,6 +3229,8 @@ void Settings::Debugger::doSave()
|
|||
saveValue("autosave_breakpoints",mAutosaveBreakpoints);
|
||||
saveValue("autosave_watches",mAutosaveWatches);
|
||||
saveValue("open_cpu_info_when_signaled",mOpenCPUInfoWhenSignaled);
|
||||
saveValue("use_gdb_server", mUseGDBServer);
|
||||
saveValue("gdb_server_port",mGDBServerPort);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3206,7 +3238,7 @@ void Settings::Debugger::doLoad()
|
|||
{
|
||||
mEnableDebugConsole = boolValue("enable_debug_console",true);
|
||||
mShowDetailLog = boolValue("show_detail_log",false);
|
||||
#ifdef Q_WIN_OS
|
||||
#ifdef Q_OS_WIN
|
||||
mFontName = stringValue("font_name","Consolas");
|
||||
#else
|
||||
mFontName = stringValue("font_name","Dejavu Sans Mono");
|
||||
|
@ -3221,6 +3253,12 @@ void Settings::Debugger::doLoad()
|
|||
mAutosaveBreakpoints = boolValue("autosave_breakpoints",true);
|
||||
mAutosaveWatches = boolValue("autosave_watches",true);
|
||||
mOpenCPUInfoWhenSignaled = boolValue("open_cpu_info_when_signaled",true);
|
||||
#ifdef Q_OS_WIN
|
||||
mUseGDBServer = boolValue("use_gdb_server", false);
|
||||
#else
|
||||
mUseGDBServer = boolValue("use_gdb_server", true);
|
||||
#endif
|
||||
mGDBServerPort = intValue("gdb_server_port",41234);
|
||||
}
|
||||
|
||||
Settings::History::History(Settings *settings):_Base(settings, SETTING_HISTORY)
|
||||
|
|
|
@ -1013,6 +1013,11 @@ public:
|
|||
bool openCPUInfoWhenSignaled() const;
|
||||
void setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled);
|
||||
|
||||
bool useGDBServer() const;
|
||||
void setUseGDBServer(bool newUseGDBServer);
|
||||
int GDBServerPort() const;
|
||||
void setGDBServerPort(int newGDBServerPort);
|
||||
|
||||
private:
|
||||
bool mEnableDebugConsole;
|
||||
bool mShowDetailLog;
|
||||
|
@ -1027,6 +1032,8 @@ public:
|
|||
bool mAutosaveBreakpoints;
|
||||
bool mAutosaveWatches;
|
||||
bool mOpenCPUInfoWhenSignaled;
|
||||
bool mUseGDBServer;
|
||||
int mGDBServerPort;
|
||||
|
||||
// _Base interface
|
||||
protected:
|
||||
|
@ -1072,6 +1079,8 @@ public:
|
|||
void setProfiler(const QString& name);
|
||||
const QString& resourceCompiler() const;
|
||||
void setResourceCompiler(const QString& name);
|
||||
const QString &debugServer() const;
|
||||
void setDebugServer(const QString &newDebugServer);
|
||||
|
||||
QStringList& binDirs();
|
||||
QStringList& CIncludeDirs();
|
||||
|
@ -1144,6 +1153,7 @@ public:
|
|||
QString mDebugger;
|
||||
QString mProfiler;
|
||||
QString mResourceCompiler;
|
||||
QString mDebugServer;
|
||||
|
||||
// Directories, mostly hardcoded too
|
||||
QStringList mBinDirs;
|
||||
|
@ -1186,7 +1196,7 @@ public:
|
|||
PCompilerSet addSet(const CompilerSet& set);
|
||||
PCompilerSet addSet(const QString& folder=QString());
|
||||
|
||||
void addSets(const QString& folder);
|
||||
bool addSets(const QString& folder);
|
||||
void clearSets();
|
||||
void findSets();
|
||||
void saveSets();
|
||||
|
|
|
@ -110,6 +110,7 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
|
|||
ui->txtCppCompiler->setText(pSet->cppCompiler());
|
||||
ui->txtMake->setText(pSet->make());
|
||||
ui->txtDebugger->setText(pSet->debugger());
|
||||
ui->txtGDBServer->setText(pSet->debugServer());
|
||||
ui->txtResourceCompiler->setText(pSet->resourceCompiler());
|
||||
ui->txtProfiler->setText(pSet->profiler());
|
||||
}
|
||||
|
@ -185,6 +186,7 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet()
|
|||
pSet->setCppCompiler(ui->txtCppCompiler->text().trimmed());
|
||||
pSet->setMake(ui->txtMake->text().trimmed());
|
||||
pSet->setDebugger(ui->txtDebugger->text().trimmed());
|
||||
pSet->setDebugServer(ui->txtGDBServer->text().trimmed());
|
||||
pSet->setResourceCompiler(ui->txtResourceCompiler->text().trimmed());
|
||||
pSet->setProfiler(ui->txtProfiler->text().trimmed());
|
||||
|
||||
|
@ -246,7 +248,9 @@ void CompilerSetOptionWidget::on_btnAddCompilerSetByFolder_pressed()
|
|||
QString folder = QFileDialog::getExistingDirectory(this, tr("Compiler Set Folder"));
|
||||
int oldSize = pSettings->compilerSets().size();
|
||||
|
||||
pSettings->compilerSets().addSets(folder);
|
||||
if (!pSettings->compilerSets().addSets(folder)) {
|
||||
pSettings->compilerSets().addSets(folder+QDir::separator()+"bin");
|
||||
}
|
||||
doLoad();
|
||||
int newSize = pSettings->compilerSets().size();
|
||||
if (oldSize == newSize) {
|
||||
|
@ -277,4 +281,11 @@ void CompilerSetOptionWidget::updateIcons()
|
|||
pIconsManager->setIcon(ui->btnRemoveCompilerSet, IconsManager::ACTION_MISC_REMOVE);
|
||||
pIconsManager->setIcon(ui->btnRenameCompilerSet, IconsManager::ACTION_MISC_RENAME);
|
||||
|
||||
pIconsManager->setIcon(ui->btnChooseCCompiler, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseCppCompiler, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseGDB, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseGDBServer, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseMake, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseProfiler, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
pIconsManager->setIcon(ui->btnChooseResourceCompiler, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="settingTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
|
@ -238,15 +238,45 @@
|
|||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="btnChooseMake">
|
||||
<property name="toolTip">
|
||||
<string>Choose make</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Resource Compiler(windres)</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtCppCompiler"/>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>C Compiler(gcc)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QToolButton" name="btnChooseProfiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose Profiler</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="txtResourceCompiler"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
|
@ -270,6 +300,44 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Profiler(gprof)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="txtProfiler"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>make</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="btnChooseGDB">
|
||||
<property name="toolTip">
|
||||
<string>Choose Debugger</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="txtDebugger"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="txtMake"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="btnChooseCCompiler">
|
||||
<property name="toolTip">
|
||||
|
@ -285,81 +353,18 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="txtCCompiler"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>C Compiler(gcc)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtCppCompiler"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Debugger(gdb)</string>
|
||||
<string>gdb</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Profiler(gprof)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>make</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="txtMake"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="txtDebugger"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="txtResourceCompiler"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="txtProfiler"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="btnChooseMake">
|
||||
<property name="toolTip">
|
||||
<string>Choose make</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="btnChooseDebugger">
|
||||
<property name="toolTip">
|
||||
<string>Choose Debugger</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="chooseResourceCompiler">
|
||||
<item row="5" column="2">
|
||||
<widget class="QToolButton" name="btnChooseResourceCompiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose Resource Compiler</string>
|
||||
</property>
|
||||
|
@ -373,18 +378,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QToolButton" name="chooseProfiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose Profiler</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="txtCCompiler"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>gdb server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Resource Compiler(windres)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="txtGDBServer"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="btnChooseGDBServer">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -410,6 +431,8 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -34,6 +34,11 @@ void DebugGeneralWidget::doLoad()
|
|||
ui->chkSkipCustomLib->setChecked(pSettings->debugger().skipCustomLibraries());
|
||||
ui->chkAutosaveBreakpoints->setChecked(pSettings->debugger().autosaveBreakpoints());
|
||||
ui->chkAutosaveWatches->setChecked(pSettings->debugger().autosaveWatches());
|
||||
#ifdef Q_OS_WIN
|
||||
ui->grpUseGDBServer->setCheckable(true);
|
||||
ui->grpUseGDBServer->setChecked(pSettings->debugger().useGDBServer());
|
||||
#endif
|
||||
ui->spinGDBServerPort->setValue(pSettings->debugger().GDBServerPort());
|
||||
}
|
||||
|
||||
void DebugGeneralWidget::doSave()
|
||||
|
@ -51,6 +56,10 @@ void DebugGeneralWidget::doSave()
|
|||
pSettings->debugger().setSkipCustomLibraries(ui->chkSkipCustomLib->isChecked());
|
||||
pSettings->debugger().setAutosaveBreakpoints(ui->chkAutosaveBreakpoints->isChecked());
|
||||
pSettings->debugger().setAutosaveWatches(ui->chkAutosaveWatches->isChecked());
|
||||
#ifdef Q_OS_WIN
|
||||
pSettings->debugger().setUseGDBServer(ui->grpUseGDBServer->isChecked());
|
||||
#endif
|
||||
pSettings->debugger().setGDBServerPort(ui->spinGDBServerPort->value());
|
||||
pSettings->debugger().save();
|
||||
pMainWindow->updateDebuggerSettings();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,48 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpUseGDBServer">
|
||||
<property name="title">
|
||||
<string>Use GDB Server to debug</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>GDB Server Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinGDBServerPort">
|
||||
<property name="minimum">
|
||||
<number>1025</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSkipSystemLib">
|
||||
<property name="text">
|
||||
|
@ -40,6 +82,9 @@
|
|||
<property name="title">
|
||||
<string>Debug Console</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>11</number>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define GCC_PROGRAM "gcc.exe"
|
||||
#define GPP_PROGRAM "g++.exe"
|
||||
#define GDB_PROGRAM "gdb.exe"
|
||||
#define GDB_SERVER_PROGRAM "gdbserver.exe"
|
||||
#define GDB32_PROGRAM "gdb32.exe"
|
||||
#define MAKE_PROGRAM "mingw32-make.exe"
|
||||
#define WINDRES_PROGRAM "windres.exe"
|
||||
|
@ -18,6 +19,7 @@
|
|||
#define GCC_PROGRAM "gcc"
|
||||
#define GPP_PROGRAM "g++"
|
||||
#define GDB_PROGRAM "gdb"
|
||||
#define GDB_SERVER_PROGRAM "gdbserver"
|
||||
#define GDB32_PROGRAM "gdb32"
|
||||
#define MAKE_PROGRAM "make"
|
||||
#define WINDRES_PROGRAM ""
|
||||
|
|
Loading…
Reference in New Issue