Problems with breakpoints in constructors

Amit S. Kale amitkale@linsyssoft.com
Fri Aug 6 13:27:00 GMT 2004


Thanks for this valuable information.

I have removed my previous change and have done the following change:
--- dwarf2out.c.orig    2004-08-06 11:26:01.000000000 +0530
+++ dwarf2out.c 2004-08-06 11:28:54.000000000 +0530
@@ -10810,6 +10810,11 @@ gen_subprogram_die (tree decl, dw_die_re

       subr_die = new_die (DW_TAG_subprogram, context_die, decl);
       add_abstract_origin_attribute (subr_die, origin);
+      if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+       {
+         add_AT_string (subr_die, DW_AT_MIPS_linkage_name,
+                        IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+       }
     }
   else if (old_die)
     {

With this change I get the dump attached herewith. Could you please look at it 
and let me know if it appears all right?

gdb can't use the information generated by this code correctly. That's because 
the MIPS_linkage doesn't go in class type definition, which is used by gdb to 
search for members matching the breakpoint name. I am trying to see whether I 
can change it to reach MIPS_linkage. I'll post more information hopefully 
with some code on the gdb mailing list when I fully understand the problem.

-Amit

On Thursday 05 Aug 2004 9:07 pm, Daniel Jacobowitz wrote:
> On Thu, Aug 05, 2004 at 08:19:13PM +0530, Amit S. Kale wrote:
> > Here they. There are two files dump.txt with my changes and dump.orig.txt
> > without them.
> >
> > I read the abbreviations related stuff from dwarf document. Also looked
> > at the gcc code that  generates abbreviations. The gcc code looks
> > correct.
>
> Let's take a look at the debug info for your test case.  Beforehand, in
> the debug information for MyClass are two declarations - one for
> MyClass(void) and one for MyClass(MyClass&).  Then outside of the class
> is a DIE for MyClass(void), without PC bounds - this uses
> DW_AT_specification.  Then there are two which reference the previous
> DIE using DW_AT_abstract_origin and have PC bounds.  This all makes
> sense.  There is no DIE for the copy constructor, which makes sense
> because there is no declaration.
>
> Your change adds to the class's members two additional copies of the
> void constructor, with linkage names.  It also adds two copies of the
> copy constructor, with linkage names.  The debug information now claims
> that the class has six member constructors.  The four new members have
> no explicit reference to the previous two, from which they are derived.
> The concrete DIEs for the clones reference the same abstract DIE they
> did before your change, not the new DIEs you have added.  This is not
> an improvement.
>
> If anything, it might be useful to add the linkage name to the concrete
> dies for the clones.
>
> > Something is messed up in the dwarfdump utility output. I can't find
> > correct abbreviations tags in debug_info. The dump_info records for 2
> > instances of MyClass and 1 instance of afun contain
> > DW_AT_MIPS_linkage_name attribute. Both of them point to the same
> > abbreviation entry. Yet when I debugged gdb's read_partial_die function,
> > I found that the abbreviation entry for afun and MyClass is different.
> > The afun entry contains 7 attributes, including DW_AT_MIPS_linkage_name
> > and MyClass entry contains 6 attributes, without the MIPS entry.
> >
> > How do I verify whether what dwarfdump output shows is incorrect or
> > whether gdb's interpretation of the dwarf data is incorrect?
>
> I don't know anything about dwarfdump.  But the dumps you sent did not
> show this.  Dwarfdump doesn't even print the abbreviation number used
> by a particular DIE in its output.
-------------- next part --------------

.debug_info

COMPILE_UNIT<header overall offset = 0>:
<0><   11>	DW_TAG_compile_unit
		DW_AT_stmt_list             0
		DW_AT_high_pc               0x3f
		DW_AT_low_pc                0
		DW_AT_producer              GNU C++ 3.4.1
		DW_AT_language              DW_LANG_C_plus_plus
		DW_AT_name                  prog.C
		DW_AT_comp_dir              /home/amitkale/tmp

LOCAL_SYMBOLS:
<1><   65>	DW_TAG_structure_type
		DW_AT_sibling               <211>
		DW_AT_name                  MyClass
		DW_AT_byte_size             1
		DW_AT_decl_file             1 /home/amitkale/tmp/prog.C
		DW_AT_decl_line             2
<2><   77>	DW_TAG_subprogram
		DW_AT_sibling               <97>
		DW_AT_external              yes(1)
		DW_AT_name                  MyClass
		DW_AT_decl_file             1 /home/amitkale/tmp/prog.C
		DW_AT_decl_line             4
		DW_AT_declaration           yes(1)
<3><   90>	DW_TAG_formal_parameter
		DW_AT_type                  <211>
		DW_AT_artificial            yes(1)
<2><   97>	DW_TAG_subprogram
		DW_AT_sibling               <137>
		DW_AT_external              yes(1)
		DW_AT_name                  afun
		DW_AT_decl_file             1 /home/amitkale/tmp/prog.C
		DW_AT_decl_line             5
		DW_AT_MIPS_linkage_name     _ZN7MyClass4afunEv
		DW_AT_declaration           yes(1)
<3><  130>	DW_TAG_formal_parameter
		DW_AT_type                  <211>
		DW_AT_artificial            yes(1)
<2><  137>	DW_TAG_subprogram
		DW_AT_sibling               <190>
		DW_AT_external              yes(1)
		DW_AT_name                  operator=
		DW_AT_MIPS_linkage_name     _ZN7MyClassaSERKS_
		DW_AT_type                  <217>
		DW_AT_artificial            yes(1)
		DW_AT_declaration           yes(1)
<3><  178>	DW_TAG_formal_parameter
		DW_AT_type                  <211>
		DW_AT_artificial            yes(1)
<3><  184>	DW_TAG_formal_parameter
		DW_AT_type                  <223>
<2><  190>	DW_TAG_subprogram
		DW_AT_external              yes(1)
		DW_AT_name                  MyClass
		DW_AT_artificial            yes(1)
		DW_AT_declaration           yes(1)
<3><  198>	DW_TAG_formal_parameter
		DW_AT_type                  <211>
		DW_AT_artificial            yes(1)
<3><  204>	DW_TAG_formal_parameter
		DW_AT_type                  <223>
<1><  211>	DW_TAG_pointer_type
		DW_AT_byte_size             4
		DW_AT_type                  <65>
<1><  217>	DW_TAG_reference_type
		DW_AT_byte_size             4
		DW_AT_type                  <65>
<1><  223>	DW_TAG_reference_type
		DW_AT_byte_size             4
		DW_AT_type                  <229>
<1><  229>	DW_TAG_const_type
		DW_AT_type                  <65>
<1><  234>	DW_TAG_subprogram
		DW_AT_sibling               <290>
		DW_AT_external              yes(1)
		DW_AT_name                  main
		DW_AT_decl_file             1 /home/amitkale/tmp/prog.C
		DW_AT_decl_line             9
		DW_AT_type                  <290>
		DW_AT_low_pc                0
		DW_AT_high_pc               0x2e
		DW_AT_frame_base            DW_OP_reg5
<2><  261>	DW_TAG_lexical_block
		DW_AT_low_pc                0x1c
		DW_AT_high_pc               0x2c
<3><  270>	DW_TAG_variable
		DW_AT_name                  myClass
		DW_AT_decl_file             1 /home/amitkale/tmp/prog.C
		DW_AT_decl_line             10
		DW_AT_type                  <65>
		DW_AT_location              DW_OP_fbreg -1
<1><  290>	DW_TAG_base_type
		DW_AT_name                  int
		DW_AT_byte_size             4
		DW_AT_encoding              DW_ATE_signed
<1><  297>	DW_TAG_subprogram
		DW_AT_sibling               <320>
		DW_AT_specification         <77>
		DW_AT_decl_line             15
		DW_AT_inline                DW_INL_not_inlined
<2><  308>	DW_TAG_formal_parameter
		DW_AT_name                  this
		DW_AT_type                  <320>
		DW_AT_artificial            yes(1)
<1><  320>	DW_TAG_const_type
		DW_AT_type                  <211>
<1><  325>	DW_TAG_subprogram
		DW_AT_sibling               <369>
		DW_AT_abstract_origin       <297>
		DW_AT_MIPS_linkage_name     _ZN7MyClassC2Ev
		DW_AT_low_pc                0x2e
		DW_AT_high_pc               0x33
		DW_AT_frame_base            DW_OP_reg5
<2><  360>	DW_TAG_formal_parameter
		DW_AT_abstract_origin       <308>
		DW_AT_location              DW_OP_fbreg 8
<1><  369>	DW_TAG_subprogram
		DW_AT_sibling               <413>
		DW_AT_abstract_origin       <297>
		DW_AT_MIPS_linkage_name     _ZN7MyClassC1Ev
		DW_AT_low_pc                0x34
		DW_AT_high_pc               0x39
		DW_AT_frame_base            DW_OP_reg5
<2><  404>	DW_TAG_formal_parameter
		DW_AT_abstract_origin       <308>
		DW_AT_location              DW_OP_fbreg 8
<1><  413>	DW_TAG_subprogram
		DW_AT_specification         <97>
		DW_AT_decl_line             18
		DW_AT_low_pc                0x3a
		DW_AT_high_pc               0x3f
		DW_AT_frame_base            DW_OP_reg5
<2><  429>	DW_TAG_formal_parameter
		DW_AT_name                  this
		DW_AT_type                  <320>
		DW_AT_artificial            yes(1)
		DW_AT_location              DW_OP_fbreg 8

line number info
<source>	[row,column]	<pc>	//<new statement or basic block
/home/amitkale/tmp/prog.C:	[  9,-1]	0	// new statement
/home/amitkale/tmp/prog.C:	[ 10,-1]	0x1c	// new statement
/home/amitkale/tmp/prog.C:	[ 11,-1]	0x27	// new statement
/home/amitkale/tmp/prog.C:	[ 12,-1]	0x2c	// new statement
/home/amitkale/tmp/prog.C:	[ 15,-1]	0x2e	// new statement
/home/amitkale/tmp/prog.C:	[ 16,-1]	0x31	// new statement
/home/amitkale/tmp/prog.C:	[ 15,-1]	0x34	// new statement
/home/amitkale/tmp/prog.C:	[ 16,-1]	0x37	// new statement
/home/amitkale/tmp/prog.C:	[ 18,-1]	0x3a	// new statement
/home/amitkale/tmp/prog.C:	[ 19,-1]	0x3d	// new statement
/home/amitkale/tmp/prog.C:	[ 19,-1]	0x42	// new statement	// end of text sequence

.debug_pubnames
global main            die 234, cu-die 11, off-in-cu 234, cu 0
global MyClass::MyClass die 325, cu-die 11, off-in-cu 325, cu 0
global MyClass::MyClass die 369, cu-die 11, off-in-cu 369, cu 0
global MyClass::afun   die 413, cu-die 11, off-in-cu 413, cu 0

.debug_macinfo

.debug_loc format <o b e l> means section-offset begin-addr end-addr length-of-block-entry

.debug_abbrev
<   1><    0><code:  1> DW_TAG_compile_unit DW_children_yes
      <    3>	DW_AT_stmt_list             DW_FORM_data4
      <    5>	DW_AT_high_pc               DW_FORM_addr
      <    7>	DW_AT_low_pc                DW_FORM_addr
      <    9>	DW_AT_producer              DW_FORM_string
      <   11>	DW_AT_language              DW_FORM_data1
      <   13>	DW_AT_name                  DW_FORM_string
      <   15>	DW_AT_comp_dir              DW_FORM_string
<   2><   19><code:  2> DW_TAG_structure_typeDW_children_yes
      <   22>	DW_AT_sibling               DW_FORM_ref4
      <   24>	DW_AT_name                  DW_FORM_strp
      <   26>	DW_AT_byte_size             DW_FORM_data1
      <   28>	DW_AT_decl_file             DW_FORM_data1
      <   30>	DW_AT_decl_line             DW_FORM_data1
<   3><   34><code:  3> DW_TAG_subprogram   DW_children_yes
      <   37>	DW_AT_sibling               DW_FORM_ref4
      <   39>	DW_AT_external              DW_FORM_flag
      <   41>	DW_AT_name                  DW_FORM_strp
      <   43>	DW_AT_decl_file             DW_FORM_data1
      <   45>	DW_AT_decl_line             DW_FORM_data1
      <   47>	DW_AT_declaration           DW_FORM_flag
<   4><   51><code:  4> DW_TAG_formal_parameterDW_children_no
      <   54>	DW_AT_type                  DW_FORM_ref4
      <   56>	DW_AT_artificial            DW_FORM_flag
<   5><   60><code:  5> DW_TAG_subprogram   DW_children_yes
      <   63>	DW_AT_sibling               DW_FORM_ref4
      <   65>	DW_AT_external              DW_FORM_flag
      <   67>	DW_AT_name                  DW_FORM_string
      <   69>	DW_AT_decl_file             DW_FORM_data1
      <   71>	DW_AT_decl_line             DW_FORM_data1
      <   73>	DW_AT_MIPS_linkage_name     DW_FORM_string
      <   76>	DW_AT_declaration           DW_FORM_flag
<   6><   80><code:  6> DW_TAG_subprogram   DW_children_yes
      <   83>	DW_AT_sibling               DW_FORM_ref4
      <   85>	DW_AT_external              DW_FORM_flag
      <   87>	DW_AT_name                  DW_FORM_string
      <   89>	DW_AT_MIPS_linkage_name     DW_FORM_string
      <   92>	DW_AT_type                  DW_FORM_ref4
      <   94>	DW_AT_artificial            DW_FORM_flag
      <   96>	DW_AT_declaration           DW_FORM_flag
<   7><  100><code:  7> DW_TAG_formal_parameterDW_children_no
      <  103>	DW_AT_type                  DW_FORM_ref4
<   8><  107><code:  8> DW_TAG_subprogram   DW_children_yes
      <  110>	DW_AT_external              DW_FORM_flag
      <  112>	DW_AT_name                  DW_FORM_strp
      <  114>	DW_AT_artificial            DW_FORM_flag
      <  116>	DW_AT_declaration           DW_FORM_flag
<   9><  120><code:  9> DW_TAG_pointer_type DW_children_no
      <  123>	DW_AT_byte_size             DW_FORM_data1
      <  125>	DW_AT_type                  DW_FORM_ref4
<  10><  129><code: 10> DW_TAG_reference_typeDW_children_no
      <  132>	DW_AT_byte_size             DW_FORM_data1
      <  134>	DW_AT_type                  DW_FORM_ref4
<  11><  138><code: 11> DW_TAG_const_type   DW_children_no
      <  141>	DW_AT_type                  DW_FORM_ref4
<  12><  145><code: 12> DW_TAG_subprogram   DW_children_yes
      <  148>	DW_AT_sibling               DW_FORM_ref4
      <  150>	DW_AT_external              DW_FORM_flag
      <  152>	DW_AT_name                  DW_FORM_string
      <  154>	DW_AT_decl_file             DW_FORM_data1
      <  156>	DW_AT_decl_line             DW_FORM_data1
      <  158>	DW_AT_type                  DW_FORM_ref4
      <  160>	DW_AT_low_pc                DW_FORM_addr
      <  162>	DW_AT_high_pc               DW_FORM_addr
      <  164>	DW_AT_frame_base            DW_FORM_block1
<  13><  168><code: 13> DW_TAG_lexical_blockDW_children_yes
      <  171>	DW_AT_low_pc                DW_FORM_addr
      <  173>	DW_AT_high_pc               DW_FORM_addr
<  14><  177><code: 14> DW_TAG_variable     DW_children_no
      <  180>	DW_AT_name                  DW_FORM_string
      <  182>	DW_AT_decl_file             DW_FORM_data1
      <  184>	DW_AT_decl_line             DW_FORM_data1
      <  186>	DW_AT_type                  DW_FORM_ref4
      <  188>	DW_AT_location              DW_FORM_block1
<  15><  192><code: 15> DW_TAG_base_type    DW_children_no
      <  195>	DW_AT_name                  DW_FORM_string
      <  197>	DW_AT_byte_size             DW_FORM_data1
      <  199>	DW_AT_encoding              DW_FORM_data1
<  16><  203><code: 16> DW_TAG_subprogram   DW_children_yes
      <  206>	DW_AT_sibling               DW_FORM_ref4
      <  208>	DW_AT_specification         DW_FORM_ref4
      <  210>	DW_AT_decl_line             DW_FORM_data1
      <  212>	DW_AT_inline                DW_FORM_data1
<  17><  216><code: 17> DW_TAG_formal_parameterDW_children_no
      <  219>	DW_AT_name                  DW_FORM_string
      <  221>	DW_AT_type                  DW_FORM_ref4
      <  223>	DW_AT_artificial            DW_FORM_flag
<  18><  227><code: 18> DW_TAG_subprogram   DW_children_yes
      <  230>	DW_AT_sibling               DW_FORM_ref4
      <  232>	DW_AT_abstract_origin       DW_FORM_ref4
      <  234>	DW_AT_MIPS_linkage_name     DW_FORM_string
      <  237>	DW_AT_low_pc                DW_FORM_addr
      <  239>	DW_AT_high_pc               DW_FORM_addr
      <  241>	DW_AT_frame_base            DW_FORM_block1
<  19><  245><code: 19> DW_TAG_formal_parameterDW_children_no
      <  248>	DW_AT_abstract_origin       DW_FORM_ref4
      <  250>	DW_AT_location              DW_FORM_block1
<  20><  254><code: 20> DW_TAG_subprogram   DW_children_yes
      <  257>	DW_AT_specification         DW_FORM_ref4
      <  259>	DW_AT_decl_line             DW_FORM_data1
      <  261>	DW_AT_low_pc                DW_FORM_addr
      <  263>	DW_AT_high_pc               DW_FORM_addr
      <  265>	DW_AT_frame_base            DW_FORM_block1
<  21><  269><code: 21> DW_TAG_formal_parameterDW_children_no
      <  272>	DW_AT_name                  DW_FORM_string
      <  274>	DW_AT_type                  DW_FORM_ref4
      <  276>	DW_AT_artificial            DW_FORM_flag
      <  278>	DW_AT_location              DW_FORM_block1
<  22><  282><code:  0> null .debug_abbrev entry

.debug_string
name at offset 0, length 7 is MyClass

.debug_aranges

arange starts at 0, length of 63, cu_die_offset = 11

COMPILE_UNIT<header overall offset = 0>:
<0><   11>	DW_TAG_compile_unit
		DW_AT_stmt_list             0
		DW_AT_high_pc               0x3f
		DW_AT_low_pc                0
		DW_AT_producer              GNU C++ 3.4.1
		DW_AT_language              DW_LANG_C_plus_plus
		DW_AT_name                  prog.C
		DW_AT_comp_dir              /home/amitkale/tmp

.debug_frame

fde:
<  0><0:0x2e><main><fde offset 0x14 length: 0x14><eh offset none>
    00000000:	cfa=04(r4/a0) r8/t0=-4(cfa) 
    00000001:	cfa=08(r4/a0) r5/a1=-8(cfa) r8/t0=-4(cfa) 
    00000003:	cfa=r5/a1 r5/a1=-8(cfa) r8/t0=-4(cfa) 
<  0><0x2e:0x33><><fde offset 0x2c length: 0x14><eh offset none>
    0000002e:	cfa=04(r4/a0) r8/t0=-4(cfa) 
    0000002f:	cfa=08(r4/a0) r5/a1=-8(cfa) r8/t0=-4(cfa) 
    00000031:	cfa=r5/a1 r5/a1=-8(cfa) r8/t0=-4(cfa) 
<  0><0x34:0x39><><fde offset 0x44 length: 0x14><eh offset none>
    00000034:	cfa=04(r4/a0) r8/t0=-4(cfa) 
    00000035:	cfa=08(r4/a0) r5/a1=-8(cfa) r8/t0=-4(cfa) 
    00000037:	cfa=r5/a1 r5/a1=-8(cfa) r8/t0=-4(cfa) 
<  0><0x3a:0x3f><><fde offset 0x5c length: 0x14><eh offset none>
    0000003a:	cfa=04(r4/a0) r8/t0=-4(cfa) 
    0000003b:	cfa=08(r4/a0) r5/a1=-8(cfa) r8/t0=-4(cfa) 
    0000003d:	cfa=r5/a1 r5/a1=-8(cfa) r8/t0=-4(cfa) 

.eh_frame

fde:
<  0><0:0x2e><main><fde offset 0xac length: 0x18><eh offset none>
    00000000:	cfa=04(r4/a0) r8/t0=-4(cfa) 
    00000001:	cfa=08(r4/a0) r5/a1=-8(cfa) r8/t0=-4(cfa) 
    00000003:	cfa=r5/a1 r5/a1=-8(cfa) r8/t0=-4(cfa) 

.debug_static_func

.debug_static_vars

.debug_types

.debug_weaknames

.rel.debug_info:
    6	<  5>                                   R_MIPS_16
   12	<  7>                                   R_MIPS_16
   16	<  2>                                   R_MIPS_16
   20	<  2>                                   R_MIPS_16
   70	< 12>                                   R_MIPS_16
   83	< 12>                                   R_MIPS_16
  192	< 12>                                   R_MIPS_16
  251	<  2>                                   R_MIPS_16
  255	<  2>                                   R_MIPS_16
  262	<  2>                                   R_MIPS_16
  266	<  2>                                   R_MIPS_16
  350	<  2>                                   R_MIPS_16
  354	<  2>                                   R_MIPS_16
  394	<  2>                                   R_MIPS_16
  398	<  2>                                   R_MIPS_16
  419	<  2>                                   R_MIPS_16
  423	<  2>                                   R_MIPS_16

.rel.debug_line:
   39	<  2>                                   R_MIPS_16

.rel.debug_aranges:
    6	<  6>                                   R_MIPS_16
   16	<  2>                                   R_MIPS_16

.rel.debug_frame:
   24	<  8>                                   R_MIPS_16
   28	<  2>                                   R_MIPS_16
   48	<  8>                                   R_MIPS_16
   52	<  2>                                   R_MIPS_16
   72	<  8>                                   R_MIPS_16
   76	<  2>                                   R_MIPS_16
   96	<  8>                                   R_MIPS_16
  100	<  2>                                   R_MIPS_16


More information about the Gcc mailing list