Re: [PATCH v2 3/4] gdbserver: Add powerpc fast tracepoint support.

Simon Marchi
2016-03-30T14:52:19Z

Hi Marcin,

One note below.

On 16-03-18 11:09 AM, Marcin Kościelnicki wrote:
> +#ifdef __powerpc64__
> +
> +/* Returns 1 if inferior is using ELFv2 ABI. Undefined for 32-bit
> + inferiors. */
> +
> +static int
> +is_elfv2_inferior (void)
> +{
> + /* To be used as fallback if we're unable to determine the right result -
> + assume inferior uses the same ABI as gdbserver. */
> +#if _CALL_ELF == 2
> + const int def_res = 1;
> +#else
> + const int def_res = 0;
> +#endif
> + unsigned long phdr;
> + Elf64_Ehdr ehdr;
> +
> + if (!ppc_get_auxv (AT_PHDR, &phdr))
> + return def_res;
> +
> + /* Assume ELF header is at the beginning of the page where program headers
> + are located. If it doesn't look like one, bail. */
> +
> + read_inferior_memory (phdr & ~0xfff, (unsigned char *) &ehdr, sizeof ehdr);
> + if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG))
> + return def_res;
> +
> + return (ehdr.e_flags & EF_PPC64_ABI) == 2;
> +}

This gives me an error when building on the gcc compile farm machine gcc110. I just
applied your patches on today's master.

linux-ppc-low.c: In function ‘is_elfv2_inferior’:
linux-ppc-low.c:774:26: error: ‘EF_PPC64_ABI’ undeclared (first use in this function)
return (ehdr.e_flags & EF_PPC64_ABI) == 2;
^
linux-ppc-low.c:774:26: note: each undeclared identifier is reported only once for each function it appears in
linux-ppc-low.c:775:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

I am not familiar with PPC, so I have no idea how to fix it. I just replaced it "return 0"
so that it built, and I was able to test what I wanted to test :).

Side note, would it be possible to avoid putting the ChangeLog changes in the diff? It makes
it overly complicated to apply patches since there are constantly some conflicts. It's common
to put them in the commit message for the review, and add them to the actual patch at commit
time.

Thanks!

Simon