Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLDB-lua] modify Lua's 'print' to respect 'io.stdout'
This patch changes the implementation of Lua's `print()` function to respect `io.stdout`. The original implementation uses `lua_writestring()` internally, which is hardcoded to `stdout`. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D90787
- Loading branch information
Showing
3 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# REQUIRES: lua | ||
# UNSUPPORTED: lldb-repro | ||
# | ||
# RUN: rm -rf %t.stderr %t.stdout | ||
# RUN: cat %s | %lldb --script-language lua 2> %t.stderr > %t.stdout | ||
# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT | ||
# RUN: cat %t.stderr | FileCheck %s --check-prefix STDERR | ||
script | ||
file = lldb.SBFile(2, "w", false) | ||
lldb.debugger:SetOutputFile(file) | ||
print(95000 + 126, nil, 'a') | ||
quit | ||
script | ||
print({}) | ||
quit | ||
|
||
# STDOUT: 95126 nil a | ||
# STDOUT-NOT: table: {{0x[[:xdigit:]]+}} | ||
# STDERR: table: {{0x[[:xdigit:]]+}} | ||
|
||
# RUN: rm -rf %t.stderr %t.stdout | ||
# RUN: %lldb --script-language lua -o 'script print(95000 + 126, nil, "a")' 2> %t.stderr > %t.stdout | ||
# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT |