diff options
author | Hannes Domani <ssbssa@yahoo.de> | 2020-02-09 17:37:58 +0100 |
---|---|---|
committer | Hannes Domani <ssbssa@yahoo.de> | 2020-02-12 17:02:35 +0100 |
commit | cd5900f33b5bbd53a628071e4e7ab0d46af735ee (patch) | |
tree | 8f47f594380a726392e8cb36a11e2b0bd78ec1da /gdb | |
parent | 6c0946d0d28d787b166cae3c2ebc2cb309c4f5a2 (diff) | |
download | gdb-cd5900f33b5bbd53a628071e4e7ab0d46af735ee.zip gdb-cd5900f33b5bbd53a628071e4e7ab0d46af735ee.tar.gz gdb-cd5900f33b5bbd53a628071e4e7ab0d46af735ee.tar.bz2 |
Cache the Thread Local Base pointer type in the gdbarch
gdb/ChangeLog:
2020-02-12 Hannes Domani <ssbssa@yahoo.de>
* windows-tdep.c (struct windows_gdbarch_data): Add tib_ptr_type.
(windows_get_tlb_type): Use windows_gdbarch_data->tib_ptr_type.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 15 |
2 files changed, 12 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 43fe4de..6629b8a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-02-12 Hannes Domani <ssbssa@yahoo.de> + + * windows-tdep.c (struct windows_gdbarch_data): Add tib_ptr_type. + (windows_get_tlb_type): Use windows_gdbarch_data->tib_ptr_type. + 2020-02-11 Tom Tromey <tom@tromey.com> * psymtab.h: Update comment. diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index e978788..6eef3fb 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -158,6 +158,7 @@ static struct gdbarch_data *windows_gdbarch_data_handle; struct windows_gdbarch_data { struct type *siginfo_type; + struct type *tib_ptr_type; /* Type of thread information block */ }; /* Allocate windows_gdbarch_data for an arch. */ @@ -182,8 +183,6 @@ get_windows_gdbarch_data (struct gdbarch *gdbarch) static struct type * windows_get_tlb_type (struct gdbarch *gdbarch) { - static struct gdbarch *last_gdbarch = NULL; - static struct type *last_tlb_type = NULL; struct type *dword_ptr_type, *dword32_type, *void_ptr_type; struct type *peb_ldr_type, *peb_ldr_ptr_type; struct type *peb_type, *peb_ptr_type, *list_type; @@ -192,10 +191,11 @@ windows_get_tlb_type (struct gdbarch *gdbarch) struct type *word_type, *wchar_type, *wchar_ptr_type; struct type *uni_str_type, *rupp_type, *rupp_ptr_type; - /* Do not rebuild type if same gdbarch as last time. */ - if (last_tlb_type && last_gdbarch == gdbarch) - return last_tlb_type; - + windows_gdbarch_data *windows_gdbarch_data + = get_windows_gdbarch_data (gdbarch); + if (windows_gdbarch_data->tib_ptr_type != nullptr) + return windows_gdbarch_data->tib_ptr_type; + dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "DWORD_PTR"); dword32_type = arch_integer_type (gdbarch, 32, @@ -365,8 +365,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) NULL); TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; - last_tlb_type = tib_ptr_type; - last_gdbarch = gdbarch; + windows_gdbarch_data->tib_ptr_type = tib_ptr_type; return tib_ptr_type; } |