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

[testsuite patch] Re-enable gdb.objc/* with recent GCCs


Hi,

at least gcc-4.4 and futher skip all gdb.objc/*.exp testcases.
Last compatible gcc was gcc-4.1 (CentOS-5).

The problem is for ObjC (sources in the testsuite) gcc produce warnings even
without -Wall, therefore the testcase is skipped:


./gdb.objc/basicclass.m: In function '+[BasicClass newWithArg:]':
./gdb.objc/basicclass.m:22:3: warning: 'BasicClass' may not respond to '+new' [enabled by default]
   id obj = [self new];
   ^
./gdb.objc/basicclass.m:22:3: warning: (Messages without a matching method signature [enabled by default]
./gdb.objc/basicclass.m:22:3: warning: will be assumed to return 'id' and accept [enabled by default]
./gdb.objc/basicclass.m:22:3: warning: '...' as arguments.) [enabled by default]
./gdb.objc/basicclass.m: In function '-[BasicClass printHi]':
./gdb.objc/basicclass.m:41:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
   printf("Hi\n");
   ^
./gdb.objc/basicclass.m: In function '-[BasicClass printNumber:]':
./gdb.objc/basicclass.m:47:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
   printf("%d\n", number);
   ^
./gdb.objc/basicclass.m: In function 'main':
./gdb.objc/basicclass.m:68:3: warning: 'BasicClass' may not respond to '+new' [enabled by default]
   obj = [BasicClass new];
   ^
./gdb.objc/basicclass.m: In function '_NSPrintForDebugger':
./gdb.objc/basicclass.m:77:3: warning: no '-respondsTo:' method found [enabled by default]
   if (object && [object respondsTo: @selector(myDescription)])
   ^


It may be more correct to fix the ObjC sources in the testsuite but I do not
know ObjC at all.

Curiously with CentOS-5 the testcase PASSed (except for
	Regression for gdb.objc/basicclass.exp [Re: [PATCH v2 3/5] use language of the main symbol]
	http://sourceware.org/ml/gdb-patches/2013-08/msg00243.html

) but with more recent GCCs (Fedora 20pre) the testcase crashes:
	continue
	Continuing.
	Program received signal SIGSEGV, Segmentation fault.
	__objc_responds_to (sel=<optimized out>, object=0x601280 <_OBJC_Class_BasicClass>) at /usr/src/debug/gcc-4.8.1-20130717/libobjc/sendmsg.c:397
	397       res = sarray_get_safe (dtable, (size_t) sel->sel_id);
	(gdb) FAIL: gdb.objc/basicclass.exp: continue until method breakpoint

I did not check more why.


Thanks,
Jan


gdb/testsuite/
2013-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/gdb.exp (gdb_compile_objc): Add additional_flags=-w.

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 70b797e..9265d52 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2872,6 +2872,9 @@ proc gdb_compile_objc {source dest type options} {
 	  set lib "-lobjc $lib"
 	}
         set options_with_lib [concat $options [list libs=$lib quiet]]
+        # GCCs after 4.1 produce some warning messages for present ObjC sources
+        # even with "quiet".  Without -w the testcase would get skipped.
+        lappend options_with_lib "additional_flags=-w"
         set ccout [gdb_compile $source $dest $type $options_with_lib]
         switch -regexp -- $ccout {
             ".*no posix threads support.*" {


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