This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make target_waitstatus_to_string return an std::string
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Mon, 14 Aug 2017 16:03:38 +0100
- Subject: Re: [PATCH] Make target_waitstatus_to_string return an std::string
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2DF689FFF9
- References: <1502526609-31934-1-git-send-email-simon.marchi@ericsson.com>
On 08/12/2017 09:30 AM, Simon Marchi wrote:
> --- a/gdb/record-btrace.c
> +++ b/gdb/record-btrace.c
> @@ -2477,8 +2477,10 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
> {
> *status = btrace_step_no_resumed ();
>
> + std::string statstr = target_waitstatus_to_string (status);
> +
> DEBUG ("wait ended by %s: %s", target_pid_to_str (null_ptid),
> - target_waitstatus_to_string (status));
> + statstr.c_str ());
I think:
DEBUG ("wait ended by %s: %s", target_pid_to_str (null_ptid),
target_waitstatus_to_string (status).c_str ());
would be better, to avoid heap-allocating the string if
debugging is not active.
> @@ -2567,10 +2569,12 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
> /* We moved the replay position but did not update registers. */
> registers_changed_ptid (eventing->ptid);
>
> + std::string statstr = target_waitstatus_to_string (status);
> +
> DEBUG ("wait ended by thread %s (%s): %s",
> print_thread_id (eventing),
> target_pid_to_str (eventing->ptid),
> - target_waitstatus_to_string (status));
> + statstr.c_str ());
Ditto.
Otherwise looks fine to me.
Thanks,
Pedro Alves