[Lldb-commits] [PATCH] D103701: [lldb] Set return status to failed when adding a command error

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 4 09:00:30 PDT 2021


DavidSpickett created this revision.
Herald added subscribers: pengfei, kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

There is a common pattern:
result.AppendError(...);
result.SetStatus(eReturnStatusFailed);

I found that some commands don't actually "fail" but only
print "error: ..." because the second line got missed.

This can cause you to miss a failed command when you're
using the Python interface during testing.
(and produce some confusing script results)

I did not find any place where you would want to add
an error without setting the return status, so just
set eReturnStatusFailed whenever you add an error to
a command result.

This change does not remove any of the now redundant
SetStatus. This should allow us to see if there are any
tests that have commands unexpectedly fail with this change.
(the test suite passes for me but I don't have access to all
the systems we cover so there could be some corner cases)

Some tests that failed on x86 and AArch64 have been modified
to work with the new behaviour.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103701

Files:
  lldb/source/Interpreter/CommandReturnObject.cpp
  lldb/test/API/commands/register/register/register_command/TestRegisters.py
  lldb/test/Shell/Commands/command-backtrace-parser-1.test
  lldb/test/Shell/Commands/command-backtrace-parser-2.test
  lldb/test/Shell/Commands/command-backtrace.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103701.349888.patch
Type: text/x-patch
Size: 4964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210604/e4af7107/attachment.bin>


More information about the lldb-commits mailing list