xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/expand-psymtabs.exp (revision 8450a7c42673d65e3b1f6560d3b6ecd317a6cbe8)
1# Copyright 2007-2015 Free Software Foundation, Inc.
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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16#
17# This file is part of the gdb testsuite.
18
19# It's possible to have a program that contains two compilation units
20# for the same source file name, that have code at different lines.
21# For example, in this test, we compile expand-psymtabs.c twice with
22# different preprocessor symbols #defined; the first .o only has
23# 'main' at some earlier source lines, while the second .o only has
24# 'foo' at later source lines.  So when setting breakpoints by line
25# number, which full symtab we need depends on the line number in
26# question.
27#
28# This test is meant to verify that, even with lazy partial symtab
29# reading in effect, GDB can set breakpoints by line number
30# successfully in either compilation unit.
31
32standard_testfile
33
34# What compiler are we using?
35if [get_compiler_info] {
36    return -1
37}
38
39# We intentionally compile the source file in twice.
40if {[prepare_for_testing_full $testfile.exp \
41	 [list $testfile debug $srcfile {debug additional_flags=-DFIRST} \
42	      $srcfile debug]]} {
43    return -1
44}
45
46set foo_bp [gdb_get_line_number "Break here"]
47gdb_test "break $foo_bp" "Breakpoint.*" "Expand psymtabs"
48
49