[PATCH 4/6] gdb: LoongArch: Add initial native linux support

Tom Tromey tom@tromey.com
Thu Jan 6 21:36:37 GMT 2022


>>>>> ">" == Tiezhu Yang <yangtiezhu@loongson.cn> writes:

>> This commit adds initial native linux support for LoongArch.

Thanks for the patch.

>> +    struct iovec iovec = { .iov_base = &regset, .iov_len = sizeof (regset) };

I'm surprised this compiles, because IIUC this one of the features that
is in C but not in C++.

It's fine to rewrite it as explicit assignments, e.g. from
arm-linux-nat.c:

      struct iovec iov;

      iov.iov_base = ®s;
      iov.iov_len = sizeof (regs);

There are a few spots that need this.

It possibly might compile as a GNU extension or something like that.
However we mostly avoid those unless they can be used conditionally
(this is why attributes can be used).

>> +  if ((regno == -1) || (regs.r <= regno && regno < regs.r + 32) ||
>> +      (regs.pc == regno) || (regs.badvaddr == regno))

FWIW the extra parens are redundant and gdb style is to avoid them.

>> +  store_gregs_to_thread(regcache, regno, tid);

Space before paren here.

Tom


More information about the Gdb-patches mailing list