binutils-gdb/gdb/testsuite/gdb.linespec/break-asm-file.exp
Yao Qi 8518049884 Compile break-asm-file{0,1}.s without debug info
If I add some nop into break-asm-file1.s like this,

--- INDEX:/gdb/testsuite/gdb.linespec/break-asm-file1.s
+++ WORKDIR:/gdb/testsuite/gdb.linespec/break-asm-file1.s
@@ -31,8 +31,8 @@ _func:
 	.type func, %function
 func:
 .Lbegin_func:
-	.int 0
-	.int 0
+	nop
+	nop
 .Lend_func:
 	.size func, .-func
 .Lend_text1:

I get the following error:

Running gdb/testsuite/gdb.linespec/break-asm-file.exp ...
gdb/testsuite/gdb.linespec/break-asm-file1.s: Assembler messages:^M
gdb/testsuite/gdb.linespec/break-asm-file1.s: Fatal error: duplicate .debug_line sections

break-asm-file0.s and break-asm-file1.s have already had debug information
(written manually), so don't need to generate debug infor for them.

gdb/testsuite:

2015-03-26  Yao Qi  <yao.qi@linaro.org>

	* gdb.linespec/break-asm-file.exp: Don't call prepare_for_testing.
	Call gdb_compile instead to compile each .s files without debug
	information.
2015-03-26 08:29:48 +00:00

69 lines
2.1 KiB
Plaintext

# Copyright 2012-2015 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/>.
# Bug 17394
# Test for break-point at a function only for a selected ASM file.
load_lib dwarf.exp
standard_testfile .c
set execfile $testfile
set asm_file1 break-asm-file1.s
set asm_file0 break-asm-file0.s
# This test can only be run on targets which support DWARF-2 and use gas.
if {![dwarf2_support]} {
return 0
}
if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
object {debug nowarnings optimize=-O0}] != ""} {
return -1
}
# Compile .s files without debug information.
if {[gdb_compile ${srcdir}/${subdir}/$asm_file0 ${binfile}2.o \
object {nodebug}] != ""} {
return -1
}
if {[gdb_compile ${srcdir}/${subdir}/$asm_file1 ${binfile}3.o \
object {nodebug}] != ""} {
return -1
}
if {[gdb_compile [list ${binfile}1.o ${binfile}2.o ${binfile}3.o] \
"${binfile}" executable {}] != ""} {
return -1
}
clean_restart $execfile
gdb_test "break a/$asm_file0:func" \
"Breakpoint 1 at 0x\[0-9a-fA-F\]+: file .*a/$asm_file0, line 7\\\." \
"set a break-point at a global function only for a selected ASM file."
gdb_test "delete 1"
gdb_test "break b/$asm_file0:func" \
"Breakpoint 2 at 0x\[0-9a-fA-F\]+: file .*b/$asm_file0, line 7\\\." \
"set a break-point at a function only for a selected ASM file."
gdb_test "delete 2"
gdb_test "break $asm_file0:func" \
"Breakpoint 3 at 0x\[0-9a-fA-F\]+: .*$asm_file0.*(2 locations).*" \
"set a break-point at function in all instances for a selected ASM file."