RFC pragma(breakpoint)
Here's a first pass at pragma(breakpoint) as I described in my dconf talk. So far, it's basically pragma(backtrace) with no interactive features. Curious what people think about this (is it useful? is it the right information?)
Here's the output from the new test:
Pragma Breakpoint: static else, before expanding the dependent template
Starting backtrace
compiler/test/compilable/pragmaBreakpoint.d(8): scope: T
compiler/test/compilable/pragmaBreakpoint.d(2): scope: T!3LU
compiler/test/compilable/pragmaBreakpoint.d(17): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/compilable/pragmaBreakpoint.d: scope: __anonymous
Pragma Breakpoint: static else, before expanding the dependent template
Starting backtrace
compiler/test/compilable/pragmaBreakpoint.d(8): scope: T
compiler/test/compilable/pragmaBreakpoint.d(2): scope: T!2LU
compiler/test/compilable/pragmaBreakpoint.d(9): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/compilable/pragmaBreakpoint.d: scope: __anonymous
Pragma Breakpoint: static else, before expanding the dependent template
Starting backtrace
compiler/test/compilable/pragmaBreakpoint.d(8): scope: T
compiler/test/compilable/pragmaBreakpoint.d(2): scope: T!1LU
compiler/test/compilable/pragmaBreakpoint.d(9): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/compilable/pragmaBreakpoint.d: scope: __anonymous
Pragma Breakpoint: done T!0LU
Starting backtrace
compiler/test/compilable/pragmaBreakpoint.d(6): scope: T
compiler/test/compilable/pragmaBreakpoint.d(2): scope: T!0LU
compiler/test/compilable/pragmaBreakpoint.d(9): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/compilable/pragmaBreakpoint.d: scope: __anonymous
Pragma Breakpoint: main
Starting backtrace
compiler/test/compilable/pragmaBreakpoint.d(21): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d(15): scope: __anonymous
compiler/test/compilable/pragmaBreakpoint.d(15): scope: pragmaBreakpoint
compiler/test/compilable/pragmaBreakpoint.d: scope: __anonymous
Thanks for your pull request and interest in making D better, @benjones! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:andReturns:)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
Your PR doesn't reference any Bugzilla issue.
If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + dmd#21758"
more (potential) discussion here: https://forum.dlang.org/post/[email protected]
I've added the outline of making this interactive:
./generated/osx/release/64/dmd compiler/test/runnable/pragmaBreakpoint.d
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) bt
Backtrace
compiler/test/runnable/pragmaBreakpoint.d(45): scope: T
compiler/test/runnable/pragmaBreakpoint.d(39): scope: T!3LU
compiler/test/runnable/pragmaBreakpoint.d(54): scope: __anonymous
compiler/test/runnable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/runnable/pragmaBreakpoint.d: scope: __anonymous
(ctdb) c
continuing compilation
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) c
continuing compilation
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) c
continuing compilation
Pragma Breakpoint: done T!0LU
(ctdb) c
continuing compilation
Pragma Breakpoint: main
(ctdb) c
continuing compilation
I assume there's a way to add this to the test above to make it run non-interactively?
/Users/ben/projects/dlang/dmd/dmd $ cat > pragmaMessageInputs.txt <<- EOM
heredocd> bt
heredocd> c
heredocd> c
heredocd> c
heredocd> c
heredocd> c
heredocd> EOM
/Users/ben/projects/dlang/dmd/dmd $ ./generated/osx/release/64/dmd compiler/test/runnable/pragmaBreakpoint.d < pragmaMessageInputs.txt
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) Backtrace
compiler/test/runnable/pragmaBreakpoint.d(45): scope: T
compiler/test/runnable/pragmaBreakpoint.d(39): scope: T!3LU
compiler/test/runnable/pragmaBreakpoint.d(54): scope: __anonymous
compiler/test/runnable/pragmaBreakpoint.d: scope: pragmaBreakpoint
compiler/test/runnable/pragmaBreakpoint.d: scope: __anonymous
(ctdb) continuing compilation
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) continuing compilation
Pragma Breakpoint: static else, before expanding the dependent template
(ctdb) continuing compilation
Pragma Breakpoint: done T!0LU
(ctdb) continuing compilation
Pragma Breakpoint: main
(ctdb) continuing compilation
Thoughts/feedback? Next thing to add will be something to print symbols in the various scopes of the backtrace.