[Lldb-commits] [lldb] r336398 - Address a few post facto review comments from Adrian.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 5 16:23:06 PDT 2018


Author: jingham
Date: Thu Jul  5 16:23:06 2018
New Revision: 336398

URL: http://llvm.org/viewvc/llvm-project?rev=336398&view=rev
Log:
Address a few post facto review comments from Adrian.

Thanks, Adrian!

Modified:
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=336398&r1=336397&r2=336398&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Jul  5 16:23:06 2018
@@ -840,7 +840,11 @@ public:
   ///     The process to load the image.
   ///
   /// @param[in] library_name
-  ///     The name of the library to look for.
+  ///     The name of the library to look for.  If library_name is an
+  ///     absolute path, the basename will be extracted and searched for
+  ///     along the paths.  This emulates the behavior of the loader when
+  ///     given an install name and a set (e.g. DYLD_LIBRARY_PATH provided) of
+  ///     alternate paths.
   ///
   /// @param[in] path_list
   ///     The list of paths to use to search for the library.  First

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=336398&r1=336397&r2=336398&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Thu Jul  5 16:23:06 2018
@@ -946,7 +946,7 @@ PlatformPOSIX::MakeLoadImageUtilityFunct
     const char *error_str;
   };
   
-  extern void *memcpy(void *, void *, size_t size);
+  extern void *memcpy(void *, const void *, size_t size);
   extern size_t strlen(const char *);
   
 
@@ -956,23 +956,23 @@ PlatformPOSIX::MakeLoadImageUtilityFunct
                                 __lldb_dlopen_result *result_ptr)
   {
     // This is the case where the name is the full path:
-    if (path_strings == (char *) 0x0) {
+    if (!path_strings) {
       result_ptr->image_ptr = dlopen(name, 2);
-      if (result_ptr->image_ptr != (void *) 0x0)
+      if (result_ptr->image_ptr)
         result_ptr->error_str = nullptr;
       return nullptr;
     }
     
     // This is the case where we have a list of paths:
     size_t name_len = strlen(name);
-    while (path_strings != (void *) 0x0 && path_strings[0] != '\0') {
+    while (path_strings && path_strings[0] != '\0') {
       size_t path_len = strlen(path_strings);
       memcpy((void *) buffer, (void *) path_strings, path_len);
       buffer[path_len] = '/';
       char *target_ptr = buffer+path_len+1; 
       memcpy((void *) target_ptr, (void *) name, name_len + 1);
       result_ptr->image_ptr = dlopen(buffer, 2);
-      if (result_ptr->image_ptr != (void *) 0x0) {
+      if (result_ptr->image_ptr) {
         result_ptr->error_str = nullptr;
         break;
       }




More information about the lldb-commits mailing list