linux-nat: Remove unnecessary xstrdup

I think this xstrdup is not useful.  We can pass ex.message directly to
throw_error instead.

gdb/ChangeLog:

	* linux-nat.c (linux_nat_attach): Remove xstrdup.
This commit is contained in:
Simon Marchi 2018-01-17 12:33:45 -05:00
parent d777820bf5
commit a7b2d0fbeb
2 changed files with 7 additions and 6 deletions

View file

@ -1,3 +1,7 @@
2018-01-17 Simon Marchi <simon.marchi@ericsson.com>
* linux-nat.c (linux_nat_attach): Remove xstrdup.
2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com>
PR gdb/21559 PR gdb/21559

View file

@ -1224,10 +1224,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
{ {
pid_t pid = parse_pid_to_attach (args); pid_t pid = parse_pid_to_attach (args);
struct buffer buffer; struct buffer buffer;
char *message, *buffer_s; char *buffer_s;
message = xstrdup (ex.message);
make_cleanup (xfree, message);
buffer_init (&buffer); buffer_init (&buffer);
linux_ptrace_attach_fail_reason (pid, &buffer); linux_ptrace_attach_fail_reason (pid, &buffer);
@ -1237,9 +1234,9 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
make_cleanup (xfree, buffer_s); make_cleanup (xfree, buffer_s);
if (*buffer_s != '\0') if (*buffer_s != '\0')
throw_error (ex.error, "warning: %s\n%s", buffer_s, message); throw_error (ex.error, "warning: %s\n%s", buffer_s, ex.message);
else else
throw_error (ex.error, "%s", message); throw_error (ex.error, "%s", ex.message);
} }
END_CATCH END_CATCH