Uh oh!
There was an error while loading. Please reload this page.
Conversation
vext01
commented
Jan 29, 2019
This is everything apart from the buildbot. NOTE: we will have to revise the commit message before merge (handles -> tracers). |
| pub fn start_tracing(kind: TracingKind) -> Box<dyn ThreadTracer> { | ||
| match kind { | ||
| TracingKind::SoftwareTracing => swt::start_tracing(), | ||
| _ => panic!("tracing kind not implemented") |
| } | ||
| fn loc(&self, idx: usize) -> &MirLoc { | ||
| if idx > isize::max_value() as usize { |
There was a problem hiding this comment.
Why are we checking against isize::max_value? Is it because we're using offset below? If so, add negates the need for this check (assuming, as I think we must, that ptr + self.len is in bounds).
There was a problem hiding this comment.
Is it because we're using offset below?
Yeah, offset accepts an isize so that you can bump pointers both back and forward:
pub unsafe fn offset(self, count: isize) -> *const T
pub unsafe fn offset(self, count: isize) -> *const T
Ah! I did not know about Ptr::add! Marvellous. Will fix.
| impl ThreadTracer for SWTThreadTracer { | ||
| fn stop_tracing(self: Box<Self>) -> Option<Box<dyn MirTrace>> { | ||
| match yk_swt::stop_tracing() { |
There was a problem hiding this comment.
Maybe yk_swt::stop_tracing().map(|(buf, len)| Some(Box::new(...))?
There was a problem hiding this comment.
Ah yes. I never was good at all of these combinators :)
| /// A thread tracer is returned through which tracing can be stopped and the trace obtained. The | ||
| /// user must ensure that only one thread tracer exists at any one time per-thread, otherwise | ||
| /// undefined behaviour will result. | ||
| pub fn start_tracing(kind: TracingKind) -> Box<dyn ThreadTracer> { |
There was a problem hiding this comment.
Is there a function somewhere which says "start tracing using whatever the best available tracer is"?
There was a problem hiding this comment.
I've not implemented one, no. We could have kind an Option where None means "just frigging choose one, will ya!".
There was a problem hiding this comment.
I was thinking the same thing. Let's do it!
vext01
commented
Jan 30, 2019
The |
vext01
commented
Jan 30, 2019
For future reference, to build rustfmt from You can't build rustfmt at stage1, and once it's built in this way you can't run it via Ready for re-review. |
vext01
commented
Jan 30, 2019
Ready. |
ltratt
commented
Jan 30, 2019
Please squash. |
vext01
commented
Jan 30, 2019
I forgot to update the docstring. If it looks good, I'll squash. |
| /// A thread tracer is returned through which tracing can be stopped and the trace obtained. The | ||
| /// user must ensure that only one thread tracer exists at any one time per-thread, otherwise | ||
| /// undefined behaviour will result. | ||
| /// By passing `kind` as `None` an appropriate tracing kind will be selected automatically. A |
There was a problem hiding this comment.
How about simplifying to something like "If None is passed, then an appropriate backend will be selected; if Some(...) is passed, a specific backend can be specified. Only one thread tracer can be started at any point; starting more than one leads to undefined behaviour."?
There was a problem hiding this comment.
Try my last push. I want the restrictions on threads to be super-clear.
| /// must ensure that only one thread tracer exists at any one time per-thread, otherwise undefined | ||
| /// behaviour will result. | ||
| /// If `None` is passed, then an appropriate tracing kind will be selected; by passing `Some(...)`, | ||
| /// a specific kind can be chosen. Tracing different threads concurrently is allowed, but tracing |
There was a problem hiding this comment.
The second sentence doesn't really help IMHO. Maybe something like "Any given thread can only have one active tracer; calling start_tracing on a thread where there is already an active tracer leads to undefined behaviour".
There was a problem hiding this comment.
"can only have one active tracer" might better be "must have at most one active tracer"?
There was a problem hiding this comment.
I wrote exactly the same independently!
vext01
commented
Jan 30, 2019
Try this. |
ltratt
commented
Jan 30, 2019
Please squash. |
Although for now ykrustc only supports software tracing, I've designed the API assuming that there can be a runtime switch between different tracing backends (e.g. hardware/software tracing). Making ykrustc support such a switch is future work. For now the API supports: * Starting a trace and returning a thread tracer struct. * Stopping a trace, consuming the thread tracer (to prevent double-stop scenarios), and returning the recorded trace. * Getting a MIR location from a trace at a given index. * Iteration over a trace. The API also adds a Drop implementation for software traces so that users don't have to manually free a raw pointer at the correct time.
vext01
commented
Jan 30, 2019
Squashed and revised commit message. Before we merge this, we need to review and merge: softdevteam/ykrustc#5 |
5: Pull the trace struct out of the low-level interface. r=ltratt a=vext01 This is a companion change to softdevteam/yktrace#1 Co-authored-by: Edd Barrett <vext01@gmail.com>
5: Pull the trace struct out of the low-level interface. r=ltratt a=vext01 This is a companion change to softdevteam/yktrace#1 Co-authored-by: Edd Barrett <vext01@gmail.com>
vext01
commented
Jan 31, 2019
With the ykrustc PR now merged we can now do this one. My next PR will enable buildbot and bors on this repo. |
ltratt
commented
Jan 31, 2019
Why don't we do the buildbot/bors PR first, merge that into master; then we can merge master into this PR and use buildbot to check this PR? |
vext01
commented
Jan 31, 2019
We could, I'd have to add some dummy code to build though. |
ltratt
commented
Jan 31, 2019
Maybe we should just add the buildbot stuff into this PR as a separate commit? It's fairly self-contained, right? |
vext01
commented
Jan 31, 2019
We can try, but like i said the other day, I'm not sure if bors will see existing PRs. It's something I'd like to know, so no objections to trying. |
ltratt
commented
Jan 31, 2019
Let's try it then :) |
vext01
commented
Jan 31, 2019
OK, it may take a little while, as I'm struggling to get a working rustfmt and rustdoc in our ykrustc image. |
vext01
commented
Jan 31, 2019
bors ping |
pong |
ltratt
commented
Jan 31, 2019
It doesn't look like the build has started? |
vext01
commented
Jan 31, 2019
I'm working on it. |
vext01
commented
Jan 31, 2019
bors try- |
vext01
commented
Jan 31, 2019
bors try |
tryBuild failed |
vext01
commented
Jan 31, 2019
bors try |
vext01
commented
Jan 31, 2019
OK, hopefully this should work. I made the mistake of informing the buildbot about the new repo after The build will take ages because we have to build a full stage2 compiler to have rustdoc and rustfmt (the build targets for these fail if you try to force stage 1 only). In the meantime, are you happy with the CI commits? |
ltratt
commented
Jan 31, 2019
I sort-of assumed you'd want to squash the third commit (the merge) away? If so, do you want to squash now, then we can do a full build (an r plus build). |
vext01
commented
Jan 31, 2019
Well yes, but you have to request squashes. Since you are OK with it, I'll do it now. |
tryBuild failed |
vext01
commented
Jan 31, 2019
Squashed |
ltratt
commented
Jan 31, 2019
bors r+ |
1: Flesh out the initial tracing SHIM API. r=ltratt a=vext01 This is a DNMY PR. I'm raising for comments on the API design of yktrace. Please see the commit message for more info. If we like the design, there's a change to ykrustc that needs to go in first, then this PR, then we should enable buildbot on this repo. Cheers Co-authored-by: Edd Barrett <vext01@gmail.com>
Build failed |
vext01
commented
Jan 31, 2019
This is due to missing packages on the buildbot machine. I've added them (for the record I've also added the Shall I squash it in? |
ltratt
commented
Jan 31, 2019
Yes, please squash. |
vext01
commented
Jan 31, 2019
splat |
ltratt
commented
Jan 31, 2019
bors r+ |
1: Flesh out the initial tracing SHIM API. r=ltratt a=vext01 This is a DNMY PR. I'm raising for comments on the API design of yktrace. Please see the commit message for more info. If we like the design, there's a change to ykrustc that needs to go in first, then this PR, then we should enable buildbot on this repo. Cheers Co-authored-by: Edd Barrett <vext01@gmail.com>
Timed out |
ltratt
commented
Jan 31, 2019
Hmm, 9 hours is a long time. Let's try again. bors r+ |
1: Flesh out the initial tracing SHIM API. r=ltratt a=vext01 This is a DNMY PR. I'm raising for comments on the API design of yktrace. Please see the commit message for more info. If we like the design, there's a change to ykrustc that needs to go in first, then this PR, then we should enable buildbot on this repo. Cheers Co-authored-by: Edd Barrett <vext01@gmail.com>
Build succeeded |
This is a DNMY PR. I'm raising for comments on the API design of yktrace.
Please see the commit message for more info.
If we like the design, there's a change to ykrustc that needs to go in first, then this PR, then we should enable buildbot on this repo.
Cheers