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

Re: [PATCH] Improve MI inferior output check / mi-console.exp


On 10/28/2013 08:43 PM, Luis Machado wrote:

> *sigh*, that is true. I think fiddling with these checks may not be ideal.
>
> What about this simpler version that just checks for both patterns
> without other changes?

> 2013-10-28  Iain Sandoe  <iain@codesourcery.com>
> 	    Luis Machado  <lgustavo@codesourcery.com>
>
> 	gdb/testsuite
> 	* gdb.mi/mi-console.exp: Check for an additional inferior
> 	output pattern.

I suggest:

	* gdb.mi/mi-console.exp: Check for semihosted inferior
	output pattern.

>
> diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
> index b7643e7..c9a1a84 100644
> --- a/gdb/testsuite/gdb.mi/mi-console.exp
> +++ b/gdb/testsuite/gdb.mi/mi-console.exp
> @@ -36,11 +36,20 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
>
>  mi_run_to_main
>
> +# The output we get from the target depends on how it is hosted.
> +# If we are local, we just see the executable's output.
> +# If we are remote (and the configuration supports semihosting),
> +# we see the target responses encapsulated by gdb's annotation.
> +# Therefore we consider two patterns here.

Not only remote, but the sim, or any other semihosted configuration.
I think it'd be good to make the comment and variable names reflect
that, and be more precise, making it a easier for future
maintainers.  So:

# The output we get from the target depends on how it is hosted.  If
# we are semihosted (e.g., the sim or a remote target that supports
# the File I/O remote protocol extension), we see the target I/O
# encapsulated in MI target output stream records.  If debugging with
# a native target, the inferior's I/O streams are connected directly
# to a PTY we create for the inferior (notice separate-inferior-tty
# above), and we just see the program's output unadorned.  If
# debugging with a remote target that doesn't support semihosting,
# we'll see nothing.

set semihosted_output "@\"H\"\r\n@\"e\"\r\n@\"l\"\r\n@\"l\"\r\n@\"o\"\r\n@\" \"\r\n@\"\\\\\\\\\"\r\n@\"\\\\\"\"\r\n@\"!\"\r\n@\"\\\\r\"\r\n@\"\\\\n\"\r\n"
set output "Hello \\\\\"!\[\r\n\]+"
set both_patterns "($semihosted_output|$output)"


This is OK with that change, though I'd prefer if $semihosted_output
was computed from $output...

-- 
Pedro Alves


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