This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Implement SDT (SystemTap probes) support for IA-64
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Gary Benson <gbenson at redhat dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Wed, 26 Jun 2013 11:49:51 -0700
- Subject: Re: [PATCH] Implement SDT (SystemTap probes) support for IA-64
- References: <m3bo6twg2x dot fsf at redhat dot com>
Hi Sergio,
> The problem was that IA-64 did not have an implementation for the SDT
> (SystemTap) probes, which was causing a warning to be printed because
> GDB was unable to parse the probe's arguments. The patch is almost
> trivial; it implements the support on ia64-linux-tdep.c file.
>
> Regtested on RHEL 5.9 Server IA-64, no regressions.
>
> Joel, could you please test to see if this works for you?
Many thanks for the patch. I am pretty sure I would have spent hours
figuring it out, and then implementing the necessary bits.
I confirm that this works for me as well.
> 2013-06-26 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * ia64-linux-tdep.c: Include <ctype.h>.
> (ia64_linux_stap_is_single_operand): New function.
> (ia64_linux_init_abi): Initialize SystemTap related attributes.
FWIW, this patch looks OK to me.
>
> diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
> index 35ee4e2..2ebe527 100644
> --- a/gdb/ia64-linux-tdep.c
> +++ b/gdb/ia64-linux-tdep.c
> @@ -27,6 +27,8 @@
> #include "symtab.h"
> #include "linux-tdep.h"
>
> +#include <ctype.h>
> +
> /* The sigtramp code is in a non-readable (executable-only) region
> of memory called the ``gate page''. The addresses in question
> were determined by examining the system headers. They are
> @@ -118,6 +120,17 @@ ia64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
> regcache_cooked_write_unsigned (regcache, IA64_GR10_REGNUM, 0);
> }
>
> +/* Implementation of `gdbarch_stap_is_single_operand', as defined in
> + gdbarch.h. */
> +
> +static int
> +ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
> +{
> + return ((isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
> + || *s == 'r' /* Register value. */
> + || isdigit (*s)); /* Literal number. */
> +}
> +
> static void
> ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> {
> @@ -142,6 +155,13 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> /* Enable TLS support. */
> set_gdbarch_fetch_tls_load_module_address (gdbarch,
> svr4_fetch_objfile_link_map);
> +
> + /* SystemTap related. */
> + set_gdbarch_stap_register_prefix (gdbarch, "r");
> + set_gdbarch_stap_register_indirection_prefix (gdbarch, "[");
> + set_gdbarch_stap_register_indirection_suffix (gdbarch, "]");
> + set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
> + set_gdbarch_stap_is_single_operand (gdbarch, ia64_linux_stap_is_single_operand);
> }
>
> /* Provide a prototype to silence -Wmissing-prototypes. */
--
Joel