[PATCH] unwind: initialize unwind context only if given tcb is initialized

Masatake YAMATO yamato at redhat.com
Fri Apr 20 00:47:44 UTC 2018


On Fri, 20 Apr 2018 01:44:51 +0300, "Dmitry V. Levin" <ldv at altlinux.org> wrote:
>> --- a/strace.c
>> +++ b/strace.c
>> @@ -1783,6 +1783,8 @@ init(int argc, char *argv[])
>>  
>>  		unwind_init();
>>  		for (tcbi = 0; tcbi < tcbtabsize; ++tcbi) {
>> +			if (!tcbtab[tcbi]->pid)
>> +				continue;
>>  			unwind_tcb_init(tcbtab[tcbi]);
>>  		}
>>  	}
> 
> Apparently, we don't need this loop at all, there is no use to call
> unwind_tcb_init until the tracee is actually attached.  The proper place
> for unwind_tcb_init invocation is the same as for newoutf.
> I've pushed a few commits to implement this change.

Much better fix.
The function name is also improved.

One thing I cannot be convince is the following code block:

    static struct tcb *
    maybe_switch_tcbs(struct tcb *tcp, const int pid)
    {
	    ...	
	    tcp->pid = pid;

pid of tcb is updated. I wonder whether unwind context can be attached
well to the modified(?) tcb.

I could not write a test executable that makes strace execute the line.

Masatake YAMATO


More information about the Strace-devel mailing list