From: Eli Zaretskii <eliz@gnu.org>
To: gdb-patches@sourceware.org
Subject: Re: [RFA] More problems with language in printing symbols
Date: Sun, 17 May 2009 16:17:00 -0000 [thread overview]
Message-ID: <833ab3r9g2.fsf@gnu.org> (raw)
In-Reply-To: <83ab5dq67f.fsf@gnu.org>
> Date: Sat, 16 May 2009 20:59:48 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb-patches@sourceware.org
>
> The new dump_symtab does this:
>
> /* 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);
>
> However, it does not check what is the value of symtab->language. It
> so happens that coffread.c creates a symtab for a "_globals_"
> pseudo-file, whose symtab gets its language set to language_unknown,
> because deduce_language_from_filename does not recognize such a file
> name. And, of course, trying to print symbols with language_unknown
> as the current language does not give good results...
>
> I'm unsure how best to fix that. We could try recognizing "_globals_"
> in deduce_language_from_filename, but what language to use for it? Or
> we could add some defensive fallback in dump_symtab which would not
> switch the language if it is language_unknown.
>
> Comments? ideas?
Here's a patch that implements 2 ideas: it uses language_minimal for
the "_globals_" pseudo-file, and it makes dump_symtab be defensive
about the language of the symtab we are dumping.
OK to commit?
2009-05-17 Eli Zaretskii <eliz@gnu.org>
* symmisc.c (dump_symtab): Switch the current language to
the language of the symtab we are dumping only if the symtab's
language is neither language_auto nor language_unknown.
* coffread.c (coff_symtab_read): Set language_minimal as the
language for the "_globals_" pseudo-file.
--- coffread.c~1 2009-05-16 19:24:27.843781500 +0300
+++ coffread.c 2009-05-17 19:07:34.874125000 +0300
@@ -758,6 +758,11 @@ coff_symtab_read (long symtab_offset, un
coff_end_symtab (objfile);
coff_start_symtab ("_globals_");
+ /* coff_start_symtab will set the language of this symtab to
+ language_unknown, since such a ``file name'' is not
+ recognized. Override that with the minimal language to
+ allow printing values in this symtab. */
+ current_subfile->language = language_minimal;
complete_symtab ("_globals_", 0, 0);
/* done with all files, everything from here on out is globals */
}
--- symmisc.c~0 2009-01-03 09:57:53.000000000 +0200
+++ symmisc.c 2009-05-17 19:02:46.139750000 +0300
@@ -496,16 +496,23 @@ static void
dump_symtab (struct objfile *objfile, struct symtab *symtab,
struct ui_file *outfile)
{
- enum language saved_lang;
-
/* 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);
+ language to print an image of the symbol. We'll restore it later.
+ But use only real languages, not placeholders. */
+ if (symtab->language != language_unknown
+ && symtab->language != language_auto)
+ {
+ enum language saved_lang;
+
+ saved_lang = set_language (symtab->language);
- dump_symtab_1 (objfile, symtab, outfile);
+ dump_symtab_1 (objfile, symtab, outfile);
- set_language (saved_lang);
+ set_language (saved_lang);
+ }
+ else
+ dump_symtab_1 (objfile, symtab, outfile);
}
void
next prev parent reply other threads:[~2009-05-17 16:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-16 16:51 [RFA] Fix printing frame arguments for COFF debug info Eli Zaretskii
2009-05-16 18:00 ` More problems with language in printing symbols Eli Zaretskii
2009-05-17 16:17 ` Eli Zaretskii [this message]
2009-05-20 23:07 ` [RFA] " 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=833ab3r9g2.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