Commit 58bec402 authored by hjk's avatar hjk Committed by Eike Ziller

Debugger: Force passing DYLD_.... environment variables to inferior

Apple's LLDB has changed behavior between 330.x and 340.x.

Newer versions seem to actively delete the DYLD_IMAGE_SUFFIX,
DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH environment variables
from the scripting environment.

Change-Id: I0b7bbdce0975e969b1dae5770fd9a99328f241be
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 5d1e894e
......@@ -218,6 +218,9 @@ class Dumper(DumperBase):
self.startMode_ = None
self.processArgs_ = None
self.attachPid_ = None
self.dyldImageSuffix = None
self.dyldLibraryPath = None
self.dyldFrameworkPath = None
self.charType_ = None
self.intType_ = None
......@@ -658,6 +661,9 @@ class Dumper(DumperBase):
self.breakOnMain_ = args.get('breakonmain', 0)
self.useTerminal_ = args.get('useterminal', 0)
self.processArgs_ = args.get('processargs', [])
self.dyldImageSuffix = args.get('dyldimagesuffix', '')
self.dyldLibraryPath = args.get('dyldlibrarypath', '')
self.dyldFrameworkPath = args.get('dyldframeworkpath', '')
self.processArgs_ = map(lambda x: self.hexdecode(x), self.processArgs_)
self.attachPid_ = args.get('attachpid', 0)
self.sysRoot_ = args.get('sysroot', '')
......@@ -738,6 +744,12 @@ class Dumper(DumperBase):
launchInfo = lldb.SBLaunchInfo(self.processArgs_)
launchInfo.SetWorkingDirectory(os.getcwd())
environmentList = [key + "=" + value for key,value in os.environ.items()]
if self.dyldImageSuffix:
environmentList.append('DYLD_IMAGE_SUFFIX=' + self.dyldImageSuffix)
if self.dyldLibraryPath:
environmentList.append('DYLD_LIBRARY_PATH=' + self.dyldLibraryPath)
if self.dyldFrameworkPath:
environmentList.append('DYLD_FRAMEWORK_PATH=' + self.dyldFrameworkPath)
launchInfo.SetEnvironmentEntries(environmentList, False)
if self.breakOnMain_:
self.createBreakpointAtMain()
......
......@@ -337,6 +337,11 @@ void LldbEngine::setupInferior()
cmd2.arg("startmode", rp.startMode);
cmd2.arg("nativemixed", isNativeMixedActive());
// FIXME: separate Inferior and Debugger environments properly
cmd2.arg("dyldimagesuffix", rp.environment.value(_("DYLD_IMAGE_SUFFIX")));
cmd2.arg("dyldframeworkpath", rp.environment.value(_("DYLD_LIBRARY_PATH")));
cmd2.arg("dyldlibrarypath", rp.environment.value(_("DYLD_FRAMEWORK_PATH")));
QJsonArray processArgs;
foreach (const QString &arg, args.toUnixArgs())
processArgs.append(QLatin1String(arg.toUtf8().toHex()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment