Re: [PATCH 19/40] Fix cp_find_first_component_aux bug

Pedro Alves
2017-07-17T19:50:15Z

--
Thanks,
Pedro Alves
On 07/17/2017 08:17 PM, Keith Seitz wrote:
> On 06/02/2017 05:22 AM, Pedro Alves wrote:
>> gdb/ChangeLog:
>> yyyy-mm-dd Pedro Alves <palves@redhat.com>
>>
>> * cp-support.c (cp_find_first_component_aux): Add missing case for
>> end of string.
>
> That's pretty obvious, even to me. Do we a test case would add anything? /me not so sure [but then it would be rather trivial to write, eh?]

There's a bunch later in the series in:
[PATCH 36/40] Add comprehensive C++ operator linespec/location/completion tests

(that's how I spotted the bug; gdb sometimes failed those tests.)

To confirm I added:

case '\0':
+ gdb_assert (0);
return index;

on top of the whole series, and reran that testcase:

Running src/gdb/testsuite/gdb.linespec/cpls-ops.exp ...
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: "b test_op_delete::operator" creates no bp locations: set breakpoint (GDB internal error)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: "b test_op_delete::operator" creates no bp locations: matches
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: "b -function test_op_delete::operator" creates no bp locations: set breakpoint (GDB internal error)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: "b -function test_op_delete::operator" creates no bp locations: matches
FAIL: gdb.linespec/cpls-ops.exp: operator-delete[]: "b test_op_delete_array::operator" creates no bp locations: set breakpoint (GDB internal error)
(...)

Unfortunately, that testcase won't work yet as is, until a few
patches more down the series (I think patch #34, even). With
patch #19 alone:

FAIL: gdb.linespec/cpls-ops.exp: operator-delete: tab complete "b test_op_delete::operator delete " (timeout)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: cmd complete "b test_op_delete::operator delete "
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: tab complete "b test_op_delete::operator delete (" (timeout)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: cmd complete "b test_op_delete::operator delete ("
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: tab complete "b test_op_delete::operator delete ( void* " (timeout)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: cmd complete "b test_op_delete::operator delete ( void* "
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: tab complete "b test_op_delete::operator delete ( void * " (timeout)
FAIL: gdb.linespec/cpls-ops.exp: operator-delete: cmd complete "b test_op_delete::operator delete ( void * "
(...)

Would you be OK with adding the fix without the test yet?

Thanks,
Pedro Alves