2005-04-26 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Tue, 26 Apr 2005 14:57:22 +0000 (14:57 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 26 Apr 2005 14:57:22 +0000 (14:57 +0000)
* remote.c (remote_open_1): Move "ex"'s declaration to where it is
used.
(remote_get_thread_local_address): Use throw_error, include a
printed string.
* linux-thread-db.c (thread_db_get_thread_local_address): Ditto.
* dwarf2loc.c (dwarf_expr_tls_address): Ditto.
* cli/cli-script.c (script_from_file): Mark up throw_error message.
* linespec.c (symtab_from_filename, decode_variable): Ditto.

gdb/ChangeLog
gdb/cli/cli-script.c
gdb/dwarf2loc.c
gdb/linespec.c
gdb/linux-thread-db.c
gdb/remote.c

index fa36e4c09edcf8f3872f24aa6f4cc6f0b723d6c4..af116537a9cb35d454f24f79e97e92ff5aa8463d 100644 (file)
@@ -1,3 +1,14 @@
+2005-04-26  Andrew Cagney  <cagney@gnu.org>
+
+       * remote.c (remote_open_1): Move "ex"'s declaration to where it is
+       used.
+       (remote_get_thread_local_address): Use throw_error, include a
+       printed string.
+       * linux-thread-db.c (thread_db_get_thread_local_address): Ditto.
+       * dwarf2loc.c (dwarf_expr_tls_address): Ditto.
+       * cli/cli-script.c (script_from_file): Mark up throw_error message.
+       * linespec.c (symtab_from_filename, decode_variable): Ditto.
+
 2005-04-26  Andrew Cagney  <cagney@gnu.org>
 
        Rename 'struct exception' to 'struct gdb_exception'.
index 3d69601477aa29e3e9143fade3d2e74529b76350..a4da9c5c5861d849c3afac382fb51c353eb170ea 100644 (file)
@@ -1286,7 +1286,8 @@ script_from_file (FILE *stream, char *file)
       case RETURN_ERROR:
        /* Re-throw the error, but with the file name information
           prepended.  */
-       throw_error (e.error, "%s:%d: Error in sourced command file:\n%s",
+       throw_error (e.error,
+                    _("%s:%d: Error in sourced command file:\n%s"),
                     source_file_name, source_line_number, e.message);
       default:
        internal_error (__FILE__, __LINE__, _("bad reason"));
index 00b21968b42ec8d96223094510fc4473d2e7de62..47c8101d763105be84b7fa8c7855c6cc2f5c3e88 100644 (file)
@@ -204,12 +204,8 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
                                                           objfile);
          /* If it's 0, throw the appropriate exception.  */
          if (lm_addr == 0)
-           {
-             struct gdb_exception e
-               = { RETURN_ERROR, TLS_LOAD_MODULE_NOT_FOUND_ERROR, 0 };
-
-             throw_exception (e);
-           }
+           throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR,
+                        _("TLS load module not found"));
 
          addr = target_get_thread_local_address (ptid, lm_addr, offset);
        }
index 8cf7a6547ef6eafa73d4f58e79f6f7a6743d2e4f..cf6e6f6fa46b91e8186550a5faa92e2ff0c2231f 100644 (file)
@@ -1529,7 +1529,7 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
        error (_("No symbol table is loaded.  Use the \"file\" command."));
       if (not_found_ptr)
        *not_found_ptr = 1;
-      throw_error (NOT_FOUND_ERROR, "No source file named %s.", copy);
+      throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy);
     }
 
   /* Discard the file name from the arg.  */
@@ -1741,7 +1741,7 @@ decode_variable (char *copy, int funfirstline, char ***canonical,
 
   if (not_found_ptr)
     *not_found_ptr = 1;
-  throw_error (NOT_FOUND_ERROR, "Function \"%s\" not defined.", copy);
+  throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy);
 }
 
 
index 30f9c94dfc77a1388eac9a600cca5ed96cbbd830..fca0b048173d0ca841fa16a53f07ce662760898d 100644 (file)
@@ -1246,12 +1246,8 @@ thread_db_get_thread_local_address (ptid_t ptid,
 
       /* glibc doesn't provide the needed interface.  */
       if (!td_thr_tls_get_addr_p)
-       {
-         struct gdb_exception e 
-           = { RETURN_ERROR, TLS_NO_LIBRARY_SUPPORT_ERROR, 0 };
-
-         throw_exception (e);
-       }
+       throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR,
+                    _("No TLS library support"));
 
       /* Caller should have verified that lm != 0.  */
       gdb_assert (lm != 0);
@@ -1267,26 +1263,17 @@ thread_db_get_thread_local_address (ptid_t ptid,
 #ifdef THREAD_DB_HAS_TD_NOTALLOC
       /* The memory hasn't been allocated, yet.  */
       if (err == TD_NOTALLOC)
-       {
          /* Now, if libthread_db provided the initialization image's
             address, we *could* try to build a non-lvalue value from
             the initialization image.  */
-
-         struct gdb_exception e
-           = { RETURN_ERROR, TLS_NOT_ALLOCATED_YET_ERROR, 0 };
-
-         throw_exception (e);
-       }
+        throw_error (TLS_NOT_ALLOCATED_YET_ERROR,
+                     _("TLS not allocated yet"));
 #endif
 
       /* Something else went wrong.  */
       if (err != TD_OK)
-       {
-         struct gdb_exception e
-           = { RETURN_ERROR, TLS_GENERIC_ERROR, thread_db_err_str (err) };
-
-         throw_exception (e);
-       }
+        throw_error (TLS_GENERIC_ERROR,
+                     (("%s")), thread_db_err_str (err));
 
       /* Cast assuming host == target.  Joy.  */
       return (CORE_ADDR) address;
@@ -1295,13 +1282,8 @@ thread_db_get_thread_local_address (ptid_t ptid,
   if (target_beneath->to_get_thread_local_address)
     return target_beneath->to_get_thread_local_address (ptid, lm, offset);
   else
-    {
-      struct gdb_exception e
-       = { RETURN_ERROR, TLS_GENERIC_ERROR,
-           "TLS not supported on this target" };
-
-      throw_exception (e);
-    }
+    throw_error (TLS_GENERIC_ERROR,
+                _("TLS not supported on this target"));
 }
 
 static void
index 7ad9ec26052d90022702593d7b6121314f0a7d72..450ef5b91baefa011a616290a2aaaab93f1ae609 100644 (file)
@@ -2179,7 +2179,6 @@ static void
 remote_open_1 (char *name, int from_tty, struct target_ops *target,
               int extended_p, int async_p)
 {
-  struct gdb_exception ex;
   struct remote_state *rs = get_remote_state ();
   if (name == 0)
     error (_("To open a remote debug connection, you need to specify what\n"
@@ -2282,14 +2281,17 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
      been fixed - the function set_cmd_context() makes it possible for
      all the ``target ....'' commands to share a common callback
      function.  See cli-dump.c.  */
-  ex = catch_exception (uiout, remote_start_remote, NULL, RETURN_MASK_ALL);
-  if (ex.reason < 0)
-    {
-      pop_target ();
-      if (async_p)
-       wait_forever_enabled_p = 1;
-      throw_exception (ex);
-    }
+  {
+    struct gdb_exception ex
+      = catch_exception (uiout, remote_start_remote, NULL, RETURN_MASK_ALL);
+    if (ex.reason < 0)
+      {
+       pop_target ();
+       if (async_p)
+         wait_forever_enabled_p = 1;
+       throw_exception (ex);
+      }
+  }
 
   if (async_p)
     wait_forever_enabled_p = 1;
@@ -5357,28 +5359,15 @@ remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset)
          return result;
        }
       else if (result == PACKET_UNKNOWN)
-       {
-         struct gdb_exception e
-           = { RETURN_ERROR, TLS_GENERIC_ERROR,
-               "Remote target doesn't support qGetTLSAddr packet" };
-         throw_exception (e);
-       }
+       throw_error (TLS_GENERIC_ERROR,
+                    _("Remote target doesn't support qGetTLSAddr packet"));
       else
-       {
-         struct gdb_exception e
-           = { RETURN_ERROR, TLS_GENERIC_ERROR,
-               "Remote target failed to process qGetTLSAddr request" };
-         throw_exception (e);
-
-       }
+       throw_error (TLS_GENERIC_ERROR,
+                    _("Remote target failed to process qGetTLSAddr request"));
     }
   else
-    {
-      struct gdb_exception e
-       = { RETURN_ERROR, TLS_GENERIC_ERROR,
-           "TLS not supported or disabled on this target" };
-      throw_exception (e);
-    }
+    throw_error (TLS_GENERIC_ERROR,
+                _("TLS not supported or disabled on this target"));
   /* Not reached.  */
   return 0;
 }