[lldb-dev] Enabling logging

Carlo Kok ck at remobjects.com
Sun Sep 21 05:08:14 PDT 2014


On Sun, 21 Sep 2014 00:05:23 +0200, Mikhail Sosonkin <mike at nanotick.net>  
wrote:

> Hello Developers,
>
> I'm trying to use the LLDB API for some experimentation. It seems that
> there are a lot of functions that contain logging statements such as
> this:
>
> SBProcess
> SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
> {
>     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
>
>     SBProcess sb_process;
>     TargetSP target_sp(GetSP());
>
>     if (log)
>         log->Printf ("SBTarget(%p)::Launch (launch_info, error)...",
>                      static_cast<void*>(target_sp.get()));
>
> I'd like to enable them. So far, I've not been able to find anything
> in API/* that would let me do that. SBDebugger::EnableLog didn't help.


EnableLog is the right api, but you have to pass a callback to the  
SBDebugger constructor to actually get the log callbacks.

char* val[2] = { "all", NULL };
debugger.EnableLog("lldb", val);

for example gives a massive amount of log info.

-- 
Carlo Kok
RemObjects Software



More information about the lldb-dev mailing list