From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11261 invoked by alias); 30 May 2005 19:53:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11209 invoked by uid 22791); 30 May 2005 19:53:45 -0000 Received: from cpe-144-131-104-16.nsw.bigpond.net.au (HELO takamaka.act-europe.fr) (144.131.104.16) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 30 May 2005 19:53:45 +0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 1A64547959; Tue, 31 May 2005 05:53:39 +1000 (EST) Date: Mon, 30 May 2005 19:55:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] Set current language when dumping symtab Message-ID: <20050530195338.GO18754@adacore.com> References: <20050504001955.GE2439@adacore.com> <20050528234905.GF22435@nevyn.them.org> <20050529021056.GF18754@adacore.com> <20050529025401.GA14380@nevyn.them.org> <20050530054538.GM18754@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: <20050530054538.GM18754@adacore.com> User-Agent: Mutt/1.4i X-SW-Source: 2005-05/txt/msg00643.txt.bz2 --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1783 Humpf, with the patch, this time. Thanks Daniel! On Mon, May 30, 2005 at 03:45:38PM +1000, Joel Brobecker wrote: > > > #define TRY_CATCH(EXCEPTION,MASK) \ > > > { \ > > > EXCEPTIONS_SIGJMP_BUF *buf = \ > > > exceptions_state_mc_init (uiout, &(EXCEPTION), (MASK)); \ > > > EXCEPTIONS_SIGSETJMP (*buf); \ > > > } \ > > > while (exceptions_state_mc_action_iter ()) \ > > > while (exceptions_state_mc_action_iter_1 ()) > > > > > > There is a dependency on "uiout". Perhaps it would be better to include > > > that file from exceptions.h, rather than requiring all clients to include > > > it themselves? I could send a separate RFA for that. > > > > Yes please. I figured it was something like that, went looking at the > > definition, and my eyes skipped right over it. > > Sure. Patch sent, although I can provide the URL yet, as sources.redhat.com > is unfortunately refusing connections on port 25. Will send the URL as > a followup message as soon as the problem is fixed. > > > > > Also, I am not convinced that the new TRY_CATCH is necessary. The > > > > only bit likely to throw is print_symbol, which is already wrapped in > > > > catch_errors. > > > > > > That's true, and I'd be happy to remove it. But I thought that it might > > > be safer to use it anyway, so that any change underneath that might cause > > > an exception to be thrown does not affect this code. This is a hard > > > guaranty that the language will never be changed as a side-effect of > > > this command. > > Okidoke, understood. New patch attached. > > 2005-05-30 Joel Brobecker > > * symmisc.c (dump_symtab_1): Renamed from dump_symtab. > (dump_symtab): New function. > > Tested on x86-linux. -- Joel --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="symmisc.c.diff" Content-length: 1255 Index: symmisc.c =================================================================== RCS file: /cvs/src/src/gdb/symmisc.c,v retrieving revision 1.38 diff -u -p -r1.38 symmisc.c --- symmisc.c 14 Feb 2005 14:37:38 -0000 1.38 +++ symmisc.c 30 May 2005 05:16:41 -0000 @@ -440,8 +440,8 @@ dump_psymtab (struct objfile *objfile, s } static void -dump_symtab (struct objfile *objfile, struct symtab *symtab, - struct ui_file *outfile) +dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, + struct ui_file *outfile) { int i; struct dict_iterator iter; @@ -533,6 +533,23 @@ dump_symtab (struct objfile *objfile, st } } +static void +dump_symtab (struct objfile *objfile, struct symtab *symtab, + struct ui_file *outfile) +{ + enum language saved_lang; + volatile struct gdb_exception except; + + /* Set the current language to the language of the symtab we're dumping + because certain routines used during dump_symtab() use the current + language to print an image of the symbol. We'll restore it later. */ + saved_lang = set_language (symtab->language); + + dump_symtab_1 (objfile, symtab, outfile); + + set_language (saved_lang); +} + void maintenance_print_symbols (char *args, int from_tty) { --bg08WKrSYDhXBjb5--