Skip to content

Commit 21b740c

Browse files
[lldb] enable stdout and stderr (#51)
1 parent ce22b23 commit 21b740c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/idd/debuggers/lldb/lldb_driver.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def __init__(self, exe="", pid=None):
3030

3131
if exe != "":
3232
error = lldb.SBError()
33-
target = self.lldb_instance.CreateTarget(exe, "x86_64", "host", True, error)
33+
self.target = self.lldb_instance.CreateTarget(exe, "x86_64", "host", True, error)
3434
if not error.Success():
3535
raise Exception(error.GetCString())
3636

3737
launch_info = lldb.SBLaunchInfo(None)
38-
launch_info.SetExecutableFile (target.GetExecutable(), True)
38+
launch_info.SetExecutableFile(self.target.GetExecutable(), True)
3939
elif pid is not None:
4040
self.run_single_command("attach -p " + str(pid))
4141

@@ -109,6 +109,12 @@ def run(lldb_args, pipe):
109109
pipe.send(res)
110110
else:
111111
res = lldb.run_single_command(*args, **kwargs)
112+
stdout = lldb.target.GetProcess().GetSTDOUT(1024 * 1024 * 10)
113+
if stdout:
114+
res.extend(stdout.split("\n"))
115+
stderr = lldb.target.GetProcess().GetSTDERR(1024 * 1024 * 10)
116+
if stderr:
117+
res.extend(stderr.split("\n"))
112118
pipe.send(res)
113119

114120

0 commit comments

Comments
 (0)