Page MenuHomeFreeBSD

dtrace(1): add -d flag to dump D script post-dt_sugar
Needs ReviewPublic

Authored by christos on Wed, Feb 22, 4:42 PM.
Tags
Referenced Files
Unknown Object (File)
Mon, Mar 20, 4:57 AM
Unknown Object (File)
Thu, Mar 16, 3:23 PM
Unknown Object (File)
Wed, Mar 15, 3:57 PM
Unknown Object (File)
Mon, Feb 27, 9:22 PM
Subscribers

Details

Reviewers
markj
gnn
Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

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.

christos marked an inline comment as done.

Move dump code to dt_cc.c.

Would it be wiser to implement this as an extension to the -x flag?

markj added inline comments.
cddl/contrib/opensolaris/cmd/dtrace/dtrace.1
199
cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
155
This revision is now accepted and ready to land.Thu, Feb 23, 5:56 PM
In D38732#881808, @0mp wrote:

Would it be wiser to implement this as an extension to the -x flag?

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?

In D38732#881808, @0mp wrote:

Would it be wiser to implement this as an extension to the -x flag?

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.

christos marked an inline comment as done.

s/stdout/standard output/

This revision now requires review to proceed.Fri, Feb 24, 12:03 AM
christos marked 2 inline comments as done.

Typo fixes.

This revision is now accepted and ready to land.Fri, Feb 24, 4:10 PM

remove if/else comment in dt_cc as dt_sugar now also performs transformations
on kinst probes.

This revision now requires review to proceed.Sat, Mar 4, 1:32 PM

I don't think there are any pending changes for this PR, it can get through.