binutils-gdb/gdb/dwarf2
Tom de Vries 8f5c6526eb [gdb/breakpoint, PIE] Handle setting breakpoint on label without address
When adding:
...
if ![runto_main] then {
    fail "can't run to main"
    return 0
}
...
to test-case gdb.base/label-without-address.exp and running it with target
board unix/-fPIE/-pie, we run into:
...
(gdb) break main:L1^M
Breakpoint 2 at 0x555555554000: file label-without-address.c, line 22.^M
...
That is, for a label with optimized-out address, we set a breakpoint at the
relocation base.

The root cause is that the dwarf reader, despite finding that attribute
DW_AT_low_pc is missing, still tags the L1 symbol as having LOC_LABEL, which
means it has a valid address, which defaults to 0.

Fix this by instead tagging the L1 symbol with LOC_OPTIMIZED_OUT.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-09-03  Tom de Vries  <tdevries@suse.de>

	PR breakpoint/26546
	* dwarf2/read.c (new_symbol): Tag label symbol without DW_AT_low_pc as
	LOC_OPTIMIZED_OUT instead of LOC_LABEL.

gdb/testsuite/ChangeLog:

2020-09-03  Tom de Vries  <tdevries@suse.de>

	PR breakpoint/26546
	* gdb.base/label-without-address.exp: Runto main first.
2020-09-03 12:30:10 +02:00
..
abbrev.c Inline abbrev lookup 2020-05-27 11:48:19 -06:00
abbrev.h Inline abbrev lookup 2020-05-27 11:48:19 -06:00
attribute.c Attribute method inlining 2020-05-27 11:48:18 -06:00
attribute.h Attribute method inlining 2020-05-27 11:48:18 -06:00
comp-unit.c gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
comp-unit.h gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
die.h Rewrite new die_info methods 2020-03-26 09:28:26 -06:00
dwz.c Add dwz.c and dwz_file::read_string 2020-03-26 09:28:09 -06:00
dwz.h Add dwz.c and dwz_file::read_string 2020-03-26 09:28:09 -06:00
expr.c Fix bug in DW_OP_GNU_variable_value evaluation 2020-07-28 10:55:43 -06:00
expr.h Add dwarf2_per_objfile to dwarf_expr_context and dwarf2_frame_cache 2020-05-27 11:15:56 -04:00
frame-tailcall.c gdb: use bool in frame code 2020-08-04 14:53:10 -04:00
frame-tailcall.h Move DWARF code to dwarf2/ subdirectory 2020-02-08 13:40:59 -07:00
frame.c Add dwarf2_per_objfile to dwarf_expr_context and dwarf2_frame_cache 2020-05-27 11:15:56 -04:00
frame.h Don't forward-declare struct objfile in dwarf2/frame.h 2020-02-11 17:57:46 -07:00
index-cache.c gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
index-cache.h gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
index-common.c Move DWARF code to dwarf2/ subdirectory 2020-02-08 13:40:59 -07:00
index-common.h Move DWARF code to dwarf2/ subdirectory 2020-02-08 13:40:59 -07:00
index-write.c gdb: move regcache::regcaches to regcache.c 2020-08-06 16:23:48 -04:00
index-write.h gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
leb.c Move read_offset_1 to leb.c 2020-02-08 13:43:24 -07:00
leb.h Move two more functions to dwarf2/leb.h 2020-02-08 13:43:24 -07:00
line-header.c gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
line-header.h gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
loc.c gdb: fix wrong indentation in symbol_needs_eval_context 2020-08-17 06:02:24 -04:00
loc.h Remove dwarf2_per_cu_data::objfile () 2020-05-27 11:15:57 -04:00
macro.c gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
macro.h gdb: rename dwarf2_per_objfile variables/fields to per_objfile 2020-05-29 15:15:10 -04:00
read.c [gdb/breakpoint, PIE] Handle setting breakpoint on label without address 2020-09-03 12:30:10 +02:00
read.h gdb: replace function pointer with void * data with function_view 2020-08-09 18:26:48 -04:00
section.c Add dwarf2_section_info::read_string method 2020-03-26 09:28:14 -06:00
section.h Add dwarf2_section_info::read_string method 2020-03-26 09:28:14 -06:00
stringify.c Move DWARF-constant stringifying code to new file 2020-03-26 09:28:26 -06:00
stringify.h Move DWARF-constant stringifying code to new file 2020-03-26 09:28:26 -06:00