This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


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

[PATCH] Overload test failure patch


Hi.

I believe one test in the 'overload' tests fails because of
a potential problem in the test program, not gdb. The failure
I see is when gdb prints out the values of instance 'foo_instance1'
of class 'Foo'. This instance is called with the constructor
function taking an integer as a parameter. The character pointer
parameter 'ccpfoo' is never initialized to anything, so when
gdb executes 'print foo_instance1' it prints out

{ifoo = '111', ccpfoo = 0xXXXXXX "{stuff}"}

instead of

{ifoo = '111', ccpfoo = 0x0}

as the test expects.

My patch modifies the constructor function to explicitly set
the pointer to null in this case, thus making the test pass.

I'm not a C++ programmer by a long shot, so this
patch may be compensating for an issue regarding the compiler -
egcs-1.1.2, i586 - but I really, really doubt that.

Use the patch as you see fit.

Art Haas
==============================================
--- gdb-4.17.86/gdb/testsuite/gdb.c++/overload.cc.orig	Mon Jan  4 09:35:05 1999
+++ gdb-4.17.86/gdb/testsuite/gdb.c++/overload.cc	Wed Mar 17 16:51:11 1999
@@ -73,7 +73,7 @@
     return 0; 
 }
 
-foo::foo  (int i)                  { ifoo = i;}
+foo::foo  (int i)                  { ifoo = i; ccpfoo = NULL;}
 foo::foo  (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
 foo::foo  (foo& afoo)              { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;}
 foo::~foo ()                       {}