From a6d099a1ea3998435e5be20aefbcd38ccc24e073 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 3 Nov 2009 16:02:16 +0100 Subject: [PATCH] Debugger: Fix LD_PRELOAD on Mac. Reviewed-by: hjk <qtc-committer@nokia.com> --- src/plugins/debugger/debuggerconstants.h | 6 ++++++ src/plugins/debugger/gdb/gdbengine.cpp | 5 ++++- src/plugins/debugger/gdb/termgdbadapter.cpp | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index 53874f23cc0..6640b4033d5 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -57,6 +57,12 @@ const char * const DEBUGGER_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("Debugger", "D namespace Internal { enum { debug = 0 }; +#ifdef Q_OS_MAC + const char * const LD_PRELOAD_ENV_VAR = "DYLD_INSERT_LIBRARIES"; +#else + const char * const LD_PRELOAD_ENV_VAR = "LD_PRELOAD"; +#endif + } } // namespace Constants diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 6c6c307bede..8a787fa5fcf 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4328,7 +4328,10 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr } if (m_gdbAdapter->dumperHandling() == AbstractGdbAdapter::DumperLoadedByGdbPreload && checkDebuggingHelpers()) { - const QString cmd = QLatin1String("set environment LD_PRELOAD ") + manager()->qtDumperLibraryName(); + QString cmd = _("set environment "); + cmd += _(Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR); + cmd += _c(' '); + cmd += manager()->qtDumperLibraryName(); postCommand(cmd); m_debuggingHelperState = DebuggingHelperLoadTried; } diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index 19de9ffa067..5461d175bf2 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -95,7 +95,10 @@ void TermGdbAdapter::startAdapter() QStringList environment = startParameters().environment; if (dumperHandling() == DumperLoadedByGdbPreload && m_engine->checkDebuggingHelpers()) { - environment.push_back(QLatin1String("LD_PRELOAD=") + m_engine->qtDumperLibraryName()); + QString var = QLatin1String(Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR); + var += QLatin1Char('='); + var += m_engine->qtDumperLibraryName(); + environment.push_back(var); m_engine->setDebuggingHelperState(DebuggingHelperLoadTried); } m_stubProc.setEnvironment(environment); -- GitLab