[Lldb-commits] [lldb] r166733 - in /lldb/trunk/source: Commands/CommandObjectTarget.cpp Target/TargetList.cpp
Greg Clayton
gclayton at apple.com
Thu Oct 25 15:45:35 PDT 2012
Author: gclayton
Date: Thu Oct 25 17:45:35 2012
New Revision: 166733
URL: http://llvm.org/viewvc/llvm-project?rev=166733&view=rev
Log:
<rdar://problem/12570550>
TOT lldb broke finding App in app bundles when launching with shell.
Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Target/TargetList.cpp
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=166733&r1=166732&r2=166733&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Oct 25 17:45:35 2012
@@ -234,13 +234,6 @@
if (target_sp)
{
- if (file_path)
- {
- // Use exactly what the user typed as the first argument
- // when we exec or posix_spawn
- target_sp->SetArg0 (file_path);
- }
-
debugger.GetTargetList().SetSelectedTarget(target_sp.get());
if (core_file)
{
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=166733&r1=166732&r2=166733&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Thu Oct 25 17:45:35 2012
@@ -156,8 +156,14 @@
arch = specified_arch;
FileSpec file (user_exe_path, false);
+ bool user_exe_path_is_bundle = false;
+ char resolved_bundle_exe_path[PATH_MAX];
+ resolved_bundle_exe_path[0] = '\0';
if (file)
{
+ if (file.GetFileType() == FileSpec::eFileTypeDirectory)
+ user_exe_path_is_bundle = true;
+
if (file.IsRelativeToCurrentWorkingDirectory())
{
// Ignore paths that start with "./" and "../"
@@ -208,6 +214,8 @@
}
target_sp.reset(new Target(debugger, arch, platform_sp));
target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
+ if (user_exe_path_is_bundle)
+ exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path, sizeof(resolved_bundle_exe_path));
}
}
else
@@ -219,10 +227,21 @@
if (target_sp)
{
+ // Set argv0 with what the user typed, unless the user specified a
+ // directory. If the user specified a directory, then it is probably a
+ // bundle that was resolved and we need to use the resolved bundle path
if (user_exe_path)
{
// Use exactly what the user typed as the first argument when we exec or posix_spawn
- target_sp->SetArg0 (user_exe_path);
+ if (user_exe_path_is_bundle && resolved_bundle_exe_path[0])
+ {
+ target_sp->SetArg0 (resolved_bundle_exe_path);
+ }
+ else
+ {
+ // Just use what the user typed
+ target_sp->SetArg0 (user_exe_path);
+ }
}
if (file.GetDirectory())
{
More information about the lldb-commits
mailing list