Writing logging to screen


How do I run lldb in such way that the logging statements are visible on my stdout/stderr?

For example, I'm trying to debug:

ReadRegOperation::Execute(ProcessMonitor *monitor)
     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));


     if (log)
         log->Printf ("ProcessMonitor::%s() reg %s: 0x%" PRIx64, __FUNCTION__,
                      m_reg_name, data);

How can I make the Printf visible?

Matthew Gardiner

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.

log enable [-STgnpstv] [-f <filename>] <log-channel> <log-category>
[<log-category> [...]]

If you don't specify a "-f <filename>" you'll see the log output on stdout:

(lldb) b main
Breakpoint 1: where = ls`main + 9 at ls.c:166, address = 0x0000000000403069
(lldb) log enable freebsd process
(lldb) run
Process 29265 launching
ProcessFreeBSD::UpdateThreadList (pid = 29265)
ProcessFreeBSD::UpdateThreadList new tid = 102295
Process 29265 stopped
(lldb) process 29265 resuming (continue)

"log list" shows the available channels and categories.

Note that the "posix" channel (for POSIX_LOG_* categories) is spelled
"freebsd" or "linux", depending on your OS.

Ed Maste wrote: