[PATCH] D43278: Add Xray instrumentation support to FreeBSD
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 14:25:31 PST 2018
devnexen added inline comments.
================
Comment at: lib/xray/xray_fdr_logging_impl.h:240
TLD.RecordPtr = static_cast<char *>(B.Data);
- pid_t Tid = syscall(SYS_gettid);
+ pid_t Tid = getTid();
timespec TS{0, 0};
----------------
krytarowski wrote:
> krytarowski wrote:
> > krytarowski wrote:
> > > devnexen wrote:
> > > > krytarowski wrote:
> > > > > krytarowski wrote:
> > > > > > Here `Tid` should be of type `Tid_t`.
> > > > > There are more `pid_t` out there:
> > > > >
> > > > > ```
> > > > > static void writeNewBufferPreamble(pid_t Tid, timespec TS);
> > > > > ```
> > > > >
> > > > > ```
> > > > > static void writeNewBufferPreamble(pid_t Tid,
> > > > > timespec TS) XRAY_NEVER_INSTRUMENT {
> > > > > ```
> > > > >
> > > > > ```
> > > > > // point we only write down the following bytes:
> > > > > // - Thread ID (pid_t, 4 bytes)
> > > > > ```
> > > > Careful here writeNewBufferPreamble expects internally a size of pid_t (so 4 bytes)
> > > Please adjust the code for `Tid_t` of 8bytes.
> > Alternatively we can squash `Tid_t` to 4 bytes, it will be fine for Linux, FreeBSD and NetBSD. I have no idea about Darwin.
> By a squash I mean to typedef `Tid_t` to `int32_t`.
I honestly prefer it fits 4 bytes indeed struct using them has strict alignment
https://reviews.llvm.org/D43278
More information about the llvm-commits
mailing list