{
uint32_t probe_offset
= ((uint32_t *) offtab)[DOF_UINT (dof, probe->dofpr_offidx) + i];
- struct dtrace_probe *ret
- = obstack_alloc (&objfile->per_bfd->storage_obstack, sizeof (*ret));
+ struct dtrace_probe *ret =
+ XOBNEW (&objfile->per_bfd->storage_obstack, struct dtrace_probe);
ret->p.pops = &dtrace_probe_ops;
ret->p.arch = gdbarch;
for (j = 0; j < ret->probe_argc; j++)
{
struct dtrace_probe_arg arg;
- struct expression *expr;
+ struct expression *expr = NULL;
/* Set arg.expr to ensure all fields in expr are initialized and
the compiler will not warn when arg is used. */
this does not work then we set the type to `long
int'. */
arg.type = builtin_type (gdbarch)->builtin_long;
- expr = parse_expression (arg.type_str);
- if (expr->elts[0].opcode == OP_TYPE)
+
+ TRY
+ {
+ expr = parse_expression_with_language (arg.type_str, language_c);
+ }
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ expr = NULL;
+ }
+ END_CATCH
+
+ if (expr != NULL && expr->elts[0].opcode == OP_TYPE)
arg.type = expr->elts[1].type;
VEC_safe_push (dtrace_probe_arg_s, ret->args, &arg);
unsigned int entsize = DOF_UINT (dof, probes_s->dofs_entsize);
int num_probes;
+ if (DOF_UINT (dof, section->dofs_size)
+ < sizeof (struct dtrace_dof_provider))
+ {
+ /* The section is smaller than expected, so do not use it.
+ This has been observed on x86-solaris 10. */
+ goto invalid_dof_data;
+ }
+
/* Very, unlikely, but could crash gdb if not handled
properly. */
if (entsize == 0)