Bug 24760 - [gdb/testsuite] gdb.objc/basicclass.exp has bitrotted
Summary: [gdb/testsuite] gdb.objc/basicclass.exp has bitrotted
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: testsuite (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-03 09:43 UTC by Tom de Vries
Modified: 2019-07-14 11:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2019-07-03 09:43:49 UTC
I.

Currently when running gdb.objc/basicclass.exp, we get:
...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp ...

                === gdb Summary ===

# of unsupported tests          1
...

Compilation fails because we run into a bunch of warnings:
...
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m: In function '+[BasicClass newWithArg:]':
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:22:3: warning: 'BasicClass' may not respond to '+new'
   id obj = [self new];
   ^~
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:22:3: warning: (Messages without a matching method signature
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:22:3: warning: will be assumed to return 'id' and accept
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:22:3: warning: '...' as arguments.)
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m: In function '-[BasicClass printHi]':
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:41:3: warning: incompatible implicit declaration of built-in function 'printf'
   printf("Hi\n");
   ^~~~~~
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:41:3: note: include '<stdio.h>' or provide a declaration of 'printf'
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m: In function '-[BasicClass printNumber:]':
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:47:3: warning: incompatible implicit declaration of built-in function 'printf'
   printf("%d\n", number);
   ^~~~~~
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:47:3: note: include '<stdio.h>' or provide a declaration of 'printf'
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m: In function 'main':
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:68:3: warning: 'BasicClass' may not respond to '+new'
   obj = [BasicClass new];
   ^~~
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m: In function '_NSPrintForDebugger':
/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.m:77:3: warning: no '-respondsTo:' method found
   if (object && [object respondsTo: @selector(myDescription)])
   ^~
...


II.

When bypassing these warnings using:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index da36ec0d4a..6b81585296 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3938,6 +3938,7 @@ proc gdb_compile_shlib_pthreads {sources dest options} {
 proc gdb_compile_objc {source dest type options} {
     set built_binfile 0
     set why_msg "unrecognized error"
+    lappend options "nowarnings"
     foreach lib {-lobjc -lpthreads -lpthread -lthread solaris} {
         # This kind of wipes out whatever libs the caller may have
         # set.  Or maybe theirs will override ours.  How infelicitous.
...
we run into:
...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp ...
FAIL: gdb.objc/basicclass.exp: continue until method breakpoint
ERROR: tcl error sourcing /data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp.
ERROR: extra characters after close-quote
    while executing
"gdb_test "" "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*" "resetting breakpoints when r

#
# Continue until breakpoint (test re-setting..."
    (file "/data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp" line 122)
    invoked from within
"source /data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /data/gdb_versions/devel/src/gdb/testsuite/gdb.objc/basicclass.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

                === gdb Summary ===

# of expected passes            7
# of unexpected failures        1
...


III.

If we fix this (broken since 2014):
...
diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp
index d88655afb5..43b93cdaf9 100644
--- a/gdb/testsuite/gdb.objc/basicclass.exp
+++ b/gdb/testsuite/gdb.objc/basicclass.exp
@@ -119,7 +119,7 @@ gdb_test continue \
 # Test resetting breakpoints when re-running program
 #
 gdb_run_cmd
-gdb_test "" "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*" "resetting breakpoints when r
+gdb_test "" "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*" "resetting breakpoints when rerunning"
 
 #
 # Continue until breakpoint (test re-setting breakpoint)
...
we get:
...
FAIL: gdb.objc/basicclass.exp: continue until method breakpoint
FAIL: gdb.objc/basicclass.exp: continue until method breakpoint
FAIL: gdb.objc/basicclass.exp: print an ivar of self
FAIL: gdb.objc/basicclass.exp: print self
FAIL: gdb.objc/basicclass.exp: print contents of self
FAIL: gdb.objc/basicclass.exp: continue until category method
FAIL: gdb.objc/basicclass.exp: call an Objective-C method with no arguments
FAIL: gdb.objc/basicclass.exp: call an Objective-C method with one argument
FAIL: gdb.objc/basicclass.exp: use of the print-object command
FAIL: gdb.objc/basicclass.exp: use of the po (print-object) command

                === gdb Summary ===

# of expected passes            9
# of unexpected failures        10
...
Comment 1 Sourceware Commits 2019-07-14 11:23:47 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=da73816739483bac537403262cef1c460e43319f

commit da73816739483bac537403262cef1c460e43319f
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Jul 14 13:23:04 2019 +0200

    [gdb/testsuite] Fix unterminated string in gdb.objc/basicclass.exp
    
    The test-case gdb.objc/basicclass.exp contains an unterminated string,
    introduced in refactoring commit fa43b1d7ca "after gdb_run_cmd, gdb_expect ->
    gdb_test_multiple/gdb_test".
    
    Fix the unterminated string.
    
    gdb/testsuite/ChangeLog:
    
    2019-07-14  Tom de Vries  <tdevries@suse.de>
    
    	PR testsuite/24760
    	* gdb.objc/basicclass.exp: Fix unterminated string.
Comment 2 Tom de Vries 2019-07-14 11:39:21 UTC
Filed PR24807 - "gdb.objc FAILs" for remaining FAILs.

Fixed unterminated string in test-case, marking resolved-fixed.