This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Extend handling of immediates on ARM's SystemTap SDT probe support


Hi there,

Continuing my series of fixes on the SystemTap SDT support for the
ARM/AArch64 architectures, this patch now extends how ARM's SDT specific
parser handles literal numbers (immediates).

Currently, it only accepts "#" as the prefix.  However, according to
"info '(as) ARM-Chars'", expressions can also have "$" and nothing as a
prefix.  This patch extends the parser to accept those options.

It is a rather trivial patch, and tests have proved that it works fine.
OK to apply?

-- 
Sergio

2013-12-23  Sergio Durigan Junior  <sergiodj@redhat.com>

	* arm-linux-tdep.c (arm_stap_is_single_operand): Accept "$" as a
	literal prefix.  Also accept no prefix at all.
	(arm_stap_parse_special_token): Likewise.
	(arm_linux_init_abi): Likewise.

diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 0284f69..df2b8c4 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1116,7 +1116,7 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
 static int
 arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
 {
-  return (*s == '#' /* Literal number.  */
+  return (*s == '#' || *s == '$' || isdigit (*s) /* Literal number.  */
 	  || *s == '[' /* Register indirection or
 			  displacement.  */
 	  || isalpha (*s)); /* Register value.  */
@@ -1183,14 +1183,19 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
 
       ++tmp;
       tmp = skip_spaces_const (tmp);
-      if (*tmp++ != '#')
-	return 0;
+      if (*tmp == '#' || *tmp == '$')
+	++tmp;
 
       if (*tmp == '-')
 	{
 	  ++tmp;
 	  got_minus = 1;
 	}
+      else if (*tmp == '+')
+	++tmp;
+
+      if (!isdigit (*tmp))
+	return 0;
 
       displacement = strtol (tmp, &endp, 10);
       tmp = endp;
@@ -1235,7 +1240,7 @@ static void
 arm_linux_init_abi (struct gdbarch_info info,
 		    struct gdbarch *gdbarch)
 {
-  static const char *const stap_integer_prefixes[] = { "#", NULL };
+  static const char *const stap_integer_prefixes[] = { "#", "$", "", NULL };
   static const char *const stap_register_prefixes[] = { "r", NULL };
   static const char *const stap_register_indirection_prefixes[] = { "[",
 								    NULL };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]