RE: [patch v4 10/13] gdbserver, linux, btrace: add btrace support for linux-low

Metzger, Markus T
2012-12-05T09:27:59Z

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Wednesday, November 28, 2012 9:44 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org; markus.t.metzger@gmail.com; jan.kratochvil@redhat.com; tromey@redhat.com;
> kettenis@gnu.org
> Subject: Re: [patch v4 10/13] gdbserver, linux, btrace: add btrace support for linux-low
>
> On 11/27/2012 10:49 AM, markus.t.metzger@intel.com wrote:
> > From: Markus Metzger <markus.t.metzger@intel.com>
> >
> > Implement btrace target ops in target linux-low using the common linux-btrace
> > functions.
> >
> > Add linux-btrace.o to all targets that link linux-low.o. I'd rather not link it
> > to targets that do not support branch tracing, but this would require changing
> > the way target ops are defined for gdbserver.
>
> A simple way to do this would be to have configure.src set srv_linux_btrace=yes
> and then configure.ac would do:
>
> if test "${srv_linux_btrace}" = "yes"; then
> AC_DEFINE(HAVE_BTRACE, 1,
> [Define if the target supports branch tracing])
> fi
>
> You'd then do e.g.,:
>
> @@ -5858,6 +5884,11 @@ static struct target_ops linux_target_ops = {
> linux_get_min_fast_tracepoint_insn_len,
> linux_qxfer_libraries_svr4,
> linux_supports_agent,
> + #if HAVE_BTRACE
> + linux_supports_btrace,
> + linux_enable_btrace,
> + linux_disable_btrace,
> + linux_btrace_has_changed,
> + linux_low_read_btrace,
> + #endif
> };

Thanks. I'll do just that.

This removes the bulk of the feature for targets that do not support it. It leaves the function pointer fields in struct target_ops and the communication in server.c. If we are very conscious about gdbserver code size, I can guard those, as well.

Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052