[patch] mangled names for addr2line -i

James E Wilson wilson@specifix.com
Tue Sep 20 20:22:00 GMT 2005


The new addr2line -i feature added by Fred Fish, which prints info about
inline function scopes, is not using the mangled names for inline C++
functions.

The solution is pretty easy.  The new function
find_abstract_instance_name needs to look at and use the
DW_AT_MIPS_linkage_name attributes.  The fix here is to copy the code
already used in scan_unit_for_symbols to set func->name.

Without this patch, using the original testcase from Fred's binutils PR
947, we get
_S_get_pool
mt_allocator.h:450
...

With this patch, and adding the -C option, I now get
__gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true>::_S_get_pool()
mt_allocator.h:450
...

Since this appears to be a safe and non-controversial patch, I
will self-approve this and check this in.  This was tested with
an ia64-linux make check.  There were no regressions.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-09-19  James E. Wilson  <wilson@specifix.com>

	* dwarf2.c (find_abstract_instance_name): Don't early exit when name
	set.  For DW_AT_name case, only set name if not already set.  Handle
	DW_AT_MIPS_linkage_name.

Index: dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.79
diff -p -p -r1.79 dwarf2.c
*** dwarf2.c	17 Aug 2005 14:28:00 -0000	1.79
--- dwarf2.c	20 Sep 2005 02:47:38 -0000
*************** find_abstract_instance_name (struct comp
*** 1568,1584 ****
  	}
        else
  	{
! 	  for (i = 0; i < abbrev->num_attrs && !name; ++i)
  	    {
  	      info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
  	      switch (attr.name)
  		{
  		case DW_AT_name:
! 		  name = attr.u.str;
  		  break;
  		case DW_AT_specification:
  		  name = find_abstract_instance_name (unit, attr.u.val);
  		  break;
  		default:
  		  break;
  		}
--- 1568,1589 ----
  	}
        else
  	{
! 	  for (i = 0; i < abbrev->num_attrs; ++i)
  	    {
  	      info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
  	      switch (attr.name)
  		{
  		case DW_AT_name:
! 		  /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name.  */
! 		  if (name == NULL)
! 		    name = attr.u.str;
  		  break;
  		case DW_AT_specification:
  		  name = find_abstract_instance_name (unit, attr.u.val);
  		  break;
+ 		case DW_AT_MIPS_linkage_name:
+ 		  name = attr.u.str;
+ 		  break;
  		default:
  		  break;
  		}


More information about the Binutils mailing list