<div>Hi everyone,</div><div><br></div><div><b>Currently, this is the output from a LLDB session:</b></div><div><br></div><div><div>[3:21pm][wlynch@orange bin] ./lldb </div><div>(lldb) process</div><div>terminate called after throwing an instance of 'std::logic_error'</div>
<div> what(): basic_string::_S_construct NULL not valid</div></div><div><br></div><div><b>If the attached patch is applied, the following is the LLDB session:</b></div><div><br></div><div><div>[3:25pm][wlynch@orange bin] ./lldb </div>
</div><div><div>(lldb) process</div><div>The following subcommands are supported:</div><div><br></div><div> attach -- Attaches to a process.</div><div> continue -- Continues execution all threads in the current process.</div>
<div> detach -- Detaches from the current process being debugged.</div><div> interrupt -- Interrupts the current process being debugged.</div><div> kill -- Terminates the current process being debugged.</div>
<div> launch -- Launches the executable in the debugger.</div><div> signal -- Sends a UNIX signal to the current process being debugged.</div><div> status -- Shows the current status and location of executing process.</div>
<div><br></div><div>For more help on any particular subcommand, type 'help <command> <subcommand>'.</div></div><div><br></div><div><b>Here's some notes on what's going on:</b></div><div><b><br>
</b></div><div>So, "process" is a multiword command object. That is, it uses CommandObjectMultiword to choose between a set of possible classes. In CommandObjectMultiword, a map is created to search for the desired subcommand. If null is searched for in that map, an uncaught exception is thrown by the standard library. Basically, it calls std::string(NULL). </div>
<div><br></div><div>The fix for this is to make sure that when we look for the next subcommand, to verify that one does in fact exist. </div><div><br></div><div><b>And here's the patch:</b></div><div><br></div><div>Index: source/Commands/CommandObjectMultiword.cpp</div>
<div>===================================================================</div><div>--- source/Commands/CommandObjectMultiword.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 108841)</div><div>+++ source/Commands/CommandObjectMultiword.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)</div>
<div>@@ -290,13 +290,12 @@</div><div> const char *</div><div> CommandObjectMultiword::GetRepeatCommand (Args ¤t_command_args, uint32_t index)</div><div> {</div><div>- if (current_command_args.GetArgumentCount() == 0)</div>
<div>- return NULL;</div><div> index++;</div><div>+ if (current_command_args.GetArgumentCount() <= index)</div><div>+ return NULL;</div><div> CommandObject *sub_command_object = GetSubcommandObject (current_command_args.GetArgumentAtIndex(index));</div>
<div> if (sub_command_object == NULL)</div><div> return NULL;</div><div>- else </div><div> return sub_command_object->GetRepeatCommand(current_command_args, index);</div><div> }</div><div><br></div>