Re: [RFA 8/8] Let gdb.execute handle multi-line commands

Pedro Alves
2018-04-24T16:44:05Z

On 04/19/2018 08:15 PM, Tom Tromey wrote:

> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -581,6 +581,20 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
> {
> struct interp *interp;
>
> + std::string arg_copy = arg;
> + bool first = true;
> + char *save_ptr = nullptr;
> + gdb::function_view<const char * ()> reader
> + = [&] ()

"auto reader"

Looks good to me otherwise.

> + {
> + const char *result = strtok_r (first ? &arg_copy[0] : nullptr,
> + "\n", &save_ptr);
> + first = false;
> + return result;
> + };
> +
Thanks,
Pedro Alves