This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 3/4] gdbserver: Add powerpc fast tracepoint support.
- From: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>, Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 31 Mar 2016 03:31:33 +0200
- Subject: Re: [PATCH v2 3/4] gdbserver: Add powerpc fast tracepoint support.
- Authentication-results: sourceware.org; auth=none
- References: <20160330153540 dot 8D4454989 at oc7340732750 dot ibm dot com>
On 30/03/16 17:35, Ulrich Weigand wrote:
Simon Marchi wrote:
Ahh, it seems like the ordering is important here. If I include it before
<elf.h> (and everything that includes <elf.h>), it works.
Hmm, it would probably be best to avoid mixing in-tree BFD headers and
system headers this way. I'd suggest to *not* include <elf.h> at all,
but instead use:
#include "elf/common.h"
#include "elf/ppc64.h"
Bye,
Ulrich
That doesn't work either:
../../../gdb/gdbserver/linux-ppc-low.c: In function ‘is_elfv2_inferior’:
../../../gdb/gdbserver/linux-ppc-low.c:763:3: error: unknown type name
‘Elf64_Ehdr’
Elf64_Ehdr ehdr;
^
../../../gdb/gdbserver/linux-ppc-low.c:772:18: error: request for member
‘e_ident’ in something not a structure or union
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG))
^
../../../gdb/gdbserver/linux-ppc-low.c:772:28: error: ‘ELFMAG’
undeclared (first use in this function)
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG))
^
../../../gdb/gdbserver/linux-ppc-low.c:772:28: note: each undeclared
identifier is reported only once for each function it appears in
../../../gdb/gdbserver/linux-ppc-low.c:772:36: error: ‘SELFMAG’
undeclared (first use in this function)
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG))
^
../../../gdb/gdbserver/linux-ppc-low.c:775:15: error: request for member
‘e_flags’ in something not a structure or union
return (ehdr.e_flags & EF_PPC64_ABI) == 2;
^
../../../gdb/gdbserver/linux-ppc-low.c:776:1: error: control reaches end
of non-void function [-Werror=return-type]
}
^
There's no equivalent to ELFMAG in the BFD headers, and getting to
e_flags requires more work too (you need elf/external.h and manually
assemble the word from bytes). Perhaps it'd be simpler to just define
EF_PPC64_ABI manually if it's not defined?