Insert breakpoint even when the raw breakpoint is found
[deliverable/binutils-gdb.git] / gdb / guile / scm-utils.c
index 6d9542d24c1934fa6053a06a4150191f276c7d49..e804cfc77bff3830363210dc1bb745af330e675f 100644 (file)
@@ -1,6 +1,6 @@
 /* General utility routines for GDB/Scheme code.
 
-   Copyright (C) 2014 Free Software Foundation, Inc.
+   Copyright (C) 2014-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    conventions, et.al.  */
 
 #include "defs.h"
-#include <stdarg.h>
-#include <stdint.h>
-#include "gdb_assert.h"
 #include "guile-internal.h"
 
 /* Define VARIABLES in the gdb module.  */
 
 void
-gdbscm_define_variables (const scheme_variable *variables, int public)
+gdbscm_define_variables (const scheme_variable *variables, int is_public)
 {
   const scheme_variable *sv;
 
   for (sv = variables; sv->name != NULL; ++sv)
     {
       scm_c_define (sv->name, sv->value);
-      if (public)
+      if (is_public)
        scm_c_export (sv->name, NULL);
     }
 }
@@ -44,7 +41,7 @@ gdbscm_define_variables (const scheme_variable *variables, int public)
 /* Define FUNCTIONS in the gdb module.  */
 
 void
-gdbscm_define_functions (const scheme_function *functions, int public)
+gdbscm_define_functions (const scheme_function *functions, int is_public)
 {
   const scheme_function *sf;
 
@@ -55,7 +52,7 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
       scm_set_procedure_property_x (proc, gdbscm_documentation_symbol,
                                    gdbscm_scm_from_c_string (sf->doc_string));
-      if (public)
+      if (is_public)
        scm_c_export (sf->name, NULL);
     }
 }
@@ -64,14 +61,14 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
 void
 gdbscm_define_integer_constants (const scheme_integer_constant *constants,
-                                int public)
+                                int is_public)
 {
   const scheme_integer_constant *sc;
 
   for (sc = constants; sc->name != NULL; ++sc)
     {
       scm_c_define (sc->name, scm_from_int (sc->value));
-      if (public)
+      if (is_public)
        scm_c_export (sc->name, NULL);
     }
 }
@@ -204,7 +201,7 @@ extract_arg (char format_char, SCM arg, void *argp,
     {
     case 's':
       {
-       char **arg_ptr = argp;
+       char **arg_ptr = (char **) argp;
 
        CHECK_TYPE (gdbscm_is_true (scm_string_p (arg)), arg, position,
                    func_name, _("string"));
@@ -213,7 +210,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 't':
       {
-       int *arg_ptr = argp;
+       int *arg_ptr = (int *) argp;
 
        /* While in Scheme, anything non-#f is "true", we're strict.  */
        CHECK_TYPE (gdbscm_is_bool (arg), arg, position, func_name,
@@ -223,7 +220,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'i':
       {
-       int *arg_ptr = argp;
+       int *arg_ptr = (int *) argp;
 
        CHECK_TYPE (scm_is_signed_integer (arg, INT_MIN, INT_MAX),
                    arg, position, func_name, _("int"));
@@ -232,7 +229,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'u':
       {
-       int *arg_ptr = argp;
+       int *arg_ptr = (int *) argp;
 
        CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT_MAX),
                    arg, position, func_name, _("unsigned int"));
@@ -241,7 +238,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'l':
       {
-       long *arg_ptr = argp;
+       long *arg_ptr = (long *) argp;
 
        CHECK_TYPE (scm_is_signed_integer (arg, LONG_MIN, LONG_MAX),
                    arg, position, func_name, _("long"));
@@ -250,7 +247,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'n':
       {
-       unsigned long *arg_ptr = argp;
+       unsigned long *arg_ptr = (unsigned long *) argp;
 
        CHECK_TYPE (scm_is_unsigned_integer (arg, 0, ULONG_MAX),
                    arg, position, func_name, _("unsigned long"));
@@ -259,7 +256,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'L':
       {
-       LONGEST *arg_ptr = argp;
+       LONGEST *arg_ptr = (LONGEST *) argp;
 
        CHECK_TYPE (scm_is_signed_integer (arg, INT64_MIN, INT64_MAX),
                    arg, position, func_name, _("LONGEST"));
@@ -268,7 +265,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'U':
       {
-       ULONGEST *arg_ptr = argp;
+       ULONGEST *arg_ptr = (ULONGEST *) argp;
 
        CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT64_MAX),
                    arg, position, func_name, _("ULONGEST"));
@@ -277,7 +274,7 @@ extract_arg (char format_char, SCM arg, void *argp,
       }
     case 'O':
       {
-       SCM *arg_ptr = argp;
+       SCM *arg_ptr = (SCM *) argp;
 
        *arg_ptr = arg;
        break;
@@ -435,8 +432,8 @@ gdbscm_parse_function_args (const char *func_name,
 
   if (num_keywords > 0)
     {
-      SCM *keyword_args = (SCM *) alloca (num_keywords * sizeof (SCM));
-      int *keyword_positions = (int *) alloca (num_keywords * sizeof (int));
+      SCM *keyword_args = XALLOCAVEC (SCM, num_keywords);
+      int *keyword_positions = XALLOCAVEC (int, num_keywords);
 
       gdb_assert (*p == '#');
       ++p;
@@ -590,7 +587,8 @@ char *
 gdbscm_gc_xstrdup (const char *str)
 {
   size_t len = strlen (str);
-  char *result = scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
+  char *result
+    = (char *) scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
 
   strcpy (result, str);
   return result;
@@ -610,8 +608,9 @@ gdbscm_gc_dup_argv (char **argv)
 
   /* Allocating "pointerless" works because the pointers are all
      self-contained within the object.  */
-  result = scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
-                                     + string_space, "parameter enum list");
+  result = (char **) scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
+                                               + string_space,
+                                               "parameter enum list");
   p = (char *) &result[len + 1];
 
   for (i = 0; i < len; ++i)
@@ -624,3 +623,22 @@ gdbscm_gc_dup_argv (char **argv)
 
   return (const char * const *) result;
 }
+
+/* Return non-zero if the version of Guile being used it at least
+   MAJOR.MINOR.MICRO.  */
+
+int
+gdbscm_guile_version_is_at_least (int major, int minor, int micro)
+{
+  if (major > gdbscm_guile_major_version)
+    return 0;
+  if (major < gdbscm_guile_major_version)
+    return 1;
+  if (minor > gdbscm_guile_minor_version)
+    return 0;
+  if (minor < gdbscm_guile_minor_version)
+    return 1;
+  if (micro > gdbscm_guile_micro_version)
+    return 0;
+  return 1;
+}
This page took 0.042899 seconds and 4 git commands to generate.