It looks like when lldb initializes the default OutputFileHandle and ErrorFileHandle on a new debugger instance it is not setting the handles as writable (mode='w').
Here is a simple python script using the lldb module to illustrate this:
import lldb
dbg = lldb.SBDebugger.Create()
print("output", dbg.GetOutputFileHandle()) #> output <_io.TextIOWrapper name=1 mode='r' encoding='UTF-8'>
print("error", dbg.GetErrorFileHandle()) #> error <_io.TextIOWrapper name=2 mode='r' encoding='UTF-8'>
I think this is happening because:
However, stdout and stderr should be set to mode='w' by default.
It looks like when lldb initializes the default OutputFileHandle and ErrorFileHandle on a new debugger instance it is not setting the handles as writable (mode='w').
Here is a simple python script using the lldb module to illustrate this:
I think this is happening because:
FILE*llvm-project/lldb/source/Core/Debugger.cpp
Line 878 in ba704d5
StreamFileconstructor https://github.com/llvm/llvm-project/blob/ba704d59569151f1b8b6552ed22a7b840f5e6256/lldb/include/lldb/Host/StreamFile.h#L31C3-L31C13NativeFilellvm-project/lldb/source/Host/common/StreamFile.cpp
Line 30 in ba704d5
options()llvm-project/lldb/include/lldb/Host/File.h
Line 384 in ba704d5
'r'mode by defaultllvm-project/lldb/include/lldb/Host/File.h
Line 51 in ba704d5
However, stdout and stderr should be set to
mode='w'by default.