[PATCH v4 38/44] testsuite, sycl: add test for 'info locals' and 'info args'
Markus Metzger <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
From: Tankut Baris Aktemur <[email protected]> Test that local variables and arguments inside a SYCL kernel can be displayed correctly. --- .../gdb.sycl/info-locals-and-args.exp | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 gdb/testsuite/gdb.sycl/info-locals-and-args.exp diff --git a/gdb/testsuite/gdb.sycl/info-locals-and-args.exp b/gdb/testsuite/gdb.sycl/info-locals-and-args.exp new file mode 100644 index 00000000000..f2b446daef8 --- /dev/null +++ b/gdb/testsuite/gdb.sycl/info-locals-and-args.exp @@ -0,0 +1,78 @@ +# Copyright 2019-2026 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Tests GDBs support for SYCL for the "info locals" and "info args" +# commands inside a kernel. + +load_lib sycl.exp + +standard_testfile call-stack.cpp + +set sycl_device_list [init_sycl_devices_list] +if {[llength $sycl_device_list] == 0} { + unsupported "target does not support SYCL" + return +} + +if {[build_executable "failed to compile $srcfile" "$binfile" "$srcfile" \ + {sycl debug}]} { + return +} + +foreach device $sycl_device_list { + sycl_with_intelgt_lock $device { + clean_restart $testfile + + if {![sycl_start $device]} { + continue + } + + set outer_loc [gdb_get_line_number "ordinary-outer-loc"] + set inner_loc [gdb_get_line_number "kernel-function-return"] + gdb_breakpoint "$outer_loc" + gdb_breakpoint "$inner_loc" + + gdb_continue_to_breakpoint "bp 1" ".*$srcfile:$outer_loc.*" + + set fill "\[^\r\n\]+" + set ten 0 + set four 0 + set fourteen 0 + gdb_test_multiple "info locals" "info locals 1" -lbl { + -re "\r\nten = $fill" { + set ten 1 + exp_continue + } + -re "\r\nfour = $fill" { + set four 1 + exp_continue + } + -re "\r\nfourteen = $fill" { + set fourteen 1 + exp_continue + } + -re -wrap "" { + gdb_assert { $ten == 1 && $four == 1 && $fourteen == 1 } \ + $gdb_test_name + } + } + + gdb_continue_to_breakpoint "bp 2" ".*$srcfile:$inner_loc.*" + gdb_test "info locals" "result = $fill.*" "info locals 2" + gdb_test "info args" [multi_line \ + "x1 = $fill" \ + "y1 = $fill"] + } +} -- 2.43.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.