Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Manoj Iyer <manjo@austin.ibm.com>
To: gdb-patches@sources.redhat.com
Cc: Michael Chastain <mec.gnu@mindspring.com>
Subject: [RFC] GDB testsuite patch. (revised version)
Date: Fri, 27 Aug 2004 00:00:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.58.0408261009010.27764@lazy> (raw)
In-Reply-To: <412C98BD.nail10P1YTPHK@mindspring.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1448 bytes --]


Michael,

Ok here is another attempt, let me know what you think of this one. I
added the change log to the begning of the attached file, and I am pasting
the same below.

2004-08-26  Manoj Iyer  <manjo@austin.ibm.com

        * lib/gdb.exp (gdb_check_debuginfo): New procedure
        * gdb.gdb/complaints.exp: check if gdb has debug information.
        * gdb.gdb/observer.exp: check if gdb has debug information.
        * gdb.gdb/selftest.exp: check if gdb has debug information.
        * gdb.gdb/xfullpath.exp: check if gdb has debug information.


Thanks
-----
Manjo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cognito ergo sum                                                          +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

On Wed, 25 Aug 2004, Michael Chastain wrote:

> Daniel Jacobowitz <drow@false.org> wrote:
> > That's not the same as what you've done.  gdb_file_cmd should not
> > always fail for objects without debugging information, since there are
> > other tests that work OK without it.  This only applies to the gdb.gdb/
> > tests.
>
> Damn, I noticed this, but I got so caught up in the procedural criticism,
> I forgot to mention it.
>
> Daniel is right; gdb_file_cmd is not a good place to test for this
> unconditionally.  You have to look in gdb.gdb/*.exp and find a good
> way so that you make this check only for gdb.gdb/*.exp.
>
> Michael
>

[-- Attachment #2: testsuite patch --]
[-- Type: TEXT/PLAIN, Size: 5585 bytes --]

2004-08-26  Manoj Iyer  <manjo@austin.ibm.com

        * lib/gdb.exp (gdb_check_debuginfo): New procedure
        * gdb.gdb/complaints.exp: check if gdb has debug information.
        * gdb.gdb/observer.exp: check if gdb has debug information.
        * gdb.gdb/selftest.exp: check if gdb has debug information.
        * gdb.gdb/xfullpath.exp: check if gdb has debug information.

=======================================================================

diff -Naur ./old/src/gdb/testsuite/gdb.gdb/complaints.exp ./new/src/gdb/testsuite/gdb.gdb/complaints.exp
--- ./old/src/gdb/testsuite/gdb.gdb/complaints.exp	2004-08-24 18:16:00.889191248 -0500
+++ ./new/src/gdb/testsuite/gdb.gdb/complaints.exp	2004-08-26 04:40:28.377294120 -0500
@@ -302,13 +302,20 @@
 
 gdb_start
 
+
 set file [remote_download host $GDB_FULLPATH x$tool]
 
+set debug_result [gdb_check_debuginfo x$tool ]
+if {$debug_result < 0} then {
+   return -1
+}
+
 set setup_result [setup_test $file ]
 if {$setup_result <0} then {
     return -1
 }
 
+
 test_initial_complaints
 test_serial_complaints
 test_short_complaints
diff -Naur ./old/src/gdb/testsuite/gdb.gdb/observer.exp ./new/src/gdb/testsuite/gdb.gdb/observer.exp
--- ./old/src/gdb/testsuite/gdb.gdb/observer.exp	2004-08-24 18:16:00.889191248 -0500
+++ ./new/src/gdb/testsuite/gdb.gdb/observer.exp	2004-08-26 04:40:41.855242136 -0500
@@ -254,6 +254,12 @@
 
 gdb_start
 set file [remote_download host $GDB_FULLPATH x$tool]
+
+set debug_result [gdb_check_debuginfo x$tool ]
+if {$debug_result < 0} then {
+   return -1
+}
+
 set result [test_observer_normal_stop $file];
 gdb_exit;
 catch "remote_file host delete $file";
diff -Naur ./old/src/gdb/testsuite/gdb.gdb/selftest.exp ./new/src/gdb/testsuite/gdb.gdb/selftest.exp
--- ./old/src/gdb/testsuite/gdb.gdb/selftest.exp	2004-08-24 18:16:00.889191248 -0500
+++ ./new/src/gdb/testsuite/gdb.gdb/selftest.exp	2004-08-26 04:40:57.197305976 -0500
@@ -507,6 +507,12 @@
 
 gdb_start
 set file [remote_download host $GDB_FULLPATH x$tool]
+
+set debug_result [gdb_check_debuginfo x$tool ]
+if {$debug_result < 0} then {
+   return -1
+}
+
 set result [test_with_self $file];
 gdb_exit;
 catch "remote_file host delete $file";
diff -Naur ./old/src/gdb/testsuite/gdb.gdb/xfullpath.exp ./new/src/gdb/testsuite/gdb.gdb/xfullpath.exp
--- ./old/src/gdb/testsuite/gdb.gdb/xfullpath.exp	2004-08-24 18:16:00.889191248 -0500
+++ ./new/src/gdb/testsuite/gdb.gdb/xfullpath.exp	2004-08-26 04:41:11.206306432 -0500
@@ -179,6 +179,12 @@
 
 gdb_start
 set file [remote_download host $GDB_FULLPATH x$tool]
+
+set debug_result [gdb_check_debuginfo x$tool ]
+if {$debug_result < 0} then {
+   return -1
+}
+
 set result [test_with_self $file];
 gdb_exit;
 catch "remote_file host delete $file";
diff -Naur ./old/src/gdb/testsuite/lib/gdb.exp ./new/src/gdb/testsuite/lib/gdb.exp
--- ./old/src/gdb/testsuite/lib/gdb.exp	2004-08-24 18:16:00.892190792 -0500
+++ ./new/src/gdb/testsuite/lib/gdb.exp	2004-08-26 04:40:01.645231192 -0500
@@ -1023,6 +1023,82 @@
     }
 }
 
+
+#
+# Check to see if the executable has debug information. 
+# If not the return -1 and exit.
+#
+proc gdb_check_debuginfo { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global GDB
+    global gdb_prompt
+    upvar timeout timeout
+
+    if [is_remote host] {
+	set arg [remote_download host $arg];
+	if { $arg == "" } {
+	    error "download failed"
+	    return -1;
+	}
+    }
+
+    send_gdb "file $arg\n"
+    gdb_expect 120 {
+	-re "Reading symbols from.*no debugging symbols found.*$gdb_prompt $" {
+	    untested "skip tests no debugging information found."
+	    return -1
+	}
+        -re "Reading symbols from.*done.*$gdb_prompt $" {
+            verbose "\t\tLoaded $arg into the $GDB"
+            return 0
+        }
+        -re "has no symbol-table.*$gdb_prompt $" {
+            perror "$arg wasn't compiled with \"-g\""
+            return -1
+        }
+        -re "A program is being debugged already.*Kill it.*y or n. $" {
+            send_gdb "y\n"
+                verbose "\t\tKilling previous program being debugged"
+            exp_continue
+        }
+        -re "Load new symbol table from \".*\".*y or n. $" {
+            send_gdb "y\n"
+            gdb_expect 120 {
+                -re "Reading symbols from.*done.*$gdb_prompt $" {
+                    verbose "\t\tLoaded $arg with new symbol table into $GDB"
+                    return 0
+                }
+                timeout {
+                    perror "(timeout) Couldn't load $arg, other program already loaded."
+                    return -1
+                }
+            }
+	}
+        -re "No such file or directory.*$gdb_prompt $" {
+            perror "($arg) No such file or directory\n"
+            return -1
+        }
+        -re "$gdb_prompt $" {
+            perror "couldn't load $arg into $GDB."
+            return -1
+            }
+        timeout {
+            perror "couldn't load $arg into $GDB (timed out)."
+            return -1
+        }
+        eof {
+            # This is an attempt to detect a core dump, but seems not to
+            # work.  Perhaps we need to match .* followed by eof, in which
+            # gdb_expect does not seem to have a way to do that.
+            perror "couldn't load $arg into $GDB (end of file)."
+            return -1
+        }
+    }
+}
+
+
 #
 # start gdb -- start gdb running, default procedure
 #

       reply	other threads:[~2004-08-27  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.58.0408191014360.21237@lazy>
     [not found] ` <41251A45.nail58D215HD7@mindspring.com>
     [not found]   ` <Pine.LNX.4.58.0408191637370.21237@lazy>
     [not found]     ` <4125BB8B.nailJWP1FZGHJ@mindspring.com>
     [not found]       ` <Pine.LNX.4.58.0408242319060.7065@lazy>
     [not found]         ` <20040825124945.GA25217@nevyn.them.org>
     [not found]           ` <412C98BD.nail10P1YTPHK@mindspring.com>
2004-08-27  0:00             ` Manoj Iyer [this message]
2004-08-27 14:48               ` Michael Chastain
2004-08-27 15:28                 ` Manoj Iyer
2004-08-27 16:01                   ` Michael Chastain
2004-08-28  5:50                     ` Manoj Iyer
2004-08-28  5:48                   ` Manoj Iyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0408261009010.27764@lazy \
    --to=manjo@austin.ibm.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec.gnu@mindspring.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox