[4/4] Test different follow-exec-mode settings in gdb.multi/multi-arch-exec.exp

Message ID 1503828934-26404-5-git-send-email-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi Aug. 27, 2017, 10:15 a.m. UTC
  Using follow-exec-mode "new" takes a different code path than "same", so
it's interesting to test this path in combination with a change in
architecture of the inferior.  This test fails if you remove the
previous patch.

gdb/testsuite/ChangeLog:

	* gdb.multi/multi-arch-exec.exp: Test with different
	"follow-exec-mode" settings.
	(do_test): New procedure.
---
 gdb/testsuite/gdb.multi/multi-arch-exec.exp | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
  

Comments

Yao Qi Sept. 5, 2017, 10:39 a.m. UTC | #1
On 17-08-27 12:15:34, Simon Marchi wrote:
> +	# Test that GDB updates the target description / arch successfuly
> +	# after the exec.
> +	gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"
> +	gdb_test "info inferior"

Nit, any reason not to match the output here?

>  }
>  
> -# Test that GDB updates the target description / arch successfuly
> -# after the exec.
> -gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"

Patch is good to me.
  
Simon Marchi Sept. 5, 2017, 3:40 p.m. UTC | #2
On 2017-09-05 12:39 PM, Yao Qi wrote:
> On 17-08-27 12:15:34, Simon Marchi wrote:
>> +	# Test that GDB updates the target description / arch successfuly
>> +	# after the exec.
>> +	gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"
>> +	gdb_test "info inferior"
> 
> Nit, any reason not to match the output here?

Errr, I think I used that to debug and it shouldn't be there.  I'll remove it.

>>  }
>>  
>> -# Test that GDB updates the target description / arch successfuly
>> -# after the exec.
>> -gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"
> 
> Patch is good to me.

Thanks, I am pushing the series to master and gdb-8.0-branch.

Simon
  

Patch

diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.exp b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
index ed98532..3053345 100644
--- a/gdb/testsuite/gdb.multi/multi-arch-exec.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
@@ -76,12 +76,23 @@  if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
     return -1
 }
 
-clean_restart ${exec1}
-if ![runto_main] then {
-    fail "couldn't run to main"
-    return -1
+proc do_test { mode } {
+	global exec1
+
+	clean_restart ${exec1}
+	if ![runto_main] then {
+	    fail "couldn't run to main"
+	    return -1
+	}
+
+	gdb_test_no_output "set follow-exec-mode $mode"
+
+	# Test that GDB updates the target description / arch successfuly
+	# after the exec.
+	gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"
+	gdb_test "info inferior"
 }
 
-# Test that GDB updates the target description / arch successfuly
-# after the exec.
-gdb_test "continue" "Breakpoint 1, main.*" "continue across exec that changes architecture"
+foreach follow_exec_mode {"same" "new"} {
+    do_test $follow_exec_mode
+}