This is the mail archive of the gdb-prs@sources.redhat.com 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]

breakpoints/942: GDB problem: Incorrect use of attribute DW_AT_containing_type.


>Number:         942
>Category:       breakpoints
>Synopsis:       GDB problem: Incorrect use of attribute DW_AT_containing_type.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 16 23:18:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     sana@stl.sarov.ru
>Release:        unknown-1.0
>Organization:
>Environment:
32-bit Linux, Red Hat 8.0
>Description:
GCC (on RH8.0)emits attributes DW_AT_containing_type in some cases.
GDB (on RH8.0) makes use of attribute DW_AT_containing_type although gcc seemingly illegally emits the attribute.
Further, GDB does not work correctly with attached test if it is built Intel compiler because Intel compiler does not emit this attribute.

We see this in g++-compiled test.o:
<1><d5e>: Abbrev Number: 15 (DW_TAG_structure_type)
     DW_AT_sibling     : <df0>  
     DW_AT_name        : B      
     DW_AT_byte_size   : 12     
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 12     
     DW_AT_containing_type: <cc4>       

Dwarf3 draft (draft7) section 5.12 describes this attribute as being attached DW_TAG_ptr_to_member_type, and it does not describe its use with a structure DIE.

Furthermore, GDB seems to make use of this emission and this is not correct.

Probably GDB should be able to ignore this information and use other algorithms for calculation of inheritance.

Example of debug session with GDB on RH7.2 with executable file, which was built by Intel compiler:

This GDB was configured as "i386-redhat-linux"...
(gdb) b main
Breakpoint 1 at 0x8048b8b: file test.cpp, line 15.
(gdb) r
Starting program: /home1/sana/trackers/GDB/tr29321/a.out 

Breakpoint 1, main () at test.cpp:15
15        B pf;
(gdb) p pf
$1 = {<A> = <invalid address>, _vptr.B = void, b2 = 134518391}
(gdb)

Example of debug session with IDB on RH7.2:

Linux Application Debugger for 32-bit applications, Version 7.0 Beta, Build 20020715
------------------ 
object file name: a.out 
Reading symbolic information ...done
(idb) stop main
[#1: stop in int main(void) ]
(idb) r
[1] stopped at [int main(void):15 0x8048b8b]
     15   B pf;
(idb) p pf
class B {
  b2 = 134518391; 
  a1 = 0;                         // class A
}

Generation of debug information is the same on RH7.2 and RH8.0 for Intel compiler in this case.

Unfortunately IDB is not workable right now on RH8.0.

If executable file is built G++ on RH8.0 then GDB works correctly. But when I changed value of attribute DW_AT_containing type in executable file by binary editor(it became to point to other die), GDB behaviour changed. It looks like as proof that GDB uses value of this attribute in its algorithmes.

So emission of this attribute is incorrect then using of it by GDB is incorrect also.
>How-To-Repeat:
Regression test is attached or below:
class A {
public:
    int a1;
};
class c {
public:
    int c1;
};
class B : virtual public A {
public:
    int b2;
};
int main()
{
  B pf;
}

Intel compiler should be used.
Command line is 'icc -g test.cpp' on RH8.0!!!.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="test.cpp"
Content-Disposition: inline; filename="test.cpp"

class A {
public:
    int a1;
};
class c {
public:
    int c1;
};
class B : virtual public A {
public:
    int b2;
};
int main()
{
  B pf;
}


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