Use symbol_set_language to set a symbol's language
[deliverable/binutils-gdb.git] / gdb / guile / scm-cmd.c
index 64243d1ba2e55f78b8c42164b39aad11babafd82..3b8195b8b4191ffe344227108d039009f3e40674 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB commands implemented in Scheme.
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -267,9 +267,9 @@ gdbscm_command_valid_p (SCM self)
 static SCM
 gdbscm_dont_repeat (SCM self)
 {
-  /* We currently don't need anything from SELF, but still verify it.  */
-  command_smob *c_smob
-    = cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+  /* We currently don't need anything from SELF, but still verify it.
+     Call for side effects.  */
+  cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
   dont_repeat ();
 
@@ -316,10 +316,10 @@ cmdscm_function (struct cmd_list_element *command,
         itself.  */
       if (gdbscm_user_error_p (gdbscm_exception_key (result)))
        {
-         char *msg = gdbscm_exception_message_to_string (result);
+         gdb::unique_xmalloc_ptr<char> msg
+           = gdbscm_exception_message_to_string (result);
 
-         make_cleanup (xfree, msg);
-         error ("%s", msg);
+         error ("%s", msg.get ());
        }
       else
        {
@@ -362,8 +362,8 @@ cmdscm_add_completion (SCM completion, completion_tracker &tracker)
     }
 
   gdb::unique_xmalloc_ptr<char> item
-    (gdbscm_scm_to_string (completion, NULL, host_charset (), 1,
-                          &except_scm));
+    gdbscm_scm_to_string (completion, NULL, host_charset (), 1,
+                           &except_scm);
   if (item == NULL)
     {
       /* Inform the user, but otherwise ignore the entire result.  */
@@ -492,10 +492,7 @@ gdbscm_parse_command_name (const char *name,
   lastchar = i;
 
   /* Find first character of the final word.  */
-  for (; i > 0 && (isalnum (name[i - 1])
-                  || name[i - 1] == '-'
-                  || name[i - 1] == '_');
-       --i)
+  for (; i > 0 && valid_cmd_char_p (name[i - 1]); --i)
     ;
   result = (char *) xmalloc (lastchar - i + 2);
   memcpy (result, &name[i], lastchar - i + 1);
@@ -758,7 +755,8 @@ gdbscm_register_command_x (SCM self)
   c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
   xfree (cmd_name);
 
-  TRY
+  gdbscm_gdb_exception exc {};
+  try
     {
       if (c_smob->is_prefix)
        {
@@ -776,11 +774,11 @@ gdbscm_register_command_x (SCM self)
                         c_smob->doc, cmd_list);
        }
     }
-  CATCH (except, RETURN_MASK_ALL)
+  catch (const gdb_exception &except)
     {
-      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+      exc = unpack (except);
     }
-  END_CATCH
+  GDBSCM_HANDLE_GDB_EXCEPTION (exc);
 
   /* Note: At this point the command exists in gdb.
      So no more errors after this point.  */
This page took 0.025006 seconds and 4 git commands to generate.