X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fstap-probe.c;h=ea206cbb80f3016db7e30e65db751892b7cd7415;hb=bd5766ec689140aa80e5d4fd5c0bf9c990f5a38b;hp=e5a901b4bf67d5ac6d8b1e678339b815ac9996e9;hpb=677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index e5a901b4bf..ea206cbb80 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -20,7 +20,6 @@ #include "defs.h" #include "stap-probe.h" #include "probe.h" -#include "common/vec.h" #include "ui-out.h" #include "objfiles.h" #include "arch-utils.h" @@ -136,7 +135,7 @@ public: CORE_ADDR get_relocated_address (struct objfile *objfile) override; /* See probe.h. */ - unsigned get_argument_count (struct frame_info *frame) override; + unsigned get_argument_count (struct gdbarch *gdbarch) override; /* See probe.h. */ bool can_evaluate_arguments () const override; @@ -762,13 +761,39 @@ stap_parse_register_operand (struct stap_parse_info *p) regname += gdb_reg_suffix; } + int regnum = user_reg_map_name_to_regnum (gdbarch, regname.c_str (), + regname.size ()); + /* Is this a valid register name? */ - if (user_reg_map_name_to_regnum (gdbarch, - regname.c_str (), - regname.size ()) == -1) + if (regnum == -1) error (_("Invalid register name `%s' on expression `%s'."), regname.c_str (), p->saved_arg); + /* Check if there's any special treatment that the arch-specific + code would like to perform on the register name. */ + if (gdbarch_stap_adjust_register_p (gdbarch)) + { + std::string newregname + = gdbarch_stap_adjust_register (gdbarch, p, regname, regnum); + + if (regname != newregname) + { + /* This is just a check we perform to make sure that the + arch-dependent code has provided us with a valid + register name. */ + regnum = user_reg_map_name_to_regnum (gdbarch, newregname.c_str (), + newregname.size ()); + + if (regnum == -1) + internal_error (__FILE__, __LINE__, + _("Invalid register name '%s' after replacing it" + " (previous name was '%s')"), + newregname.c_str (), regname.c_str ()); + + regname = newregname; + } + } + write_exp_elt_opcode (&p->pstate, OP_REGISTER); str.ptr = regname.c_str (); str.length = regname.size (); @@ -1275,10 +1300,8 @@ stap_probe::get_relocated_address (struct objfile *objfile) argument string. */ unsigned -stap_probe::get_argument_count (struct frame_info *frame) +stap_probe::get_argument_count (struct gdbarch *gdbarch) { - struct gdbarch *gdbarch = get_frame_arch (frame); - if (!m_have_parsed_args) { if (this->can_evaluate_arguments ())