+public:
+ /* We need a user-provided constructor to placate some compilers.
+ See PR build/24937. */
+ stap_static_probe_ops ()
+ {
+ }
+
+ /* See probe.h. */
+ bool is_linespec (const char **linespecp) const override;
+
+ /* See probe.h. */
+ void get_probes (std::vector<std::unique_ptr<probe>> *probesp,
+ struct objfile *objfile) const override;
+
+ /* See probe.h. */
+ const char *type_name () const override;
+
+ /* See probe.h. */
+ std::vector<struct info_probe_column> gen_info_probes_table_header
+ () const override;
+};
+
+/* SystemTap static_probe_ops. */
+
+const stap_static_probe_ops stap_static_probe_ops {};
+
+class stap_probe : public probe
+{
+public:
+ /* Constructor for stap_probe. */
+ stap_probe (std::string &&name_, std::string &&provider_, CORE_ADDR address_,
+ struct gdbarch *arch_, CORE_ADDR sem_addr, const char *args_text)
+ : probe (std::move (name_), std::move (provider_), address_, arch_),
+ m_sem_addr (sem_addr),
+ m_have_parsed_args (false), m_unparsed_args_text (args_text)
+ {}
+
+ /* See probe.h. */
+ CORE_ADDR get_relocated_address (struct objfile *objfile) override;
+
+ /* See probe.h. */
+ unsigned get_argument_count (struct gdbarch *gdbarch) override;
+
+ /* See probe.h. */
+ bool can_evaluate_arguments () const override;
+
+ /* See probe.h. */
+ struct value *evaluate_argument (unsigned n,
+ struct frame_info *frame) override;
+
+ /* See probe.h. */
+ void compile_to_ax (struct agent_expr *aexpr,
+ struct axs_value *axs_value,
+ unsigned n) override;
+
+ /* See probe.h. */
+ void set_semaphore (struct objfile *objfile,
+ struct gdbarch *gdbarch) override;
+
+ /* See probe.h. */
+ void clear_semaphore (struct objfile *objfile,
+ struct gdbarch *gdbarch) override;
+
+ /* See probe.h. */
+ const static_probe_ops *get_static_ops () const override;
+
+ /* See probe.h. */
+ std::vector<const char *> gen_info_probes_table_values () const override;
+
+ /* Return argument N of probe.
+
+ If the probe's arguments have not been parsed yet, parse them. If
+ there are no arguments, throw an exception (error). Otherwise,
+ return the requested argument. */
+ struct stap_probe_arg *get_arg_by_number (unsigned n,
+ struct gdbarch *gdbarch)
+ {
+ if (!m_have_parsed_args)
+ this->parse_arguments (gdbarch);
+
+ gdb_assert (m_have_parsed_args);
+ if (m_parsed_args.empty ())
+ internal_error (__FILE__, __LINE__,
+ _("Probe '%s' apparently does not have arguments, but \n"
+ "GDB is requesting its argument number %u anyway. "
+ "This should not happen. Please report this bug."),
+ this->get_name ().c_str (), n);
+
+ if (n > m_parsed_args.size ())
+ internal_error (__FILE__, __LINE__,
+ _("Probe '%s' has %d arguments, but GDB is requesting\n"
+ "argument %u. This should not happen. Please\n"
+ "report this bug."),
+ this->get_name ().c_str (),
+ (int) m_parsed_args.size (), n);
+
+ return &m_parsed_args[n];
+ }
+
+ /* Function which parses an argument string from the probe,
+ correctly splitting the arguments and storing their information
+ in properly ways.