[RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command

Pedro Alves palves@redhat.com
Fri Dec 2 14:49:00 GMT 2016


On 11/29/2016 05:05 AM, Tom Tromey wrote:
> This replaces a cleanup in execute_gdb_command with an instance of
> unique_xmalloc_ptr.  std::string was not used because execute_command
> and execute_command_to_string don't accept a "const char *" (in fact
> the reason for copying the string at all).

You can do:

 std::string copy (arg);
 ...
 to_string_res = execute_command_to_string (&copy[0], from_tty);

That's fine in C++11.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list