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]

[patch] Remove DMGL_VERBOSE


Hi,

this patch depends on:
	[patch] Follow DW_AT_linkage_name for methods #2
	http://sourceware.org/ml/gdb-patches/2011-06/msg00034.html

I do not think it matters too much whether DMGL_VERBOSE is in use or not.
Compiler supplies mangled names (where DMGL_VERBOSE does not apply) and GDB can
always do dwarf2_canonicalize_name/cp_comp_to_string to unify one form to the
other.

But it should be used always the same way inside GDB as GDB cannot do proper
symbols aliasing yet and if the DWARF and ELF names differ then extern DWARF
names cannot be resolved and ELF names do not provide type information.

physname is using dwarf2_canonicalize_name->...->cp_comp_to_string which does
not use DMGL_VERBOSE while symbol_find_demangled_name was using DMGL_VERBOSE
(since the physname patch), therefore there was some DMGL_VERBOSE discrepancy
between ELF<->DWARF linkage names.  This dwarf2_canonicalize_name should unify
any differences by the compiler, which BTW currently produces DMGL_VERBOSE-like
DW_AT_name for templates (but that does not matter much):
	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49130#c6

pre-physname GDB did not ever expose the DMGL_VERBOSE variant and to have a
single variant therefore proposing to drop DMGL_VERBOSE again and unify
everything on non-DMGL_VERBOSE names.  Also I think use should be exposed to
non-DMGL_VERBOSE names, that was their purpose.

After Keith's fix of GDB PR 12266 GDB should resolve mostly any form
(typedefed/untypedefed etc.) of the user entered function parameters.
Therefore I believe this testcase verification DMGL_VERBOSE name is
UNresolvable will no longer apply.  This testcase rather illustrates the
purpose of this patch.


Thanks,
Jan


gdb/
2011-06-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2read.c (dwarf2_physname): Remove DMGL_VERBOSE.
	* symtab.c (symbol_find_demangled_name): Likewise.

gdb/testsuite/
2011-06-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.cp/no-dmgl-verbose.cc: New file.
	* gdb.cp/no-dmgl-verbose.exp: New file.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5207,7 +5207,6 @@ dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu)
 	 */
 
       demangled = cplus_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI
-					    | DMGL_VERBOSE
 					    | (cu->language == language_java
 					       ? DMGL_JAVA | DMGL_RET_POSTFIX
 					       : DMGL_RET_DROP)));
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -500,7 +500,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
       || gsymbol->language == language_auto)
     {
       demangled =
-        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
+        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
       if (demangled != NULL)
 	{
 	  gsymbol->language = language_cplus;
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/no-dmgl-verbose.cc
@@ -0,0 +1,23 @@
+/* This test file is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <string>
+
+void
+f (std::string s)
+{
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp
@@ -0,0 +1,38 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+# Test loading symbols from unrelocated C++ object files.
+
+set testfile no-dmgl-verbose
+set srcfile ${testfile}.cc
+set executable ${testfile}.o
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [skip_cplus_tests] } { continue }
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {c++ debug}] != "" } {
+     untested ${testfile}.exp
+     return -1
+}
+
+clean_restart ${executable}
+
+gdb_test_no_output "set breakpoint pending off"
+
+gdb_breakpoint {'f(std::string)'}
+
+gdb_test {break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'} \
+	 {Function ".*" not defined\.} \
+	 "DMGL_VERBOSE-demangled f(std::string) is not defined"


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