Patchwork [1/3] gdb/testsuite: Fix broken regexp in gdbstub case

login
register
mail settings
Submitter Andrew Burgess
Date April 9, 2018, 3:15 p.m.
Message ID <1ec70ce9afe8bebbb3f0257778943d4634ea126b.1523286728.git.andrew.burgess@embecosm.com>
Download mbox | patch
Permalink /patch/26657/
State New
Headers show

Comments

Andrew Burgess - April 9, 2018, 3:15 p.m.
When $use_gdb_stub is true then, when we start an MI target there's a
regexp to match GDB's startup pattern.  Unfortunately the pattern is
broken, and we're also missing a timeout case in the match list (which
would have helped point out that the regexp was broken).

gdb/testsuite/ChangeLog:

	* lib/mi-support.exp (mi_run_cmd_full): Fix regexp and add a
	timeout.
---
 gdb/testsuite/ChangeLog          | 5 +++++
 gdb/testsuite/lib/mi-support.exp | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
Pedro Alves - April 13, 2018, 12:12 p.m.
On 04/09/2018 04:15 PM, Andrew Burgess wrote:
> When $use_gdb_stub is true then, when we start an MI target there's a
> regexp to match GDB's startup pattern.  Unfortunately the pattern is
> broken, and we're also missing a timeout case in the match list (which
> would have helped point out that the regexp was broken).

That seems to have been added by:
 https://sourceware.org/ml/gdb-patches/2015-12/msg00357.html

curious how it seems to have worked back then.  I wonder whether
it was GDB's CLI-in-MI output that changed meanwhile?

I'd have appreciated a bit more detail on what is actually broken in
the pattern.  The git log above gives no clue, and the diff is not
exactly easy to read.  I trust that it's now correct though.  Thus, OK.

Thanks,
Pedro Alves

Patch

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 2846da74e47..851e490f4de 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -979,7 +979,11 @@  proc mi_run_cmd_full {use_mi_command args} {
 	send_gdb  "jump *$start\n"
 	warning "Using CLI jump command, expect run-to-main FAIL"
 	gdb_expect {
-	    -re "${run_match}&\"jump \\*${start}\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\\n.\"\[\r\n\]+\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" {}
+	    -re "&\"jump \\*${start}\\\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\.\\\\n\"\[\r\n\]+\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\[\r\n\]+${mi_gdb_prompt}" {}
+	    timeout {
+		perror "Unable to start target"
+		return -1
+	    }
 	}
 	return 0
     }