Re: [RFA 40/67] Constify some commands in tracepoint.c

Pedro Alves
2017-09-21T10:03:50Z

This looks OK, but ...

On 09/21/2017 06:09 AM, Tom Tromey wrote:

> @@ -2501,9 +2489,10 @@ tfind_range_command (char *args, int from_tty)
>
> if (0 != (tmp = strchr (args, ',')))
> {
> - *tmp++ = '\0'; /* Terminate start address. */
> + std::string start_addr (args, tmp);
> + ++tmp;

... this fixes an actual bug:

(gdb) tfind range 1, 2
Breakpoint 4, tfind_range_command (args=0x30a0cbc "1, 2", from_tty=1) at src/gdb/tracepoint.c:2496
...
(top gdb) c
(gdb) <enter again for repeat>
Breakpoint 4, tfind_range_command (args=0x30a0cbc "1", from_tty=1) at src/gdb/tracepoint.c:2496

Which is great, and shows that constification pays off.

I think it'd have been nice to split fixes like these to a
separate patch, or at least mention them in the commit log, though.

[/me goes read patches 2-40 again to double check.]

Thanks,
Pedro Alves