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:
Friedemann Kleint
2010-02-03 16:50:28 +01:00
parent 62705df65f
commit 40f0d4d7c3
5 changed files with 44 additions and 10 deletions

View File

@@ -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()) {