In command line it is possible to use the output of a command as the stdin of an executable. For example, pbpaste
returns the value of the clipboard on OSX. I could run a program using this, e.g. pbpaste | ./program
Is this also possible in LLDB?
CodePudding user response:
lldb only has access to a program's stdio if it launched the program and is sharing the terminal with it. So you can't always do this.
There isn't an lldb command to send text to the debuggee's stdin, but you can get write to the process stdin (when that's possible) from Python using SBProcess.PutSTDIN
:
https://lldb.llvm.org/python_api/lldb.SBProcess.html#lldb.SBProcess.PutSTDIN
So you could pretty easily cons up Python command that runs the shell command you want, gets the output, and uses this API to write it to the target.