* [ob] Adjust member pointer test for g++ 3.3
@ 2007-01-12 20:17 Daniel Jacobowitz
2007-01-12 21:50 ` Mark Kettenis
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2007-01-12 20:17 UTC (permalink / raw)
To: gdb-patches
Mark noticed that this test failed on G++ 3.3 because it warns that
all of Padding's member functions are private. Easily avoided.
I imagine g++ 4.x moved or removed this warning intentionally; not
so useful here...
--
Daniel Jacobowitz
CodeSourcery
2007-01-12 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.cp/member-ptr.cc (class Padding): Make contents public.
Index: member-ptr.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/member-ptr.cc,v
retrieving revision 1.5
diff -u -p -r1.5 member-ptr.cc
--- member-ptr.cc 9 Jan 2007 17:59:12 -0000 1.5
+++ member-ptr.cc 12 Jan 2007 20:14:34 -0000
@@ -86,6 +86,7 @@ typedef int A::*PMI;
added twice - otherwise it would be 2 * 0 == 0. */
class Padding
{
+public:
int spacer;
virtual int vspacer();
};
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-12 20:17 [ob] Adjust member pointer test for g++ 3.3 Daniel Jacobowitz @ 2007-01-12 21:50 ` Mark Kettenis 2007-01-12 23:08 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Mark Kettenis @ 2007-01-12 21:50 UTC (permalink / raw) To: drow; +Cc: gdb-patches > Date: Fri, 12 Jan 2007 15:17:06 -0500 > From: Daniel Jacobowitz <drow@false.org> > > Mark noticed that this test failed on G++ 3.3 because it warns that > all of Padding's member functions are private. Easily avoided. > I imagine g++ 4.x moved or removed this warning intentionally; not > so useful here... Thanks Daniel, The test now runs for me, but I get quite a few errors. Here's the resulting bit from gdb.log. Can you spot what's going wromg here? Should we XFAIL this test for GCC 3.3? Running ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.exp ... get_compiler_info: gcc-3-3-5 Executing on host: g++ ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.cc -L/home/kettenis/obj/gdb/libiberty -g -lm -o /home/kettenis/obj/gdb/gdb/testsuite/gdb.cp/member-ptr (timeout = 300) GNU gdb 6.6.50.20070112-cvs Copyright (C) 2007 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-openbsd4.0". (gdb) set height 0 (gdb) set width 0 (gdb) dir Reinitialize source path to empty? (y or n) y Source directories searched: $cdir:$cwd (gdb) dir ../../../../src/gdb/gdb/testsuite/gdb.cp Source directories searched: /home/kettenis/obj/gdb/gdb/testsuite/../../../../src/gdb/gdb/testsuite/gdb.cp:$cdir:$cwd (gdb) kill The program is not being run. (gdb) file /home/kettenis/obj/gdb/gdb/testsuite/gdb.cp/member-ptr Reading symbols from /home/kettenis/obj/gdb/gdb/testsuite/gdb.cp/member-ptr...done. (gdb) delete breakpoints (gdb) info breakpoints No breakpoints or watchpoints. (gdb) break main Breakpoint 1 at 0x1c000c05: file ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.cc, line 150. (gdb) run Starting program: /home/kettenis/obj/gdb/gdb/testsuite/gdb.cp/member-ptr Breakpoint 1, main () at ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.cc:150 150 A a; (gdb) break 199 Breakpoint 2 at 0x1c000cee: file ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.cc, line 199. (gdb) continue Continuing. Breakpoint 2, main () at ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.cc:199 199 pmi = NULL; /* Breakpoint 1 here. */ (gdb) PASS: gdb.cp/member-ptr.exp: continue to breakpoint: continue to pmi = NULL ptype pmi type = int A::** (gdb) FAIL: gdb.cp/member-ptr.exp: ptype pmi (A::j) print pmi $1 = (PMI) 0x8 (gdb) FAIL: gdb.cp/member-ptr.exp: print pmi (A::j) print a.*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a.*pmi (A::j) print a_p->*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a_p->*pmi (A::j) set var pmi = &A::jj (gdb) PASS: gdb.cp/member-ptr.exp: set var pmi = &A::jj print pmi $2 = (PMI) 0xc (gdb) FAIL: gdb.cp/member-ptr.exp: print pmi (A::jj) print a.*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a.*pmi (A::jj) set var pmi = &A::j (gdb) PASS: gdb.cp/member-ptr.exp: set var pmi = &A::j print a.*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a.*pmi (A::j) (again) print a.*pmi = 33 non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a.*pmi = 33 print a.*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a.*pmi (A::j) (33) print a $3 = {_vptr$A = 0x3c000098, c = 120 'x', j = 121, jj = 1331, static s = 10} (gdb) KFAIL: gdb.cp/member-ptr.exp: print a (j = 33) (PRMS: gdb/NNNN) print a_p->*pmi = 44 non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a_p->*pmi = 44 print a_p->*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print a_p->*pmi (44) print a $4 = {_vptr$A = 0x3c000098, c = 120 'x', j = 121, jj = 1331, static s = 10} (gdb) KFAIL: gdb.cp/member-ptr.exp: print a (j = 44) (PRMS: gdb/NNNN) ptype a.*pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: ptype a.*pmi print *pmi Cannot access memory at address 0x8 (gdb) KFAIL: gdb.cp/member-ptr.exp: print *pmi (PRMS: gdb/NNNN) ptype *pmi type = int A::* (gdb) FAIL: gdb.cp/member-ptr.exp: ptype *pmi print (int) pmi $5 = 8 (gdb) PASS: gdb.cp/member-ptr.exp: print (int) pmi print ((int) pmi) == ((char *) &a.j - (char *) & a) $6 = true (gdb) PASS: gdb.cp/member-ptr.exp: print ((int) pmi) == ((char *) &a.j - (char *) &a) ptype pmf type = int (A::*)(A *, int) (gdb) PASS: gdb.cp/member-ptr.exp: ptype pmf print pmf $7 = 0x1c000af6 <A::bar(int)> (gdb) PASS: gdb.cp/member-ptr.exp: print pmf ptype pmf_p type = int (A::**)(A *, int) (gdb) PASS: gdb.cp/member-ptr.exp: ptype pmf_p print pmf_p $8 = (PMF *) 0xcf7cf2c0 (gdb) PASS: gdb.cp/member-ptr.exp: gdb/NNNN print a.*pmf $9 = {int (A *, int)} 0x1c000af6 <A::bar(int)> (gdb) PASS: gdb.cp/member-ptr.exp: print a.*pmf print a_p->*pmf $10 = {int (A *, int)} 0x1c000af6 <A::bar(int)> (gdb) PASS: gdb.cp/member-ptr.exp: print a_p->*pmf set var pmf = &A::foo (gdb) PASS: gdb.cp/member-ptr.exp: set var pmf = &A::foo print *pmf Attempt to dereference pointer to member without an object (gdb) PASS: gdb.cp/member-ptr.exp: print *pmf ptype *pmf Attempt to dereference pointer to member without an object (gdb) PASS: gdb.cp/member-ptr.exp: ptype *pmf print (a.*pmf)(3) $11 = 127 (gdb) FAIL: gdb.cp/member-ptr.exp: print (a.*pmf)(3) print diamond_pmi $12 = (int Diamond::**) 0xc (gdb) FAIL: gdb.cp/member-ptr.exp: print diamond_pmi print diamond.*diamond_pmi non-pointer-to-member value used in pointer-to-member construct (gdb) FAIL: gdb.cp/member-ptr.exp: print diamond.*diamond_pmi print diamond.*left_pmf $13 = {int (Diamond *)} 0x1c000b9c <Base::get_x()> (gdb) PASS: gdb.cp/member-ptr.exp: print diamond.*left_pmf print diamond.*right_pmf $14 = {int (Diamond *)} 0x1c000b9c <Base::get_x()> (gdb) PASS: gdb.cp/member-ptr.exp: print diamond.*right_pmf print (diamond.*left_pmf) () $15 = 77 (gdb) PASS: gdb.cp/member-ptr.exp: print (diamond.*left_pmf) () print (diamond.*right_pmf) () $16 = 88 (gdb) PASS: gdb.cp/member-ptr.exp: print (diamond.*right_pmf) () print diamond.*left_vpmf $17 = {int (Diamond *)} 0x1c000bb8 <Left::vget()> (gdb) PASS: gdb.cp/member-ptr.exp: print diamond.*left_vpmf print diamond.*right_vpmf $18 = {int (Diamond *)} 0x1c000bc6 <Right::vget()> (gdb) PASS: gdb.cp/member-ptr.exp: print diamond.*right_vpmf print (diamond.*left_vpmf) () $19 = 177 (gdb) PASS: gdb.cp/member-ptr.exp: print (diamond.*left_vpmf) () print (diamond.*left_base_vpmf) () $20 = 2077 (gdb) PASS: gdb.cp/member-ptr.exp: print (diamond.*left_base_vpmf) () print (diamond.*right_vpmf) () $21 = 288 (gdb) PASS: gdb.cp/member-ptr.exp: print (diamond.*right_vpmf) () print left_vpmf $22 = &virtual Left::vget() (gdb) PASS: gdb.cp/member-ptr.exp: print left_vpmf print right_vpmf $23 = &virtual Right::vget() (gdb) PASS: gdb.cp/member-ptr.exp: print right_vpmf print base_vpmf $24 = &virtual table offset 4, this adjustment -8 (gdb) PASS: gdb.cp/member-ptr.exp: print base_vpmf print diamond.*left_vpmf () Invalid data type for function to be called. (gdb) PASS: gdb.cp/member-ptr.exp: print diamond.*left_vpmf () print null_pmi $25 = (PMI) 0xffffffff (gdb) FAIL: gdb.cp/member-ptr.exp: print null_pmi print null_pmi = &A::j $26 = (int A::**) 0x8 (gdb) FAIL: gdb.cp/member-ptr.exp: print null_pmi = &A::j print null_pmi = 0 $27 = (int A::**) 0x0 (gdb) FAIL: gdb.cp/member-ptr.exp: print null_pmi = 0 print null_pmf $28 = NULL (gdb) PASS: gdb.cp/member-ptr.exp: print null_pmf print null_pmf = &A::foo $29 = 0x1c000ad8 <A::foo(int)> (gdb) PASS: gdb.cp/member-ptr.exp: print null_pmf = &A::foo print null_pmf = 0 $30 = NULL (gdb) PASS: gdb.cp/member-ptr.exp: print null_pmf = 0 testcase ../../../../src/gdb/gdb/testsuite/gdb.cp/member-ptr.exp completed in 2 seconds ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-12 21:50 ` Mark Kettenis @ 2007-01-12 23:08 ` Daniel Jacobowitz 2007-01-28 15:40 ` Mark Kettenis 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2007-01-12 23:08 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Fri, Jan 12, 2007 at 10:50:27PM +0100, Mark Kettenis wrote: > The test now runs for me, but I get quite a few errors. Here's the > resulting bit from gdb.log. Can you spot what's going wromg here? > Should we XFAIL this test for GCC 3.3? That depends how we got to some of these bogus conclusions. I filed a GCC bug for the lousy debug info it emits for member pointers; until that's fixed, though, I added a workaround in dwarf2read.c. If there's an easy way to extend that to match this too, then it may be helpful to do so. Do OpenBSD 3.x toolchains use dwarf2? Or is this out in stabs land? > ptype pmi > type = int A::** > (gdb) FAIL: gdb.cp/member-ptr.exp: ptype pmi (A::j) It should be "int A::*". Somehow we think we have a pointer to a member pointer, instead of just a member pointer. That explains most of the cascading failures for pmi. > print a.*pmf > $9 = {int (A *, int)} 0x1c000af6 <A::bar(int)> > (gdb) PASS: gdb.cp/member-ptr.exp: print a.*pmf We get this right... > print (a.*pmf)(3) > $11 = 127 > (gdb) FAIL: gdb.cp/member-ptr.exp: print (a.*pmf)(3) So I'm pretty surprised that we get this wrong. We've somehow called the wrong function, or called it with a bogus argument / "this" pointer. All the failures except for this one are caused by the strange type of pointers to data members. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-12 23:08 ` Daniel Jacobowitz @ 2007-01-28 15:40 ` Mark Kettenis 2007-01-28 17:11 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Mark Kettenis @ 2007-01-28 15:40 UTC (permalink / raw) To: drow; +Cc: gdb-patches > Date: Fri, 12 Jan 2007 18:08:03 -0500 > From: Daniel Jacobowitz <drow@false.org> > > On Fri, Jan 12, 2007 at 10:50:27PM +0100, Mark Kettenis wrote: > > The test now runs for me, but I get quite a few errors. Here's the > > resulting bit from gdb.log. Can you spot what's going wromg here? > > Should we XFAIL this test for GCC 3.3? > > That depends how we got to some of these bogus conclusions. I filed > a GCC bug for the lousy debug info it emits for member pointers; until > that's fixed, though, I added a workaround in dwarf2read.c. If there's > an easy way to extend that to match this too, then it may be helpful to > do so. > > Do OpenBSD 3.x toolchains use dwarf2? Or is this out in stabs land? We're using dwarf2 for a while now. > > ptype pmi > > type = int A::** > > (gdb) FAIL: gdb.cp/member-ptr.exp: ptype pmi (A::j) > > It should be "int A::*". Somehow we think we have a pointer to a > member pointer, instead of just a member pointer. That explains most > of the cascading failures for pmi. Here's the relevant readelf -a output: <1><11f>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : int DW_AT_byte_size : 4 DW_AT_encoding : 5 (signed) ... <1><177b>: Abbrev Number: 2 (DW_TAG_typedef) DW_AT_name : PMI DW_AT_decl_file : 1 DW_AT_decl_line : 82 DW_AT_type : <1786> <1><1786>: Abbrev Number: 20 (DW_TAG_pointer_type) DW_AT_byte_size : 8 DW_AT_type : <178c> <1><178c>: Abbrev Number: 47 (DW_TAG_ptr_to_member_type) DW_AT_containing_type: <14a7> DW_AT_type : <11f> So it looks like GCC 3.3.5 is emitting bogus debug info. Do you see a possibility to deal with that? > > print a.*pmf > > $9 = {int (A *, int)} 0x1c000af6 <A::bar(int)> > > (gdb) PASS: gdb.cp/member-ptr.exp: print a.*pmf > > We get this right... > > > print (a.*pmf)(3) > > $11 = 127 > > (gdb) FAIL: gdb.cp/member-ptr.exp: print (a.*pmf)(3) > > So I'm pretty surprised that we get this wrong. We've somehow called > the wrong function, or called it with a bogus argument / "this" pointer. Isn't it just another cascading error because initializing members through data member pointers fails? Mark P.S. You still need to submit some bug reports for the gdb/NNN's. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-28 15:40 ` Mark Kettenis @ 2007-01-28 17:11 ` Daniel Jacobowitz 2007-01-28 17:50 ` Mark Kettenis 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2007-01-28 17:11 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Sun, Jan 28, 2007 at 04:39:59PM +0100, Mark Kettenis wrote: > Here's the relevant readelf -a output: > > <1><11f>: Abbrev Number: 3 (DW_TAG_base_type) > DW_AT_name : int > DW_AT_byte_size : 4 > DW_AT_encoding : 5 (signed) > ... > <1><177b>: Abbrev Number: 2 (DW_TAG_typedef) > DW_AT_name : PMI > DW_AT_decl_file : 1 > DW_AT_decl_line : 82 > DW_AT_type : <1786> > <1><1786>: Abbrev Number: 20 (DW_TAG_pointer_type) > DW_AT_byte_size : 8 > DW_AT_type : <178c> > <1><178c>: Abbrev Number: 47 (DW_TAG_ptr_to_member_type) > DW_AT_containing_type: <14a7> > DW_AT_type : <11f> > > So it looks like GCC 3.3.5 is emitting bogus debug info. Do you see a > possibility to deal with that? Hmm... how much of a hack do you think it's worth? :-) It's definitely possible. The problem is that this is a perfectly legitimate piece of debug output, describing "int A::**" instead of "int A::*". We could recognize this problem based on string matching the DW_AT_producer; I have added precedents for that before. I don't see any other way of doing it. > Isn't it just another cascading error because initializing members > through data member pointers fails? Oh, you're probably right. > P.S. You still need to submit some bug reports for the gdb/NNN's. Rather delete most of them, at this point - I didn't add them in this round of changes. Michael Chastain did several years ago, when none of these tests worked with GCC. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-28 17:11 ` Daniel Jacobowitz @ 2007-01-28 17:50 ` Mark Kettenis 2007-01-28 17:52 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Mark Kettenis @ 2007-01-28 17:50 UTC (permalink / raw) To: drow; +Cc: mark.kettenis, gdb-patches > Date: Sun, 28 Jan 2007 12:11:34 -0500 > From: Daniel Jacobowitz <drow@false.org> > Cc: gdb-patches@sourceware.org > Mail-Followup-To: Mark Kettenis <mark.kettenis@xs4all.nl>, > gdb-patches@sourceware.org > Content-Disposition: inline > X-XS4ALL-DNSBL-Checked: mxdrop24.xs4all.nl checked 66.93.172.17 against DNS blacklists > X-Virus-Scanned: by XS4ALL Virus Scanner > X-XS4ALL-Spam-Score: 0.0 () DK_POLICY_SIGNSOME > X-XS4ALL-Spam: NO > Envelope-To: mark.kettenis@xs4all.nl > X-UIDL: 1170004298._smtp.mxdrop24.68367,S=3014 > > On Sun, Jan 28, 2007 at 04:39:59PM +0100, Mark Kettenis wrote: > > Here's the relevant readelf -a output: > > > > <1><11f>: Abbrev Number: 3 (DW_TAG_base_type) > > DW_AT_name : int > > DW_AT_byte_size : 4 > > DW_AT_encoding : 5 (signed) > > ... > > <1><177b>: Abbrev Number: 2 (DW_TAG_typedef) > > DW_AT_name : PMI > > DW_AT_decl_file : 1 > > DW_AT_decl_line : 82 > > DW_AT_type : <1786> > > <1><1786>: Abbrev Number: 20 (DW_TAG_pointer_type) > > DW_AT_byte_size : 8 > > DW_AT_type : <178c> > > <1><178c>: Abbrev Number: 47 (DW_TAG_ptr_to_member_type) > > DW_AT_containing_type: <14a7> > > DW_AT_type : <11f> > > > > So it looks like GCC 3.3.5 is emitting bogus debug info. Do you see a > > possibility to deal with that? > > Hmm... how much of a hack do you think it's worth? :-) It's definitely > possible. > > The problem is that this is a perfectly legitimate piece of debug > output, describing "int A::**" instead of "int A::*". We could > recognize this problem based on string matching the DW_AT_producer; > I have added precedents for that before. I don't see any other way > of doing it. I don't really care; ok if I xfail those tests for GCC 3.3.x? 3.4.x seems to be fine. Did you test things on some other GCC versions? > > Isn't it just another cascading error because initializing members > > through data member pointers fails? > > Oh, you're probably right. > > > P.S. You still need to submit some bug reports for the gdb/NNN's. > > Rather delete most of them, at this point - I didn't add them in this > round of changes. Michael Chastain did several years ago, when none of > these tests worked with GCC. Oops, for some reason I thought this was a new test. Anyway, the failure modes are probably completely different after your code changes, so removing them is probably the most sensible thing to do. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ob] Adjust member pointer test for g++ 3.3 2007-01-28 17:50 ` Mark Kettenis @ 2007-01-28 17:52 ` Daniel Jacobowitz 0 siblings, 0 replies; 7+ messages in thread From: Daniel Jacobowitz @ 2007-01-28 17:52 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Sun, Jan 28, 2007 at 06:50:05PM +0100, Mark Kettenis wrote: > > Hmm... how much of a hack do you think it's worth? :-) It's definitely > > possible. > > > > The problem is that this is a perfectly legitimate piece of debug > > output, describing "int A::**" instead of "int A::*". We could > > recognize this problem based on string matching the DW_AT_producer; > > I have added precedents for that before. I don't see any other way > > of doing it. > > I don't really care; ok if I xfail those tests for GCC 3.3.x? 3.4.x > seems to be fine. Did you test things on some other GCC versions? That's fine with me. I believe I tested a 3.4.x gcc and a 4.1.x. > Oops, for some reason I thought this was a new test. Anyway, the > failure modes are probably completely different after your code > changes, so removing them is probably the most sensible thing to do. It actually was originally an HP aCC test. You're right - I should delete the kfails, although I have honestly no idea what the test will do for stabs. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-01-28 17:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-01-12 20:17 [ob] Adjust member pointer test for g++ 3.3 Daniel Jacobowitz 2007-01-12 21:50 ` Mark Kettenis 2007-01-12 23:08 ` Daniel Jacobowitz 2007-01-28 15:40 ` Mark Kettenis 2007-01-28 17:11 ` Daniel Jacobowitz 2007-01-28 17:50 ` Mark Kettenis 2007-01-28 17:52 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox