labath added a comment.

It looks like this patch already includes some non-trivial functionality, so I 
think this is a good time to start figuring out how to test this. Another 
thing, which may not be needed straight away, but which I think we should 
consider pretty early is creating some sort of c++ wrappers, similar to the 
PythonDataObject we have for python. This is so that we don't have C error 
handling code everywhere, but have things wrapped in a nicer interface with 
`llvm::Expected`s and everything.



================
Comment at: 
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:47
+
+class IOHandlerLuaInterpreter : public IOHandler {
+public:
----------------
How much of this class is boiler plate? Can it be shared with something?


================
Comment at: 
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:159
+                                          const ExecuteScriptOptions &options) 
{
+  if (command.empty()) {
+    result->AppendError("empty command passed to lua\n");
----------------
TBH, I am not sure how useful this error really is. Presumably you will get 
some sort of an error from the lua interpreter if you just let this pass..


================
Comment at: 
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:167
+  // FIXME: Redirecting stdin, stdout and stderr.
+  int success = luaL_dostring(l.State(), command.data());
+  if (success == 0)
----------------
So what happens when `command` is not null terminated? I guess you ought to 
split this into `luaL_loadbuffer && lua_pcall`..


================
Comment at: 
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:171
+
+  result->AppendErrorWithFormat("lua failed attempting to evaluate '%s'\n",
+                                command.data());
----------------
same here. You can just use `AppendErrorWithFormatv`..


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D71234



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to