From 109c3e397e8c8c131128f2bcf6cea8b6ce6f2d51 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 26 Apr 2005 14:57:22 +0000 Subject: [PATCH] 2005-04-26 Andrew Cagney * 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 | 11 +++++++++++ gdb/cli/cli-script.c | 3 ++- gdb/dwarf2loc.c | 8 ++------ gdb/linespec.c | 4 ++-- gdb/linux-thread-db.c | 34 ++++++++------------------------ gdb/remote.c | 45 ++++++++++++++++--------------------------- 6 files changed, 42 insertions(+), 63 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fa36e4c09ed..af116537a9c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2005-04-26 Andrew Cagney + + * 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 Rename 'struct exception' to 'struct gdb_exception'. diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 3d69601477a..a4da9c5c586 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -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")); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 00b21968b42..47c8101d763 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -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); } diff --git a/gdb/linespec.c b/gdb/linespec.c index 8cf7a6547ef..cf6e6f6fa46 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -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); } diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 30f9c94dfc7..fca0b048173 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 diff --git a/gdb/remote.c b/gdb/remote.c index 7ad9ec26052..450ef5b91ba 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -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; } -- 2.30.2