Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / dmsym.exp
CommitLineData
28e7fd62 1# Copyright (C) 2011-2013 Free Software Foundation, Inc.
095bcf5e
JB
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16set testfile dmsym_main
17
18# Build dmsym_main using two C files:
19# - dmsym.c, which needs to be built without debug info;
20# - dmsym_main.c, which needs to be build with debug info.
21# This is why we use gdb_compile instead of relying on the usual
22# call to prepare_for_testing.
23
24if {[gdb_compile "${srcdir}/${subdir}/dmsym.c" \
25 ${objdir}/${subdir}/dmsym.o \
26 object {}] != ""} {
27 untested dmsym.exp
28 return -1
29}
30
31if {[gdb_compile \
32 [list ${srcdir}/${subdir}/dmsym_main.c ${objdir}/${subdir}/dmsym.o] \
33 ${objdir}/${subdir}/${testfile} \
34 executable {debug}] != ""} {
35 untested dmsym.exp
36 return -1
37}
38
39clean_restart ${testfile}
40
41# Some convenient regular expressions...
42set num "\[0-9\]+"
43set addr "0x\[0-9a-zA-Z\]+"
44
45# Although the test program is written in C, the original problem
46# occurs only when the language is Ada. The use of a C program is
47# only a convenience to be able to exercise the original problem
48# without requiring an Ada compiler. In the meantime, temporarily
49# force the language to Ada.
50
51gdb_test_no_output "set lang ada"
52
53# Verify that setting a breakpoint on `pck__foo__bar__minsym' only
54# results in one location found (function pck__foo__bar__minsym__2).
55# A mistake would be to also insert a breakpoint where
56# pck__foo__bar__minsym is defined. Despite the fact that there is
57# no debugging info available, this is a data symbol and thus should
58# not be used for breakpoint purposes.
59
60gdb_test "break pck__foo__bar__minsym" \
61 "Breakpoint $num at $addr.: file .*dmsym_main\\.c, line $num\\."
62
63# However, verify that the `info line' command, on the other hand,
64# finds both locations.
65
66gdb_test "info line pck__foo__bar__minsym" \
67 "Line $num of \".*dmsym_main\\.c\" .*\r\nNo line number information available for address $addr <pck__foo__bar__minsym>"
68
69gdb_test_no_output "set lang auto"
70
71# Now, run the program until we get past the call to
72# pck__foo__bar__minsym__2. Except when using hardware breakpoints,
73# inferior behavior is going to be affected if a breakpoint was
74# incorrectly inserted at pck__foo__bar__minsym.
75
76gdb_breakpoint dmsym_main.c:[gdb_get_line_number "BREAK" dmsym_main.c]
77
78gdb_run_cmd
79gdb_test "" \
80 "Breakpoint $num, pck__foo__bar__minsym__2 \\(\\) at.*" \
81 "Run until breakpoint at BREAK"
82
83gdb_test "continue" \
84 "Breakpoint $num, main \\(\\) at.*"
85
86gdb_test "print val" \
87 " = 124"
This page took 0.389959 seconds and 4 git commands to generate.