Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: add gdb_load_cmd to test harness
Date: Tue, 13 Jun 2006 13:13:00 -0000	[thread overview]
Message-ID: <448EB9AF.3040002@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

This patch adds a gdb_load_cmd procedure to the test harness.  It's useful to 
have this as a separate component so that a target specific gdb_load procedure 
can be built up.  There are some instances in the testsuite/config directory 
that could be simplified by using this -- I've not done so, because I cannot 
easily test them.

ok?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


[-- Attachment #2: support-2.patch --]
[-- Type: text/x-patch, Size: 1692 bytes --]

2006-06-13  Nathan Sidwell  <nathan@codesourcery.com>

	gdb/testsuite/
	* lib/gdb.exp (gdb_load_cmd): New.

Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.64.10.1
diff -c -3 -p -r1.64.10.1 gdb.exp
*** gdb/testsuite/lib/gdb.exp	7 Mar 2006 15:48:34 -0000	1.64.10.1
--- gdb/testsuite/lib/gdb.exp	13 Jun 2006 07:31:34 -0000
*************** proc gdb_exit { } {
*** 1867,1872 ****
--- 1867,1916 ----
  }
  
  #
+ # gdb_load_cmd -- load a file into the debugger.
+ #		  ARGS - additional args to load command.
+ #                 return a -1 if anything goes wrong.
+ #
+ proc gdb_load_cmd { args } {
+     global gdb_prompt
+ 
+     if [target_info exists gdb_load_timeout] {
+ 	set loadtimeout [target_info gdb_load_timeout]
+     } else {
+ 	set loadtimeout 1600
+     }
+     send_gdb "load $args\n"
+     verbose "Timeout is now $timeout seconds" 2
+     gdb_expect $loadtimeout {
+ 	-re "Loading section\[^\r\]*\r\n" {
+ 	    exp_continue
+ 	}
+ 	-re "Start address\[\r\]*\r\n" {
+ 	    exp_continue
+ 	}
+ 	-re "Transfer rate\[\r\]*\r\n" {
+ 	    exp_continue
+ 	}
+ 	-re "Memory access error\[^\r\]*\r\n" {
+ 	    perror "Failed to load program"
+ 	    return -1
+ 	}
+ 	-re "$gdb_prompt $" {
+ 	    return 0
+ 	}
+ 	-re "(.*)\r\n$gdb_prompt " {
+ 	    perror "Unexpected reponse from 'load' -- $expect_out(1,string)"
+ 	    return -1
+ 	}
+ 	timeout {
+ 	    perror "Timed out trying to load $arg."
+ 	    return -1
+ 	}
+     }
+     return -1
+ }
+ 
+ #
  # gdb_load -- load a file into the debugger.
  # Many files in config/*.exp override this procedure.
  #

             reply	other threads:[~2006-06-13 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-13 13:13 Nathan Sidwell [this message]
2006-06-13 13:16 ` Daniel Jacobowitz

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=448EB9AF.3040002@codesourcery.com \
    --to=nathan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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