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

[binutils-gdb] Fix buglets in gdb.trace/tspeed.{exp,c}


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

commit f9c49bffe616013ba97f679afd3446a8c87d80a7
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Fri Oct 12 16:27:29 2018 -0400

    Fix buglets in gdb.trace/tspeed.{exp,c}
    
    When trying to run gdb.trace/tspeed.exp, I get:
    
    ERROR: can't read "ipalib": no such variable
        while executing
    "gdb_load_shlib $ipalib"
        (procedure "prepare_for_trace_test" line 5)
    
    This problem seems to come from commit
    
        c708f4d256f ("gdb: Don't call gdb_load_shlib unless GDB is running")
    
    which moved the gdb_load_shlib call in prepare_for_trace_test.  In order
    to access the ipalib variable, we need to declare "global ipalib" first.
    
    Then, this test uses nowarnings, for no good reason I could find.  We
    can remove that and fix the two trivial warnings that appear:
    
    /home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c: In function 'main':
    /home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:87:16: warning: too many arguments for format [-Wformat-extra-args]
            printf ("Negative times, giving up\n", max_iters);
                    ^
    /home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:99:7: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
           sleep (1);  /* set post-run breakpoint here */
           ^
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.trace/tspeed.exp: Remove nowarnings.
    	(prepare_for_trace_test): Declare "global ipalib".
    	* gdb.trace/tspeed.c: Include unistd.h.
    	(main): Remove superfluous printf argument.

Diff:
---
 gdb/testsuite/ChangeLog            | 7 +++++++
 gdb/testsuite/gdb.trace/tspeed.c   | 3 ++-
 gdb/testsuite/gdb.trace/tspeed.exp | 3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ba5fae9..465d606 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-12  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* gdb.trace/tspeed.exp: Remove nowarnings.
+	(prepare_for_trace_test): Declare "global ipalib".
+	* gdb.trace/tspeed.c: Include unistd.h.
+	(main): Remove superfluous printf argument.
+
 2018-10-11  Sandra Loosemore  <sandra@codesourcery.com>
 
 	* gdb.base/solib-vanish.exp: Fix regexp not to require a POSIX
diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c
index b084d6a..8995ebb 100644
--- a/gdb/testsuite/gdb.trace/tspeed.c
+++ b/gdb/testsuite/gdb.trace/tspeed.c
@@ -28,6 +28,7 @@
 #include <time.h>
 #include <sys/time.h>
 #include <sys/resource.h>
+#include <unistd.h>
 
 int trace_speed_test (void);
 
@@ -84,7 +85,7 @@ main(int argc, char **argv)
 	    }
 	  if (problem < 0)
 	    {
-	      printf ("Negative times, giving up\n", max_iters);
+	      printf ("Negative times, giving up\n");
 	      break;
 	    }
 
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index 47a8250..bc12afd 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -21,7 +21,7 @@ set executable $testfile
 set ipalib [get_in_proc_agent]
 
 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-	  executable [concat {debug nowarnings c} shlib=$ipalib]] != "" } {
+	  executable [concat {debug c} shlib=$ipalib]] != "" } {
     untested "failed to compile"
     return -1
 }
@@ -38,6 +38,7 @@ set cr "\[\r\n\]+"
 
 proc prepare_for_trace_test {} {
     global executable
+    global ipalib
 
     clean_restart $executable
     gdb_load_shlib $ipalib


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