[PATCH] Support AArch64 architecture

Petr Machata pmachata at redhat.com
Mon Nov 25 09:11:50 UTC 2013


Mark Wielaard <mjw at redhat.com> writes:

>> diff --git a/backends/aarch64_regs.c b/backends/aarch64_regs.c
>> +  ssize_t
>> +  regtype (const char *setname, int type, const char *fmt, int arg)
>> +  {
>> +    *setnamep = setname;
>> +    *typep = type;
>> +    int s = snprintf (name, namelen, fmt, arg);
>> +    if (s > 0 && (unsigned) s >= namelen)
>> +      s = -1;
>
> I would have expected if (s < 0 || (unsigned) s >= namelen)
> to signal a snprintf error.
>
>> +    return s + 1;
>> +  }
>
> So if there is an error (given name array is too short?) then
> s = -1 + 1 = 0. But that looks like an unused register number.

D'oh, right.  I changed it to return s+1, which makes it a success
path.  I'll change it to:

        if (s < 0 || (unsigned) s >= namelen)
          return -1;
        return s + 1;

... as you propose.

Thanks,
PM


More information about the elfutils-devel mailing list