From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2649 invoked by alias); 5 Oct 2015 18:13:01 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 2624 invoked by uid 48); 5 Oct 2015 18:13:01 -0000 From: "richard_sharman at mitel dot com" To: gdb-prs@sourceware.org Subject: [Bug c++/19068] gdb cannot handle operator= if both const access (as rhs) and non-const (lhs) methods defined Date: Mon, 05 Oct 2015 18:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.10 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: richard_sharman at mitel dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q4/txt/msg00013.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=19068 --- Comment #2 from Richard Sharman --- If a class is defined with a single operator[] method, then gdb can invoke this method with the normal x[i] syntax. If, however, there are separate const "rhs" and non-const "lhs" methods defined, then trying to print or assign using x[i] syntax produces the message "Could not find operator[].". See example t.c. When compiled as is (SEPARATE_SUB_METHODS defined) there are methods const T& operator[](const int index) const and T& operator[](const int index) { Running gdb shows: (gdb) b 53 Breakpoint 1 at 0x40076a: file t.cc, line 53. (gdb) r (gdb) p x $1 = {storage = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}} (gdb) p x[3] Could not find operator[]. (gdb) show version GNU gdb (GDB) 7.10 Copyright (C) 2015 Free Software Foundation, Inc. When SEPARATE_SUB_METHODS is undefined there is only one method T& operator[](const int index) { and gdb works fine with this: (gdb) b 53 Breakpoint 1 at 0x40076a: file t2.cc, line 53. (gdb) r Starting program: /localhome/sharman/tmp/c++test/t2 Breakpoint 1, main (NameError: Installation error: gdb.execute_unwinders function is missing argc=1, argv=0x7fffffffdbc8) at t2.cc:53 53 printf("%2d: %d\n", i, x[i]); (gdb) p x $1 = {storage = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}} (gdb) p x[3] NameError: Installation error: gdb.execute_unwinders function is missing $2 = (int &) @0x7fffffffdab8: 30 (gdb) set var x[3] = 33 (gdb) p x[3] $3 = (int &) @0x7fffffffdab8: 33 (gdb) p x $4 = {storage = {10, 20, 33, 40, 50, 60, 70, 80, 90, 100}} (gdb) -- You are receiving this mail because: You are on the CC list for the bug.