From f84bc21877ea3a58cd77929d9b365fd156df1b33 Mon Sep 17 00:00:00 2001 From: Keven Boell Date: Thu, 21 Nov 2013 10:54:47 +0100 Subject: [PATCH] testsuite: introduce index in varobj child eval. In some languages, e.g. fortran, arrays start with index 1 instead 0. This patch changes the MI library to support testing varobj children of fortran arrays. 2013-11-21 Keven Boell testsuite/ * lib/mi-support.exp (mi_list_varobj_children_range): Add call to mi_list_array_varobj_children_with_index. (mi_list_array_varobj_children_with_index): New function. Add parameter to specify array start. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/lib/mi-support.exp | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 070ea726394..7c47870c7f8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-12-06 Keven Boell + + * lib/mi-support.exp (mi_list_varobj_children_range): Add + call to mi_list_array_varobj_children_with_index. + (mi_list_array_varobj_children_with_index): New function. + Add parameter to specify array start. + 2013-12-03 Jose E. Marchesi * gdb.base/sigall.exp (test_one_sig): gdb identifies SIGLOST as a diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 0c3cdbe1ab6..cb7bf903316 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1487,9 +1487,18 @@ proc mi_list_varobj_children_range {varname from to numchildren children testnam # Verifies that variable object VARNAME has NUMBER children, # where each one is named $VARNAME. and has type TYPE. proc mi_list_array_varobj_children { varname number type testname } { + mi_list_array_varobj_children_with_index $varname $number 0 $type $testname +} + +# Same as mi_list_array_varobj_children, but allowing to pass a start index +# for an array. +proc mi_list_array_varobj_children_with_index { varname number start_index \ + type testname } { set t {} + set index $start_index for {set i 0} {$i < $number} {incr i} { - lappend t [list $varname.$i $i 0 $type] + lappend t [list $varname.$index $index 0 $type] + incr index } mi_list_varobj_children $varname $t $testname } -- 2.30.2