[lldb-dev] printf works under lldb but not otherwise

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 17 10:17:06 PDT 2019


The only thing I can think if is stdin/out/err are not setup correctly when launched out of the debugger. How does your program get launched? From a terminal on the command line?

printf will call fprintf() under the covers with stdout as the file handle. Maybe "stdout" can be checked for NULL with an if statement in your code? The theory would be that "stdout" would be null when not run under the debugger, and would be with run in lldb?

> On Oct 7, 2019, at 3:40 PM, Peter Rowat via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> 
> I have a simple C program that has printf statements.
> It produces zero output.
> However when it’s run under lldb, it prints correct output. How could this be?
> 
> I tried replacing the printf statements by “fprintf” to a file: same behaviour -
>    no file created and no output, but under lldb, the file is created with correct output data.
> 
> Peter R
> 
> 
> 
> 
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20191017/71a8321c/attachment.html>


More information about the lldb-dev mailing list