[Lldb-commits] [PATCH] Fix process attach and detach for Windows

Chaoren Lin chaorenl at google.com
Wed Jun 17 15:27:11 PDT 2015


I know very little about ProcessWindows as well, so here's some bikeshedding.


================
Comment at: source/Plugins/Process/Windows/ProcessWindows.cpp:71
@@ +70,3 @@
+        file_name.resize(file_name_size);
+        copied = ::GetModuleFileNameEx(process_handle, NULL, &file_name[0], file_name_size);
+    } while (copied >= file_name_size);
----------------
```
&file_name[0]
```
I think this is undefined behavior (might be different in recent C++ standards). Please use a `std::vector<char>` and `std::vector::data()`.

================
Comment at: source/Plugins/Process/Windows/ProcessWindows.cpp:775
@@ -719,2 +774,3 @@
         return exe_module_sp->GetFileSpec().Exists();
-    return false;
+    // However, if there is no executable module, we return true since we might be preparing to attach.
+    return true;
----------------
Is there a way to check if we're actually preparing to attach? There are probably other things we can check too (e.g., if //any// module exists).

================
Comment at: source/Plugins/Process/Windows/ProcessWindows.cpp:813
@@ +812,3 @@
+
+        FileSpec executable_file(file_name, false);
+        ModuleSpec module_spec(executable_file);
----------------
Shouldn't `resolve = true`?

http://reviews.llvm.org/D10404

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list