[PATCH] gdb-comm: Script confusion with a pending breakpoint

"Maciej W. Rozycki" <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.bugs
Message-ID <[email protected]>
Hello,

 With the mips-sde-elf target I observe a problem with a test script from 
the binutils testsuite looping as follows:

(gdb) file tmpdir/striprog
Reading symbols from [...]/tmpdir/striprog...(no debugging symbols found)...done.
(gdb) break _exit
Function "_exit" not defined.
Make breakpoint pending on future shared library load? (y or [n]) break 
exit
Please answer y or [n].
Make breakpoint pending on future shared library load? (y or [n]) break 
abort
Please answer y or [n].
Make breakpoint pending on future shared library load? (y or [n]) target 
mdi 15:2
Please answer y or [n].
Make breakpoint pending on future shared library load? (y or [n]) WARNING: 
Unable to connect to 15:2 with GDB.
quit
Please answer y or [n].
Make breakpoint pending on future shared library load? (y or [n])
Rebooting mipssim-sde

In this case the binary has been stripped, so no surprise there is no 
_exit symbol to place a breakpoint on.  As seen from config/gdb-comm.exp 
the breakpoint is used to catch a runaway debugger only, so it is safe to 
skip it if it cannot be set straight away; the return status from the 
function may be used for further processing if need be.

 The following patch fixes the problem for me.

2009-06-08  Maciej W. Rozycki  <[email protected]>

	* config/gdb-comm.exp (gdb_comm_add_breakpoint): Handle pending 
	breakpoints.

 Please apply.

  Maciej

dejagnu-1.4.99-gdb-comm-1.patch
diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp
index b7dbfc3..3d46011 100644
--- a/config/gdb-comm.exp
+++ b/config/gdb-comm.exp
@@ -200,6 +200,10 @@ proc gdb_comm_add_breakpoint { function } {
 	-re "Breakpoint.*$gdb_prompt $" { return "" }
 	-re "Function.*not defined.*$gdb_prompt $" { return "undef" }
 	-re "No symbol table.*$gdb_prompt $" { return "undef" }
+	-re ".*Make breakpoint pending.*\\\? \\(y or \\\[n\\\]\\) $" {
+	    remote_send host "y\n"
+	    return "maybe"
+	}
 	default {
 	    return "untested"
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.