5
votes

I'm using LLDB with the latest OS X toolchain (lldb --version says lldb-340.4.110).

I tried to debug executable which produces lots of output into stdout. Previously it was possible to suppress output by redirecting it, e.g. to /dev/null.

But after latest OS X toolchain update it has started producing the following error:

(lldb) run >/dev/null
error: invalid JSON

Has something changed in LLDB in that area? Like adding some syntax for specifying stdin/stdout/stderr redirects. Can't find any clue in LLDB docs or mailing lists. Also I can suppose it is Apple-specific LLDB bug.

P.S.

I know that my problem can be temporary solved by running: sudo lldb -w -n <executable> in separate terminal window, which will tell LLDB to wait for new process with the given name and then attach to that process. In that case I can run my executable in another terminal window with stdin redirected to /dev/null.

But I feel highly uncomfortable with that workflow, because stdout redirect just works in GDB on my Linux machine. Breaking the habits is always uncomfortable.

1

1 Answers

8
votes
(lldb) process launch -o /dev/null -- <OTHER ARGUMENTS>

will do what you want. You can also make an alias to do this:

(lldb) command alias silent-run process launch -o /dev/null --

then:

(lldb) silent-run a b c 

will run your program, redirect stdout to /dev/null, and pass a, b and c as arguments.