<div dir="ltr">While definitely not a prime example of StringRef usage, it is not strictly a bug either. Future calls of getopt will modify the value of optarg, but the actual string it points to (will have pointed to) remains unchanged as that is just some member of the initial argv array.<div><br></div><div>That said, I have no objections to making that a regular string, as it will avoid any doubts in the future.</div><div><br></div><div>pl</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 April 2017 at 23:43, Zachary Turner via lldb-dev <span dir="ltr"><<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">On Wed, Apr 12, 2017 at 10:43 AM Greg Clayton via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">What I now believe is happening is lldb-server is exiting for some reason and then the process just runs and still shows the output in LLDB because we hooked up the STDIO. I see lldb-server exits with an exit code of 0, but no command had been sent to terminate it. I will track that down.<div><br></div><div>Also, log_channels in lldb-gdbserver.cpp is using a llvm::StringRef incorrectly:</div><div><br></div><div>    case 'c': // Log Channels<br>      if (optarg && optarg[0])<br>        log_channels = StringRef(optarg);<br>      break;<br><br><div>Bad! This is exactly when we shouldn't be using llvm::StringRef. optarg is a static variable and can change if there are any arguments after "-c <args>".</div></div></div></blockquote><div><br></div></span><div>Good catch, log_channels should definitely be a std::string here.</div></div></div>
<br>______________________________<wbr>_________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br></div>