8be455d765
PR 12573 * dwarf2read.c (struct dwarf2_cu): New field has_loclist. (producer_is_gcc_ge_4_0): New function. (process_full_comp_unit): Set also symtab->locations_valid. Move the symtab->language code. (var_decode_location): Set cu->has_loclist. * symtab.c (skip_prologue_sal): New variables saved_pc, force_skip and skip. Intialize force_skip from locations_valid. Move the prologue skipping code into two passes. * symtab.h (struct symtab): Make the primary field a bitfield. New field locations_valid. gdb/testsuite/ PR 12573 * gdb.dwarf2/dw2-skip-prologue.S: New file. * gdb.dwarf2/dw2-skip-prologue.c: New file. * gdb.dwarf2/dw2-skip-prologue.exp: New file.
74 lines
2.6 KiB
Text
74 lines
2.6 KiB
Text
# Copyright 2011 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/>.
|
|
load_lib dwarf.exp
|
|
|
|
# Test multiple location breakpoints vs. prologue analysis on -O2 -g code.
|
|
# when the first statement of a function is an inlined function GDB could
|
|
# crash. Map of this testcase:
|
|
#
|
|
# File name Line number Starting address
|
|
# main.c 5 func_start
|
|
# other.c 1 func0
|
|
# `inlined' called at main.c line 8
|
|
# main.c 9 func1
|
|
# func1 = Breakpoint location 1
|
|
# other.c 1 func2
|
|
# `inlined2' called at main.c line 11
|
|
# main.c 9 func3
|
|
# func3 = Breakpoint location 2
|
|
# `otherinline' called at main.c line 9
|
|
# end of main func_end
|
|
|
|
# This test can only be run on targets which support DWARF-2 and use gas.
|
|
if {![dwarf2_support]} {
|
|
return 0
|
|
}
|
|
|
|
set testfile "dw2-skip-prologue"
|
|
set executable ${testfile}
|
|
set binfile ${objdir}/${subdir}/${executable}
|
|
|
|
if {[build_executable ${testfile}.exp ${executable} "${testfile}.c ${testfile}.S" {additional_flags=-DINLINED}] == -1} {
|
|
return -1
|
|
}
|
|
|
|
# We need those symbols global to access them from the .S file.
|
|
set test "strip stub symbols"
|
|
set objcopy_program [transform objcopy]
|
|
set result [catch "exec $objcopy_program \
|
|
-N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \
|
|
-N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \
|
|
${binfile}" output]
|
|
verbose "result is $result"
|
|
verbose "output is $output"
|
|
if {$result != 0} {
|
|
fail $test
|
|
return
|
|
}
|
|
pass $test
|
|
|
|
clean_restart $executable
|
|
|
|
if ![runto_main] {
|
|
return -1
|
|
}
|
|
|
|
gdb_breakpoint "func"
|
|
gdb_continue_to_breakpoint "func"
|
|
|
|
# Sanity check GDB has really found 2 locations
|
|
gdb_test {info break $bpnum} "\r\n2\\.1\[ \t\]\[^\n\]*\r\n2\\.2\[ \t\]\[^\n\]*" "2 locations found"
|
|
|
|
gdb_test "p v" " = 0" "no statement got executed"
|