Use scoped_switch_to_sym_language_if_auto in symtab.c to switch language.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 28 Oct 2018 12:57:51 +0000 (13:57 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 20 Nov 2018 21:41:08 +0000 (22:41 +0100)
Use scoped_switch_to_sym_language_if_auto in treg_matches_sym_type_name to
replace the local logic that was doing the same as the new class
scoped_switch_to_sym_language_if_auto.

Use scoped_switch_to_sym_language_if_auto 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-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* symtab.c (treg_matches_sym_type_name): Use
scoped_switch_to_sym_language_if_auto instead of local logic.
(print_symbol_info): Use scoped_switch_to_sym_language_if_auto
to switch to SYM language when language mode is auto.

gdb/testsuite/ChangeLog
2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.dwarf2/dw2-case-insensitive.exp: Update due to auto switch to
FUNC_lang language syntax.

gdb/ChangeLog
gdb/symtab.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp

index 413c61243c469ff3feed2cf9002187413c10b9c3..e82799a7d2929aa0e8366512d79be040540ca777 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * symtab.c (treg_matches_sym_type_name): Use
+       scoped_switch_to_sym_language_if_auto instead of local logic.
+       (print_symbol_info): Use scoped_switch_to_sym_language_if_auto
+       to switch to SYM language when language mode is auto.
+
 2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * language.h (scoped_switch_to_sym_language_if_auto): New class.
index 7a77bcfb1833958dad24bdabf7b8adec1037a006..f8c755fdab295a358f65f981e8cd45c9275a7644 100644 (file)
@@ -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_to_sym_language_if_auto 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)
     {
@@ -4600,6 +4597,7 @@ print_symbol_info (enum search_domain kind,
                   struct symbol *sym,
                   int block, const char *last)
 {
+  scoped_switch_to_sym_language_if_auto l (sym);
   struct symtab *s = symbol_symtab (sym);
 
   if (last != NULL)
index 5b2172543a8a9674a714f5dc6c9a011760eda5cf..b532ed27eb964a049384f46285e8753a6557b7e4 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * gdb.dwarf2/dw2-case-insensitive.exp: Update due to auto switch to
+       FUNC_lang language syntax.
+
 2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * gdb.base/info_minsym.c: New file.
index b15dcafa005e930f96ced3e58ba0cf287fb10c46..328facd64eab78928c6a4411c0c5f93e7c8df422 100644 (file)
@@ -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 specified 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>}
This page took 0.044899 seconds and 4 git commands to generate.