[Lldb-commits] [lldb] r156994 - /lldb/trunk/source/Host/common/Host.cpp
Greg Clayton
gclayton at apple.com
Fri May 18 10:11:02 PDT 2012
This is actually not the right fix for how we use this currently. The dummy target is used only for when someone doesn't have a target around and wants to evaluate a simple expression. By creating a new target every time you will lose all of your persistent variables and expression global variables.
Filipe, if we change this patch to keep the dummy target in a shared pointer, but also remember the triple we used to create it, and then remove the global cached version when the triple changes, would that be enough to keep the test suite happy?
On May 17, 2012, at 8:48 AM, Filipe Cabecinhas wrote:
> Author: filcab
> Date: Thu May 17 10:48:02 2012
> New Revision: 156994
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156994&view=rev
> Log:
> We shouldn't save g_dummy_target_sp. Other code will simply call Destroy() on it.
>
> TestBackticksWithoutATarget.BackticksWithNoTargetTestCase was calling
> GetDummyTarget() when executing for x86_64. When performing session
> tearDown, it would get destroyed (and everything would be invalid (arch,
> etc).
>
> Then the test would run for i386. The dummy target wasn't being
> reinitialized and was invalid. lldb complained that 'current process state
> is unsuitable for expression parsing'.
>
> Modified:
> lldb/trunk/source/Host/common/Host.cpp
>
> Modified: lldb/trunk/source/Host/common/Host.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=156994&r1=156993&r2=156994&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/common/Host.cpp (original)
> +++ lldb/trunk/source/Host/common/Host.cpp Thu May 17 10:48:02 2012
> @@ -1227,22 +1227,19 @@
> lldb::TargetSP
> Host::GetDummyTarget (lldb_private::Debugger &debugger)
> {
> - static TargetSP g_dummy_target_sp;
> -
> - if (!g_dummy_target_sp)
> - {
> - ArchSpec arch(Target::GetDefaultArchitecture());
> - if (!arch.IsValid())
> - arch = Host::GetArchitecture ();
> - Error err = debugger.GetTargetList().CreateTarget(debugger,
> - FileSpec(),
> - arch.GetTriple().getTriple().c_str(),
> - false,
> - NULL,
> - g_dummy_target_sp);
> - }
> -
> - return g_dummy_target_sp;
> + lldb::TargetSP dummy_target_sp;
> +
> + ArchSpec arch(Target::GetDefaultArchitecture());
> + if (!arch.IsValid())
> + arch = Host::GetArchitecture ();
> + Error err = debugger.GetTargetList().CreateTarget(debugger,
> + FileSpec(),
> + arch.GetTriple().getTriple().c_str(),
> + false,
> + NULL,
> + dummy_target_sp);
> +
> + return dummy_target_sp;
> }
>
> struct ShellInfo
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list