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]

c++/1617: does not use overloaded operator ->


>Number:         1617
>Category:       c++
>Synopsis:       does not use overloaded operator ->
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 21 16:28:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Bruce Merry
>Release:        gdb 6.1
>Organization:
>Environment:
Debian GNU/Linux 3.0 (woody)
gdb 6.1 installed from backports.org
gcc version 2.95.4 20011002 (Debian prerelease) OR
gcc version 3.4.0
>Description:
Where a class overloads operator ->, GDB will fail to use this overloaded operator when evaluating expressions. This particularly affects STL iterators, which overload -> so that they may act like pointers.

It is possible to achieve the same effect as obj->field with (*obj).field, but when using long chains of dereferences this becomes unwieldy: (*(*(*(*edge).next).dual).prev).id for example, as opposed to edge->next->dual->prev->id.
>How-To-Repeat:
Compile a C++ program that uses STL iterators to point at structs in a std::list. Compile with -g flag (adding -gdwarf-2 as suggested by gdb docs does not help). Set a breakpoint at a suitable place and attempt to dereference the iterator using ->. It will complain that the field that you are attempting to view does not exist in the class.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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