[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

Hui Huang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 21 11:33:19 PST 2019


Hui added inline comments.


================
Comment at: include/lldb/Utility/Args.h:121
 
+  bool GetFlattenWindowsCommandString(std::string &command) const;
+
----------------
labath wrote:
> I am sorry for being such a pain, but I don't think this is grammatically correct, as `get` and `flatten` are both verbs. I'd call this either GetFlatten**ed**WindowsCommandLine or just plain FlattenWindowsCommandLine.
There are  two kinds of sources of args in this discussion:

  - from lldb console through stdin which is not raw.
  - from LLDB_SERVER_LOG_FILE environment variables which are raw

We expect to call a GetFlattenedWindowsCommandString for raw input. However it seems not the case for now. 

What about adding a TODO in the following in ProcessWindowsLauncher. 

Would like a solution to proceed.

+
+bool GetFlattenedWindowsCommandString(Args args, std::string &command) {
+  if (args.empty())
+    return false;
+
+  std::vector<llvm::StringRef> args_ref;
+  for (auto &entry : args.entries())
+     args_ref.push_back(entry.ref);
+
+  // TODO: only flatten raw input.
+  // Inputs from lldb console through the stdin are not raw, for example,
+  // A command line like "dir c:\" is attained as "dir c":\\". Trying to flatten such
+  // input will result in unexpected errors. In this case, the flattend string will be
+  // interpreted as "dir c:\\ which is a wrong usage of `dir` command.
+
+  command = llvm::sys::flattenWindowsCommandLine(args_ref);
+  return true;
 }
+} // namespace



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56230/new/

https://reviews.llvm.org/D56230





More information about the lldb-commits mailing list