+2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * probe.h (struct probe_ops) <get_probe_argument_count,
+ evaluate_probe_argument, enable_probe, disable_probe>: Mention in
+ the comment that the function can throw an exception.
+ (get_probe_argument_count): Likewise.
+ (evaluate_probe_argument): Likewise.
+ * stap-probe.c (stap_get_opcode): Call error instead of
+ internal_error.
+ (stap_get_expected_argument_type): Likewise. Add argument
+ 'probe'. Improve error message by mentioning the probe's name.
+ (stap_parse_probe_arguments): Adjust call to
+ stap_get_expected_argument_type.
+ (stap_get_arg): Add comment. Assert that 'probe->args_parsed' is
+ not zero. Call internal_error if GDB requests an argument but the
+ probe has no arguments.
+
2015-09-01 Pierre-Marie de Rodat <derodat@adacore.com>
* ada-lang.c (ada_resolve_function): Do not ask the user what
CORE_ADDR (*get_probe_address) (struct probe *probe,
struct objfile *objfile);
- /* Return the number of arguments of PROBE. */
+ /* Return the number of arguments of PROBE. This function can
+ throw an exception. */
unsigned (*get_probe_argument_count) (struct probe *probe,
struct frame_info *frame);
int (*can_evaluate_probe_arguments) (struct probe *probe);
/* Evaluate the Nth argument from the PROBE, returning a value
- corresponding to it. The argument number is represented N. */
+ corresponding to it. The argument number is represented N.
+ This function can throw an exception. */
struct value *(*evaluate_probe_argument) (struct probe *probe,
unsigned n,
/* Enable a probe. The semantics of "enabling" a probe depend on
the specific backend and the field can be NULL in case enabling
- probes is not supported. */
+ probes is not supported. This function can throw an
+ exception. */
void (*enable_probe) (struct probe *probe);
/* Disable a probe. The semantics of "disabling" a probe depend
on the specific backend and the field can be NULL in case
- disabling probes is not supported. */
+ disabling probes is not supported. This function can throw an
+ exception. */
void (*disable_probe) (struct probe *probe);
};
extern CORE_ADDR get_probe_address (struct probe *probe,
struct objfile *objfile);
-/* Return the argument count of the specified probe. */
+/* Return the argument count of the specified probe.
+
+ This function can throw an exception. */
extern unsigned get_probe_argument_count (struct probe *probe,
struct frame_info *frame);
extern int can_evaluate_probe_arguments (struct probe *probe);
/* Evaluate argument N of the specified probe. N must be between 0
- inclusive and get_probe_argument_count exclusive. */
+ inclusive and get_probe_argument_count exclusive.
+
+ This function can throw an exception. */
extern struct value *evaluate_probe_argument (struct probe *probe,
unsigned n,
break;
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid opcode in expression `%s' for SystemTap"
- "probe"), *s);
+ error (_("Invalid opcode in expression `%s' for SystemTap"
+ "probe"), *s);
}
return op;
static struct type *
stap_get_expected_argument_type (struct gdbarch *gdbarch,
- enum stap_arg_bitness b)
+ enum stap_arg_bitness b,
+ const struct stap_probe *probe)
{
switch (b)
{
return builtin_type (gdbarch)->builtin_uint64;
default:
- internal_error (__FILE__, __LINE__,
- _("Undefined bitness for probe."));
+ error (_("Undefined bitness for probe '%s'."),
+ probe->p.name);
break;
}
}
else
arg.bitness = STAP_ARG_BITNESS_UNDEFINED;
- arg.atype = stap_get_expected_argument_type (gdbarch, arg.bitness);
+ arg.atype = stap_get_expected_argument_type (gdbarch, arg.bitness,
+ probe);
expr = stap_parse_argument (&cur, arg.atype, gdbarch);
return ret;
}
+/* Return argument N of probe 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. */
+
static struct stap_probe_arg *
stap_get_arg (struct stap_probe *probe, unsigned n, struct gdbarch *gdbarch)
{
if (!probe->args_parsed)
stap_parse_probe_arguments (probe, gdbarch);
+ gdb_assert (probe->args_parsed);
+ if (probe->args_u.vec == NULL)
+ 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."),
+ probe->p.name, n);
+
return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
}