Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: gdb-patches@sourceware.org
Subject: [RFA] Fix printing frame arguments for COFF debug info
Date: Sat, 16 May 2009 16:51:00 -0000	[thread overview]
Message-ID: <83d4a9q9e5.fsf@gnu.org> (raw)

Currently, debugging DJGPP programs with COFF debug info fails to
print frame arguments:

  GNU gdb (GDB) 6.8.50.20090410
  Copyright (C) 2009 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "--host=i586-pc-msdosdjgpp --target=djgpp".
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>...
  (gdb) start
  Temporary breakpoint 1 at 0x1748: file tchset.c, line 6.
  Starting program: d:/usr/djgpp/gnu/gdb-68.410/gdb/./tchset45c.exe

  Temporary breakpoint 1, main (argc=<error reading variable>,
      argv=<error reading variable>) at tchset.c:6
  6         const char *cset = locale_charset ();
  (gdb) frame
  #0  main (argc=<error reading variable>, argv=<error reading variable>)
      at tchset.c:6
  6         const char *cset = locale_charset ();

GDB 6.1 does not have this problem, and neither does the current CVS
when DWARF-2 or stabs are used.

This started to happen because of this change:

  2008-05-06  Joel Brobecker  <brobecker@adacore.com>

	  * valprint.c (val_print): Add new language parameter and use it
	  instead of using the current_language. Update calls to val_print
	  throughout.
	  (common_val_print): Add new langauge parameter and pass it to
	  val_print.
	  * stack.c (print_frame_args): Update call to common_val_print
	  using the appropriate language.

After this change, print_frame_args uses the following logic to
compute the language with which to print frame arguments:

                  /* Use the appropriate language to display our symbol,
                     unless the user forced the language to a specific
                     language.  */
                  if (language_mode == language_mode_auto)
                    language = language_def (SYMBOL_LANGUAGE (sym));
                  else
                    language = current_language;

However, it does not check the value returned by language_def.  What
if that value is itself language_auto?  If that happens, val_print
will throw an error, because language_auto does not know how to print
values -- it's just a placeholder for some other, "real" language.

And it just so happens that coffread.c:process_coff_symbol does this:

  SYMBOL_LANGUAGE (sym) = language_auto;

The first step towards solving this is to fix coffread.c, as in the
patch I suggest below.  OK to commit it?

Even if this patch is accepted, I'm not sure that's all we need to do.
At least minsyms.c:prim_record_minimal_symbol_and_info also sets the
symbol's language to language_auto.  Should we make sure neither
common_val_print nor val_print ever get language_auto as the language?
That is, should we fall back to current_language in that case?

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

	* coffread.c (process_coff_symbol): Set the symbol's language to
	the language of current_subfile.

--- coffread.c~0	2009-01-03 09:57:51.000000000 +0200
+++ coffread.c	2009-05-16 19:24:27.843781500 +0300
@@ -1482,7 +1482,7 @@ process_coff_symbol (struct coff_symbol 
   memset (sym, 0, sizeof (struct symbol));
   name = cs->c_name;
   name = EXTERNAL_NAME (name, objfile->obfd);
-  SYMBOL_LANGUAGE (sym) = language_auto;
+  SYMBOL_LANGUAGE (sym) = current_subfile->language;
   SYMBOL_SET_NAMES (sym, name, strlen (name), objfile);
 
   /* default assumptions */


             reply	other threads:[~2009-05-16 16:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-16 16:51 Eli Zaretskii [this message]
2009-05-16 18:00 ` More problems with language in printing symbols Eli Zaretskii
2009-05-17 16:17   ` [RFA] " Eli Zaretskii
2009-05-20 23:07     ` Joel Brobecker
2009-05-23  9:26       ` Eli Zaretskii
2009-05-20 23:07 ` [RFA] Fix printing frame arguments for COFF debug info Joel Brobecker
2009-05-21  3:22   ` Eli Zaretskii
2009-05-21 17:05     ` Joel Brobecker
2009-05-23 10:37       ` Eli Zaretskii
2009-05-25  6:29         ` Joel Brobecker
2009-05-25 20:41           ` Eli Zaretskii
2009-05-25 22:55             ` Joel Brobecker
2009-05-29 12:07               ` Eli Zaretskii
2009-05-23  9:33   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d4a9q9e5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox