From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [RFA 2/5] Use scoped_switch_auto_to_sym_language in symtab.c to switch language.
Date: Sun, 28 Oct 2018 14:46:00 -0000 [thread overview]
Message-ID: <20181028144614.14149-3-philippe.waroquiers@skynet.be> (raw)
In-Reply-To: <20181028144614.14149-1-philippe.waroquiers@skynet.be>
Use scoped_switch_auto_to_sym_language in treg_matches_sym_type_name to
replace the local logic that was doing the same as the new class
scoped_switch_auto_to_sym_language.
Use scoped_switch_auto_to_sym_language inside print_symbol_info, so
that symbol information is printed in the symbol language when
language mode is auto.
This modifies the behaviour of the test dw2-case-insensitive.exp,
as the function FUNC_lang is now printed with the Fortran syntax
(as declared in the .S file).
gdb/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* symtab.c (treg_matches_sym_type_name): Use
scoped_switch_auto_to_sym_language instead of local logic.
(print_symbol_info): Use scoped_switch_auto_to_sym_language
to switch to SYM language when language mode is auto.
gdb/testsuite/ChangeLOg
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.dwarf2/dw2-case-insensitive.exp: Update due to auto switch to
FUNC_lang language syntax.
---
gdb/symtab.c | 12 +++++-------
gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp | 4 +++-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index cd27a75e8c..0f9d562c84 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4288,15 +4288,12 @@ treg_matches_sym_type_name (const compiled_regex &treg,
if (sym_type == NULL)
return false;
- if (language_mode == language_mode_auto)
- {
- scoped_restore_current_language l;
+ {
+ scoped_switch_auto_to_sym_language l (sym);
- set_language (SYMBOL_LANGUAGE (sym));
- printed_sym_type_name = type_to_string (sym_type);
- }
- else
printed_sym_type_name = type_to_string (sym_type);
+ }
+
if (symbol_lookup_debug > 1)
{
@@ -4601,6 +4598,7 @@ print_symbol_info (enum search_domain kind,
struct symbol *sym,
int block, const char *last)
{
+ scoped_switch_auto_to_sym_language l (sym);
struct symtab *s = symbol_symtab (sym);
if (last != NULL)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
index b15dcafa00..2e3397865a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
@@ -42,8 +42,10 @@ gdb_test "info functions fUnC_lang" \
gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.}
# The dot-leading symbol is for ppc64 function descriptors.
+# Note that info functions gives the FUNC_lang result using the fortran syntax
+# as specific in dw-case-insensitive-debug.S DW_AT_language.
gdb_test "info functions fUnC_lang" \
- "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
+ "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
"regexp case-sensitive off"
gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ <FUNC_lang>}
--
2.19.1
next prev parent reply other threads:[~2018-10-28 14:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-28 14:46 [RFA 0/5] Use language mode in 'info [functions|variables|types]|rbreak' Philippe Waroquiers
2018-10-28 14:46 ` [RFA 3/5] Add a test to verify info [functions|variables|types]|rbreak respect language_mode Philippe Waroquiers
2018-11-16 18:30 ` Pedro Alves
2018-10-28 14:46 ` [RFA 4/5] Document language choice in 'info [functions|variables|types]|rbreak' commands Philippe Waroquiers
2018-10-28 15:33 ` Eli Zaretskii
2018-10-28 14:46 ` [RFA 1/5] Add class scoped_switch_auto_to_sym_language Philippe Waroquiers
2018-11-16 18:27 ` Pedro Alves
2018-10-28 14:46 ` [RFA 5/5] NEWS: Document the language choice by 'info [types|functions|variables]|rbreak' Philippe Waroquiers
2018-10-28 15:31 ` Eli Zaretskii
2018-10-28 14:46 ` Philippe Waroquiers [this message]
2018-11-16 18:28 ` [RFA 2/5] Use scoped_switch_auto_to_sym_language in symtab.c to switch language Pedro Alves
2018-11-17 12:24 ` Philippe Waroquiers
2018-11-13 19:15 ` PING Re: [RFA 0/5] Use language mode in 'info [functions|variables|types]|rbreak' Philippe Waroquiers
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=20181028144614.14149-3-philippe.waroquiers@skynet.be \
--to=philippe.waroquiers@skynet.be \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).