/* GNU/Linux on ARM target support.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "breakpoint.h"
#include "auxv.h"
#include "xml-syscall.h"
+#include "expop.h"
#include "aarch32-tdep.h"
#include "arch/arm.h"
void *cb_data,
const struct regcache *regcache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", ARM_LINUX_SIZEOF_GREGSET, ARM_LINUX_SIZEOF_GREGSET,
&arm_linux_gregset, NULL, cb_data);
It returns one if the special token has been parsed successfully,
or zero if the current token is not considered special. */
-static int
+static expr::operation_up
arm_stap_parse_special_token (struct gdbarch *gdbarch,
struct stap_parse_info *p)
{
int len, offset;
int got_minus = 0;
long displacement;
- struct stoken str;
++tmp;
start = tmp;
++tmp;
if (*tmp != ',')
- return 0;
+ return {};
len = tmp - start;
regname = (char *) alloca (len + 2);
/* Skipping last `]'. */
if (*tmp++ != ']')
- return 0;
+ return {};
+ p->arg = tmp;
+
+ using namespace expr;
/* The displacement. */
- write_exp_elt_opcode (&p->pstate, OP_LONG);
- write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
- write_exp_elt_longcst (&p->pstate, displacement);
- write_exp_elt_opcode (&p->pstate, OP_LONG);
+ struct type *long_type = builtin_type (gdbarch)->builtin_long;
if (got_minus)
- write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+ displacement = -displacement;
+ operation_up disp = make_operation<long_const_operation> (long_type,
+ displacement);
/* The register name. */
- 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);
+ operation_up reg
+ = make_operation<register_operation> (regname);
- write_exp_elt_opcode (&p->pstate, BINOP_ADD);
+ operation_up sum
+ = make_operation<add_operation> (std::move (reg), std::move (disp));
/* Casting to the expected type. */
- write_exp_elt_opcode (&p->pstate, UNOP_CAST);
- write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
- write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
- write_exp_elt_opcode (&p->pstate, UNOP_IND);
-
- p->arg = tmp;
+ struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+ sum = make_operation<unop_cast_operation> (std::move (sum),
+ arg_ptr_type);
+ return make_operation<unop_ind_operation> (std::move (sum));
}
- else
- return 0;
- return 1;
+ return {};
}
/* ARM process record-replay constructs: syscall, signal etc. */
-struct linux_record_tdep arm_linux_record_tdep;
+static linux_record_tdep arm_linux_record_tdep;
/* arm_canonicalize_syscall maps from the native arm Linux set
of syscall ids into a canonical set of syscall ids used by
if (syscall_gdb == gdb_sys_no_syscall)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (svc_number));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (svc_number));
return -1;
}
NULL };
static const char *const stap_register_indirection_suffixes[] = { "]",
NULL };
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 1);
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);