Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2018-2020 Free Software Foundation, Inc. |
7ab6656f OJ |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | # This file is part of the gdb testsuite | |
17 | ||
18 | # | |
19 | # PR gdb/21695 | |
20 | # This tests if gdb can display line information of relocated symbols in the | |
21 | # case where executable text section was at address zero before relocation. | |
22 | # | |
23 | ||
24 | standard_testfile .c | |
25 | ||
26 | if [get_compiler_info] { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | # Build executable with stripped startup code and text section starting at zero | |
31 | ||
4625b4d0 | 32 | set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"} |
7ab6656f OJ |
33 | |
34 | if {[build_executable $testfile.exp $testfile $srcfile $opts] == -1} { | |
35 | untested "failed to compile" | |
36 | return -1 | |
37 | } | |
38 | ||
39 | clean_restart | |
40 | ||
41 | # Load symbols at an offset 0xffff0000 using add-symbol-file | |
42 | ||
43 | gdb_test "add-symbol-file $binfile 0xffff0000" \ | |
44 | "Reading symbols from .*" \ | |
45 | "add-symbol-file" \ | |
46 | "add symbol table from file \".*\" at.*\\(y or n\\) " "y" | |
47 | ||
48 | # Check if we are able to read offset adjusted line information of main | |
49 | ||
50 | gdb_test "info line main" \ | |
51 | "Line.*starts at address 0xffff0000.*and ends at.*" |