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

Re: [RFA] Error handling in gdb/testsuite/config/sid.exp


Michael Snyder wrote:
> 
> These changes will handle some error conditions.
> 

Thanks Michael.


> 2001-05-03  Michael Snyder  <msnyder@redhat.com>
> 
>         * config/sid.exp (gdb_target_sid): Check for error messages.
>         On error or timeout, don't make expect exit (which will terminate
>         all subsequent tests); instead just make gdb exit.
>         (gdb_load): Check for error messages.  On error or timeout,
>         return a negative value.
> 
> *** sid.exp.mrg Thu May  3 15:49:44 2001
> --- sid.exp     Thu May  3 15:49:02 2001
> *************** proc gdb_target_sid { } {
> *** 141,153 ****
>       set timeout 60
>       verbose "Timeout is now $timeout seconds" 2
>       gdb_expect {
>         -re "Remote debugging using.*$gdb_prompt"       {
>             verbose "Set target to sid"
>         }
>         timeout {
>             perror "Couldn't set target for remote simulator."
>             cleanup
> !           exit $exit_status
>         }
>       }
>       set timeout $prev_timeout
> --- 141,158 ----
>       set timeout 60
>       verbose "Timeout is now $timeout seconds" 2
>       gdb_expect {
> +       -re ".*\[Ee\]rror.*$gdb_prompt $" {
> +           perror "Couldn't set target for remote simulator."
> +           cleanup
> +           gdb_exit
> +       }
>         -re "Remote debugging using.*$gdb_prompt"       {
>             verbose "Set target to sid"
>         }
>         timeout {
>             perror "Couldn't set target for remote simulator."
>             cleanup
> !           gdb_exit
>         }
>       }
>       set timeout $prev_timeout
> *************** proc gdb_load { arg } {
> *** 164,169 ****
> --- 169,175 ----
>       global loadfile
>       global GDB
>       global gdb_prompt
> +     global retval
> 
>       gdb_unload
>       if [gdb_file_cmd $arg] then { return -1 }
> *************** proc gdb_load { arg } {
> *** 175,198 ****
>       set timeout 2400
>       verbose "Timeout is now $timeout seconds" 2
>       gdb_expect {
>         -re ".*$gdb_prompt $" {
>             if $verbose>1 then {
>                 send_user "Loaded $arg into $GDB\n"
>             }
> !           set timeout 30
> !           verbose "Timeout is now $timeout seconds" 2
> !           return 1
>         }
>         -re "$gdb_prompt $"     {
>             if $verbose>1 then {
>                 perror "GDB couldn't load."
>             }
>         }
>         timeout {
>             if $verbose>1 then {
>                 perror "Timed out trying to load $arg."
>             }
>         }
>       }
>       set timeout $prev_timeout
>   }
> --- 181,212 ----
>       set timeout 2400
>       verbose "Timeout is now $timeout seconds" 2
>       gdb_expect {
> +       -re ".*\[Ee\]rror.*$gdb_prompt $" {
> +           if $verbose>1 then {
> +               perror "Error during download."
> +           }
> +           set retval -1;
> +       }
>         -re ".*$gdb_prompt $" {
>             if $verbose>1 then {
>                 send_user "Loaded $arg into $GDB\n"
>             }
> !           set retval 1;
>         }
>         -re "$gdb_prompt $"     {
>             if $verbose>1 then {
>                 perror "GDB couldn't load."
>             }
> +           set retval -1;
>         }
>         timeout {
>             if $verbose>1 then {
>                 perror "Timed out trying to load $arg."
>             }
> +           set retval -1;
>         }
>       }
>       set timeout $prev_timeout
> +     verbose "Timeout is now $timeout seconds" 2
> +     return $retval;
>   }

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


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