public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/fw/unwind-link] __frame_state_for: Use <unwind-link.h> for unwinder access
@ 2020-02-13 10:46 Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2020-02-13 10:46 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cc2ab2b164ee6615bb82660f3ff9369bacce783f

commit cc2ab2b164ee6615bb82660f3ff9369bacce783f
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Feb 12 17:31:06 2020 +0100

    __frame_state_for: Use <unwind-link.h> for unwinder access

Diff:
---
 sysdeps/generic/framestate.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index e342ce8..83cfcd2 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -17,7 +17,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <dlfcn.h>
 #include <stdlib.h>
 #define STATIC static
 #define __frame_state_for fallback_frame_state_for
@@ -25,6 +24,8 @@
 #undef __frame_state_for
 #include <gnu/lib-names.h>
 
+#include <unwind-link.h>
+
 typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
 struct frame_state *__frame_state_for (void *pc,
 				       struct frame_state *frame_state);
@@ -32,21 +33,15 @@ struct frame_state *__frame_state_for (void *pc,
 struct frame_state *
 __frame_state_for (void *pc, struct frame_state *frame_state)
 {
-  static framesf frame_state_for;
-
-  if (frame_state_for == NULL)
+  struct unwind_link *unwind_link = __libc_unwind_link_get ();
+  if (unwind_link != NULL)
+    return UNWIND_LINK_PTR (unwind_link, __frame_state_for) (pc, frame_state);
+  else
     {
-      void *handle = __libc_dlopen (LIBGCC_S_SO);
-
-      if (handle == NULL
-	  || (frame_state_for
-	      = (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
 #ifndef __USING_SJLJ_EXCEPTIONS__
-	frame_state_for = fallback_frame_state_for;
+      return fallback_frame_state_for (pc, frame_state);
 #else
-	frame_state_for = abort;
+      abort ();
 #endif
     }
-
-  return frame_state_for (pc, frame_state);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc/fw/unwind-link] __frame_state_for: Use <unwind-link.h> for unwinder access
@ 2020-02-13 16:22 Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2020-02-13 16:22 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3cd557dd662c5ed0ead06fdbe54d5e0f5b799eee

commit 3cd557dd662c5ed0ead06fdbe54d5e0f5b799eee
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Feb 12 17:31:06 2020 +0100

    __frame_state_for: Use <unwind-link.h> for unwinder access

Diff:
---
 sysdeps/generic/framestate.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index e342ce8..83cfcd2 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -17,7 +17,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <dlfcn.h>
 #include <stdlib.h>
 #define STATIC static
 #define __frame_state_for fallback_frame_state_for
@@ -25,6 +24,8 @@
 #undef __frame_state_for
 #include <gnu/lib-names.h>
 
+#include <unwind-link.h>
+
 typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
 struct frame_state *__frame_state_for (void *pc,
 				       struct frame_state *frame_state);
@@ -32,21 +33,15 @@ struct frame_state *__frame_state_for (void *pc,
 struct frame_state *
 __frame_state_for (void *pc, struct frame_state *frame_state)
 {
-  static framesf frame_state_for;
-
-  if (frame_state_for == NULL)
+  struct unwind_link *unwind_link = __libc_unwind_link_get ();
+  if (unwind_link != NULL)
+    return UNWIND_LINK_PTR (unwind_link, __frame_state_for) (pc, frame_state);
+  else
     {
-      void *handle = __libc_dlopen (LIBGCC_S_SO);
-
-      if (handle == NULL
-	  || (frame_state_for
-	      = (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
 #ifndef __USING_SJLJ_EXCEPTIONS__
-	frame_state_for = fallback_frame_state_for;
+      return fallback_frame_state_for (pc, frame_state);
 #else
-	frame_state_for = abort;
+      abort ();
 #endif
     }
-
-  return frame_state_for (pc, frame_state);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-13 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 10:46 [glibc/fw/unwind-link] __frame_state_for: Use <unwind-link.h> for unwinder access Florian Weimer
2020-02-13 16:22 Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).