This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug debug/33155] _stdcall assembler names in win32 vs gdb



------- Comment #5 from dannysmith at users dot sourceforge dot net  2008-04-26 08:24 -------
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > (In reply to comment #1)
> > > > What is the status on this?  Does reverting the langhooks.c change remanifest
> > > > PR27067?
> > > > 
> > > No. PR27067 is fixed by 
> > > cp/mangle.c (mangle_decl): Call targetm.mangle_decl_assembler_name.
> > 
> > I see; then should the langhooks.c bit be reverted to fix this bug, or do you
> > think it will be able to be solved soon some other way?
> > 
> 
> I don't know how to solve it. I thought it might be a GDB bug concerning
> DW_AT_MIPS_linkage_name and an assumption by GDB  that "C" assembler names are
> not mangled, but I haven't had time to follow up.  But on windows, the external
> DECL_ASSEMBLER_NAME for stdcall symbols look mangled to me,  in C as well as
> C++,  and gcc/dwarf2out.c:add_name_and_src_coords_attributes() does the right
> thing.  
> 
> But ,as I said,  I haven't had time to study GDB.
> Danny
> 

Huh, it is quite easy to ensure the old gdb assumptions about GNU C
name mangling.
This fixes the PR testcase for me, with GNU gdb 6.5.50.20060706-cvs
(cygwin-special).  GCC "make check"  is in progress. 


        * dwarf2out.c (is c): New function.
        (add_name_and_src_coords_attributes): Don't add
         DW_AT_MIPS_linkage_name if is_c ().



Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 134429)
+++ dwarf2out.c (working copy)
@@ -5558,6 +5558,15 @@
   return a ? AT_file (a) : NULL;
 }

+/* Return TRUE if the language is C.  */
+static inline bool
+is_c (void)
+{
+  unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
+
+  return (lang == DW_LANG_C || lang == DW_LANG_C89  || lang == DW_LANG_C99);
+}
+
 /* Return TRUE if the language is C or C++.  */

 static inline bool
@@ -11558,7 +11567,7 @@
          && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
          && !DECL_ABSTRACT (decl)
          && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
-         && !is_fortran ())
+         && !is_fortran () && !is_c ())
        add_AT_string (die, DW_AT_MIPS_linkage_name,
                       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
     }


-- 

dannysmith at users dot sourceforge dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dannysmith at users dot
                   |                            |sourceforge dot net
         AssignedTo|unassigned at gcc dot gnu   |dannysmith at users dot
                   |dot org                     |sourceforge dot net
             Status|NEW                         |ASSIGNED
      Known to fail|                            |4.3.0
      Known to work|                            |4.2.1
   Last reconfirmed|2008-04-26 04:13:31         |2008-04-26 08:24:46
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33155


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