RE: [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction

Metzger, Markus T
2015-01-28T12:01:32Z

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Tuesday, January 27, 2015 4:50 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction
>
> On 01/27/2015 03:31 PM, Metzger, Markus T wrote:
>
> >> Isn't there a better type to use here instead of "long long"?
> >> Why not size_t, if a host buffer size; uint64_t, if it's a fixed
> >> buffer format, assuming 64-bit here; or ULONGEST, the widest
> >> integer we support?
> >
> > I'm using the same data type as the respective fields in
> > struct perf_event_mmap_page (after resolving a few typedefs).
> >
> > I'm also fine to directly use __u64 or to use uint64_t.
>
> Ah, so fits in "fixed format" category. Let's go with
> uint64_t then.

gdb/nat/linux-btrace.c:450:24: error: assignment from incompatible pointer type [-Werror]
tinfo->bts.data_head = &header->data_head;
^
cc1: all warnings being treated as errors

The problem is that stdint.h defines uint64_t as unsigned int. We know
it's the same size on 64-bit systems so we could cast the pointer...

I'd rather stay with unsigned long long, though.

Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052