* [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x}
@ 2004-06-08 13:11 Jakub Jelinek
2004-06-08 13:42 ` Steve Munroe
2004-06-11 19:28 ` Roland McGrath
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2004-06-08 13:11 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
libgcc_s.so's unwinder has no way to get at the statically linked binary's
unwind tables. For -static, we really want to use _Unwind_* stuff
from libgcc_eh.a.
2004-06-08 Jakub Jelinek <jakub@redhat.com>
* sysdeps/s390/s390-32/backtrace.c (init): Guard with #ifdef SHARED.
(unwind_backtrace, unwind_getip): Define #ifndef SHARED.
(__backtrace): Don't call init #ifndef SHARED.
* sysdeps/s390/s390-64/backtrace.c (init): Guard with #ifdef SHARED.
(unwind_backtrace, unwind_getip): Define #ifndef SHARED.
(__backtrace): Don't call init #ifndef SHARED.
* sysdeps/ia64/backtrace.c (init): Guard with #ifdef SHARED.
(unwind_backtrace, unwind_getip): Define #ifndef SHARED.
(__backtrace): Don't call init #ifndef SHARED.
--- libc/sysdeps/s390/s390-32/backtrace.c.jj 2003-12-11 22:23:20.000000000 +0100
+++ libc/sysdeps/s390/s390-32/backtrace.c 2004-06-08 14:56:56.516905061 +0200
@@ -1,5 +1,5 @@
/* Return backtrace of current program state.
- Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -61,6 +61,7 @@ struct trace_arg
int cnt, size;
};
+#ifdef SHARED
static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
@@ -77,6 +78,10 @@ init (void)
if (unwind_getip == NULL)
unwind_backtrace = NULL;
}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
static int
__backchain_backtrace (void **array, int size)
@@ -122,9 +127,11 @@ int
__backtrace (void **array, int size)
{
struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+#ifdef SHARED
__libc_once_define (static, once);
__libc_once (once, init);
+#endif
if (unwind_backtrace == NULL)
return __backchain_backtrace (array, size);
--- libc/sysdeps/s390/s390-64/backtrace.c.jj 2003-12-11 20:18:30.000000000 +0100
+++ libc/sysdeps/s390/s390-64/backtrace.c 2004-06-08 14:57:59.804563089 +0200
@@ -1,5 +1,5 @@
/* Return backtrace of current program state. 64 bit S/390 version.
- Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -60,6 +60,7 @@ struct trace_arg
int cnt, size;
};
+#ifdef SHARED
static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
@@ -76,6 +77,10 @@ init (void)
if (unwind_getip == NULL)
unwind_backtrace = NULL;
}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
int
__backchain_backtrace (void **array, int size)
@@ -121,9 +126,11 @@ int
__backtrace (void **array, int size)
{
struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+#ifdef SHARED
__libc_once_define (static, once);
__libc_once (once, init);
+#endif
if (unwind_backtrace == NULL)
return __backchain_backtrace (array, size);
--- libc/sysdeps/ia64/backtrace.c.jj 2003-10-24 14:02:44.000000000 +0200
+++ libc/sysdeps/ia64/backtrace.c 2004-06-08 14:49:37.328613321 +0200
@@ -1,5 +1,5 @@
/* Return backtrace of current program state.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -30,6 +30,7 @@ struct trace_arg
int cnt, size;
};
+#ifdef SHARED
static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
@@ -46,6 +47,10 @@ init (void)
if (unwind_getip == NULL)
unwind_backtrace = NULL;
}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
static _Unwind_Reason_Code
backtrace_helper (struct _Unwind_Context *ctx, void *a)
@@ -67,11 +72,13 @@ __backtrace (array, size)
int size;
{
struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+#ifdef SHARED
__libc_once_define (static, once);
__libc_once (once, init);
if (unwind_backtrace == NULL)
return 0;
+#endif
if (size >= 1)
unwind_backtrace (backtrace_helper, &arg);
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x}
2004-06-08 13:11 [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x} Jakub Jelinek
@ 2004-06-08 13:42 ` Steve Munroe
2004-06-08 13:53 ` Jakub Jelinek
2004-06-11 19:28 ` Roland McGrath
1 sibling, 1 reply; 4+ messages in thread
From: Steve Munroe @ 2004-06-08 13:42 UTC (permalink / raw)
To: Jakub Jelinek, Alan Modra; +Cc: Ulrich Drepper, Glibc hackers
Jakub Jelinek <jakub@redhat.com> wrote on 06/08/2004 05:57:35 AM:
> Hi!
>
> libgcc_s.so's unwinder has no way to get at the statically linked
binary's
> unwind tables. For -static, we really want to use _Unwind_* stuff
> from libgcc_eh.a.
>
Alan, Is this needed for PPC32/PPC64 as well?
Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x}
2004-06-08 13:42 ` Steve Munroe
@ 2004-06-08 13:53 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2004-06-08 13:53 UTC (permalink / raw)
To: Steve Munroe; +Cc: Alan Modra, Ulrich Drepper, Glibc hackers
On Tue, Jun 08, 2004 at 08:41:54AM -0500, Steve Munroe wrote:
> > libgcc_s.so's unwinder has no way to get at the statically linked binary's
> > unwind tables. For -static, we really want to use _Unwind_* stuff
> > from libgcc_eh.a.
> >
>
> Alan, Is this needed for PPC32/PPC64 as well?
Neither PPC, nor IA-32 use unwind info in backtrace(3).
Until they do, such change is not needed for them.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x}
2004-06-08 13:11 [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x} Jakub Jelinek
2004-06-08 13:42 ` Steve Munroe
@ 2004-06-11 19:28 ` Roland McGrath
1 sibling, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2004-06-11 19:28 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
> 2004-06-08 Jakub Jelinek <jakub@redhat.com>
>
> * sysdeps/s390/s390-32/backtrace.c (init): Guard with #ifdef SHARED.
> (unwind_backtrace, unwind_getip): Define #ifndef SHARED.
> (__backtrace): Don't call init #ifndef SHARED.
> * sysdeps/s390/s390-64/backtrace.c (init): Guard with #ifdef SHARED.
> (unwind_backtrace, unwind_getip): Define #ifndef SHARED.
> (__backtrace): Don't call init #ifndef SHARED.
> * sysdeps/ia64/backtrace.c (init): Guard with #ifdef SHARED.
> (unwind_backtrace, unwind_getip): Define #ifndef SHARED.
> (__backtrace): Don't call init #ifndef SHARED.
I've put this in.
Thanks,
Roland
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-06-11 19:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 13:11 [PATCH] Fix backtrace in statically linked programs on ia64/x86-64/s390{,x} Jakub Jelinek
2004-06-08 13:42 ` Steve Munroe
2004-06-08 13:53 ` Jakub Jelinek
2004-06-11 19:28 ` Roland McGrath
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).