[Lldb-commits] [PATCH] D86996: [lldb] Add -l/--language option to script command

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 1 22:51:58 PDT 2020


JDevlieghere planned changes to this revision.
JDevlieghere marked 3 inline comments as done.
JDevlieghere added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectScript.cpp:50-51
+
+  std::tie(head, tail) = tail.split(' ');
+  if (head != "-l" && head != "--language")
+    return CommandParsed(command);
----------------
kastiglione wrote:
> generally, lldb supports more than space delimited  flags. For example I often type `expr -lobjc -- ...` with no space. A quick check shows `--language=objc` is also supported. Should these cases be handled too?
Yes, if that works for other command it should work for this command too. I was already on the fence about this, but supporting that would definitely tip the scales beyond the complexity I'm willing to accept to work around the limitations of `CommandObjectParsed`. I'll need to come up with a different solution. 


================
Comment at: lldb/source/Commands/CommandObjectScript.cpp:65
+
+  return CommandParsed(command);
+}
----------------
kastiglione wrote:
> this is missing error handling for unsupported languages, such as `script -l swift`
I actually did that on purpose, I don't think either Python or Lua support statements that begin with `-l` or `--language` but I didn't want to intercept this unless it meant something to LLDB. But I agree that's not great UX. 


================
Comment at: lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test:7
+# RUN: cd %t
+# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o a.out
+# RUN: cat %s | %lldb 2>&1 | FileCheck %s
----------------
kastiglione wrote:
> is `a.out` not a universal default?
Not sure about Windows, but regardless I prefer to be explicit. 


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

https://reviews.llvm.org/D86996



More information about the lldb-commits mailing list