[Lldb-commits] [PATCH] lldb - fix misleading "valid target indexes are" error message

Greg Clayton gclayton at apple.com
Wed Jul 9 14:13:08 PDT 2014


Looks good.

> On Jul 8, 2014, at 11:49 PM, Paul Osmialowski <pawelo at king.net.pl> wrote:
> 
> This fixes following issue:
> 
> (lldb) target select 0
> error: index 0 is out of range, valid target indexes are 0 - 4294967295
> (lldb) target select 1
> error: index 1 is out of range, valid target indexes are 0 - 4294967295
> 
> Due to unsigned arithmetic operation, we can see above output which is both misleading and against pure logic.
> 
> The question why there are no targets listed remains open.
> 
> http://reviews.llvm.org/D4430
> 
> Files:
>  source/Commands/CommandObjectTarget.cpp
> 
> Index: source/Commands/CommandObjectTarget.cpp
> ===================================================================
> --- source/Commands/CommandObjectTarget.cpp
> +++ source/Commands/CommandObjectTarget.cpp
> @@ -519,9 +519,16 @@
>                 }
>                 else
>                 {
> -                    result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n", 
> -                                                  target_idx,
> -                                                  num_targets - 1);
> +                    if (num_targets > 0)
> +                    {
> +                        result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n",
> +                                                      target_idx,
> +                                                      num_targets - 1);
> +                    } else
> +                    {
> +                        result.AppendErrorWithFormat ("index %u is out of range since there are no targets listed\n",
> +                                                      target_idx);
> +                    }
>                     result.SetStatus (eReturnStatusFailed);
>                 }
>             }
> <D4430.11186.patch>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list