diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h index af92f413..291b1018 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h @@ -227,7 +227,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) #define arm_find_proc_info UNW_OBJ(find_proc_info) #define arm_put_unwind_info UNW_OBJ(put_unwind_info) @@ -264,7 +264,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) ((as)->big_endian) -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-hppa/libunwind_i.h b/include/tdep-hppa/libunwind_i.h index a94138d6..b5bbcecc 100644 --- a/include/tdep-hppa/libunwind_i.h +++ b/include/tdep-hppa/libunwind_i.h @@ -224,7 +224,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ @@ -259,7 +259,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) 1 -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-ia64/libunwind_i.h b/include/tdep-ia64/libunwind_i.h index 71e4310b..4d1806d6 100644 --- a/include/tdep-ia64/libunwind_i.h +++ b/include/tdep-ia64/libunwind_i.h @@ -186,7 +186,7 @@ struct ia64_global_unwind_state { pthread_mutex_t lock; /* global data lock */ - volatile char needs_initialization; + volatile char init_done; /* Table of registers that prologues can save (and order in which they're saved). */ @@ -217,7 +217,7 @@ struct ia64_global_unwind_state }; #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization unw.needs_initialization +#define tdep_init_done unw.init_done #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h index f2bc8936..3ef1cef3 100644 --- a/include/tdep-mips/libunwind_i.h +++ b/include/tdep-mips/libunwind_i.h @@ -277,7 +277,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ @@ -311,7 +311,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_get_as_arg(c) ((c)->dwarf.as_arg) #define tdep_get_ip(c) ((c)->dwarf.ip) -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-ppc32/libunwind_i.h b/include/tdep-ppc32/libunwind_i.h index 7e669977..06c00236 100644 --- a/include/tdep-ppc32/libunwind_i.h +++ b/include/tdep-ppc32/libunwind_i.h @@ -252,7 +252,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ @@ -291,7 +291,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) 1 -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h index aa979b96..6d728586 100644 --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -252,7 +252,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ @@ -291,7 +291,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) 1 -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-x86/libunwind_i.h b/include/tdep-x86/libunwind_i.h index ddcdc10b..f59a3cfb 100644 --- a/include/tdep-x86/libunwind_i.h +++ b/include/tdep-x86/libunwind_i.h @@ -238,7 +238,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ @@ -273,7 +273,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) 0 -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/include/tdep-x86_64/libunwind_i.h b/include/tdep-x86_64/libunwind_i.h index 3bd0101c..8c9cd051 100644 --- a/include/tdep-x86_64/libunwind_i.h +++ b/include/tdep-x86_64/libunwind_i.h @@ -178,7 +178,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) -#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_done UNW_OBJ(init_done) #define tdep_init_mem_validate UNW_OBJ(init_mem_validate) #define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define @@ -220,7 +220,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_big_endian(as) 0 -extern int tdep_needs_initialization; +extern int tdep_init_done; extern void tdep_init (void); extern void tdep_init_mem_validate (void); diff --git a/src/arm/Gglobal.c b/src/arm/Gglobal.c index 2856ba93..ce692f7b 100644 --- a/src/arm/Gglobal.c +++ b/src/arm/Gglobal.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t arm_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; /* Unwinding methods to use. See UNW_METHOD_ enums */ HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL; @@ -40,7 +40,7 @@ tdep_init (void) lock_acquire (&arm_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -58,7 +58,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY arm_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&arm_lock, saved_mask); diff --git a/src/arm/Ginit_local.c b/src/arm/Ginit_local.c index 87d07a37..e1cc30c6 100644 --- a/src/arm/Ginit_local.c +++ b/src/arm/Ginit_local.c @@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/arm/Ginit_remote.c b/src/arm/Ginit_remote.c index 854f3b62..f284e994 100644 --- a/src/arm/Ginit_remote.c +++ b/src/arm/Ginit_remote.c @@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/hppa/Gglobal.c b/src/hppa/Gglobal.c index f453a43b..849b8e55 100644 --- a/src/hppa/Gglobal.c +++ b/src/hppa/Gglobal.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "unwind_i.h" HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; HIDDEN void tdep_init (void) @@ -37,7 +37,7 @@ tdep_init (void) lock_acquire (&hppa_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -48,7 +48,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY hppa_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&hppa_lock, saved_mask); diff --git a/src/hppa/Ginit_local.c b/src/hppa/Ginit_local.c index 6d4dd3df..40277f29 100644 --- a/src/hppa/Ginit_local.c +++ b/src/hppa/Ginit_local.c @@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/hppa/Ginit_remote.c b/src/hppa/Ginit_remote.c index bd6093f1..50ec62cf 100644 --- a/src/hppa/Ginit_remote.c +++ b/src/hppa/Ginit_remote.c @@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/hppa/get_accessors.c b/src/hppa/get_accessors.c index b6bd49a7..cac6cba1 100644 --- a/src/hppa/get_accessors.c +++ b/src/hppa/get_accessors.c @@ -28,10 +28,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED unw_accessors_t * unw_get_accessors (unw_addr_space_t as) { - if (hppa_needs_initialization) - { - hppa_needs_initialization = 0; - hppa_init (); - } + if (!tdep_init_done) + tdep_init (); + return &as->acc; } diff --git a/src/ia64/Gglobal.c b/src/ia64/Gglobal.c index b04a5783..f9eea62d 100644 --- a/src/ia64/Gglobal.c +++ b/src/ia64/Gglobal.c @@ -29,7 +29,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN struct ia64_global_unwind_state unw = { - .needs_initialization = 1, .lock = PTHREAD_MUTEX_INITIALIZER, .save_order = { IA64_REG_IP, IA64_REG_PFS, IA64_REG_PSP, IA64_REG_PR, @@ -73,7 +72,7 @@ tdep_init (void) lock_acquire (&unw.lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -116,7 +115,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ia64_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&unw.lock, saved_mask); diff --git a/src/ia64/Ginit_local.c b/src/ia64/Ginit_local.c index 42f8b1f0..5f82c013 100644 --- a/src/ia64/Ginit_local.c +++ b/src/ia64/Ginit_local.c @@ -83,7 +83,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) unw_word_t sp, bsp; int ret; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/ia64/Ginit_remote.c b/src/ia64/Ginit_remote.c index ae0b718c..334d236f 100644 --- a/src/ia64/Ginit_remote.c +++ b/src/ia64/Ginit_remote.c @@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) unw_word_t sp, bsp; int ret; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/mi/Gget_accessors.c b/src/mi/Gget_accessors.c index fb256d70..0e3606c6 100644 --- a/src/mi/Gget_accessors.c +++ b/src/mi/Gget_accessors.c @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED unw_accessors_t * unw_get_accessors (unw_addr_space_t as) { - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); return &as->acc; } diff --git a/src/mi/Gset_caching_policy.c b/src/mi/Gset_caching_policy.c index 52fc7e54..421c4357 100644 --- a/src/mi/Gset_caching_policy.c +++ b/src/mi/Gset_caching_policy.c @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED int unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) { - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); #ifndef HAVE___THREAD diff --git a/src/mips/Gglobal.c b/src/mips/Gglobal.c index a0386f60..a29583f7 100644 --- a/src/mips/Gglobal.c +++ b/src/mips/Gglobal.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t mips_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; HIDDEN void tdep_init (void) @@ -37,7 +37,7 @@ tdep_init (void) lock_acquire (&mips_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -48,7 +48,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY mips_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&mips_lock, saved_mask); diff --git a/src/mips/Ginit_local.c b/src/mips/Ginit_local.c index debf5bb5..e5e1c5a3 100644 --- a/src/mips/Ginit_local.c +++ b/src/mips/Ginit_local.c @@ -40,7 +40,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/mips/Ginit_remote.c b/src/mips/Ginit_remote.c index 854f3b62..f284e994 100644 --- a/src/mips/Ginit_remote.c +++ b/src/mips/Ginit_remote.c @@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/ppc/Ginit_local.c b/src/ppc/Ginit_local.c index b931b5b6..4ca2b25b 100644 --- a/src/ppc/Ginit_local.c +++ b/src/ppc/Ginit_local.c @@ -48,7 +48,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/ppc/Ginit_remote.c b/src/ppc/Ginit_remote.c index 0f4b0fdb..4ee54025 100644 --- a/src/ppc/Ginit_remote.c +++ b/src/ppc/Ginit_remote.c @@ -41,7 +41,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/ppc32/Gglobal.c b/src/ppc32/Gglobal.c index 15221f38..36566668 100644 --- a/src/ppc32/Gglobal.c +++ b/src/ppc32/Gglobal.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t ppc32_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; /* The API register numbers are exactly the same as the .eh_frame registers, for now at least. */ @@ -117,7 +117,7 @@ tdep_init (void) lock_acquire (&ppc32_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -128,7 +128,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ppc32_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&ppc32_lock, saved_mask); diff --git a/src/ppc64/Gglobal.c b/src/ppc64/Gglobal.c index 888554d3..c192f629 100644 --- a/src/ppc64/Gglobal.c +++ b/src/ppc64/Gglobal.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t ppc64_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; /* The API register numbers are exactly the same as the .eh_frame registers, for now at least. */ @@ -164,7 +164,7 @@ tdep_init (void) lock_acquire (&ppc64_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -175,7 +175,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ppc64_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&ppc64_lock, saved_mask); diff --git a/src/x86/Gglobal.c b/src/x86/Gglobal.c index 3c97853c..d7f53263 100644 --- a/src/x86/Gglobal.c +++ b/src/x86/Gglobal.c @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t x86_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; /* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ @@ -49,7 +49,7 @@ tdep_init (void) lock_acquire (&x86_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -60,7 +60,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY x86_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&x86_lock, saved_mask); diff --git a/src/x86/Ginit_local.c b/src/x86/Ginit_local.c index 5e8b6972..412663be 100644 --- a/src/x86/Ginit_local.c +++ b/src/x86/Ginit_local.c @@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/x86/Ginit_remote.c b/src/x86/Ginit_remote.c index aa924052..c8899054 100644 --- a/src/x86/Ginit_remote.c +++ b/src/x86/Ginit_remote.c @@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/x86_64/Gglobal.c b/src/x86_64/Gglobal.c index b9b001aa..7c66b6dd 100644 --- a/src/x86_64/Gglobal.c +++ b/src/x86_64/Gglobal.c @@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN pthread_mutex_t x86_64_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; +HIDDEN int tdep_init_done; /* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ @@ -82,7 +82,7 @@ tdep_init (void) lock_acquire (&x86_64_lock, saved_mask); { - if (!tdep_needs_initialization) + if (tdep_init_done) /* another thread else beat us to it... */ goto out; @@ -95,7 +95,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY x86_64_local_addr_space_init (); #endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&x86_64_lock, saved_mask); diff --git a/src/x86_64/Ginit_local.c b/src/x86_64/Ginit_local.c index 54b4fcdb..8c3f0606 100644 --- a/src/x86_64/Ginit_local.c +++ b/src/x86_64/Ginit_local.c @@ -43,7 +43,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) { struct cursor *c = (struct cursor *) cursor; - if (unlikely (tdep_needs_initialization)) + if (unlikely (!tdep_init_done)) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/x86_64/Ginit_remote.c b/src/x86_64/Ginit_remote.c index 25dd6860..1b7123c0 100644 --- a/src/x86_64/Ginit_remote.c +++ b/src/x86_64/Ginit_remote.c @@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) #else /* !UNW_LOCAL_ONLY */ struct cursor *c = (struct cursor *) cursor; - if (tdep_needs_initialization) + if (!tdep_init_done) tdep_init (); Debug (1, "(cursor=%p)\n", c);