mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
4a94e36819
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
101 lines
2.5 KiB
Plaintext
101 lines
2.5 KiB
Plaintext
# Copyright 2017-2022 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
|
|
|
|
# This test can only be run on targets which support DWARF-2 and use gas.
|
|
if {![dwarf2_support]} {
|
|
return 0
|
|
}
|
|
|
|
standard_testfile main.c -dw.S
|
|
|
|
# Make some DWARF for the test.
|
|
set asm_file [standard_output_file $srcfile2]
|
|
Dwarf::assemble $asm_file {
|
|
global pair
|
|
|
|
cu { addr_size 4 } {
|
|
compile_unit {} {
|
|
declare_labels int_label ushort_label struct_label
|
|
|
|
int_label: DW_TAG_base_type {
|
|
{DW_AT_byte_size 4 DW_FORM_udata}
|
|
{DW_AT_encoding @DW_ATE_unsigned}
|
|
{DW_AT_name "myint"}
|
|
}
|
|
ushort_label: DW_TAG_base_type {
|
|
{DW_AT_byte_size 2 DW_FORM_udata}
|
|
{DW_AT_encoding @DW_ATE_unsigned}
|
|
{DW_AT_name "myushort"}
|
|
}
|
|
|
|
struct_label: DW_TAG_structure_type {
|
|
{DW_AT_name "S"}
|
|
{DW_AT_byte_size 8 DW_FORM_udata}
|
|
} {
|
|
DW_TAG_member {
|
|
{DW_AT_name "a"}
|
|
{DW_AT_type :${int_label}}
|
|
{DW_AT_data_member_location 0 DW_FORM_udata}
|
|
}
|
|
|
|
DW_TAG_member {
|
|
{DW_AT_name "b"}
|
|
{DW_AT_type :${ushort_label}}
|
|
{DW_AT_data_member_location 4 DW_FORM_udata}
|
|
}
|
|
}
|
|
|
|
DW_TAG_variable {
|
|
{DW_AT_name "s1"}
|
|
{DW_AT_type :${struct_label}}
|
|
{DW_AT_external 1 DW_FORM_flag}
|
|
{DW_AT_location {
|
|
DW_OP_constu 1
|
|
DW_OP_stack_value
|
|
DW_OP_piece 4
|
|
DW_OP_constu 0
|
|
DW_OP_stack_value
|
|
DW_OP_piece 2
|
|
} SPECIAL_expr}
|
|
}
|
|
|
|
DW_TAG_variable {
|
|
{DW_AT_name "s2"}
|
|
{DW_AT_type :${struct_label}}
|
|
{DW_AT_external 1 DW_FORM_flag}
|
|
{DW_AT_location {
|
|
DW_OP_constu 1
|
|
DW_OP_stack_value
|
|
DW_OP_piece 4
|
|
DW_OP_constu 0
|
|
DW_OP_stack_value
|
|
DW_OP_piece 8
|
|
} SPECIAL_expr}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if { [prepare_for_testing "failed to prepare" ${testfile} \
|
|
[list $srcfile $asm_file] {nodebug}] } {
|
|
return -1
|
|
}
|
|
|
|
gdb_test "p s1" " = {a = 1, b = 0}"
|
|
gdb_test "p s2" \
|
|
"access outside bounds of object referenced via synthetic pointer"
|