Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb] python API SBDebugger.GetOutputFileHandle() returns a file handle with the wrong mode for stdout/stderr #122387

Open
ashgti opened this issue Jan 9, 2025 · 1 comment
Labels

Comments

@ashgti
Copy link
Contributor

ashgti commented Jan 9, 2025

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.

@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2025

@llvm/issue-subscribers-lldb

Author: John Harrison (ashgti)

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()) #&gt; output &lt;_io.TextIOWrapper name=1 mode='r' encoding='UTF-8'&gt;
print("error", dbg.GetErrorFileHandle()) #&gt; error &lt;_io.TextIOWrapper name=2 mode='r' encoding='UTF-8'&gt;

I think this is happening because:

However, stdout and stderr should be set to mode='w' by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants