public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-sergiodj-stap-patch-split: Implementing stap support for ARM.
@ 2011-09-07 21:41 sergiodj
0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-09-07 21:41 UTC (permalink / raw)
To: archer-commits
The branch, archer-sergiodj-stap-patch-split has been updated
via 7bb7b6a490dd8913a206c341596790cacc2ada3e (commit)
from 51bc080cc381dc4b981222439265bdf2773ab67d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 7bb7b6a490dd8913a206c341596790cacc2ada3e
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed Sep 7 18:41:07 2011 -0300
Implementing stap support for ARM.
-----------------------------------------------------------------------
Summary of changes:
gdb/arm-linux-tdep.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 119 insertions(+), 0 deletions(-)
First 500 lines of diff:
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index b5b56de..56a0379 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -44,6 +44,10 @@
#include "gdbthread.h"
#include "symfile.h"
+#include "cli/cli-utils.h"
+#include "stap-probe.h"
+#include <ctype.h>
+
#include "gdb_string.h"
/* This is defined in <elf.h> on ARM GNU/Linux systems. */
@@ -1049,6 +1053,109 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
return dsc;
}
+static int
+arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
+{
+ return (*s == '#' /* Literal number. */
+ || (*s == '[' && s[1] == 'r') /* Register indirection or
+ displacement. */
+ || *s == 'r'); /* Register value. */
+}
+
+static int
+arm_stap_parse_special_token (struct gdbarch *gdbarch, const char **token)
+{
+ char *s = (char *) *token;
+
+ /* The special tokens parsed here are:
+
+ - register displacement, in the form of [rR, #N]. */
+ if (*s == '[')
+ {
+ ++s;
+ if (*s++ != 'r')
+ return 0;
+
+ if (!isdigit (*s))
+ return 0;
+
+ while (isdigit (*s))
+ ++s;
+
+ if (*s++ != ',')
+ return 0;
+
+ s = skip_spaces (s);
+
+ if (*s++ != '#')
+ return 0;
+
+ if (!isdigit (*s))
+ return 0;
+
+ while (isdigit (*s))
+ ++s;
+
+ if (*s++ != ']')
+ return 0;
+ }
+ else
+ return 0;
+
+ *token = s;
+
+ return 1;
+}
+
+static struct value *
+arm_stap_evaluate_special_token (struct gdbarch *gdbarch,
+ struct stap_evaluation_info *eval_info)
+{
+ struct value *ret = NULL;
+
+ if (*eval_info->exp_buf == '[')
+ {
+ char *tmp = eval_info->exp_buf;
+ char *comma;
+ int number;
+
+ ++tmp;
+ while (*tmp && *tmp != ',')
+ ++tmp;
+
+ if (*tmp == '\0')
+ return NULL;
+
+ /* We have to make this hack here because otherwise
+ `stap_fetch_reg_value' would get confused due to the odd format
+ of the displacement line. */
+ *tmp = ']';
+ comma = tmp;
+
+ ++tmp;
+ tmp = skip_spaces (tmp);
+ if (*tmp++ != '#')
+ return NULL;
+
+ number = strtol (tmp, &tmp, 0);
+
+ /* Skipping last `]'. */
+ ++tmp;
+
+ ret = stap_fetch_reg_value (eval_info,
+ value_from_longest (builtin_type (gdbarch)->builtin_int,
+ number));
+
+ eval_info->exp_buf = tmp;
+ /* Restoring the original char. */
+ *comma = ',';
+ }
+ else
+ return NULL;
+
+ return ret;
+}
+
static void
arm_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -1148,6 +1255,18 @@ arm_linux_init_abi (struct gdbarch_info info,
simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
+ /* SystemTap functions. */
+ set_gdbarch_stap_integer_prefix (gdbarch, "#");
+ set_gdbarch_stap_integer_sufix (gdbarch, NULL);
+ set_gdbarch_stap_register_prefix (gdbarch, NULL);
+ set_gdbarch_stap_register_sufix (gdbarch, NULL);
+ set_gdbarch_stap_register_indirection_prefix (gdbarch, "[");
+ set_gdbarch_stap_register_indirection_sufix (gdbarch, "]");
+ set_gdbarch_stap_is_single_operand (gdbarch, arm_stap_is_single_operand);
+ set_gdbarch_stap_parse_special_token (gdbarch,
+ arm_stap_parse_special_token);
+ set_gdbarch_stap_evaluate_special_token (gdbarch,
+ arm_stap_evaluate_special_token);
tdep->syscall_next_pc = arm_linux_syscall_next_pc;
}
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-07 21:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07 21:41 [SCM] archer-sergiodj-stap-patch-split: Implementing stap support for ARM sergiodj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).