diff options
author | Omair Javaid <omair.javaid@linaro.org> | 2018-05-15 19:04:21 +0500 |
---|---|---|
committer | Omair Javaid <omair.javaid@linaro.org> | 2018-06-27 20:12:49 +0500 |
commit | 7ab6656f274b450942deb8800257c0d2e060fa84 (patch) | |
tree | 6149da797c45cdbd2cc01371f62ee794777cf1d6 /gdb/ChangeLog | |
parent | bd583225a52f920f71e417ef87092d25553dc85e (diff) | |
download | gdb-7ab6656f274b450942deb8800257c0d2e060fa84.zip gdb-7ab6656f274b450942deb8800257c0d2e060fa84.tar.gz gdb-7ab6656f274b450942deb8800257c0d2e060fa84.tar.bz2 |
Fix lost line info for symbol at addr zero
This patch fixes a unique condition where GDB fails to provide line
information of symbol at address zero when code is compiled with text
address zero but loaded at an offset > 0.
For example lets compile following code snippet:
int main() {
return 0;
}
gcc -O0 -g3 -nostdlib -emain -Wl,-Ttext=0x00 -o file.out file.c
Start gdb and run:
add-symbol-file file.out 0xffff0000
info line main
GDB will return error saying no line info is available for the symbol.
This is a direct consequence of the fix for PR 12528 where GDB tries to ignore
line table for a function which has been garbage collected by the linker.
As the garbage collected symbols are sent to address zero GDB assumes a symbol
actually placed at address zero as garbage collected.
This was fixed with an additional check address < lowpc. But when symbol is
loaded at an offset lowpc becomes lowpc + offset while no offset is added to
address rather final symbol address is calculated based on baseaddr and address
added together. So in case where symbols are loaded at an offset the condition
address < lowpc will always return true.
This patch fixes this by comparing address against a non offset lowpc.
This patch also adds a GDB test case to replicate this behavior.
gdb:
2018-06-27 Omair Javaid <omair.javaid@linaro.org>
PR gdb/21695
* dwarf2read.c (lnp_state_machine::check_line_address): Update declaration.
(dwarf_decode_lines_1): Adjust.
gdb/testsuite:
2018-06-27 Omair Javaid <omair.javaid@linaro.org>
PR gdb/21695
* gdb.base/infoline-reloc-main-from-zero.exp: New test.
* gdb.base/infoline-reloc-main-from-zero.c: New file.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c315246..a3882f5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-06-27 Omair Javaid <omair.javaid@linaro.org> + + PR gdb/21695 + * dwarf2read.c (lnp_state_machine::check_line_address): Update declaration. + (dwarf_decode_lines_1): Adjust. + 2018-06-27 Simon Marchi <simon.marchi@ericsson.com> * fbsd-nat.h (class fbsd_nat_target) <find_memory_regions>: Add |