|
|
2c2fa1 |
commit 05c0465e16a5e2db92f8975aebf2bb5aacb1c542
|
|
|
2c2fa1 |
Author: Sergio Durigan Junior <sergiodj@redhat.com>
|
|
|
2c2fa1 |
Date: Thu Dec 19 18:53:40 2013 -0200
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
Extend SystemTap SDT probe argument parser
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
This patch extends the current generic parser for SystemTap SDT probe
|
|
|
2c2fa1 |
arguments. It can be almost considered a cleanup, but the main point of
|
|
|
2c2fa1 |
it is actually to allow the generic parser to accept multiple prefixes
|
|
|
2c2fa1 |
and suffixes for the its operands (i.e., integers, register names, and
|
|
|
2c2fa1 |
register indirection).
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
I have chosen to implement this as a list of const strings, and declare
|
|
|
2c2fa1 |
this list as "static" inside each target's method used to initialize
|
|
|
2c2fa1 |
gdbarch.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
This patch is actually a preparation for an upcoming patch for ARM,
|
|
|
2c2fa1 |
which implements the support for multiple integer prefixes (as defined
|
|
|
2c2fa1 |
by ARM's asm spec). And AArch64 will also need this, for the same
|
|
|
2c2fa1 |
reason.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
This patch was regtested on all architectures that it touches (i.e.,
|
|
|
2c2fa1 |
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
|
|
|
2c2fa1 |
argument prefixes and suffixes. Initialize gdbarch with them.
|
|
|
2c2fa1 |
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
|
|
|
2c2fa1 |
* gdbarch.c: Regenerate.
|
|
|
2c2fa1 |
* gdbarch.h: Regenerate.
|
|
|
2c2fa1 |
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
|
|
|
2c2fa1 |
(stap_register_prefix, stap_register_suffix)
|
|
|
2c2fa1 |
(stap_register_indirection_prefix)
|
|
|
2c2fa1 |
(stap_register_indirection_suffix): Declare as "const char *const
|
|
|
2c2fa1 |
*" instead of "const char *". Adjust printing function. Rename
|
|
|
2c2fa1 |
all of the variables to the plural.
|
|
|
2c2fa1 |
(pstring_list): New function.
|
|
|
2c2fa1 |
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
|
|
|
2c2fa1 |
argument prefixes and suffixes. Initialize gdbarch with them.
|
|
|
2c2fa1 |
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
|
|
|
2c2fa1 |
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
|
|
|
2c2fa1 |
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
|
|
|
2c2fa1 |
* stap-probe.c (stap_is_generic_prefix): New function.
|
|
|
2c2fa1 |
(stap_is_register_prefix): Likewise.
|
|
|
2c2fa1 |
(stap_is_register_indirection_prefix): Likewise.
|
|
|
2c2fa1 |
(stap_is_integer_prefix): Likewise.
|
|
|
2c2fa1 |
(stap_generic_check_suffix): Likewise.
|
|
|
2c2fa1 |
(stap_check_integer_suffix): Likewise.
|
|
|
2c2fa1 |
(stap_check_register_suffix): Likewise.
|
|
|
2c2fa1 |
(stap_check_register_indirection_suffix): Likewise.
|
|
|
2c2fa1 |
(stap_parse_register_operand): Remove unecessary declarations for
|
|
|
2c2fa1 |
variables holding prefix and suffix information. Use the new
|
|
|
2c2fa1 |
functions listed above for checking for prefixes and suffixes.
|
|
|
2c2fa1 |
(stap_parse_single_operand): Likewise.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/amd64-tdep.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/amd64-tdep.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/amd64-tdep.c
|
|
|
2c2fa1 |
@@ -2867,6 +2867,12 @@ amd64_init_abi (struct gdbarch_info info
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
2c2fa1 |
const struct target_desc *tdesc = info.target_desc;
|
|
|
2c2fa1 |
+ static const char *const stap_integer_prefixes[] = { "$", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_prefixes[] = { "%", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_prefixes[] = { "(",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_suffixes[] = { ")",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* AMD64 generally uses `fxsave' instead of `fsave' for saving its
|
|
|
2c2fa1 |
floating-point registers. */
|
|
|
2c2fa1 |
@@ -2976,10 +2982,12 @@ amd64_init_abi (struct gdbarch_info info
|
|
|
2c2fa1 |
set_gdbarch_gen_return_address (gdbarch, amd64_gen_return_address);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* SystemTap variables and functions. */
|
|
|
2c2fa1 |
- set_gdbarch_stap_integer_prefix (gdbarch, "$");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_prefix (gdbarch, "%");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_suffix (gdbarch, ")");
|
|
|
2c2fa1 |
+ set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_prefixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_suffixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
set_gdbarch_stap_is_single_operand (gdbarch,
|
|
|
2c2fa1 |
i386_stap_is_single_operand);
|
|
|
2c2fa1 |
set_gdbarch_stap_parse_special_token (gdbarch,
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/arm-linux-tdep.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/arm-linux-tdep.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/arm-linux-tdep.c
|
|
|
2c2fa1 |
@@ -1182,6 +1182,12 @@ static void
|
|
|
2c2fa1 |
arm_linux_init_abi (struct gdbarch_info info,
|
|
|
2c2fa1 |
struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
+ static const char *const stap_integer_prefixes[] = { "#", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_prefixes[] = { "r", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_prefixes[] = { "[",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_suffixes[] = { "]",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
linux_init_abi (info, gdbarch);
|
|
|
2c2fa1 |
@@ -1281,10 +1287,12 @@ arm_linux_init_abi (struct gdbarch_info
|
|
|
2c2fa1 |
set_gdbarch_process_record (gdbarch, arm_process_record);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* SystemTap functions. */
|
|
|
2c2fa1 |
- set_gdbarch_stap_integer_prefix (gdbarch, "#");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_prefix (gdbarch, "r");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_prefix (gdbarch, "[");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_suffix (gdbarch, "]");
|
|
|
2c2fa1 |
+ set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_prefixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_suffixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
|
|
|
2c2fa1 |
set_gdbarch_stap_is_single_operand (gdbarch, arm_stap_is_single_operand);
|
|
|
2c2fa1 |
set_gdbarch_stap_parse_special_token (gdbarch,
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/gdbarch.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/gdbarch.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/gdbarch.c
|
|
|
2c2fa1 |
@@ -86,6 +86,35 @@ pstring (const char *string)
|
|
|
2c2fa1 |
return string;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
+/* Helper function to print a list of strings, represented as "const
|
|
|
2c2fa1 |
+ char *const *". The list is printed comma-separated. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static char *
|
|
|
2c2fa1 |
+pstring_list (const char *const *list)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ static char ret[100];
|
|
|
2c2fa1 |
+ const char *const *p;
|
|
|
2c2fa1 |
+ size_t offset = 0;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (list == NULL)
|
|
|
2c2fa1 |
+ return "(null)";
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ ret[0] = '\0';
|
|
|
2c2fa1 |
+ for (p = list; *p != NULL && offset < sizeof (ret); ++p)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ size_t s = xsnprintf (ret + offset, sizeof (ret) - offset, "%s, ", *p);
|
|
|
2c2fa1 |
+ offset += 2 + s;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (offset > 0)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ gdb_assert (offset - 2 < sizeof (ret));
|
|
|
2c2fa1 |
+ ret[offset - 2] = '\0';
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return ret;
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Maintain the struct gdbarch object. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
@@ -264,12 +293,12 @@ struct gdbarch
|
|
|
2c2fa1 |
gdbarch_get_siginfo_type_ftype *get_siginfo_type;
|
|
|
2c2fa1 |
gdbarch_record_special_symbol_ftype *record_special_symbol;
|
|
|
2c2fa1 |
gdbarch_get_syscall_number_ftype *get_syscall_number;
|
|
|
2c2fa1 |
- const char * stap_integer_prefix;
|
|
|
2c2fa1 |
- const char * stap_integer_suffix;
|
|
|
2c2fa1 |
- const char * stap_register_prefix;
|
|
|
2c2fa1 |
- const char * stap_register_suffix;
|
|
|
2c2fa1 |
- const char * stap_register_indirection_prefix;
|
|
|
2c2fa1 |
- const char * stap_register_indirection_suffix;
|
|
|
2c2fa1 |
+ const char *const * stap_integer_prefixes;
|
|
|
2c2fa1 |
+ const char *const * stap_integer_suffixes;
|
|
|
2c2fa1 |
+ const char *const * stap_register_prefixes;
|
|
|
2c2fa1 |
+ const char *const * stap_register_suffixes;
|
|
|
2c2fa1 |
+ const char *const * stap_register_indirection_prefixes;
|
|
|
2c2fa1 |
+ const char *const * stap_register_indirection_suffixes;
|
|
|
2c2fa1 |
const char * stap_gdb_register_prefix;
|
|
|
2c2fa1 |
const char * stap_gdb_register_suffix;
|
|
|
2c2fa1 |
gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
|
|
|
2c2fa1 |
@@ -436,12 +465,12 @@ struct gdbarch startup_gdbarch =
|
|
|
2c2fa1 |
0, /* get_siginfo_type */
|
|
|
2c2fa1 |
0, /* record_special_symbol */
|
|
|
2c2fa1 |
0, /* get_syscall_number */
|
|
|
2c2fa1 |
- 0, /* stap_integer_prefix */
|
|
|
2c2fa1 |
- 0, /* stap_integer_suffix */
|
|
|
2c2fa1 |
- 0, /* stap_register_prefix */
|
|
|
2c2fa1 |
- 0, /* stap_register_suffix */
|
|
|
2c2fa1 |
- 0, /* stap_register_indirection_prefix */
|
|
|
2c2fa1 |
- 0, /* stap_register_indirection_suffix */
|
|
|
2c2fa1 |
+ 0, /* stap_integer_prefixes */
|
|
|
2c2fa1 |
+ 0, /* stap_integer_suffixes */
|
|
|
2c2fa1 |
+ 0, /* stap_register_prefixes */
|
|
|
2c2fa1 |
+ 0, /* stap_register_suffixes */
|
|
|
2c2fa1 |
+ 0, /* stap_register_indirection_prefixes */
|
|
|
2c2fa1 |
+ 0, /* stap_register_indirection_suffixes */
|
|
|
2c2fa1 |
0, /* stap_gdb_register_prefix */
|
|
|
2c2fa1 |
0, /* stap_gdb_register_suffix */
|
|
|
2c2fa1 |
0, /* stap_is_single_operand */
|
|
|
2c2fa1 |
@@ -741,12 +770,12 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
/* Skip verify of get_siginfo_type, has predicate. */
|
|
|
2c2fa1 |
/* Skip verify of record_special_symbol, has predicate. */
|
|
|
2c2fa1 |
/* Skip verify of get_syscall_number, has predicate. */
|
|
|
2c2fa1 |
- /* Skip verify of stap_integer_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
- /* Skip verify of stap_integer_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_indirection_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_integer_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_integer_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_indirection_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_indirection_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
/* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
/* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
/* Skip verify of stap_is_single_operand, has predicate. */
|
|
|
2c2fa1 |
@@ -1342,11 +1371,11 @@ gdbarch_dump (struct gdbarch *gdbarch, s
|
|
|
2c2fa1 |
"gdbarch_dump: stap_gdb_register_suffix = %s\n",
|
|
|
2c2fa1 |
pstring (gdbarch->stap_gdb_register_suffix));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_integer_prefix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_integer_prefix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_integer_prefixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_integer_prefixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_integer_suffix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_integer_suffix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_integer_suffixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_integer_suffixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
"gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
|
|
|
2c2fa1 |
gdbarch_stap_is_single_operand_p (gdbarch));
|
|
|
2c2fa1 |
@@ -1360,17 +1389,17 @@ gdbarch_dump (struct gdbarch *gdbarch, s
|
|
|
2c2fa1 |
"gdbarch_dump: stap_parse_special_token = <%s>\n",
|
|
|
2c2fa1 |
host_address_to_string (gdbarch->stap_parse_special_token));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_register_indirection_prefix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_register_indirection_prefix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_register_indirection_prefixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_register_indirection_prefixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_register_indirection_suffix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_register_indirection_suffix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_register_indirection_suffixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_register_indirection_suffixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_register_prefix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_register_prefix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_register_prefixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_register_prefixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
- "gdbarch_dump: stap_register_suffix = %s\n",
|
|
|
2c2fa1 |
- pstring (gdbarch->stap_register_suffix));
|
|
|
2c2fa1 |
+ "gdbarch_dump: stap_register_suffixes = %s\n",
|
|
|
2c2fa1 |
+ pstring_list (gdbarch->stap_register_suffixes));
|
|
|
2c2fa1 |
fprintf_unfiltered (file,
|
|
|
2c2fa1 |
"gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
|
|
|
2c2fa1 |
gdbarch_static_transform_name_p (gdbarch));
|
|
|
2c2fa1 |
@@ -3971,106 +4000,106 @@ set_gdbarch_get_syscall_number (struct g
|
|
|
2c2fa1 |
gdbarch->get_syscall_number = get_syscall_number;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_integer_prefix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_integer_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_integer_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_integer_prefix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_integer_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_integer_prefix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_integer_prefixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_integer_prefix = stap_integer_prefix;
|
|
|
2c2fa1 |
+ gdbarch->stap_integer_prefixes = stap_integer_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_integer_suffix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_integer_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_integer_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_suffix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_integer_suffix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_suffixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_integer_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_integer_suffix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_integer_suffixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_integer_suffix = stap_integer_suffix;
|
|
|
2c2fa1 |
+ gdbarch->stap_integer_suffixes = stap_integer_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_register_prefix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_register_prefixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_register_prefix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_register_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_register_prefix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_register_prefixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_register_prefix = stap_register_prefix;
|
|
|
2c2fa1 |
+ gdbarch->stap_register_prefixes = stap_register_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_register_suffix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_register_suffixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_suffix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_register_suffix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_suffixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_register_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_register_suffix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_register_suffixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_register_suffix = stap_register_suffix;
|
|
|
2c2fa1 |
+ gdbarch->stap_register_suffixes = stap_register_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_indirection_prefixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_register_indirection_prefix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_register_indirection_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_register_indirection_prefix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_register_indirection_prefixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_register_indirection_prefix = stap_register_indirection_prefix;
|
|
|
2c2fa1 |
+ gdbarch->stap_register_indirection_prefixes = stap_register_indirection_prefixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-const char *
|
|
|
2c2fa1 |
-gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
+const char *const *
|
|
|
2c2fa1 |
+gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
gdb_assert (gdbarch != NULL);
|
|
|
2c2fa1 |
- /* Skip verify of stap_register_indirection_suffix, invalid_p == 0 */
|
|
|
2c2fa1 |
+ /* Skip verify of stap_register_indirection_suffixes, invalid_p == 0 */
|
|
|
2c2fa1 |
if (gdbarch_debug >= 2)
|
|
|
2c2fa1 |
- fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_suffix called\n");
|
|
|
2c2fa1 |
- return gdbarch->stap_register_indirection_suffix;
|
|
|
2c2fa1 |
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_suffixes called\n");
|
|
|
2c2fa1 |
+ return gdbarch->stap_register_indirection_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
-set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
- const char * stap_register_indirection_suffix)
|
|
|
2c2fa1 |
+set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch,
|
|
|
2c2fa1 |
+ const char *const * stap_register_indirection_suffixes)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- gdbarch->stap_register_indirection_suffix = stap_register_indirection_suffix;
|
|
|
2c2fa1 |
+ gdbarch->stap_register_indirection_suffixes = stap_register_indirection_suffixes;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
const char *
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/gdbarch.h
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/gdbarch.h
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/gdbarch.h
|
|
|
2c2fa1 |
@@ -1030,37 +1030,42 @@ extern LONGEST gdbarch_get_syscall_numbe
|
|
|
2c2fa1 |
extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* SystemTap related fields and functions.
|
|
|
2c2fa1 |
- Prefix used to mark an integer constant on the architecture's assembly
|
|
|
2c2fa1 |
+ A NULL-terminated array of prefixes used to mark an integer constant
|
|
|
2c2fa1 |
+ on the architecture's assembly.
|
|
|
2c2fa1 |
For example, on x86 integer constants are written as:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
$10 ;; integer constant 10
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
in this case, this prefix would be the character `$'. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch, const char *const * stap_integer_prefixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Suffix used to mark an integer constant on the architecture's assembly. */
|
|
|
2c2fa1 |
+/* A NULL-terminated array of suffixes used to mark an integer constant
|
|
|
2c2fa1 |
+ on the architecture's assembly. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_integer_suffix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch, const char * stap_integer_suffix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch, const char *const * stap_integer_suffixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Prefix used to mark a register name on the architecture's assembly.
|
|
|
2c2fa1 |
+/* A NULL-terminated array of prefixes used to mark a register name on
|
|
|
2c2fa1 |
+ the architecture's assembly.
|
|
|
2c2fa1 |
For example, on x86 the register name is written as:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
%eax ;; register eax
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
in this case, this prefix would be the character `%'. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_register_prefixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_prefixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Suffix used to mark a register name on the architecture's assembly */
|
|
|
2c2fa1 |
+/* A NULL-terminated array of suffixes used to mark a register name on
|
|
|
2c2fa1 |
+ the architecture's assembly. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_register_suffix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch, const char * stap_register_suffix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_register_suffixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_suffixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Prefix used to mark a register indirection on the architecture's assembly.
|
|
|
2c2fa1 |
+/* A NULL-terminated array of prefixes used to mark a register
|
|
|
2c2fa1 |
+ indirection on the architecture's assembly.
|
|
|
2c2fa1 |
For example, on x86 the register indirection is written as:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
(%eax) ;; indirecting eax
|
|
|
2c2fa1 |
@@ -1070,10 +1075,11 @@ extern void set_gdbarch_stap_register_su
|
|
|
2c2fa1 |
Please note that we use the indirection prefix also for register
|
|
|
2c2fa1 |
displacement, e.g., `4(%eax)' on x86. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Suffix used to mark a register indirection on the architecture's assembly.
|
|
|
2c2fa1 |
+/* A NULL-terminated array of suffixes used to mark a register
|
|
|
2c2fa1 |
+ indirection on the architecture's assembly.
|
|
|
2c2fa1 |
For example, on x86 the register indirection is written as:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
(%eax) ;; indirecting eax
|
|
|
2c2fa1 |
@@ -1083,10 +1089,10 @@ extern void set_gdbarch_stap_register_in
|
|
|
2c2fa1 |
Please note that we use the indirection suffix also for register
|
|
|
2c2fa1 |
displacement, e.g., `4(%eax)' on x86. */
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-extern const char * gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
-extern void set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch, const char * stap_register_indirection_suffix);
|
|
|
2c2fa1 |
+extern const char *const * gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch);
|
|
|
2c2fa1 |
+extern void set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-/* Prefix used to name a register using GDB's nomenclature.
|
|
|
2c2fa1 |
+/* Prefix(es) used to name a register using GDB's nomenclature.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
For example, on PPC a register is represented by a number in the assembly
|
|
|
2c2fa1 |
language (e.g., `10' is the 10th general-purpose register). However,
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/gdbarch.sh
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/gdbarch.sh
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/gdbarch.sh
|
|
|
2c2fa1 |
@@ -823,29 +823,34 @@ M:LONGEST:get_syscall_number:ptid_t ptid
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
# SystemTap related fields and functions.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Prefix used to mark an integer constant on the architecture's assembly
|
|
|
2c2fa1 |
+# A NULL-terminated array of prefixes used to mark an integer constant
|
|
|
2c2fa1 |
+# on the architecture's assembly.
|
|
|
2c2fa1 |
# For example, on x86 integer constants are written as:
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# \$10 ;; integer constant 10
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# in this case, this prefix would be the character \`\$\'.
|
|
|
2c2fa1 |
-v:const char *:stap_integer_prefix:::0:0::0:pstring (gdbarch->stap_integer_prefix)
|
|
|
2c2fa1 |
+v:const char *const *:stap_integer_prefixes:::0:0::0:pstring_list (gdbarch->stap_integer_prefixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Suffix used to mark an integer constant on the architecture's assembly.
|
|
|
2c2fa1 |
-v:const char *:stap_integer_suffix:::0:0::0:pstring (gdbarch->stap_integer_suffix)
|
|
|
2c2fa1 |
+# A NULL-terminated array of suffixes used to mark an integer constant
|
|
|
2c2fa1 |
+# on the architecture's assembly.
|
|
|
2c2fa1 |
+v:const char *const *:stap_integer_suffixes:::0:0::0:pstring_list (gdbarch->stap_integer_suffixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Prefix used to mark a register name on the architecture's assembly.
|
|
|
2c2fa1 |
+# A NULL-terminated array of prefixes used to mark a register name on
|
|
|
2c2fa1 |
+# the architecture's assembly.
|
|
|
2c2fa1 |
# For example, on x86 the register name is written as:
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# \%eax ;; register eax
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# in this case, this prefix would be the character \`\%\'.
|
|
|
2c2fa1 |
-v:const char *:stap_register_prefix:::0:0::0:pstring (gdbarch->stap_register_prefix)
|
|
|
2c2fa1 |
+v:const char *const *:stap_register_prefixes:::0:0::0:pstring_list (gdbarch->stap_register_prefixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Suffix used to mark a register name on the architecture's assembly
|
|
|
2c2fa1 |
-v:const char *:stap_register_suffix:::0:0::0:pstring (gdbarch->stap_register_suffix)
|
|
|
2c2fa1 |
+# A NULL-terminated array of suffixes used to mark a register name on
|
|
|
2c2fa1 |
+# the architecture's assembly.
|
|
|
2c2fa1 |
+v:const char *const *:stap_register_suffixes:::0:0::0:pstring_list (gdbarch->stap_register_suffixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Prefix used to mark a register indirection on the architecture's assembly.
|
|
|
2c2fa1 |
+# A NULL-terminated array of prefixes used to mark a register
|
|
|
2c2fa1 |
+# indirection on the architecture's assembly.
|
|
|
2c2fa1 |
# For example, on x86 the register indirection is written as:
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# \(\%eax\) ;; indirecting eax
|
|
|
2c2fa1 |
@@ -854,9 +859,10 @@ v:const char *:stap_register_suffix:::0:
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# Please note that we use the indirection prefix also for register
|
|
|
2c2fa1 |
# displacement, e.g., \`4\(\%eax\)\' on x86.
|
|
|
2c2fa1 |
-v:const char *:stap_register_indirection_prefix:::0:0::0:pstring (gdbarch->stap_register_indirection_prefix)
|
|
|
2c2fa1 |
+v:const char *const *:stap_register_indirection_prefixes:::0:0::0:pstring_list (gdbarch->stap_register_indirection_prefixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Suffix used to mark a register indirection on the architecture's assembly.
|
|
|
2c2fa1 |
+# A NULL-terminated array of suffixes used to mark a register
|
|
|
2c2fa1 |
+# indirection on the architecture's assembly.
|
|
|
2c2fa1 |
# For example, on x86 the register indirection is written as:
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# \(\%eax\) ;; indirecting eax
|
|
|
2c2fa1 |
@@ -865,9 +871,9 @@ v:const char *:stap_register_indirection
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# Please note that we use the indirection suffix also for register
|
|
|
2c2fa1 |
# displacement, e.g., \`4\(\%eax\)\' on x86.
|
|
|
2c2fa1 |
-v:const char *:stap_register_indirection_suffix:::0:0::0:pstring (gdbarch->stap_register_indirection_suffix)
|
|
|
2c2fa1 |
+v:const char *const *:stap_register_indirection_suffixes:::0:0::0:pstring_list (gdbarch->stap_register_indirection_suffixes)
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
-# Prefix used to name a register using GDB's nomenclature.
|
|
|
2c2fa1 |
+# Prefix(es) used to name a register using GDB's nomenclature.
|
|
|
2c2fa1 |
#
|
|
|
2c2fa1 |
# For example, on PPC a register is represented by a number in the assembly
|
|
|
2c2fa1 |
# language (e.g., \`10\' is the 10th general-purpose register). However,
|
|
|
2c2fa1 |
@@ -1478,6 +1484,35 @@ pstring (const char *string)
|
|
|
2c2fa1 |
return string;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
+/* Helper function to print a list of strings, represented as "const
|
|
|
2c2fa1 |
+ char *const *". The list is printed comma-separated. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static char *
|
|
|
2c2fa1 |
+pstring_list (const char *const *list)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ static char ret[100];
|
|
|
2c2fa1 |
+ const char *const *p;
|
|
|
2c2fa1 |
+ size_t offset = 0;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (list == NULL)
|
|
|
2c2fa1 |
+ return "(null)";
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ ret[0] = '\0';
|
|
|
2c2fa1 |
+ for (p = list; *p != NULL && offset < sizeof (ret); ++p)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ size_t s = xsnprintf (ret + offset, sizeof (ret) - offset, "%s, ", *p);
|
|
|
2c2fa1 |
+ offset += 2 + s;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (offset > 0)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ gdb_assert (offset - 2 < sizeof (ret));
|
|
|
2c2fa1 |
+ ret[offset - 2] = '\0';
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return ret;
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
EOF
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
# gdbarch open the gdbarch object
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/i386-tdep.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/i386-tdep.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/i386-tdep.c
|
|
|
2c2fa1 |
@@ -3767,14 +3767,23 @@ i386_stap_parse_special_token (struct gd
|
|
|
2c2fa1 |
void
|
|
|
2c2fa1 |
i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
+ static const char *const stap_integer_prefixes[] = { "$", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_prefixes[] = { "%", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_prefixes[] = { "(",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_suffixes[] = { ")",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
/* We typically use stabs-in-ELF with the SVR4 register numbering. */
|
|
|
2c2fa1 |
set_gdbarch_stab_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Registering SystemTap handlers. */
|
|
|
2c2fa1 |
- set_gdbarch_stap_integer_prefix (gdbarch, "$");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_prefix (gdbarch, "%");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_suffix (gdbarch, ")");
|
|
|
2c2fa1 |
+ set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_prefixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_suffixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
set_gdbarch_stap_is_single_operand (gdbarch,
|
|
|
2c2fa1 |
i386_stap_is_single_operand);
|
|
|
2c2fa1 |
set_gdbarch_stap_parse_special_token (gdbarch,
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/ppc-linux-tdep.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/ppc-linux-tdep.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/ppc-linux-tdep.c
|
|
|
2c2fa1 |
@@ -1723,6 +1723,11 @@ ppc_linux_init_abi (struct gdbarch_info
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
2c2fa1 |
struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
|
|
|
2c2fa1 |
+ static const char *const stap_integer_prefixes[] = { "i", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_prefixes[] = { "(",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_suffixes[] = { ")",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
linux_init_abi (info, gdbarch);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
@@ -1741,9 +1746,11 @@ ppc_linux_init_abi (struct gdbarch_info
|
|
|
2c2fa1 |
set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* SystemTap functions. */
|
|
|
2c2fa1 |
- set_gdbarch_stap_integer_prefix (gdbarch, "i");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_suffix (gdbarch, ")");
|
|
|
2c2fa1 |
+ set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_prefixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_suffixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
|
|
|
2c2fa1 |
set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand);
|
|
|
2c2fa1 |
set_gdbarch_stap_parse_special_token (gdbarch,
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/s390-tdep.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/s390-tdep.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/s390-tdep.c
|
|
|
2c2fa1 |
@@ -3032,6 +3032,11 @@ s390_gdbarch_init (struct gdbarch_info i
|
|
|
2c2fa1 |
int have_linux_v1 = 0;
|
|
|
2c2fa1 |
int have_linux_v2 = 0;
|
|
|
2c2fa1 |
int first_pseudo_reg, last_pseudo_reg;
|
|
|
2c2fa1 |
+ static const char *const stap_register_prefixes[] = { "%", NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_prefixes[] = { "(",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
+ static const char *const stap_register_indirection_suffixes[] = { ")",
|
|
|
2c2fa1 |
+ NULL };
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Default ABI and register size. */
|
|
|
2c2fa1 |
switch (info.bfd_arch_info->mach)
|
|
|
2c2fa1 |
@@ -3364,9 +3369,11 @@ s390_gdbarch_init (struct gdbarch_info i
|
|
|
2c2fa1 |
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* SystemTap functions. */
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_prefix (gdbarch, "%");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
|
|
|
2c2fa1 |
- set_gdbarch_stap_register_indirection_suffix (gdbarch, ")");
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_prefixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_prefixes);
|
|
|
2c2fa1 |
+ set_gdbarch_stap_register_indirection_suffixes (gdbarch,
|
|
|
2c2fa1 |
+ stap_register_indirection_suffixes);
|
|
|
2c2fa1 |
set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
return gdbarch;
|
|
|
2c2fa1 |
Index: gdb-7.6.1/gdb/stap-probe.c
|
|
|
2c2fa1 |
===================================================================
|
|
|
2c2fa1 |
--- gdb-7.6.1.orig/gdb/stap-probe.c
|
|
|
2c2fa1 |
+++ gdb-7.6.1/gdb/stap-probe.c
|
|
|
2c2fa1 |
@@ -346,6 +346,191 @@ stap_get_expected_argument_type (struct
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
+/* Helper function to check for a generic list of prefixes. GDBARCH
|
|
|
2c2fa1 |
+ is the current gdbarch being used. S is the expression being
|
|
|
2c2fa1 |
+ analyzed. If R is not NULL, it will be used to return the found
|
|
|
2c2fa1 |
+ prefix. PREFIXES is the list of expected prefixes.
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ This function does a case-insensitive match.
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ Return 1 if any prefix has been found, zero otherwise. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_is_generic_prefix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r, const char *const *prefixes)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *p;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (prefixes == NULL)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = "";
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 1;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ for (p = prefixes; *p != NULL; ++p)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ if (strncasecmp (s, *p, strlen (*p)) == 0)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = *p;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 1;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 0;
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to a register prefix, zero otherwise. For a
|
|
|
2c2fa1 |
+ description of the arguments, look at stap_is_generic_prefix. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_is_register_prefix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *t = gdbarch_stap_register_prefixes (gdbarch);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return stap_is_generic_prefix (gdbarch, s, r, t);
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to a register indirection prefix, zero
|
|
|
2c2fa1 |
+ otherwise. For a description of the arguments, look at
|
|
|
2c2fa1 |
+ stap_is_generic_prefix. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_is_register_indirection_prefix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *t = gdbarch_stap_register_indirection_prefixes (gdbarch);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return stap_is_generic_prefix (gdbarch, s, r, t);
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to an integer prefix, zero otherwise. For a
|
|
|
2c2fa1 |
+ description of the arguments, look at stap_is_generic_prefix.
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ This function takes care of analyzing whether we are dealing with
|
|
|
2c2fa1 |
+ an expected integer prefix, or, if there is no integer prefix to be
|
|
|
2c2fa1 |
+ expected, whether we are dealing with a digit. It does a
|
|
|
2c2fa1 |
+ case-insensitive match. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_is_integer_prefix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *t = gdbarch_stap_integer_prefixes (gdbarch);
|
|
|
2c2fa1 |
+ const char *const *p;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (t == NULL)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ /* A NULL value here means that integers do not have a prefix.
|
|
|
2c2fa1 |
+ We just check for a digit then. */
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = "";
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return isdigit (*s);
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ for (p = t; *p != NULL; ++p)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ size_t len = strlen (*p);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if ((len == 0 && isdigit (*s))
|
|
|
2c2fa1 |
+ || (len > 0 && strncasecmp (s, *p, len) == 0))
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ /* Integers may or may not have a prefix. The "len == 0"
|
|
|
2c2fa1 |
+ check covers the case when integers do not have a prefix
|
|
|
2c2fa1 |
+ (therefore, we just check if we have a digit). The call
|
|
|
2c2fa1 |
+ to "strncasecmp" covers the case when they have a
|
|
|
2c2fa1 |
+ prefix. */
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = *p;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 1;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 0;
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Helper function to check for a generic list of suffixes. If we are
|
|
|
2c2fa1 |
+ not expecting any suffixes, then it just returns 1. If we are
|
|
|
2c2fa1 |
+ expecting at least one suffix, then it returns 1 if a suffix has
|
|
|
2c2fa1 |
+ been found, zero otherwise. GDBARCH is the current gdbarch being
|
|
|
2c2fa1 |
+ used. S is the expression being analyzed. If R is not NULL, it
|
|
|
2c2fa1 |
+ will be used to return the found suffix. SUFFIXES is the list of
|
|
|
2c2fa1 |
+ expected suffixes. This function does a case-insensitive
|
|
|
2c2fa1 |
+ match. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_generic_check_suffix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r, const char *const *suffixes)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *p;
|
|
|
2c2fa1 |
+ int found = 0;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (suffixes == NULL)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = "";
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return 1;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ for (p = suffixes; *p != NULL; ++p)
|
|
|
2c2fa1 |
+ if (strncasecmp (s, *p, strlen (*p)) == 0)
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ if (r != NULL)
|
|
|
2c2fa1 |
+ *r = *p;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ found = 1;
|
|
|
2c2fa1 |
+ break;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return found;
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to an integer suffix, zero otherwise. For a
|
|
|
2c2fa1 |
+ description of the arguments, look at
|
|
|
2c2fa1 |
+ stap_generic_check_suffix. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_check_integer_suffix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *p = gdbarch_stap_integer_suffixes (gdbarch);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return stap_generic_check_suffix (gdbarch, s, r, p);
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to a register suffix, zero otherwise. For a
|
|
|
2c2fa1 |
+ description of the arguments, look at
|
|
|
2c2fa1 |
+ stap_generic_check_suffix. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_check_register_suffix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *p = gdbarch_stap_register_suffixes (gdbarch);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return stap_generic_check_suffix (gdbarch, s, r, p);
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+/* Return 1 if S points to a register indirection suffix, zero
|
|
|
2c2fa1 |
+ otherwise. For a description of the arguments, look at
|
|
|
2c2fa1 |
+ stap_generic_check_suffix. */
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+static int
|
|
|
2c2fa1 |
+stap_check_register_indirection_suffix (struct gdbarch *gdbarch, const char *s,
|
|
|
2c2fa1 |
+ const char **r)
|
|
|
2c2fa1 |
+{
|
|
|
2c2fa1 |
+ const char *const *p = gdbarch_stap_register_indirection_suffixes (gdbarch);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ return stap_generic_check_suffix (gdbarch, s, r, p);
|
|
|
2c2fa1 |
+}
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
/* Function responsible for parsing a register operand according to
|
|
|
2c2fa1 |
SystemTap parlance. Assuming:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
@@ -385,24 +570,14 @@ stap_parse_register_operand (struct stap
|
|
|
2c2fa1 |
const char *start;
|
|
|
2c2fa1 |
char *regname;
|
|
|
2c2fa1 |
int len;
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- /* Prefixes for the parser. */
|
|
|
2c2fa1 |
- const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch);
|
|
|
2c2fa1 |
- const char *reg_ind_prefix
|
|
|
2c2fa1 |
- = gdbarch_stap_register_indirection_prefix (gdbarch);
|
|
|
2c2fa1 |
const char *gdb_reg_prefix = gdbarch_stap_gdb_register_prefix (gdbarch);
|
|
|
2c2fa1 |
- int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0;
|
|
|
2c2fa1 |
- int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0;
|
|
|
2c2fa1 |
int gdb_reg_prefix_len = gdb_reg_prefix ? strlen (gdb_reg_prefix) : 0;
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- /* Suffixes for the parser. */
|
|
|
2c2fa1 |
- const char *reg_suffix = gdbarch_stap_register_suffix (gdbarch);
|
|
|
2c2fa1 |
- const char *reg_ind_suffix
|
|
|
2c2fa1 |
- = gdbarch_stap_register_indirection_suffix (gdbarch);
|
|
|
2c2fa1 |
const char *gdb_reg_suffix = gdbarch_stap_gdb_register_suffix (gdbarch);
|
|
|
2c2fa1 |
- int reg_suffix_len = reg_suffix ? strlen (reg_suffix) : 0;
|
|
|
2c2fa1 |
- int reg_ind_suffix_len = reg_ind_suffix ? strlen (reg_ind_suffix) : 0;
|
|
|
2c2fa1 |
int gdb_reg_suffix_len = gdb_reg_suffix ? strlen (gdb_reg_suffix) : 0;
|
|
|
2c2fa1 |
+ const char *reg_prefix;
|
|
|
2c2fa1 |
+ const char *reg_ind_prefix;
|
|
|
2c2fa1 |
+ const char *reg_suffix;
|
|
|
2c2fa1 |
+ const char *reg_ind_suffix;
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Checking for a displacement argument. */
|
|
|
2c2fa1 |
if (*p->arg == '+')
|
|
|
2c2fa1 |
@@ -436,11 +611,10 @@ stap_parse_register_operand (struct stap
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Getting rid of register indirection prefix. */
|
|
|
2c2fa1 |
- if (reg_ind_prefix
|
|
|
2c2fa1 |
- && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0)
|
|
|
2c2fa1 |
+ if (stap_is_register_indirection_prefix (gdbarch, p->arg, ®_ind_prefix))
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
indirect_p = 1;
|
|
|
2c2fa1 |
- p->arg += reg_ind_prefix_len;
|
|
|
2c2fa1 |
+ p->arg += strlen (reg_ind_prefix);
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
if (disp_p && !indirect_p)
|
|
|
2c2fa1 |
@@ -448,8 +622,8 @@ stap_parse_register_operand (struct stap
|
|
|
2c2fa1 |
p->saved_arg);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Getting rid of register prefix. */
|
|
|
2c2fa1 |
- if (reg_prefix && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0)
|
|
|
2c2fa1 |
- p->arg += reg_prefix_len;
|
|
|
2c2fa1 |
+ if (stap_is_register_prefix (gdbarch, p->arg, ®_prefix))
|
|
|
2c2fa1 |
+ p->arg += strlen (reg_prefix);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Now we should have only the register name. Let's extract it and get
|
|
|
2c2fa1 |
the associated number. */
|
|
|
2c2fa1 |
@@ -507,23 +681,21 @@ stap_parse_register_operand (struct stap
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Getting rid of the register name suffix. */
|
|
|
2c2fa1 |
- if (reg_suffix)
|
|
|
2c2fa1 |
- {
|
|
|
2c2fa1 |
- if (strncmp (p->arg, reg_suffix, reg_suffix_len) != 0)
|
|
|
2c2fa1 |
- error (_("Missing register name suffix `%s' on expression `%s'."),
|
|
|
2c2fa1 |
- reg_suffix, p->saved_arg);
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- p->arg += reg_suffix_len;
|
|
|
2c2fa1 |
- }
|
|
|
2c2fa1 |
+ if (stap_check_register_suffix (gdbarch, p->arg, ®_suffix))
|
|
|
2c2fa1 |
+ p->arg += strlen (reg_suffix);
|
|
|
2c2fa1 |
+ else
|
|
|
2c2fa1 |
+ error (_("Missing register name suffix on expression `%s'."),
|
|
|
2c2fa1 |
+ p->saved_arg);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Getting rid of the register indirection suffix. */
|
|
|
2c2fa1 |
- if (indirect_p && reg_ind_suffix)
|
|
|
2c2fa1 |
+ if (indirect_p)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
- if (strncmp (p->arg, reg_ind_suffix, reg_ind_suffix_len) != 0)
|
|
|
2c2fa1 |
- error (_("Missing indirection suffix `%s' on expression `%s'."),
|
|
|
2c2fa1 |
- reg_ind_suffix, p->saved_arg);
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- p->arg += reg_ind_suffix_len;
|
|
|
2c2fa1 |
+ if (stap_check_register_indirection_suffix (gdbarch, p->arg,
|
|
|
2c2fa1 |
+ ®_ind_suffix))
|
|
|
2c2fa1 |
+ p->arg += strlen (reg_ind_suffix);
|
|
|
2c2fa1 |
+ else
|
|
|
2c2fa1 |
+ error (_("Missing indirection suffix on expression `%s'."),
|
|
|
2c2fa1 |
+ p->saved_arg);
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
@@ -546,19 +718,7 @@ static void
|
|
|
2c2fa1 |
stap_parse_single_operand (struct stap_parse_info *p)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
struct gdbarch *gdbarch = p->gdbarch;
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- /* Prefixes for the parser. */
|
|
|
2c2fa1 |
- const char *const_prefix = gdbarch_stap_integer_prefix (gdbarch);
|
|
|
2c2fa1 |
- const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch);
|
|
|
2c2fa1 |
- const char *reg_ind_prefix
|
|
|
2c2fa1 |
- = gdbarch_stap_register_indirection_prefix (gdbarch);
|
|
|
2c2fa1 |
- int const_prefix_len = const_prefix ? strlen (const_prefix) : 0;
|
|
|
2c2fa1 |
- int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0;
|
|
|
2c2fa1 |
- int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0;
|
|
|
2c2fa1 |
-
|
|
|
2c2fa1 |
- /* Suffixes for the parser. */
|
|
|
2c2fa1 |
- const char *const_suffix = gdbarch_stap_integer_suffix (gdbarch);
|
|
|
2c2fa1 |
- int const_suffix_len = const_suffix ? strlen (const_suffix) : 0;
|
|
|
2c2fa1 |
+ const char *int_prefix = NULL;
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* We first try to parse this token as a "special token". */
|
|
|
2c2fa1 |
if (gdbarch_stap_parse_special_token_p (gdbarch))
|
|
|
2c2fa1 |
@@ -600,8 +760,7 @@ stap_parse_single_operand (struct stap_p
|
|
|
2c2fa1 |
if (isdigit (*tmp))
|
|
|
2c2fa1 |
number = strtol (tmp, (char **) &tmp, 10);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
- if (!reg_ind_prefix
|
|
|
2c2fa1 |
- || strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0)
|
|
|
2c2fa1 |
+ if (!stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
/* This is not a displacement. We skip the operator, and deal
|
|
|
2c2fa1 |
with it later. */
|
|
|
2c2fa1 |
@@ -629,15 +788,22 @@ stap_parse_single_operand (struct stap_p
|
|
|
2c2fa1 |
const char *tmp = p->arg;
|
|
|
2c2fa1 |
long number;
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
- /* We can be dealing with a numeric constant (if `const_prefix' is
|
|
|
2c2fa1 |
- NULL), or with a register displacement. */
|
|
|
2c2fa1 |
+ /* We can be dealing with a numeric constant, or with a register
|
|
|
2c2fa1 |
+ displacement. */
|
|
|
2c2fa1 |
number = strtol (tmp, (char **) &tmp, 10);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
if (p->inside_paren_p)
|
|
|
2c2fa1 |
tmp = skip_spaces_const (tmp);
|
|
|
2c2fa1 |
- if (!const_prefix && reg_ind_prefix
|
|
|
2c2fa1 |
- && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0)
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ /* If "stap_is_integer_prefix" returns true, it means we can
|
|
|
2c2fa1 |
+ accept integers without a prefix here. But we also need to
|
|
|
2c2fa1 |
+ check whether the next token (i.e., "tmp") is not a register
|
|
|
2c2fa1 |
+ indirection prefix. */
|
|
|
2c2fa1 |
+ if (stap_is_integer_prefix (gdbarch, p->arg, NULL)
|
|
|
2c2fa1 |
+ && !stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
+ const char *int_suffix;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
/* We are dealing with a numeric constant. */
|
|
|
2c2fa1 |
write_exp_elt_opcode (OP_LONG);
|
|
|
2c2fa1 |
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
|
|
2c2fa1 |
@@ -646,29 +812,25 @@ stap_parse_single_operand (struct stap_p
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
p->arg = tmp;
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
- if (const_suffix)
|
|
|
2c2fa1 |
- {
|
|
|
2c2fa1 |
- if (strncmp (p->arg, const_suffix, const_suffix_len) == 0)
|
|
|
2c2fa1 |
- p->arg += const_suffix_len;
|
|
|
2c2fa1 |
- else
|
|
|
2c2fa1 |
- error (_("Invalid constant suffix on expression `%s'."),
|
|
|
2c2fa1 |
- p->saved_arg);
|
|
|
2c2fa1 |
- }
|
|
|
2c2fa1 |
+ if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
|
|
|
2c2fa1 |
+ p->arg += strlen (int_suffix);
|
|
|
2c2fa1 |
+ else
|
|
|
2c2fa1 |
+ error (_("Invalid constant suffix on expression `%s'."),
|
|
|
2c2fa1 |
+ p->saved_arg);
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
- else if (reg_ind_prefix
|
|
|
2c2fa1 |
- && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) == 0)
|
|
|
2c2fa1 |
+ else if (stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
|
|
|
2c2fa1 |
stap_parse_register_operand (p);
|
|
|
2c2fa1 |
else
|
|
|
2c2fa1 |
error (_("Unknown numeric token on expression `%s'."),
|
|
|
2c2fa1 |
p->saved_arg);
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
- else if (const_prefix
|
|
|
2c2fa1 |
- && strncmp (p->arg, const_prefix, const_prefix_len) == 0)
|
|
|
2c2fa1 |
+ else if (stap_is_integer_prefix (gdbarch, p->arg, &int_prefix))
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
/* We are dealing with a numeric constant. */
|
|
|
2c2fa1 |
long number;
|
|
|
2c2fa1 |
+ const char *int_suffix;
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
- p->arg += const_prefix_len;
|
|
|
2c2fa1 |
+ p->arg += strlen (int_prefix);
|
|
|
2c2fa1 |
number = strtol (p->arg, (char **) &p->arg, 10);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
write_exp_elt_opcode (OP_LONG);
|
|
|
2c2fa1 |
@@ -676,19 +838,14 @@ stap_parse_single_operand (struct stap_p
|
|
|
2c2fa1 |
write_exp_elt_longcst (number);
|
|
|
2c2fa1 |
write_exp_elt_opcode (OP_LONG);
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
- if (const_suffix)
|
|
|
2c2fa1 |
- {
|
|
|
2c2fa1 |
- if (strncmp (p->arg, const_suffix, const_suffix_len) == 0)
|
|
|
2c2fa1 |
- p->arg += const_suffix_len;
|
|
|
2c2fa1 |
- else
|
|
|
2c2fa1 |
- error (_("Invalid constant suffix on expression `%s'."),
|
|
|
2c2fa1 |
- p->saved_arg);
|
|
|
2c2fa1 |
- }
|
|
|
2c2fa1 |
+ if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
|
|
|
2c2fa1 |
+ p->arg += strlen (int_suffix);
|
|
|
2c2fa1 |
+ else
|
|
|
2c2fa1 |
+ error (_("Invalid constant suffix on expression `%s'."),
|
|
|
2c2fa1 |
+ p->saved_arg);
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
- else if ((reg_prefix
|
|
|
2c2fa1 |
- && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0)
|
|
|
2c2fa1 |
- || (reg_ind_prefix
|
|
|
2c2fa1 |
- && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0))
|
|
|
2c2fa1 |
+ else if (stap_is_register_prefix (gdbarch, p->arg, NULL)
|
|
|
2c2fa1 |
+ || stap_is_register_indirection_prefix (gdbarch, p->arg, NULL))
|
|
|
2c2fa1 |
stap_parse_register_operand (p);
|
|
|
2c2fa1 |
else
|
|
|
2c2fa1 |
error (_("Operator `%c' not recognized on expression `%s'."),
|