aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:38 -0700
commit4c5e7a930a46ddd6844eb7aede3ef60df535bc33 (patch)
tree360c0598047c43c52d5b770a869cfa3efe847f3a /gdb/ppc-linux-tdep.c
parent482ddd69c5f026aac98932be2fa8ac985b37d5be (diff)
downloadgdb-4c5e7a930a46ddd6844eb7aede3ef60df535bc33.zip
gdb-4c5e7a930a46ddd6844eb7aede3ef60df535bc33.tar.gz
gdb-4c5e7a930a46ddd6844eb7aede3ef60df535bc33.tar.bz2
Convert stap probes to create operations
This changes the stap probe code to create operations, rather than exp_elements. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * stap-probe.c (binop_maker_ftype): New typedef. (stap_maker_map): New global. (stap_make_binop): New function. (stap_parse_register_operand): Return operation_up. (stap_parse_single_operand, stap_parse_argument_conditionally) (stap_parse_argument_1): Likewise. (stap_parse_argument): Create operations. (stap_probe::parse_arguments): Update. (_initialize_stap_probe): Initialize stap_maker_map. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Change return type. * i386-tdep.h (i386_stap_parse_special_token): Change return type. * i386-tdep.c (i386_stap_parse_special_token_triplet) (i386_stap_parse_special_token_three_arg_disp) (i386_stap_parse_special_token): Change return type. * gdbarch.sh (stap_parse_special_token): Change return type. * gdbarch.c: Rebuild. * gdbarch.h: Rebuild. * arm-linux-tdep.c (arm_stap_parse_special_token): Change return type. * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Change return type.
Diffstat (limited to 'gdb/ppc-linux-tdep.c')
-rw-r--r--gdb/ppc-linux-tdep.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 467d696..1e94922 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -52,6 +52,7 @@
#include "linux-record.h"
#include "record-full.h"
#include "infrun.h"
+#include "expop.h"
#include "stap-probe.h"
#include "ax.h"
@@ -1674,7 +1675,7 @@ ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
/* Implementation of `gdbarch_stap_parse_special_token', as defined in
gdbarch.h. */
-static int
+static expr::operation_up
ppc_stap_parse_special_token (struct gdbarch *gdbarch,
struct stap_parse_info *p)
{
@@ -1686,7 +1687,6 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
const char *s = p->arg;
char *regname;
int len;
- struct stoken str;
while (isdigit (*s))
++s;
@@ -1695,7 +1695,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
{
/* It is a register displacement indeed. Returning 0 means we are
deferring the treatment of this case to the generic parser. */
- return 0;
+ return {};
}
len = s - p->arg;
@@ -1710,22 +1710,14 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
error (_("Invalid register name `%s' on expression `%s'."),
regname, p->saved_arg);
- write_exp_elt_opcode (&p->pstate, OP_REGISTER);
- str.ptr = regname;
- str.length = len;
- write_exp_string (&p->pstate, str);
- write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-
p->arg = s;
- }
- else
- {
- /* All the other tokens should be handled correctly by the generic
- parser. */
- return 0;
+
+ return expr::make_operation<expr::register_operation> (regname);
}
- return 1;
+ /* All the other tokens should be handled correctly by the generic
+ parser. */
+ return {};
}
/* Initialize linux_record_tdep if not initialized yet.