[Lldb-commits] [lldb] r167175 - in /lldb/trunk/tools/debugserver/source: DNB.cpp MacOSX/CFBundle.cpp MacOSX/CFBundle.h
Greg Clayton
gclayton at apple.com
Wed Oct 31 14:44:39 PDT 2012
Author: gclayton
Date: Wed Oct 31 16:44:39 2012
New Revision: 167175
URL: http://llvm.org/viewvc/llvm-project?rev=167175&view=rev
Log:
Resolve any bundle paths we are given when the specified executable is a bundle.
Modified:
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.cpp
lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.h
Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=167175&r1=167174&r2=167175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Wed Oct 31 16:44:39 2012
@@ -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 @@
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))
{
Modified: lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.cpp?rev=167175&r1=167174&r2=167175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.cpp Wed Oct 31 16:44:39 2012
@@ -85,3 +85,13 @@
return ::CFBundleGetIdentifier (bundle);
return NULL;
}
+
+
+CFURLRef
+CFBundle::CopyExecutableURL () const
+{
+ CFBundleRef bundle = get();
+ if (bundle != NULL)
+ return CFBundleCopyExecutableURL(bundle);
+ return NULL;
+}
Modified: lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.h?rev=167175&r1=167174&r2=167175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/CFBundle.h Wed Oct 31 16:44:39 2012
@@ -25,11 +25,17 @@
CFBundle(const char *path = NULL);
CFBundle(const CFBundle& rhs);
CFBundle& operator=(const CFBundle& rhs);
- virtual ~CFBundle();
+ virtual
+ ~CFBundle();
+ bool
+ SetPath (const char *path);
- bool SetPath (const char *path);
- CFStringRef GetIdentifier () const;
+ CFStringRef
+ GetIdentifier () const;
+ CFURLRef
+ CopyExecutableURL () const;
+
protected:
CFReleaser<CFURLRef> m_bundle_url;
};
More information about the lldb-commits
mailing list