[Lldb-commits] [lldb] r154965 - /lldb/trunk/source/Target/Process.cpp

Greg Clayton gclayton at apple.com
Tue Apr 17 17:05:19 PDT 2012


Author: gclayton
Date: Tue Apr 17 19:05:19 2012
New Revision: 154965

URL: http://llvm.org/viewvc/llvm-project?rev=154965&view=rev
Log:
Make sure an error is returned when Process::LoadImage() fails.


Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=154965&r1=154964&r2=154965&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Apr 17 19:05:19 2012
@@ -1391,6 +1391,9 @@
 uint32_t
 Process::LoadImage (const FileSpec &image_spec, Error &error)
 {
+    char path[PATH_MAX];
+    image_spec.GetPath(path, sizeof(path));
+
     DynamicLoader *loader = GetDynamicLoader();
     if (loader)
     {
@@ -1413,8 +1416,6 @@
                 frame_sp->CalculateExecutionContext (exe_ctx);
                 bool unwind_on_error = true;
                 StreamString expr;
-                char path[PATH_MAX];
-                image_spec.GetPath(path, sizeof(path));
                 expr.Printf("dlopen (\"%s\", 2)", path);
                 const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n";
                 lldb::ValueObjectSP result_valobj_sp;
@@ -1437,6 +1438,8 @@
             }
         }
     }
+    if (!error.AsCString())
+        error.SetErrorStringWithFormat("unable to load '%s'", path);
     return LLDB_INVALID_IMAGE_TOKEN;
 }
 





More information about the lldb-commits mailing list