[PATCH v3] Implement -e trace=/regex option

JingPiao Chen chenjingpiao at gmail.com
Thu Apr 13 01:33:06 UTC 2017


On Thu, Apr 13, 2017 at 5:10 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
>On Wed, Apr 12, 2017 at 09:31:51PM +0800, JingPiao Chen wrote:
>> @@ -198,6 +199,48 @@ qualify_syscall_number(const char *s, struct
number_set *set)
>>   return done;
>>  }
>>
>> +static bool
>> +qualify_syscall_regex(const char *s, struct number_set *set)
>> +{
>> + regex_t preg;
>> + int rc;
>> +
>> + if ((rc = regcomp(&preg, s, REG_EXTENDED | REG_NOSUB)) != 0) {
>> + size_t len = regerror(rc, &preg, NULL, 0);
>> + char buf[len];
>
>We don't use VLA on the stack, it is not portable.  In particular,
>it won't pass travis-ci clang tests.  If you've pushed it to github
>and enabled travis-ci, you'd have noticed.

Ok, I replace it with alloca. But it pass travis-ci clang tests [1],
and strace have similar code in socketutils.c:152.

>
>Why do you need it here?

The length of buffer is unknown, len return by first regerror call.

[1]https://travis-ci.org/ppiao/strace/builds/22134567

JingPiao Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170413/2526a03d/attachment.html>


More information about the Strace-devel mailing list