[lldb-dev] Asserts in StringRef::front

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 6 13:41:27 PDT 2016


Thanks for the heads up.  I do run with asserts, so I'm not sure why I
didn't see this particular failure.  In any case i'll go back and look
through my changes for any other occurrences of this.

Most of the time args were being checked before being used.  Like the code
would go:

const char *arg = args.GetArgumentAtIndex(i);
if (!arg || arg[0] == '\0')
  continue;

// Use it.

I shouldn't have messed up any of those because I converted them all to

if (arg.empty())
  continue;

So hopefully the one you found is the only one.

On Thu, Oct 6, 2016 at 12:16 PM Jim Ingham <jingham at apple.com> wrote:

> I fixed a bug in CommandObject::Execute that cause test-suite crashes when
> running with an Assert build of llvm (r283479.)
>
> The test was doing:
>
> break modify -c ''
>
> which is the way you unset a condition on a breakpoint.
>
> So the StringRef for that option value was empty, and it appears that you
> aren't supposed to call "front" on an empty StringRef.  But empty option
> values are used in a bunch of places in lldb.
>
> Zachary, you might want to go scrub through the Args changes (and anywhere
> else you might be parsing an empty StringRef) to make sure there aren't
> other errors of this sort.
>
> And if you aren't running your prep testsuite runs with an Assert build of
> llvm, it's probably a good idea to do so.
>
> Jim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20161006/16b70a28/attachment.html>


More information about the lldb-dev mailing list