binutils-gdb/gdb/dwarf2
Simon Marchi 0bc2e38dd7 gdb: fix logic of find_comp_unit and set_comp_unit
The logic in find_comp_unit and set_comp_unit is reversed.  When the BFD
requires relocation, we want to put the comp_unit structure in the
map where the comp_unit objects are not shared, that is the one indexed
by objfile.  If the BFD does not require relocation, then, we can share
a single comp_unit structure for all users of that BFD, so we want to
put it in the BFD-indexed map.  The comments on top of
dwarf2_frame_bfd_data and dwarf2_frame_objfile_data make that clear.

Fix it by swapping the two in find_comp_unit and set_comp_unit.

I don't have a test for this, because I don't see how to write one in a
reasonable amount of time.

gdb/ChangeLog:

	PR gdb/26876
	* dwarf2/frame.c (find_comp_unit, set_comp_unit): Reverse use of
	dwarf2_frame_bfd_data and dwarf2_frame_objfile_data.

Change-Id: I80c1ee7ad8425fa4947de65b170973d05f5a52ec
2020-12-03 15:47:56 -05:00
..
abbrev.c Remove objfile parameter from abbrev_table::read 2020-11-05 18:27:43 -07:00
abbrev.h Remove objfile parameter from abbrev_table::read 2020-11-05 18:27:43 -07:00
attribute.c gdb, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05:00
attribute.h Remove DW_UNSND 2020-09-29 20:29:07 -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 Change die_info methods to check the attribute's form 2020-09-29 20:29:07 -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 gdb, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05: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 gdb: fix logic of find_comp_unit and set_comp_unit 2020-12-03 15:47:56 -05: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, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05: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, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05: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 Rewrite leb.h:read_3_bytes 2020-11-04 08:22:05 -07:00
line-header.c gdb, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05: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/symtab] Fix gdb.base/vla-optimized-out.exp with clang 2020-11-30 13:50:26 +01:00
loc.h Remove dwarf2_per_cu_data::objfile () 2020-05-27 11:15:57 -04:00
macro.c gdb, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05:00
macro.h DWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries. 2020-10-02 12:27:45 +05:30
read.c Search for DWZ files in debug-file-directories as well 2020-12-01 22:03:18 -05:00
read.h gdb, gdbserver, gdbsupport: fix leading space vs tabs issues 2020-11-02 10:28:45 -05: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