Fix libunwind segfault when -p is passed before -k
* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after unwind_init for all allocated tcb structures if stack trace is enabled. * unwind.c (unwind_tcb_init): Skip if tcb is already initialized. Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
parent
9555f21588
commit
54c7792bfd
8
strace.c
8
strace.c
@ -1769,8 +1769,14 @@ init(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_LIBUNWIND
|
#ifdef USE_LIBUNWIND
|
||||||
if (stack_trace_enabled)
|
if (stack_trace_enabled) {
|
||||||
|
unsigned int tcbi;
|
||||||
|
|
||||||
unwind_init();
|
unwind_init();
|
||||||
|
for (tcbi = 0; tcbi < tcbtabsize; ++tcbi) {
|
||||||
|
unwind_tcb_init(tcbtab[tcbi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* See if they want to run as another user. */
|
/* See if they want to run as another user. */
|
||||||
|
3
unwind.c
3
unwind.c
@ -103,6 +103,9 @@ unwind_init(void)
|
|||||||
void
|
void
|
||||||
unwind_tcb_init(struct tcb *tcp)
|
unwind_tcb_init(struct tcb *tcp)
|
||||||
{
|
{
|
||||||
|
if (tcp->libunwind_ui)
|
||||||
|
return;
|
||||||
|
|
||||||
tcp->libunwind_ui = _UPT_create(tcp->pid);
|
tcp->libunwind_ui = _UPT_create(tcp->pid);
|
||||||
if (!tcp->libunwind_ui)
|
if (!tcp->libunwind_ui)
|
||||||
die_out_of_memory();
|
die_out_of_memory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user