[Lldb-commits] [PATCH] D29615: Convert Log class to llvm streams

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 8 09:38:07 PST 2017


clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as if we type two log enable commands like:

  (lldb) log enable -f /tmp/a.txt lldb process
  (lldb) log enable -f /tmp/a.txt lldb api

share the same log stream (we don't open /tmp/a.txt twice) if is still open and available.



================
Comment at: source/Core/StreamCallback.cpp:22
 StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
-    : Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton),
-      m_accumulated_data(), m_collection_mutex() {}
----------------
labath wrote:
> zturner wrote:
> > I find it rather odd that this was hardcoding big endian.  Was the endianness here important for some reason?
> I think that was there just because you needed to specify some value. As we were always printing strings, it did not matter anyway.
Pavel is correct, this is because streams can be put into binary mode and that you can use Stream::Put32(uint32_t) which will write a number if in non-binary mode, or endian correct bytes if in binary mode. Logs didn't ever use the binary feature so we just set it to defaults.


https://reviews.llvm.org/D29615





More information about the lldb-commits mailing list