<div dir="ltr"><div>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.</div><div><br></div><div>All of these commands would return nothing:</div>
<div> target modules show-unwind 0x80484d0 ; invalid command - nothing done</div><div> target modules show-unwind -a 0x80484d0 ; this is a valid command that </div><div> target modules show-unwind -foobar 0x80484d0 ; invalid command - nothing done<br>
</div><div> target modules show-unwind nonexistentfunctionname ; invalid command - nothing done<br></div><div><br></div><div>The patch below returns an error string if you specify an invalid option, don't specify an option, or no results were found.</div>
<div><br></div><div>Please let me know if it's ok to submit. Thanks.</div><div> -Mike</div><div><br></div><div>mikesart@mikesart-rad:~/data/src/llvm.svn/llvm/tools/lldb$ svn diff</div><div>Index: source/Commands/CommandObjectTarget.cpp</div>
<div>===================================================================</div><div>--- source/Commands/CommandObjectTarget.cpp (revision 188467)</div><div>+++ source/Commands/CommandObjectTarget.cpp (working copy)</div>
<div>@@ -3468,6 +3468,7 @@</div><div> case 'a':</div><div> {</div><div> ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());</div><div>+ m_str = option_arg;</div>
<div> m_type = eLookupTypeAddress;</div><div> m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);</div><div> if (m_addr == LLDB_INVALID_ADDRESS)</div>
<div>@@ -3481,6 +3482,10 @@</div><div> m_type = eLookupTypeFunctionOrSymbol;</div><div> break;</div><div> }</div><div>+</div><div>+ default:</div><div>
+ error.SetErrorStringWithFormat ("unrecognized option %c.", short_option);</div><div>+ break;</div><div> }</div><div> </div><div> return error;</div>
<div>@@ -3591,8 +3596,21 @@</div><div> }</div><div> }</div><div> }</div><div>+ else</div><div>+ {</div><div>+ result.AppendError ("address-expression or function name option must be specified.");</div>
<div>+ result.SetStatus (eReturnStatusFailed);</div><div>+ return false;</div><div>+ }</div><div> </div><div> size_t num_matches = sc_list.GetSize();</div><div>+ if (num_matches == 0)</div>
<div>+ {</div><div>+ result.AppendErrorWithFormat ("no unwind data found that matches '%s'.", m_options.m_str.c_str());</div><div>+ result.SetStatus (eReturnStatusFailed);</div>
<div>+ return false;</div><div>+ }</div><div>+</div><div> for (uint32_t idx = 0; idx < num_matches; idx++)</div><div> {</div><div> SymbolContext sc;</div><div><br></div></div>