[Lldb-commits] [lldb] r159927 - /lldb/trunk/source/Commands/CommandObjectTarget.cpp
Filipe Cabecinhas
me at filcab.net
Mon Jul 9 06:02:18 PDT 2012
Author: filcab
Date: Mon Jul 9 08:02:17 2012
New Revision: 159927
URL: http://llvm.org/viewvc/llvm-project?rev=159927&view=rev
Log:
Make error messages more user-friendly for the 'target delete' command.
Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=159927&r1=159926&r2=159927&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Jul 9 08:02:17 2012
@@ -474,6 +474,13 @@
if (argc > 0)
{
const uint32_t num_targets = target_list.GetNumTargets();
+ // Bail out if don't have any targets.
+ if (num_targets == 0) {
+ result.AppendError("no targets to delete");
+ result.SetStatus(eReturnStatusFailed);
+ success = false;
+ }
+
for (uint32_t arg_idx = 0; success && arg_idx < argc; ++arg_idx)
{
const char *target_idx_arg = args.GetArgumentAtIndex(arg_idx);
@@ -489,9 +496,14 @@
continue;
}
}
- result.AppendErrorWithFormat ("target index %u is out of range, valid target indexes are 0 - %u\n",
- target_idx,
- num_targets - 1);
+ if (num_targets > 1)
+ result.AppendErrorWithFormat ("target index %u is out of range, valid target indexes are 0 - %u\n",
+ target_idx,
+ num_targets - 1);
+ else
+ result.AppendErrorWithFormat("target index %u is out of range, the only valid index is 0\n",
+ target_idx);
+
result.SetStatus (eReturnStatusFailed);
success = false;
}
More information about the lldb-commits
mailing list