diff options
| author | Jason Molenda <jmolenda@apple.com> | 2015-08-12 03:27:33 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2015-08-12 03:27:33 +0000 |
| commit | 6acc86c3f550a8477870e5ff88de0857d11dd996 (patch) | |
| tree | fde8f5a3fb46003aca24a9e73222978480cecdb3 /lldb/tools/debugserver/source | |
| parent | 993b2864da4c3a12b8e2ea3d3fe92c66e53fe00d (diff) | |
| download | bcm5719-llvm-6acc86c3f550a8477870e5ff88de0857d11dd996.tar.gz bcm5719-llvm-6acc86c3f550a8477870e5ff88de0857d11dd996.zip | |
Have debugserver send the OS version string plus
major, minor, and patchlevel in the qHostInfo reply.
Document that qHostInfo may report major/minor/patch
separately / in addition to the version: combination.
<rdar://problem/22125465>
llvm-svn: 244716
Diffstat (limited to 'lldb/tools/debugserver/source')
| -rw-r--r-- | lldb/tools/debugserver/source/DNB.cpp | 6 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/DNB.h | 1 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachProcess.h | 1 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachProcess.mm | 24 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 15 |
5 files changed, 47 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index 77154bb6e51..53b42cd267a 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -1936,6 +1936,12 @@ DNBResolveExecutablePath (const char *path, char *resolved_path, size_t resolved return false; } +bool +DNBGetOSVersionNumbers (uint64_t *major, uint64_t *minor, uint64_t *patch) +{ + return MachProcess::GetOSVersionNumbers (major, minor, patch); +} + void DNBInitialize() diff --git a/lldb/tools/debugserver/source/DNB.h b/lldb/tools/debugserver/source/DNB.h index 1d29625469f..7b186d38b32 100644 --- a/lldb/tools/debugserver/source/DNB.h +++ b/lldb/tools/debugserver/source/DNB.h @@ -168,5 +168,6 @@ nub_bool_t DNBGetRegisterInfoByName (const char *reg_name, DNBRegist //---------------------------------------------------------------------- const char * DNBStateAsString (nub_state_t state); nub_bool_t DNBResolveExecutablePath (const char *path, char *resolved_path, size_t resolved_path_size); +bool DNBGetOSVersionNumbers (uint64_t *major, uint64_t *minor, uint64_t *patch); #endif diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h b/lldb/tools/debugserver/source/MacOSX/MachProcess.h index 66977079016..0795a78501c 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h @@ -80,6 +80,7 @@ public: static const void * PrepareForAttach (const char *path, nub_launch_flavor_t launch_flavor, bool waitfor, DNBError &err_str); static void CleanupAfterAttach (const void *attach_token, bool success, DNBError &err_str); static nub_process_t CheckForProcess (const void *attach_token); + static bool GetOSVersionNumbers (uint64_t *major, uint64_t *minor, uint64_t *patch); #ifdef WITH_BKS pid_t BKSLaunchForDebug (const char *app_bundle_path, char const *argv[], char const *envp[], bool no_stdio, bool disable_aslr, const char *event_data, DNBError &launch_err); pid_t BKSForkChildForPTraceDebugging (const char *path, char const *argv[], char const *envp[], bool no_stdio, bool disable_aslr, const char *event_data, DNBError &launch_err); diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm index b635b8afdd5..e837173068f 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm @@ -31,6 +31,8 @@ #include <algorithm> #include <map> +#import <Foundation/Foundation.h> + #include "DNBDataRef.h" #include "DNBLog.h" #include "DNBThreadResumeActions.h" @@ -2020,6 +2022,28 @@ MachProcess::GetGenealogyImageInfo (size_t idx) return m_activities.GetProcessExecutableInfosAtIndex (idx); } +bool +MachProcess::GetOSVersionNumbers (uint64_t *major, uint64_t *minor, uint64_t *patch) +{ + bool success = false; + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSOperatingSystemVersion vers = [[NSProcessInfo processInfo] operatingSystemVersion]; + if (major) + *major = vers.majorVersion; + if (minor) + *minor = vers.minorVersion; + if (patch) + *patch = vers.patchVersion; + + success = true; + + [pool drain]; + + return success; +} + // Do the process specific setup for attach. If this returns NULL, then there's no // platform specific stuff to be done to wait for the attach. If you get non-null, // pass that token to the CheckForProcess method, and then to CleanupAfterAttach. diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index dc22e52a19e..3e6d907b505 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -4628,6 +4628,21 @@ RNBRemote::HandlePacket_qHostInfo (const char *p) strm << "vendor:apple;"; + uint64_t major, minor, patch; + if (DNBGetOSVersionNumbers (&major, &minor, &patch)) + { + strm << "osmajor:" << major << ";"; + strm << "osminor:" << minor << ";"; + strm << "ospatch:" << patch << ";"; + + strm << "version:" << major << "." << minor; + if (patch != 0) + { + strm << "." << patch; + } + strm << ";"; + } + #if defined (__LITTLE_ENDIAN__) strm << "endian:little;"; #elif defined (__BIG_ENDIAN__) |

