From b6e14b3cfc330499fe96f81ac4ca30f1ac0512bf Mon Sep 17 00:00:00 2001 From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 22 Jun 2007 20:06:35 +0000 Subject: [PATCH] * pthread_support.c (GC_get_thread_stack_base): Handle pthread_getattr_np failures. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125957 138bc75d-0d04-0410-961f-82ee72b054a4 --- boehm-gc/ChangeLog | 5 +++++ boehm-gc/pthread_support.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index 89e48b942ed8..f140791a56f0 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,8 @@ +2007-06-22 Jakub Jelinek <jakub@redhat.com> + + * pthread_support.c (GC_get_thread_stack_base): Handle + pthread_getattr_np failures. + 2007-06-02 Paolo Bonzini <bonzini@gnu.org> * configure: Regenerate. diff --git a/boehm-gc/pthread_support.c b/boehm-gc/pthread_support.c index bbda8522c030..f0a58c886a3a 100644 --- a/boehm-gc/pthread_support.c +++ b/boehm-gc/pthread_support.c @@ -1135,7 +1135,13 @@ GC_PTR GC_get_thread_stack_base() size_t stack_size; my_pthread = pthread_self(); - pthread_getattr_np (my_pthread, &attr); + if (pthread_getattr_np (my_pthread, &attr) != 0) + { +# ifdef DEBUG_THREADS + GC_printf1("Can not determine stack base for attached thread"); +# endif + return 0; + } pthread_attr_getstack (&attr, (void **) &stack_addr, &stack_size); pthread_attr_destroy (&attr); -- GitLab