[lldb-dev] Patch for review: target modules show-unwind errors
Jason Molenda
jmolenda at apple.com
Thu Aug 15 17:09:43 PDT 2013
Looks good, thanks for making the fix. Please commit the patch.
(forgot to Cc the list on my orig reply)
On Aug 15, 2013, at 2:10 PM, Michael Sartain <mikesart at gmail.com> wrote:
> When using the "target modules show-unwind", it was very difficult to tell whether I had typed something wrong or it had found zero results.
>
> All of these commands would return nothing:
> target modules show-unwind 0x80484d0 ; invalid command - nothing done
> target modules show-unwind -a 0x80484d0 ; this is a valid command that
> target modules show-unwind -foobar 0x80484d0 ; invalid command - nothing done
> target modules show-unwind nonexistentfunctionname ; invalid command - nothing done
>
> The patch below returns an error string if you specify an invalid option, don't specify an option, or no results were found.
>
> Please let me know if it's ok to submit. Thanks.
> -Mike
>
> mikesart at mikesart-rad:~/data/src/llvm.svn/llvm/tools/lldb$ svn diff
> Index: source/Commands/CommandObjectTarget.cpp
> ===================================================================
> --- source/Commands/CommandObjectTarget.cpp (revision 188467)
> +++ source/Commands/CommandObjectTarget.cpp (working copy)
> @@ -3468,6 +3468,7 @@
> case 'a':
> {
> ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
> + m_str = option_arg;
> m_type = eLookupTypeAddress;
> m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
> if (m_addr == LLDB_INVALID_ADDRESS)
> @@ -3481,6 +3482,10 @@
> m_type = eLookupTypeFunctionOrSymbol;
> break;
> }
> +
> + default:
> + error.SetErrorStringWithFormat ("unrecognized option %c.", short_option);
> + break;
> }
>
> return error;
> @@ -3591,8 +3596,21 @@
> }
> }
> }
> + else
> + {
> + result.AppendError ("address-expression or function name option must be specified.");
> + result.SetStatus (eReturnStatusFailed);
> + return false;
> + }
>
> size_t num_matches = sc_list.GetSize();
> + if (num_matches == 0)
> + {
> + result.AppendErrorWithFormat ("no unwind data found that matches '%s'.", m_options.m_str.c_str());
> + result.SetStatus (eReturnStatusFailed);
> + return false;
> + }
> +
> for (uint32_t idx = 0; idx < num_matches; idx++)
> {
> SymbolContext sc;
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list