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

[Bug python/14077] New: Dynamic type of references cannot beaccessed


http://sourceware.org/bugzilla/show_bug.cgi?id=14077

             Bug #: 14077
           Summary: Dynamic type of references cannot be accessed
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: andre.poenitz@nokia.com
    Classification: Unclassified


echo "
struct A { virtual ~A() {} int a; };
struct B : A {};

int main()
{
    B b;
    A *b1 = &b;
    A &b2 = b;
    return b1->a + b2.a;
}
" | g++ -g -xc++ -

~/debugger/gdb-git-i586/gdb/gdb \
    -ex "set confirm off" \
    -ex "file ./a.out" \
    -ex "b 10" \
    -ex run \
    -ex "python print 'Pointer   static  type : %s' %
gdb.parse_and_eval('b1').type" \
    -ex "python print 'Pointer   dynamic type : %s' %
gdb.parse_and_eval('b1').dynamic_type" \
    -ex "python print 'Reference static  type : %s' %
gdb.parse_and_eval('b2').type" \
    -ex "python print 'Reference dynamic type : %s' %
gdb.parse_and_eval('b2').dynamic_type" 



yields:

    Pointer   static  type : A *
    Pointer   dynamic type : B *
    Reference static  type : A &
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    gdb.error: Attempt to take contents of a non-pointer value.
    Error while executing Python code.


It would be convenient to see   

    Reference dynamic type : B &

in the last line

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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