]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: fix logic of find_comp_unit and set_comp_unit
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 3 Dec 2020 20:47:56 +0000 (15:47 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 3 Dec 2020 20:47:56 +0000 (15:47 -0500)
commit0bc2e38dd71e24676e180b6b37e0a2cd1186994d
tree0ac8a90a0b8dce04798ab3af48fef2bd910520fd
parentb10b530a4566888492ac693773e1e35f66c4b7c4
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
gdb/ChangeLog
gdb/dwarf2/frame.c