blob: 42cb93330a55c4ebeb077dce26a8e12eb6533972 [file]
# Copyright 2013-2026 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.
require dwarf2_support
require allow_cplus_tests
standard_testfile .cc -dw.S
# Make some DWARF for the test.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
declare_labels int_label float_label struct_label
declare_labels ptr_label subr_label memptr_label
cu {} {
compile_unit {
DW_AT_language @DW_LANG_C_plus_plus
} {
int_label: base_type {
DW_AT_name int
DW_AT_encoding @DW_ATE_signed
DW_AT_byte_size 4 DW_FORM_sdata
}
float_label: base_type {
DW_AT_name float
DW_AT_encoding @DW_ATE_float
DW_AT_byte_size 4 DW_FORM_sdata
}
struct_label: structure_type {
DW_AT_name S
DW_AT_byte_size 1 DW_FORM_sdata
}
ptr_label: pointer_type {
DW_AT_type :$struct_label
}
subr_label: subroutine_type {
DW_AT_type :$int_label
} {
formal_parameter {
DW_AT_type :$ptr_label
DW_AT_artificial 1 DW_FORM_flag_present
}
formal_parameter {
DW_AT_type :$float_label
}
}
memptr_label: ptr_to_member_type {
DW_AT_type :$subr_label
DW_AT_containing_type :$struct_label
}
typedef {
DW_AT_name the_typedef
DW_AT_type :$memptr_label
}
}
}
}
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug c++}] } {
return
}
gdb_test_no_output "set language c++"
gdb_test "ptype the_typedef" \
"type = int \\(S::\\*\\)\\(S \\* const, float\\)"