By specifying the -d flag, libdtrace will dump the D script after it has applied
syntactical sugar transformations (e.g if/else). This is useful for both understanding
what dt_sugar does, as well as debugging it.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | ||
---|---|---|
199 | Probably clarify that it dumps to stdout. | |
cddl/contrib/opensolaris/lib/libdtrace/common/dt_sugar.c | ||
521 ↗ | (On Diff #117771) | Do we actually need to do this here? Why not have the compiler dump the output script after calling dt_compile_sugar()? That seems somewhat simpler. |
This option is in the same vein as -S, whereas -x is used to set runtime parameters for the dtrace script. So, -x feels like the wrong place to me, but maybe I'm missing something?
I don't think you are missing anything :) I just wonder if there is a way to avoid taking up a whole flag for a debug feature.
OTOH, I checked macOS DTrace implementation and they are not using -d for anything, so it seems it is fine if we dedicate -d to dumping D scripts post dt_sugar.
remove if/else comment in dt_cc as dt_sugar now also performs transformations
on kinst probes.
Sorry for the delay. One last comment, and then I think it's ok.
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | ||
---|---|---|
200 | It would be helpful to expand on this a bit: mention the example of if/else statements being implemented using syntactic transformations. |
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | ||
---|---|---|
200 | Will "...have been applied, such as if/else statements" suffice? |
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | ||
---|---|---|
200 | I'd suggest: "... have been applied. For example, if-statements in D are implemented using such transformations: a conditional clause in a probe body is replaced at compile-time by a separate probe predicated on the original condition." |
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | ||
---|---|---|
200 | That's way better indeed. Thanks. |