forked from qt-creator/qt-creator
Debuggers: Enable Python-dumpers for Windows-built gdb.
Engine: Introduce convention of setting the PYTHONPATH variable to <path-to-gdb>\python2.5 for WIndows. Dumpers: Import 'curses' depending on platform, fix Syntax for 2.5, catch file lock errors by os.remove. Reviewed-by: hjk
This commit is contained in:
@@ -7,7 +7,10 @@ import sys
|
||||
import traceback
|
||||
import gdb
|
||||
import base64
|
||||
import curses.ascii
|
||||
import os
|
||||
|
||||
if os.name != "nt":
|
||||
import curses.ascii
|
||||
|
||||
# only needed for gdb 7.0/7.0.1 that do not implement parse_and_eval
|
||||
import os
|
||||
@@ -40,7 +43,7 @@ def cleanAddress(addr):
|
||||
def numericTemplateArgument(type, position):
|
||||
try:
|
||||
return int(type.template_argument(position))
|
||||
except RuntimeError as error:
|
||||
except RuntimeError, error:
|
||||
# ": No type named 30."
|
||||
msg = str(error)
|
||||
return int(msg[14:-1])
|
||||
@@ -103,8 +106,10 @@ def listOfBreakpoints(d):
|
||||
continue
|
||||
lines.append(line)
|
||||
file.close()
|
||||
os.remove(filename)
|
||||
|
||||
try: # files may still be locked by gdb on Windows
|
||||
os.remove(filename)
|
||||
except:
|
||||
pass
|
||||
lines.reverse()
|
||||
bp = Breakpoint()
|
||||
for line in lines:
|
||||
@@ -254,8 +259,10 @@ def listOfLocals(varList):
|
||||
continue
|
||||
varList.append(line[0:pos])
|
||||
file.close()
|
||||
os.remove(filename)
|
||||
|
||||
try: # files may still be locked by gdb on Windows
|
||||
os.remove(filename)
|
||||
except:
|
||||
pass
|
||||
#warn("VARLIST: %s " % varList)
|
||||
for name in varList:
|
||||
#warn("NAME %s " % name)
|
||||
|
||||
@@ -284,7 +284,11 @@ DebuggerSettings *DebuggerSettings::instance()
|
||||
//
|
||||
item = new SavedAction(instance);
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("Location"));
|
||||
item->setDefaultValue("gdb");
|
||||
#ifdef Q_OS_WIN
|
||||
item->setDefaultValue(QLatin1String("gdb-i686-pc-mingw32.exe"));
|
||||
#else
|
||||
item->setDefaultValue(QLatin1String("gdb"));
|
||||
#endif
|
||||
instance->insertItem(GdbLocation, item);
|
||||
|
||||
item = new SavedAction(instance);
|
||||
|
||||
@@ -96,6 +96,8 @@ namespace Internal {
|
||||
|
||||
//#define DEBUG_PENDING 1
|
||||
|
||||
static const char winPythonVersionC[] = "python2.5";
|
||||
|
||||
#if DEBUG_PENDING
|
||||
# define PENDING_DEBUG(s) qDebug() << s
|
||||
#else
|
||||
@@ -3740,6 +3742,28 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
||||
gdbArgs << _("-i");
|
||||
gdbArgs << _("mi");
|
||||
gdbArgs += args;
|
||||
#ifdef Q_OS_WIN
|
||||
// Set python path. By convention, python is located below gdb executable
|
||||
const QFileInfo fi(location);
|
||||
if (fi.isAbsolute()) {
|
||||
const QString winPythonVersion = QLatin1String(winPythonVersionC);
|
||||
const QDir dir = fi.absoluteDir();
|
||||
if (dir.exists(winPythonVersion)) {
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
const QString pythonPathVariable = QLatin1String("PYTHONPATH");
|
||||
// Check for existing values.
|
||||
if (environment.contains(pythonPathVariable)) {
|
||||
const QString oldPythonPath = environment.value(pythonPathVariable);
|
||||
manager()->showDebuggerOutput(LogMisc, QString::fromLatin1("Using existing python path: %1").arg(oldPythonPath));
|
||||
} else {
|
||||
const QString pythonPath = QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
||||
environment.insert(pythonPathVariable, pythonPath);
|
||||
manager()->showDebuggerOutput(LogMisc, QString::fromLatin1("Python path: %1").arg(pythonPath));
|
||||
m_gdbProc.setProcessEnvironment(environment);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
m_gdbProc.start(location, gdbArgs);
|
||||
|
||||
if (!m_gdbProc.waitForStarted()) {
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QQueue>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
enum { firstSerialPort = 1, lastSerialPort = 12 };
|
||||
enum { modeDefault = Debugger::Internal::TrkOptions::Serial };
|
||||
static const char *serialPortDefaultC = SERIALPORT_ROOT"1";
|
||||
static const char *gdbDefaultC = "symgdb";
|
||||
static const char *gdbDefaultC = "gdb-arm-none-symbianelf.exe";
|
||||
#else
|
||||
# define SERIALPORT_ROOT "/dev/ttyS"
|
||||
enum { firstSerialPort = 0, lastSerialPort = 3 };
|
||||
enum { modeDefault = Debugger::Internal::TrkOptions::BlueTooth };
|
||||
static const char *serialPortDefaultC = SERIALPORT_ROOT"0";
|
||||
static const char *gdbDefaultC = "symgdb";
|
||||
static const char *gdbDefaultC = "gdb-arm-none-symbianelf";
|
||||
#endif
|
||||
|
||||
static const char *settingsGroupC = "S60Debugger";
|
||||
|
||||
Reference in New Issue
Block a user