More invalid pointer to pointer conversions.
[external/binutils.git] / gdb / stap-probe.c
index 07f5a60..1079e3b 100644 (file)
@@ -1,6 +1,6 @@
 /* SystemTap probe support for GDB.
 
-   Copyright (C) 2012 Free Software Foundation, Inc.
+   Copyright (C) 2012-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -53,7 +53,7 @@ static const struct probe_ops stap_probe_ops;
 /* Should we display debug information for the probe's argument expression
    parsing?  */
 
-static int stap_expression_debug = 0;
+static unsigned int stap_expression_debug = 0;
 
 /* The various possibilities of bitness defined for a probe's argument.
 
@@ -422,9 +422,11 @@ stap_parse_register_operand (struct stap_parse_info *p)
     {
       /* The value of the displacement.  */
       long displacement;
+      char *endp;
 
       disp_p = 1;
-      displacement = strtol (p->arg, (char **) &p->arg, 10);
+      displacement = strtol (p->arg, &endp, 10);
+      p->arg = endp;
 
       /* Generating the expression for the displacement.  */
       write_exp_elt_opcode (OP_LONG);
@@ -598,7 +600,12 @@ stap_parse_single_operand (struct stap_parse_info *p)
        tmp = skip_spaces_const (tmp);
 
       if (isdigit (*tmp))
-       number = strtol (tmp, (char **) &tmp, 10);
+       {
+         char *endp;
+
+         number = strtol (tmp, &endp, 10);
+         tmp = endp;
+       }
 
       if (!reg_ind_prefix
          || strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0)
@@ -627,11 +634,13 @@ stap_parse_single_operand (struct stap_parse_info *p)
     {
       /* A temporary variable, needed for lookahead.  */
       const char *tmp = p->arg;
+      char *endp;
       long number;
 
       /* We can be dealing with a numeric constant (if `const_prefix' is
         NULL), or with a register displacement.  */
-      number = strtol (tmp, (char **) &tmp, 10);
+      number = strtol (tmp, &endp, 10);
+      tmp = endp;
 
       if (p->inside_paren_p)
        tmp = skip_spaces_const (tmp);
@@ -667,9 +676,11 @@ stap_parse_single_operand (struct stap_parse_info *p)
     {
       /* We are dealing with a numeric constant.  */
       long number;
+      char *endp;
 
       p->arg += const_prefix_len;
-      number = strtol (p->arg, (char **) &p->arg, 10);
+      number = strtol (p->arg, &endp, 10);
+      p->arg = endp;
 
       write_exp_elt_opcode (OP_LONG);
       write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
@@ -1160,7 +1171,7 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
   int sel = (int) (uintptr_t) data;
   struct probe *pc_probe;
   const struct sym_probe_fns *pc_probe_fns;
-  int n_probes;
+  int n_args;
 
   /* SEL == -1 means "_probe_argc".  */
   gdb_assert (sel >= -1);
@@ -1175,20 +1186,20 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
 
   pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
 
-  n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+  n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
 
   if (sel == -1)
     {
       value->kind = axs_rvalue;
       value->type = builtin_type (expr->gdbarch)->builtin_int;
-      ax_const_l (expr, n_probes);
+      ax_const_l (expr, n_args);
       return;
     }
 
   gdb_assert (sel >= 0);
-  if (sel >= n_probes)
+  if (sel >= n_args)
     error (_("Invalid probe argument %d -- probe has %d arguments available"),
-          sel, n_probes);
+          sel, n_args);
 
   pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
 }
@@ -1303,7 +1314,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
   ret->p.objfile = objfile;
 
   /* Provider and the name of the probe.  */
-  ret->p.provider = &el->data[3 * size];
+  ret->p.provider = (char *) &el->data[3 * size];
   ret->p.name = memchr (ret->p.provider, '\0',
                        (char *) el->data + el->size - ret->p.provider);
   /* Making sure there is a name.  */
@@ -1533,15 +1544,15 @@ _initialize_stap_probe (void)
 {
   VEC_safe_push (probe_ops_cp, all_probe_ops, &stap_probe_ops);
 
-  add_setshow_zinteger_cmd ("stap-expression", class_maintenance,
-                           &stap_expression_debug,
-                           _("Set SystemTap expression debugging."),
-                           _("Show SystemTap expression debugging."),
-                           _("When non-zero, the internal representation "
-                             "of SystemTap expressions will be printed."),
-                           NULL,
-                           show_stapexpressiondebug,
-                           &setdebuglist, &showdebuglist);
+  add_setshow_zuinteger_cmd ("stap-expression", class_maintenance,
+                            &stap_expression_debug,
+                            _("Set SystemTap expression debugging."),
+                            _("Show SystemTap expression debugging."),
+                            _("When non-zero, the internal representation "
+                              "of SystemTap expressions will be printed."),
+                            NULL,
+                            show_stapexpressiondebug,
+                            &setdebuglist, &showdebuglist);
 
   create_internalvar_type_lazy ("_probe_argc", &probe_funcs,
                                (void *) (uintptr_t) -1);