Add support for changing the stdout and stderr file in Lua's I/O library and hook it up with the debugger's output and error file respectively for the interactive Lua interpreter.
Details
Diff Detail
Event Timeline
I have some questions (but no definitive answers) inline...
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp | ||
---|---|---|
64 | What should be the behavior if this is null? Can it even be null (should we be asserting that it isn't)? | |
65–66 | lua_getfield(m_lua_state, -1, "stdout") | |
68 | I guess it would be better to use luaL_testudata(m_lua_state, -1, LUA_FILEHANDLE) as that also checks that the user data is of the expected type (and e.g. it was not replaced by the user). Or it might actually be better to just overwrite the value of io.stdout/err with a new value/userdata object, instead of fiddling with the existing one. |
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp | ||
---|---|---|
64 | I don't really see a benefit to storing it, I'm fine with just asserting that the file is not null. |
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp | ||
---|---|---|
64 | Ok, that's fine. But then you should remove the =nullptr default arguments. |
Forgot the Differential revision in front of the phab URL. Closed by fa1b4a96a0110c87cdd83eb4ea3e9a0d002c3c3d
What should be the behavior if this is null? Can it even be null (should we be asserting that it isn't)?
It's not clear to me that we should be reusing the previously set stdout if these arguments are null... Maybe we should be saving the original stdout value and restoring it when we are done? That's what the python interpreter seems to be doing..