summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/DNB.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-10-31 21:44:39 +0000
committerGreg Clayton <gclayton@apple.com>2012-10-31 21:44:39 +0000
commit48baf7a788272d088cb90d7b53e3415bd860bdf9 (patch)
tree1694d8aee317a90b539c6a09731042b1e8621239 /lldb/tools/debugserver/source/DNB.cpp
parent4cb8cdab5e0002f4672c85afd467da8230dff476 (diff)
downloadbcm5719-llvm-48baf7a788272d088cb90d7b53e3415bd860bdf9.tar.gz
bcm5719-llvm-48baf7a788272d088cb90d7b53e3415bd860bdf9.zip
Resolve any bundle paths we are given when the specified executable is a bundle.
llvm-svn: 167175
Diffstat (limited to 'lldb/tools/debugserver/source/DNB.cpp')
-rw-r--r--lldb/tools/debugserver/source/DNB.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index 4df114849fa..bb5e72c9869 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -31,6 +31,8 @@
#include "DNBDataRef.h"
#include "DNBThreadResumeActions.h"
#include "DNBTimer.h"
+#include "CFBundle.h"
+
typedef STD_SHARED_PTR(MachProcess) MachProcessSP;
typedef std::map<nub_process_t, MachProcessSP> ProcessMap;
@@ -2097,6 +2099,21 @@ DNBResolveExecutablePath (const char *path, char *resolved_path, size_t resolved
if (result.empty())
result = path;
+
+ struct stat path_stat;
+ if (::stat(path, &path_stat) == 0)
+ {
+ if ((path_stat.st_mode & S_IFMT) == S_IFDIR)
+ {
+ CFBundle bundle (path);
+ CFReleaser<CFURLRef> url(bundle.CopyExecutableURL ());
+ if (url.get())
+ {
+ if (::CFURLGetFileSystemRepresentation (url.get(), true, (UInt8*)resolved_path, resolved_path_size))
+ return true;
+ }
+ }
+ }
if (realpath(path, max_path))
{
OpenPOWER on IntegriCloud