diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2013-12-19 18:53:40 -0200 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2013-12-19 18:53:40 -0200 |
commit | 05c0465e16a5e2db92f8975aebf2bb5aacb1c542 (patch) | |
tree | 2c42959c2f998b32a36beab6af3bdd7a73744a0c /gdb/gdbarch.h | |
parent | 9ef5d938819dff73d7640a2654b07df64670d7f9 (diff) | |
download | gdb-05c0465e16a5e2db92f8975aebf2bb5aacb1c542.zip gdb-05c0465e16a5e2db92f8975aebf2bb5aacb1c542.tar.gz gdb-05c0465e16a5e2db92f8975aebf2bb5aacb1c542.tar.bz2 |
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r-- | gdb/gdbarch.h | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index b58efc8..f37f44f 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1034,37 +1034,42 @@ 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 fields and functions. - Prefix used to mark an integer constant on the architecture's assembly + A NULL-terminated array of prefixes 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); +extern const char *const * gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch, const char *const * stap_integer_prefixes); -/* Suffix used to mark an integer constant on the architecture's assembly. */ +/* A NULL-terminated array of suffixes used to mark an integer constant + on the architecture's assembly. */ -extern const char * gdbarch_stap_integer_suffix (struct gdbarch *gdbarch); -extern void set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch, const char * stap_integer_suffix); +extern const char *const * gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch, const char *const * stap_integer_suffixes); -/* Prefix used to mark a register name on the architecture's assembly. +/* A NULL-terminated array of prefixes 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); +extern const char *const * gdbarch_stap_register_prefixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_prefixes); -/* Suffix used to mark a register name on the architecture's assembly */ +/* A NULL-terminated array of suffixes used to mark a register name on + the architecture's assembly. */ -extern const char * gdbarch_stap_register_suffix (struct gdbarch *gdbarch); -extern void set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch, const char * stap_register_suffix); +extern const char *const * gdbarch_stap_register_suffixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_suffixes); -/* Prefix used to mark a register indirection on the architecture's assembly. +/* A NULL-terminated array of prefixes used to mark a register + indirection on the architecture's assembly. For example, on x86 the register indirection is written as: (%eax) ;; indirecting eax @@ -1074,10 +1079,11 @@ extern void set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch, const cha Please note that we use the indirection prefix also for register displacement, e.g., `4(%eax)' on x86. */ -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 const char *const * gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_prefixes); -/* Suffix used to mark a register indirection on the architecture's assembly. +/* A NULL-terminated array of suffixes used to mark a register + indirection on the architecture's assembly. For example, on x86 the register indirection is written as: (%eax) ;; indirecting eax @@ -1087,10 +1093,10 @@ extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarc Please note that we use the indirection suffix also for register displacement, e.g., `4(%eax)' on x86. */ -extern const char * gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch); -extern void set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch, const char * stap_register_indirection_suffix); +extern const char *const * gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch); +extern void set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_suffixes); -/* Prefix used to name a register using GDB's nomenclature. +/* Prefix(es) used to name a register using GDB's nomenclature. For example, on PPC a register is represented by a number in the assembly language (e.g., `10' is the 10th general-purpose register). However, |