• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2# Copyright (C) 2018 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# Make sure --debug-dump=info implies .debug_types, even when implicit.
21# See run-typeiter.sh
22testfiles testfile-debug-types
23
24testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=str --debug-dump=info testfile-debug-types<<\EOF
25
26DWARF section [28] '.debug_info' at offset 0x1089:
27 [Offset]
28 Compilation unit at offset 0:
29 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
30 [     b]  compile_unit         abbrev: 8
31           producer             (strp) "GNU C++ 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic -march=x86-64 -g -fdebug-types-section"
32           language             (data1) C_plus_plus (4)
33           comp_dir             (strp) "/home/mark/src/elfutils/tests"
34           low_pc               (addr) 0x00000000004005b0 <main>
35           high_pc              (data8) 11 (0x00000000004005bb)
36           stmt_list            (sec_offset) 0
37 [    29]    subprogram           abbrev: 9
38             external             (flag_present) yes
39             name                 (strp) "main"
40             decl_file            (data1) <stdin> (1)
41             decl_line            (data1) 1
42             type                 (ref4) [    46]
43             low_pc               (addr) 0x00000000004005b0 <main>
44             high_pc              (data8) 11 (0x00000000004005bb)
45             frame_base           (exprloc)
46              [ 0] call_frame_cfa
47             GNU_all_call_sites   (flag_present) yes
48 [    46]    base_type            abbrev: 10
49             byte_size            (data1) 4
50             encoding             (data1) signed (5)
51             name                 (string) "int"
52 [    4d]    variable             abbrev: 11
53             name                 (string) "a"
54             decl_file            (data1) <stdin> (1)
55             decl_line            (data1) 1
56             type                 (ref_sig8) {18763953736e2de0}
57             external             (flag_present) yes
58             location             (exprloc)
59              [ 0] addr 0x601030 <a>
60 [    64]    variable             abbrev: 11
61             name                 (string) "b"
62             decl_file            (data1) <stdin> (1)
63             decl_line            (data1) 1
64             type                 (ref_sig8) {7cf9bbf793fcaf13}
65             external             (flag_present) yes
66             location             (exprloc)
67              [ 0] addr 0x601031 <b>
68
69DWARF section [31] '.debug_str' at offset 0x11dd:
70 Offset  String
71 [   0]  "/home/mark/src/elfutils/tests"
72 [  1e]  "GNU C++ 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic -march=x86-64 -g -fdebug-types-section"
73 [  7e]  "main"
74
75DWARF section [32] '.debug_types' at offset 0x1260:
76 [Offset]
77 Type unit at offset 0:
78 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
79 Type signature: 0x7cf9bbf793fcaf13, Type offset: 0x38 [38]
80 [    17]  type_unit            abbrev: 1
81           language             (data1) C_plus_plus (4)
82           GNU_odr_signature    (data8) 4783233826607187165
83           stmt_list            (sec_offset) 0
84 [    25]    structure_type       abbrev: 2
85             name                 (string) "A"
86             signature            (ref_sig8) {18763953736e2de0}
87             declaration          (flag_present) yes
88             sibling              (ref4) [    38]
89 [    34]      structure_type       abbrev: 3
90               name                 (string) "B"
91               declaration          (flag_present) yes
92 [    38]    structure_type       abbrev: 4
93             name                 (string) "B"
94             byte_size            (data1) 1
95             decl_file            (data1) <stdin> (1)
96             decl_line            (data1) 1
97             specification        (ref4) [    34]
98 Type unit at offset 67:
99 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
100 Type signature: 0x18763953736e2de0, Type offset: 0x25 [25]
101 [    5a]  type_unit            abbrev: 1
102           language             (data1) C_plus_plus (4)
103           GNU_odr_signature    (data8) 16005269134005989797
104           stmt_list            (sec_offset) 0
105 [    68]    structure_type       abbrev: 5
106             name                 (string) "A"
107             byte_size            (data1) 1
108             decl_file            (data1) <stdin> (1)
109             decl_line            (data1) 1
110 [    6e]      structure_type       abbrev: 6
111               name                 (string) "B"
112               declaration          (flag_present) yes
113               signature            (ref_sig8) {7cf9bbf793fcaf13}
114 [    79]      member               abbrev: 7
115               name                 (string) "x"
116               decl_file            (data1) <stdin> (1)
117               decl_line            (data1) 1
118               type                 (ref4) [    6e]
119               data_member_location (data1) 0
120EOF
121
122exit 0
123