This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix printing frame arguments for COFF debug info


> Date: Thu, 21 May 2009 10:05:02 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> > > I see that this is addressed in one of your followup messages
> > 
> > Not really, no.  The followup messages deal with a different problem.
> > This issue, i.e. whether common_val_print and/or val_print should be
> > defensive about getting language_auto, still remains.  I'd like to
> > hear your opinion about that.
> 
> Ah yes, of course! We could add guards in the valprint routines,
> I supposed, but I'm not sure it's really worth the effort, now
> that we have fixed the cause.  The error is not crippling, so
> I personally wouldn't bother. But I wouldn't object either, especially
> if it's a small localized change (I think I'd make the change in
> val_print).

How about this:

2009-05-23  Eli Zaretskii  <eliz@gnu.org>

	* valprint.c (val_print): If LANGUAGE is "unknown" or "auto" or
	"local", fall back on current_language.


--- valprint.c~0	2009-03-21 07:03:53.000000000 +0200
+++ valprint.c	2009-05-23 13:33:14.062500000 +0300
@@ -257,6 +257,14 @@ val_print (struct type *type, const gdb_
       return (0);
     }
 
+  /* If the LANGUAGE argument we received is one of the placeholder
+     ``languages'', its la_val_print method will throw an error.  To
+     avoiding that, try falling back on current_language.  */
+  if ((language->la_language == language_unknown
+       || language->la_language == language_auto)
+      && language->la_language != current_language->la_language)
+    language = current_language;
+
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       ret = language->la_val_print (type, valaddr, embedded_offset, address,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]