From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Simon Marchi <simon.marchi@ericsson.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] Add method/format information to =record-started
Date: Mon, 06 Jun 2016 13:20:00 -0000 [thread overview]
Message-ID: <A78C989F6D9628469189715575E55B23332EB299@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <57557571.7040200@ericsson.com>
> -----Original Message-----
> From: Simon Marchi [mailto:simon.marchi@ericsson.com]
> Sent: Monday, June 6, 2016 3:07 PM
> To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH] Add method/format information to =record-started
Hi Simon,
Please see Yao's reply regarding formatting.
> >> @@ -234,7 +235,8 @@ record_btrace_open (const char *args, int from_tty)
> >> NULL);
> >> record_btrace_generating_corefile = 0;
> >>
> >> - observer_notify_record_changed (current_inferior (), 1);
> >> + format = record_btrace_conf.format == BTRACE_FORMAT_PT ? "pt" : "bts";
> >
> > I'd use a switch here and not assume that format != pt means bts. If we added
> > another format (LBR maybe?) we might miss this.
>
> You're right. What do you think of adding a convenience function like this?
>
>
> diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c
> index eba3979..ebf3ed2 100644
> --- a/gdb/common/btrace-common.c
> +++ b/gdb/common/btrace-common.c
> @@ -43,6 +43,23 @@ btrace_format_string (enum btrace_format format)
>
> /* See btrace-common.h. */
>
> +const char *
> +btrace_format_short_string (enum btrace_format format)
> +{
> + switch (format)
> + {
> + case BTRACE_FORMAT_BTS:
> + return "bts";
> +
> + case BTRACE_FORMAT_PT:
> + return "pt";
> + }
> +
> + internal_error (__FILE__, __LINE__, _("Unknown branch trace format"));
> +}
> +
> +/* See btrace-common.h. */
> +
> void
> btrace_data_init (struct btrace_data *data)
> {
> diff --git a/gdb/common/btrace-common.h b/gdb/common/btrace-common.h
> index ad208cd..ba707a2 100644
> --- a/gdb/common/btrace-common.h
> +++ b/gdb/common/btrace-common.h
> @@ -214,6 +214,10 @@ enum btrace_error
> /* Return a string representation of FORMAT. */
> extern const char *btrace_format_string (enum btrace_format format);
>
> +/* Return a short abbreviation string of FORMAT. FORMAT can have the value
> + BTRACE_FORMAT_NONE. */
> +extern const char *btrace_format_short_string (enum btrace_format format);
Looks good except that BTRACE_FORMAT_NONE is not handled in the switch.
We could leave it as a bad format string to be detected by the MI consumer. This would
leave the short and long versions of btrace_format_string symmetric.
Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2016-06-06 13:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 15:52 Simon Marchi
2016-06-03 17:03 ` Simon Marchi
2016-06-06 6:38 ` Metzger, Markus T
2016-06-06 13:03 ` Yao Qi
2016-06-06 13:24 ` Simon Marchi
2016-06-07 9:32 ` Yao Qi
2016-06-07 12:53 ` Simon Marchi
2016-06-07 15:38 ` Yao Qi
2016-06-07 15:48 ` Simon Marchi
2016-06-06 13:07 ` Simon Marchi
2016-06-06 13:20 ` Metzger, Markus T [this message]
2016-06-06 13:39 ` Simon Marchi
2016-06-06 13:44 ` Metzger, Markus T
2016-06-06 13:49 ` Simon Marchi
2016-06-06 14:02 ` Metzger, Markus T
2016-06-06 14:28 ` Simon Marchi
2016-06-06 14:33 ` Metzger, Markus T
2016-06-06 15:13 ` Eli Zaretskii
2016-06-06 21:12 ` Simon Marchi
2016-07-05 13:51 ` Yao Qi
2016-07-05 13:52 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A78C989F6D9628469189715575E55B23332EB299@IRSMSX104.ger.corp.intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox