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/30/2013 12:30 PM, Luis Machado wrote:

> The following patch accomplishes that and tweaks things a little further.
> 
> First, i removed the misleading test description. It does not seem to be 
> aligned with what the test does nowadays. It is not restricted to 
> remote/sim targets anymore.
> 
> I've put back the mi-support.exp bit since that is required for remote 
> targets, otherwise we will try to read from the spawn id.
> 
> I'm explicitly checking for "remote" and "extended-remote" gdb_protocol 
> values here since neither "isremote" nor "use_gdb_stub" seem to have a 
> consistent meaning. 

> Extended-remote should be both "use_gdb_stub" and  "isremote", but it isn't.

No it shouldn't.  ;-)

> 
> Hopefully this version also addresses the gdb-simulator vs rsp-simulator 
> confusion.

I don't think it does completely yet?  A check for the
sim is missing.  We'd need:

    [target_info protocol] == "sim"

(see mi_gdb_target_load)

And, try:

$ grep noinferiorio /usr/share/dejagnu/* -rn

Where we find lots of random non-remote boards that
set gdb,noinferiorio 1.

And the patch makes all such boards fall to the

> +	    } else {
>  		global mi_inferior_spawn_id

bit.  Shouldn't the patch be leaving the

	    if { ![target_info exists gdb,noinferiorio] } {

check as the outermost?

> +# The program's real output string.
> +set program_output "Hello \\\"!\r\n"
> +
> +# Prepare the pattern for the PTY output of a native target.
> +set output [string map {"\r\n" "\[\r\n\]+"} $program_output]
> +set output [string map {"\\" "\\\\"} $output]
> +
> +# Prepare the pattern for the semihosted output.
> +set semihosted_output [semihosted_string $program_output]
> +
> +# Combine both outputs in a single pattern.
> +set both_patterns "($semihosted_output|$output)"

BTW, I'd find that naming the variables like:

# The program's real output string.
set program_output "Hello \\\"!\r\n"

# Prepare the pattern for the PTY output of a native target.
set native_output [string map {"\r\n" "\[\r\n\]+"} $program_output]
set native_output [string map {"\\" "\\\\"} $native_output]

# Prepare the pattern for the semihosted output.
set semihosted_output [semihosted_string $program_output]

# Combine both outputs in a single pattern.
set output "($semihosted_output|$native_output)"

to be a bit clearer.

-- 
Pedro Alves


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