Skip to content

Commit

Permalink
[ARM] Store exception handling information per-bfd instead of per-obj…
Browse files Browse the repository at this point in the history
…file

Based on feedback from Tromey, update the use of objfile_key in gdb/arm-tdep.c
to use bfd_key instead. That way we don't have to re-create the exception
handling data all over again if it was done before for the same BFD.

gdb/ChangeLog:

2019-10-31  Luis Machado  <luis.machado@linaro.org>

	* arm-tdep.c (arm_exidx_data_key): Use bfd_key instead of
	objfile_key.
	(arm_exidx_new_objfile): Adjust to use objfile->obfd instead of
	objfile to fetch per-bfd data.
	(arm_find_exidx_entry): Likewise.

Change-Id: Ia7b3208ea8d788414600fa6d770ac76db0562859
  • Loading branch information
luislinaro committed Oct 31, 2019
1 parent 75cafaa commit a2726d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions gdb/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2019-10-31 Luis Machado <luis.machado@linaro.org>

* arm-tdep.c (arm_exidx_data_key): Use bfd_key instead of
objfile_key.
(arm_exidx_new_objfile): Adjust to use objfile->obfd instead of
objfile to fetch per-bfd data.
(arm_find_exidx_entry): Likewise.

2019-10-31 Christian Biesinger <cbiesinger@google.com>

* gdbsupport/agent.c (debug_agent): Change type to bool.
Expand Down
9 changes: 5 additions & 4 deletions gdb/arm-tdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,8 @@ struct arm_exidx_data
std::vector<std::vector<arm_exidx_entry>> section_maps;
};

static const struct objfile_key<arm_exidx_data> arm_exidx_data_key;
/* Per-BFD key to store exception handling information. */
static const struct bfd_key<arm_exidx_data> arm_exidx_data_key;

static struct obj_section *
arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
Expand Down Expand Up @@ -2043,7 +2044,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
LONGEST i;

/* If we've already touched this file, do nothing. */
if (!objfile || arm_exidx_data_key.get (objfile) != NULL)
if (!objfile || arm_exidx_data_key.get (objfile->obfd) != NULL)
return;

/* Read contents of exception table and index. */
Expand Down Expand Up @@ -2074,7 +2075,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
}

/* Allocate exception table data structure. */
data = arm_exidx_data_key.emplace (objfile);
data = arm_exidx_data_key.emplace (objfile->obfd);
data->section_maps.resize (objfile->obfd->section_count);

/* Fill in exception table. */
Expand Down Expand Up @@ -2246,7 +2247,7 @@ arm_find_exidx_entry (CORE_ADDR memaddr, CORE_ADDR *start)
struct arm_exidx_data *data;
struct arm_exidx_entry map_key = { memaddr - obj_section_addr (sec), 0 };

data = arm_exidx_data_key.get (sec->objfile);
data = arm_exidx_data_key.get (sec->objfile->obfd);
if (data != NULL)
{
std::vector<arm_exidx_entry> &map
Expand Down

0 comments on commit a2726d4

Please sign in to comment.