[Lldb-commits] [PATCH] D29514: Change Error::PutToLog to LLDB_LOG_ERROR

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 3 14:20:59 PST 2017

labath added a comment.

In https://reviews.llvm.org/D29514#666341, @zturner wrote:

> If we do what you suggest, then we are relying on the `lldb::Error` format provider, which does not have the ability to accept this kind of "contextual reason" string (i.e. the string "While reading the %d'th item" in the above example).  So if we did this:
>   LLDB_LOG(log, error, "While reading the {0}'th item", 7)
> Then the entire error must be formatted independently of the entire context string.  So we could produce the output `error: The operation failed (0x12345), context: While reading the 7'th item` but this is slightly different from what was being printed before.
> I didn't actually try this approach and see if anything broke, because Windows runs much fewer tests than the rest of LLDB, so even if my test suite passed, it wouldn't guarantee that another test somewhere else wasn't relying on the message being exactly as it currently prints.

I doubt anything is depending on the exact string printed to the log. We should just make the new output makes sense. 
I'd format this message like this:
`LLDB_LOG(log, "Reading the {0}'th item: {1}", 7, error)`
which should give you something like:
`Reading 7th item: Too many open files.`
if you want, we can add the "error:" prefix, numeric error code, or something to the format provider,, but this would be enough for me.


More information about the lldb-commits mailing list