gdb-testsuite-add-gdb.suse-zypper-hint.exp [gdb/testsuite] Add gdb.suse/zypper-hint.exp --- gdb/testsuite/gdb.suse/zypper-hint.c | 25 ++++++++++++++++ gdb/testsuite/gdb.suse/zypper-hint.exp | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/gdb/testsuite/gdb.suse/zypper-hint.c b/gdb/testsuite/gdb.suse/zypper-hint.c new file mode 100644 index 00000000000..e179788f04f --- /dev/null +++ b/gdb/testsuite/gdb.suse/zypper-hint.c @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2021 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 . */ + +#include + +int +main (void) +{ + printf ("hello\n"); + return 0; +} diff --git a/gdb/testsuite/gdb.suse/zypper-hint.exp b/gdb/testsuite/gdb.suse/zypper-hint.exp new file mode 100644 index 00000000000..c2b9a1134bd --- /dev/null +++ b/gdb/testsuite/gdb.suse/zypper-hint.exp @@ -0,0 +1,55 @@ +# Copyright 2021 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 . + +standard_testfile .c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { + return -1 +} + +clean_restart ${binfile} + +gdb_test_no_output "set build-id-verbose 1" + +set test "zypper hint printed" +if { ![gdb_breakpoint main qualified] } { + unresolved $test + return -1 +} + +gdb_run_cmd + +set re_64 \ + "Missing separate debuginfos, use: zypper install glibc-debuginfo-" +set re_32 \ + "Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-" + +set hexno0x "\[0-9A-Fa-f\]+" +set re_nolibrpm \ + [multi_line \ + "Missing separate debuginfo for .*libc.so.*" \ + "Try: zypper install -C \"debuginfo\\(build-id\\)=$hexno0x\""] + +gdb_test_multiple "" $test { + -re -wrap ($re_64|$re_32).* { + pass "$gdb_test_name (librpm)" + } + -re -wrap $re_nolibrpm.* { + pass "$gdb_test_name (no librpm)" + } +} + +# To give some background information in case the previous test failed. +gdb_test "info shared"