[Lldb-commits] [PATCH] D35525: Fix "help format" output

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 20 13:23:31 PDT 2017


jingham added a comment.

Yes, your version clearly has the test right.  I was wondering why this didn't have a more dramatic ill-effect, but it turns out that this function is only used for printing argument help text, which it clearly messes up:

  (lldb) help format
  <format>
              --
              One
              of
              the
              format
              names
              (or
              one-character
              names)

I'm not sure why we need a separate function for printing argument output that does wrapping differently from command help, but that's a question for another day.

It doesn't look like there are any tests for this help output.  But it should be possible to write a test for this.  You can get what you need programmatically, e.g.:

  >>> result = lldb.SBCommandReturnObject()
  >>> lldb.debugger.GetCommandInterpreter().HandleCommand("help format", result)
  1
  >>> print result.GetOutput()
  <format> -- One of the format names (or one-character names) that can be used to show a variable's value:
              "default"
              'B' or "boolean"
              'b' or "binary"
              'y' or "bytes"
              'Y' or "bytes with ASCII"

And you can get & set the terminal width of the debugger with the SBDebugger.{Get,Set}TerminalWidth, so you could make sure that the length of line 1 + length of first word on line 2 > terminal width.  The only tricky bit would be picking the right command to use.

This is such an obvious fix it seems unkind to stall it for a test, but OTOH, if you could whip one up that would be great!


https://reviews.llvm.org/D35525





More information about the lldb-commits mailing list