diff mbox

[11/14] gdb/testsuite: Fix dbx.exp for remote targets

Message ID 20200207150003.8383-12-shahab.vahedi@gmail.com
State New
Headers show

Commit Message

Shahab Vahedi Feb. 7, 2020, 3 p.m. UTC
From: Anton Kolesov <Anton.Kolesov@synopsys.com>

Testcase dbx.exp uses command "exec-file" but doesn't properly handle
the case of replacing one executable with another - it was handling the
case of local debugging, when inferior process is started by GDB, but
not the case of remote gdbserver, where message is different. Example
output, which is now handled is:

(gdb) file .../gdb.base/dbx/dbx
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Load new symbol table from .../gdb.base/dbx/dbx"? (y or n) y

gdb/testsuite/ChangeLog:
2016-08-19  Anton Kolesov <Anton.Kolesov@synopsys.com>

	* gdb.base/dbx.exp (gdb_file_cmd): Add a case for
	changing the file.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
---
 gdb/testsuite/gdb.base/dbx.exp | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Luis Machado Feb. 11, 2020, 8:27 a.m. UTC | #1
On 2/7/20 12:00 PM, Shahab Vahedi wrote:
> From: Anton Kolesov <Anton.Kolesov@synopsys.com>
> 
> Testcase dbx.exp uses command "exec-file" but doesn't properly handle
> the case of replacing one executable with another - it was handling the
> case of local debugging, when inferior process is started by GDB, but
> not the case of remote gdbserver, where message is different. Example
> output, which is now handled is:

Is this again an artifact of starting a gdb+debugging stub setup with 
the program loaded as opposed to only starting gdb and then firing up 
the debugging stub?

> 
> (gdb) file .../gdb.base/dbx/dbx
> A program is being debugged already.
> Are you sure you want to change the file? (y or n) y
> Load new symbol table from .../gdb.base/dbx/dbx"? (y or n) y
> 

Is this still valid given the ChangeLog date? I don't see the file 
command being used, only exec-file and symbol-file.

> gdb/testsuite/ChangeLog:
> 2016-08-19  Anton Kolesov <Anton.Kolesov@synopsys.com>
> 
> 	* gdb.base/dbx.exp (gdb_file_cmd): Add a case for
> 	changing the file.
> 
> Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
> ---
>   gdb/testsuite/gdb.base/dbx.exp | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.base/dbx.exp b/gdb/testsuite/gdb.base/dbx.exp
> index d911fedf92cd..7993a658a314 100644
> --- a/gdb/testsuite/gdb.base/dbx.exp
> +++ b/gdb/testsuite/gdb.base/dbx.exp
> @@ -183,6 +183,12 @@ proc gdb_file_cmd {arg} {
>   	                verbose "\t\tKilling previous program being debugged"
>   	            exp_continue
>   	        }
> +	        -re "A program is being debugged already.*change the file.*y or n. $" {
> +		    # Handle the case of remote targets.
> +	            send_gdb "y\n"
> +	                verbose "\t\tChanging the file from previous program being debugged"
> +	            exp_continue
> +	        }
>                   -re ".*$gdb_prompt $" {
>                       verbose "\t\tLoaded $arg with new symbol table into $GDB"
>                       return 0
>
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.base/dbx.exp b/gdb/testsuite/gdb.base/dbx.exp
index d911fedf92cd..7993a658a314 100644
--- a/gdb/testsuite/gdb.base/dbx.exp
+++ b/gdb/testsuite/gdb.base/dbx.exp
@@ -183,6 +183,12 @@  proc gdb_file_cmd {arg} {
 	                verbose "\t\tKilling previous program being debugged"
 	            exp_continue
 	        }
+	        -re "A program is being debugged already.*change the file.*y or n. $" {
+		    # Handle the case of remote targets.
+	            send_gdb "y\n"
+	                verbose "\t\tChanging the file from previous program being debugged"
+	            exp_continue
+	        }
                 -re ".*$gdb_prompt $" {
                     verbose "\t\tLoaded $arg with new symbol table into $GDB"
                     return 0