[Lldb-commits] [lldb] r328365 - Log ObjC Runtime messages only in verbose mode

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 26 02:51:11 PDT 2018


On Fri, 23 Mar 2018 at 20:20, Adrian Prantl via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: adrian
> Date: Fri Mar 23 13:17:39 2018
> New Revision: 328365
>
> URL: http://llvm.org/viewvc/llvm-project?rev=328365&view=rev
> Log:
> Log ObjC Runtime messages only in verbose mode
>
> Modified:
>
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>
> Modified:
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=328365&r1=328364&r2=328365&view=diff
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> Fri Mar 23 13:17:39 2018
> @@ -1440,8 +1440,8 @@ uint32_t AppleObjCRuntimeV2::ParseClassI
>    //        uint32_t hash;
>    //    } __attribute__((__packed__));
>
> -  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS |
> LIBLLDB_LOG_TYPES));
> -
> +  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES
> +                                    | LLDB_LOG_OPTION_VERBOSE));
>
>
I don't think this does what you think it does. This function takes log
channels, wheres  LLDB_LOG_OPTION_VERBOSE is a log **option**.
This makes your function call equivalent to GetLogIfAllCategoriesSet(
LIBLLDB_LOG_TYPES | LLDB_LOG_PROCESS). The possible ways to do verbose
logging is:
- use the Verbose function (log->Verbose(...))
- use it GetVerbose function (if(log && log->GetVerbose()) log->...)
- use the LLDB_LOGV macro


PS: There use to be a "verbose" **channel** at some point in the past, but
it was removed during the refactoring of the Log class as it was completely
orthogonal to the LLDB_LOG_OPTION_VERBOSE option, and having two ways to do
verbose logging seemed a bit too much (actually, we had a third one as
well, but nvm).

PPS: I think that at one point we should replace these macros with enums.
Among other things, we would gain some type safety, which would have
prevented this error. (The reason I haven't done that yet is because it
would require touching every single file.)

cheers,
pl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180326/3f5cb2c7/attachment.html>


More information about the lldb-commits mailing list