1*1424dfb3Schristos# Copyright 2012-2020 Free Software Foundation, Inc.
2c03b94e9Schristos
3c03b94e9Schristos# This program is free software; you can redistribute it and/or modify
4c03b94e9Schristos# it under the terms of the GNU General Public License as published by
5c03b94e9Schristos# the Free Software Foundation; either version 3 of the License, or
6c03b94e9Schristos# (at your option) any later version.
7c03b94e9Schristos#
8c03b94e9Schristos# This program is distributed in the hope that it will be useful,
9c03b94e9Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
10c03b94e9Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11c03b94e9Schristos# GNU General Public License for more details.
12c03b94e9Schristos#
13c03b94e9Schristos# You should have received a copy of the GNU General Public License
14c03b94e9Schristos# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15c03b94e9Schristos
16c03b94e9Schristos# Tests for linespec errors with C++.
17c03b94e9Schristos# Derived from gdb.linespec/ls-errs.exp.
18c03b94e9Schristos
19c03b94e9Schristosif {[skip_cplus_tests]} {
20c03b94e9Schristos    continue
21c03b94e9Schristos}
22c03b94e9Schristos
23c03b94e9Schristosstandard_testfile .cc
24c03b94e9Schristosset exefile $testfile
25c03b94e9Schristos
261c468f90Schristosif {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug c++}]} {
27c03b94e9Schristos    return -1
28c03b94e9Schristos}
29c03b94e9Schristos
30c03b94e9Schristosif {![runto_main]} {
311c468f90Schristos    fail "can't run to main"
32c03b94e9Schristos    return 0
33c03b94e9Schristos}
34c03b94e9Schristos
35c03b94e9Schristos# Run to a location in the file.
36c03b94e9Schristosset bp_location [gdb_get_line_number "set breakpoint here"]
37c03b94e9Schristos
38c03b94e9Schristosgdb_test "break $srcfile:$bp_location" \
39c03b94e9Schristos    "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
40c03b94e9Schristos    "breakpoint line number in file"
41c03b94e9Schristos
42c03b94e9Schristosgdb_continue_to_breakpoint "$bp_location"
43c03b94e9Schristos
44c03b94e9Schristos# Try to access a variable using scope that is a non-existent filename
45c03b94e9Schristos# with a Windows-style logical drive in the name.
46c03b94e9Schristosset nonexistent_file C:/does/not/exist.cc
47c03b94e9Schristosgdb_test "print '$nonexistent_file'::var" \
48c03b94e9Schristos	 ".*No symbol \"$nonexistent_file\" in current context.*" \
49c03b94e9Schristos	 "print var from \"$nonexistent_file\""
50