public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap-patch-split: Implementing parser and eval.
@ 2011-08-22 20:26 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-08-22 20:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap-patch-split has been updated
       via  a5e3177d79455f705dac963071e25d2da6c1b748 (commit)
       via  5b77a4ce9b5dcee0091cdea15dad55b2a2c6c142 (commit)
       via  fa6d1a2747bcb6319ea9277aa15bec67b7775b1f (commit)
       via  e44fbfeb670df753c8c7ff7a418cb26f12c6140f (commit)
       via  3d62c5729a9f1a92a57df4817c8d462abc04115c (commit)
       via  efbaa071959a7c284ffce12462c6a1892ca46e83 (commit)
       via  9583fc1dbf4532e095e5513b9036d307df33913c (commit)
       via  9a31771b7de0dee2c3c81d7bc8cf0f25402f37c2 (commit)
       via  81f4a29465072cc53a8a1a92620136ca102f81ed (commit)
      from  88feabea63518c3787d961e540ed360ea08c9b65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a5e3177d79455f705dac963071e25d2da6c1b748
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Mon Aug 22 17:26:27 2011 -0300

    Implementing parser and eval.

commit 5b77a4ce9b5dcee0091cdea15dad55b2a2c6c142
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Mon Aug 22 01:15:08 2011 -0300

    Adding stap_evaluate_special_token

commit fa6d1a2747bcb6319ea9277aa15bec67b7775b1f
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Mon Aug 22 01:13:42 2011 -0300

    Fix gdbarch bug

commit e44fbfeb670df753c8c7ff7a418cb26f12c6140f
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Sun Aug 21 01:16:14 2011 -0300

    Generating new gdbarch methods and variables

commit 3d62c5729a9f1a92a57df4817c8d462abc04115c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Sun Aug 21 00:40:50 2011 -0300

    Reimplementing parse, still not ready

commit efbaa071959a7c284ffce12462c6a1892ca46e83
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri Aug 19 03:16:49 2011 -0300

    Reverting and updating gdbarch methods and variables.

commit 9583fc1dbf4532e095e5513b9036d307df33913c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri Aug 19 03:06:20 2011 -0300

    Fixing displacement bug

commit 9a31771b7de0dee2c3c81d7bc8cf0f25402f37c2
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Thu Aug 18 00:08:13 2011 -0300

    Add complaint for malformed argument

commit 81f4a29465072cc53a8a1a92620136ca102f81ed
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Wed Aug 17 23:22:49 2011 -0300

    Formatting nits

-----------------------------------------------------------------------

Summary of changes:
 gdb/amd64-linux-tdep.c |   14 ++-
 gdb/gdbarch.c          |  256 +++++++++++++++++++-------
 gdb/gdbarch.h          |  130 ++++++++++----
 gdb/gdbarch.sh         |  113 +++++++++--
 gdb/i386-linux-tdep.c  |   14 ++-
 gdb/i386-tdep.c        |    2 +
 gdb/i386-tdep.h        |    2 +
 gdb/ppc-linux-tdep.c   |    5 +-
 gdb/s390-tdep.c        |    5 +-
 gdb/stap-probe.c       |  482 +++++++++++++++++++++++++++++++++++++++++-------
 10 files changed, 833 insertions(+), 190 deletions(-)

First 500 lines of diff:
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 4e7a123..a2d643a 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1363,13 +1363,25 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_process_record (gdbarch, i386_process_record);
   set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal);
 
-  /* SystemTap functions.  */
+  /* SystemTap variables and functions.  */
+  set_gdbarch_stap_integer_prefix (gdbarch, "$");
+  set_gdbarch_stap_integer_sufix (gdbarch, NULL);
+  set_gdbarch_stap_register_prefix (gdbarch, "%");
+  set_gdbarch_stap_register_sufix (gdbarch, NULL);
+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
+  set_gdbarch_stap_register_indirection_sufix (gdbarch, NULL);
+  set_gdbarch_stap_register_displacement_prefix (gdbarch, "(");
+  set_gdbarch_stap_register_displacement_sufix (gdbarch, NULL);
+  set_gdbarch_stap_parse_special_token (gdbarch, NULL);
+  set_gdbarch_stap_evaluate_special_token (gdbarch, NULL);
+#if 0
   set_gdbarch_stap_parse_arg (gdbarch, i386_stap_parse_arg);
   set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand);
   set_gdbarch_stap_evaluate_single_operand (gdbarch,
 					    i386_stap_evaluate_single_operand);
   set_gdbarch_stap_fetch_register_value (gdbarch,
 					 i386_stap_fetch_register_value);
+#endif
 
   /* Initialize the amd64_linux_record_tdep.  */
   /* These values are the size of the type that will be used in a system
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index cf02481..74a3fb0 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -262,10 +262,16 @@ struct gdbarch
   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
   gdbarch_record_special_symbol_ftype *record_special_symbol;
   gdbarch_get_syscall_number_ftype *get_syscall_number;
-  gdbarch_stap_parse_arg_ftype *stap_parse_arg;
-  gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
-  gdbarch_stap_evaluate_single_operand_ftype *stap_evaluate_single_operand;
-  gdbarch_stap_fetch_register_value_ftype *stap_fetch_register_value;
+  const char * stap_integer_prefix;
+  const char * stap_integer_sufix;
+  const char * stap_register_prefix;
+  const char * stap_register_sufix;
+  const char * stap_register_indirection_prefix;
+  const char * stap_register_indirection_sufix;
+  const char * stap_register_displacement_prefix;
+  const char * stap_register_displacement_sufix;
+  gdbarch_stap_parse_special_token_ftype *stap_parse_special_token;
+  gdbarch_stap_evaluate_special_token_ftype *stap_evaluate_special_token;
   int has_global_solist;
   int has_global_breakpoints;
   gdbarch_has_shared_address_space_ftype *has_shared_address_space;
@@ -419,10 +425,16 @@ struct gdbarch startup_gdbarch =
   0,  /* get_siginfo_type */
   0,  /* record_special_symbol */
   0,  /* get_syscall_number */
-  0,  /* stap_parse_arg */
-  0,  /* stap_is_single_operand */
-  0,  /* stap_evaluate_single_operand */
-  0,  /* stap_fetch_register_value */
+  0,  /* stap_integer_prefix */
+  0,  /* stap_integer_sufix */
+  0,  /* stap_register_prefix */
+  0,  /* stap_register_sufix */
+  0,  /* stap_register_indirection_prefix */
+  0,  /* stap_register_indirection_sufix */
+  0,  /* stap_register_displacement_prefix */
+  0,  /* stap_register_displacement_sufix */
+  0,  /* stap_parse_special_token */
+  0,  /* stap_evaluate_special_token */
   0,  /* has_global_solist */
   0,  /* has_global_breakpoints */
   default_has_shared_address_space,  /* has_shared_address_space */
@@ -708,10 +720,16 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of get_siginfo_type, has predicate.  */
   /* Skip verify of record_special_symbol, has predicate.  */
   /* Skip verify of get_syscall_number, has predicate.  */
-  /* Skip verify of stap_parse_arg, has predicate.  */
-  /* Skip verify of stap_is_single_operand, has predicate.  */
-  /* Skip verify of stap_evaluate_single_operand, has predicate.  */
-  /* Skip verify of stap_fetch_register_value, has predicate.  */
+  /* Skip verify of stap_integer_prefix, invalid_p == 0 */
+  /* Skip verify of stap_integer_sufix, invalid_p == 0 */
+  /* Skip verify of stap_register_prefix, invalid_p == 0 */
+  /* Skip verify of stap_register_sufix, invalid_p == 0 */
+  /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
+  /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */
+  /* Skip verify of stap_register_displacement_prefix, invalid_p == 0 */
+  /* Skip verify of stap_register_displacement_sufix, invalid_p == 0 */
+  /* Skip verify of stap_parse_special_token, has predicate.  */
+  /* Skip verify of stap_evaluate_special_token, has predicate.  */
   /* Skip verify of has_global_solist, invalid_p == 0 */
   /* Skip verify of has_global_breakpoints, invalid_p == 0 */
   /* Skip verify of has_shared_address_space, invalid_p == 0 */
@@ -1238,29 +1256,41 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
                       host_address_to_string (gdbarch->stabs_argument_has_addr));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_stap_evaluate_single_operand_p() = %d\n",
-                      gdbarch_stap_evaluate_single_operand_p (gdbarch));
+                      "gdbarch_dump: gdbarch_stap_evaluate_special_token_p() = %d\n",
+                      gdbarch_stap_evaluate_special_token_p (gdbarch));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: stap_evaluate_single_operand = <%s>\n",
-                      host_address_to_string (gdbarch->stap_evaluate_single_operand));
+                      "gdbarch_dump: stap_evaluate_special_token = <%s>\n",
+                      host_address_to_string (gdbarch->stap_evaluate_special_token));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_stap_fetch_register_value_p() = %d\n",
-                      gdbarch_stap_fetch_register_value_p (gdbarch));
+                      "gdbarch_dump: stap_integer_prefix = %s\n",
+                      gdbarch->stap_integer_prefix);
   fprintf_unfiltered (file,
-                      "gdbarch_dump: stap_fetch_register_value = <%s>\n",
-                      host_address_to_string (gdbarch->stap_fetch_register_value));
+                      "gdbarch_dump: stap_integer_sufix = %s\n",
+                      gdbarch->stap_integer_sufix);
   fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
-                      gdbarch_stap_is_single_operand_p (gdbarch));
+                      "gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
+                      gdbarch_stap_parse_special_token_p (gdbarch));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: stap_is_single_operand = <%s>\n",
-                      host_address_to_string (gdbarch->stap_is_single_operand));
+                      "gdbarch_dump: stap_parse_special_token = <%s>\n",
+                      host_address_to_string (gdbarch->stap_parse_special_token));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_stap_parse_arg_p() = %d\n",
-                      gdbarch_stap_parse_arg_p (gdbarch));
+                      "gdbarch_dump: stap_register_displacement_prefix = %s\n",
+                      gdbarch->stap_register_displacement_prefix);
   fprintf_unfiltered (file,
-                      "gdbarch_dump: stap_parse_arg = <%s>\n",
-                      host_address_to_string (gdbarch->stap_parse_arg));
+                      "gdbarch_dump: stap_register_displacement_sufix = %s\n",
+                      gdbarch->stap_register_displacement_sufix);
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: stap_register_indirection_prefix = %s\n",
+                      gdbarch->stap_register_indirection_prefix);
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: stap_register_indirection_sufix = %s\n",
+                      gdbarch->stap_register_indirection_sufix);
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: stap_register_prefix = %s\n",
+                      gdbarch->stap_register_prefix);
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: stap_register_sufix = %s\n",
+                      gdbarch->stap_register_sufix);
   fprintf_unfiltered (file,
                       "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
                       gdbarch_static_transform_name_p (gdbarch));
@@ -3764,100 +3794,188 @@ set_gdbarch_get_syscall_number (struct gdbarch *gdbarch,
   gdbarch->get_syscall_number = get_syscall_number;
 }
 
-int
-gdbarch_stap_parse_arg_p (struct gdbarch *gdbarch)
+const char *
+gdbarch_stap_integer_prefix (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->stap_parse_arg != NULL;
+  /* Skip verify of stap_integer_prefix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefix called\n");
+  return gdbarch->stap_integer_prefix;
 }
 
-int
-gdbarch_stap_parse_arg (struct gdbarch *gdbarch, const char **arg)
+void
+set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch,
+                                 const char * stap_integer_prefix)
+{
+  gdbarch->stap_integer_prefix = stap_integer_prefix;
+}
+
+const char *
+gdbarch_stap_integer_sufix (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->stap_parse_arg != NULL);
+  /* Skip verify of stap_integer_sufix, invalid_p == 0 */
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_arg called\n");
-  return gdbarch->stap_parse_arg (gdbarch, arg);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_sufix called\n");
+  return gdbarch->stap_integer_sufix;
 }
 
 void
-set_gdbarch_stap_parse_arg (struct gdbarch *gdbarch,
-                            gdbarch_stap_parse_arg_ftype stap_parse_arg)
+set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch,
+                                const char * stap_integer_sufix)
 {
-  gdbarch->stap_parse_arg = stap_parse_arg;
+  gdbarch->stap_integer_sufix = stap_integer_sufix;
 }
 
-int
-gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch)
+const char *
+gdbarch_stap_register_prefix (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of stap_register_prefix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefix called\n");
+  return gdbarch->stap_register_prefix;
+}
+
+void
+set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch,
+                                  const char * stap_register_prefix)
+{
+  gdbarch->stap_register_prefix = stap_register_prefix;
+}
+
+const char *
+gdbarch_stap_register_sufix (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->stap_is_single_operand != NULL;
+  /* Skip verify of stap_register_sufix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_sufix called\n");
+  return gdbarch->stap_register_sufix;
 }
 
-int
-gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
+void
+set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch,
+                                 const char * stap_register_sufix)
+{
+  gdbarch->stap_register_sufix = stap_register_sufix;
+}
+
+const char *
+gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->stap_is_single_operand != NULL);
+  /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_is_single_operand called\n");
-  return gdbarch->stap_is_single_operand (gdbarch, s);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefix called\n");
+  return gdbarch->stap_register_indirection_prefix;
 }
 
 void
-set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
-                                    gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
+set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch,
+                                              const char * stap_register_indirection_prefix)
 {
-  gdbarch->stap_is_single_operand = stap_is_single_operand;
+  gdbarch->stap_register_indirection_prefix = stap_register_indirection_prefix;
+}
+
+const char *
+gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_sufix called\n");
+  return gdbarch->stap_register_indirection_sufix;
+}
+
+void
+set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch,
+                                             const char * stap_register_indirection_sufix)
+{
+  gdbarch->stap_register_indirection_sufix = stap_register_indirection_sufix;
+}
+
+const char *
+gdbarch_stap_register_displacement_prefix (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of stap_register_displacement_prefix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_displacement_prefix called\n");
+  return gdbarch->stap_register_displacement_prefix;
+}
+
+void
+set_gdbarch_stap_register_displacement_prefix (struct gdbarch *gdbarch,
+                                               const char * stap_register_displacement_prefix)
+{
+  gdbarch->stap_register_displacement_prefix = stap_register_displacement_prefix;
+}
+
+const char *
+gdbarch_stap_register_displacement_sufix (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of stap_register_displacement_sufix, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_displacement_sufix called\n");
+  return gdbarch->stap_register_displacement_sufix;
+}
+
+void
+set_gdbarch_stap_register_displacement_sufix (struct gdbarch *gdbarch,
+                                              const char * stap_register_displacement_sufix)
+{
+  gdbarch->stap_register_displacement_sufix = stap_register_displacement_sufix;
 }
 
 int
-gdbarch_stap_evaluate_single_operand_p (struct gdbarch *gdbarch)
+gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->stap_evaluate_single_operand != NULL;
+  return gdbarch->stap_parse_special_token != NULL;
 }
 
-struct value *
-gdbarch_stap_evaluate_single_operand (struct gdbarch *gdbarch, struct stap_evaluation_info *eval_info)
+int
+gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, const char **token)
 {
   gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->stap_evaluate_single_operand != NULL);
+  gdb_assert (gdbarch->stap_parse_special_token != NULL);
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_evaluate_single_operand called\n");
-  return gdbarch->stap_evaluate_single_operand (gdbarch, eval_info);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_special_token called\n");
+  return gdbarch->stap_parse_special_token (gdbarch, token);
 }
 
 void
-set_gdbarch_stap_evaluate_single_operand (struct gdbarch *gdbarch,
-                                          gdbarch_stap_evaluate_single_operand_ftype stap_evaluate_single_operand)
+set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
+                                      gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
 {
-  gdbarch->stap_evaluate_single_operand = stap_evaluate_single_operand;
+  gdbarch->stap_parse_special_token = stap_parse_special_token;
 }
 
 int
-gdbarch_stap_fetch_register_value_p (struct gdbarch *gdbarch)
+gdbarch_stap_evaluate_special_token_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->stap_fetch_register_value != NULL;
+  return gdbarch->stap_evaluate_special_token != NULL;
 }
 
 struct value *
-gdbarch_stap_fetch_register_value (struct gdbarch *gdbarch, struct stap_evaluation_info *eval_info, int displacement_p, int *indirect_p)
+gdbarch_stap_evaluate_special_token (struct gdbarch *gdbarch, struct stap_evaluation_info *eval_info)
 {
   gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->stap_fetch_register_value != NULL);
+  gdb_assert (gdbarch->stap_evaluate_special_token != NULL);
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_fetch_register_value called\n");
-  return gdbarch->stap_fetch_register_value (gdbarch, eval_info, displacement_p, indirect_p);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_evaluate_special_token called\n");
+  return gdbarch->stap_evaluate_special_token (gdbarch, eval_info);
 }
 
 void
-set_gdbarch_stap_fetch_register_value (struct gdbarch *gdbarch,
-                                       gdbarch_stap_fetch_register_value_ftype stap_fetch_register_value)
+set_gdbarch_stap_evaluate_special_token (struct gdbarch *gdbarch,
+                                         gdbarch_stap_evaluate_special_token_ftype stap_evaluate_special_token)
 {
-  gdbarch->stap_fetch_register_value = stap_fetch_register_value;
+  gdbarch->stap_evaluate_special_token = stap_evaluate_special_token;
 }
 
 int
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 2aff78d..74d47bc 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -957,54 +957,118 @@ typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, pti
 extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid);
 extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number);
 
-/* SystemTap related functions.
-   Parse a SystemTap probe's argument. */
+/* SystemTap related fields and functions.
+   Prefix used to mark an integer constant on the architecture's assembly
+   For example, on x86 integer constants are written as:
+  
+    $10 ;; integer constant 10
+  
+   in this case, this prefix would be the character `$'. */
+
+extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix);
+
+/* Sufix used to mark an integer constant on the architecture's assembly. */
+
+extern const char * gdbarch_stap_integer_sufix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch, const char * stap_integer_sufix);
+
+/* Prefix used to mark a register name on the architecture's assembly.
+   For example, on x86 the register name is written as:
+  
+    %eax ;; register eax
+  
+   in this case, this prefix would be the character `%'. */
+
+extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix);
+
+/* Sufix used to mark a register name on the architecture's assembly */
+
+extern const char * gdbarch_stap_register_sufix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch, const char * stap_register_sufix);
+
+/* Prefix used to mark a register indirection on the architecture's assembly.
+   For example, on x86 the register indirection is written as:
+  
+    (%eax) ;; indirecting eax
+  
+   in this case, this prefix would be the charater `('. */
+
+extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix);
 
-extern int gdbarch_stap_parse_arg_p (struct gdbarch *gdbarch);
+/* Sufix used to mark a register indirection on the architecture's assembly.
+   For example, on x86 the register indirection is written as:
+  
+    (%eax) ;; indirecting eax
+  
+   in this case, this prefix would be the charater `)'. */
 
-typedef int (gdbarch_stap_parse_arg_ftype) (struct gdbarch *gdbarch, const char **arg);
-extern int gdbarch_stap_parse_arg (struct gdbarch *gdbarch, const char **arg);
-extern void set_gdbarch_stap_parse_arg (struct gdbarch *gdbarch, gdbarch_stap_parse_arg_ftype *stap_parse_arg);
+extern const char * gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch, const char * stap_register_indirection_sufix);
 
-/* Check if S is a single operand.
+/* Prefix used to mark a register displacement on the architecture's assembly.
+   For example, on x86 the register displacement is written as:
   
-   Single operands can be:
-    - Literal integers, e.g. `$10' on x86
-    - Register access, e.g. `%eax' on x86
-    - Register indirection, e.g. `(%eax)' on x86
-    - Register displacement, e.g. `4(%eax)' on x86
+    4(%eax) ;; indirecting eax
   
-   This function should check for these patterns on the string
-   and return 1 if some were found, or zero otherwise. */
+   in this case, this prefix would be the charater `('.  Note that we do NOT
+   include the number(s) before the parenthesis, because the parser already
+   assumes that the displacement will be of the form:
+  
+   <number> <displacement_prefix> <register_name> <displacement_sufix> */
 
-extern int gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch);
+extern const char * gdbarch_stap_register_displacement_prefix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_displacement_prefix (struct gdbarch *gdbarch, const char * stap_register_displacement_prefix);
 
-typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s);
-extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s);
-extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand);
+/* Sufix used to mark a register indirection on the architecture's assembly.
+   For example, on x86 the register indirection is written as:
+  
+    (%eax) ;; indirecting eax
+  
+   in this case, this prefix would be the charater `)'. */
 
-/* Evaluate a single operand.
+extern const char * gdbarch_stap_register_displacement_sufix (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_displacement_sufix (struct gdbarch *gdbarch, const char * stap_register_displacement_sufix);
+
+/* Function used to handle a "special case" in the parser.
+  
+   A "special case" is considered to be an unknown token, i.e., a token
+   that the parser does not know how to parse.  A good example of special
+   case would be ARM's register displacement syntax:
+  
+    [R0, #4]  ;; displacing R0 by 4
   
-   Single operands can be:
+   Since the parser assumes that a register displacement is of the form:
   
-    - unary operators `-' and `~'


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-22 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 20:26 [SCM] archer-sergiodj-stap-patch-split: Implementing parser and eval 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).