▼ |  | Dr Racket Plugins

1 | Implementing Dr Racket Plugins
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-Specific Capabilities
8 | Check Syntax
9 | Cooperating with Background Check Syntax
10 | Teaching Languages
11 | Signatures
12 | drracket: get/ extend
13 | drracket: unit
14 | drracket: language
15 | drracket: language-configuration
16 | drracket: debug
17 | drracket: rep
18 | drracket: frame
19 | drracket: help-desk
20 | drracket: eval
21 | drracket: modes
22 | drracket: module-language-tools
23 | drracket: module-language
24 | drracket: tracing
25 | Backwards Compatibility
| Index

On this page:

drracket: debug: profile-unit-frame-mixin
show-profile-gui
hide-profile-gui
drracket: debug: profile-tab-mixin
drracket: debug: profile-definitions-text-mixin
drracket: debug: test-coverage-definitions-text-mixin
drracket: debug: test-coverage-interactions-text-mixin
drracket: debug: test-coverage-tab-mixin
drracket: debug: test-coverage-frame-mixin
drracket: debug: error-display-handler/ stacktrace
drracket: debug: make-debug-error-display-handler
drracket: debug: hide-backtrace-window
drracket: debug: add-prefs-panel
drracket: debug: make-debug-eval-handler
drracket: debug: test-coverage-enabled
drracket: debug: test-coverage-on-style-name
drracket: debug: test-coverage-off-style-name
drracket: debug: profiling-enabled
drracket: debug: bug-info->ticket-url
drracket: debug: small-planet-bitmap
drracket: debug: open-and-highlight-in-file
drracket: debug: show-backtrace-window/ edition-pairs
drracket: debug: show-backtrace-window/ edition-pairs/ two
drracket: debug: get-error-color
drracket: debug: show-backtrace-window
drracket: debug: srcloc->edition/ pair

top ← prev up next →

### 16`` drracket:debug

mixin drracket:debug:profile-unit-frame-mixin : (class? . -> . class?)
argument extends/implements: | drracket:frame:<%>
| drracket:unit:frame<%>

Adds support for profiling information.

> > method (send a-drracket:debug:profile-unit-frame show-profile-gui)
> > → void?

> Shows the GUI information shown about the profile.

> > method (send a-drracket:debug:profile-unit-frame hide-profile-gui)
> > → void?

> Hides the GUI information shown about the profile.

mixin drracket:debug:profile-tab-mixin : (class? . -> . class?)
argument extends/implements: | drracket:unit:tab<%>
result implements: | drracket:debug:profile-interactions-tab<%>

Tracks profiling information.

mixin drracket:debug:profile-definitions-text-mixin : (class? . -> . class?)
argument extends/implements: | drracket:unit:definitions-text<%>
| text%

Tracks profiling information.

mixin drracket:debug:test-coverage-definitions-text-mixin : (class? . -> . class?)
argument extends/implements: | text%
| drracket:unit:definitions-text<%>

Tracks test case coverage information.

mixin drracket:debug:test-coverage-interactions-text-mixin : (class? . -> . class?)
argument extends/implements: | drracket:rep:text<%>
| text:basic<%>
result implements: | drracket:debug:test-coverage-interactions-text<%>

Tracks test case coverage information.

mixin drracket:debug:test-coverage-tab-mixin : (class? . -> . class?)
argument extends/implements: | drracket:rep:context<%>
| drracket:unit:tab<%>
result implements: | drracket:debug:test-coverage-tab<%>

Tracks test case coverage information.

mixin drracket:debug:test-coverage-frame-mixin : (class? . -> . class?)
argument extends/implements: | drracket:unit:frame<%>
result implements: | drracket:debug:test-coverage-frame<%>

Tracks test case coverage information.

> > procedure
> > (drracket:debug:error-display-handler/stacktrace |
> > |  | msg |
> > |  | exn |
> > | [ | stack |
> > |  | #:definitions-text defs |
> > |  | #:interactions-text ints]) |
> → any/c
> msg : string?
> exn : any/c
> stack : (or/c false/c (listof srcloc?)) = #f
> | defs |  | : |  | (or/c #f (is-a?/c drracket:unit:definitions-text<%>))
> |  |  | = |  | #f
> ints : (or/c #f (is-a?/c drracket:rep:text<%>)) = #f

Displays the error message represented by the string, adding embellishments like those that appears in the DrRacket REPL, specifically a clickable icon for the stack trace (if the srcloc location is not empty), and a clickable icon for the source of the error (read & syntax errors show their source locations and otherwise the first place in the stack trace is shown).

If stack is false, then the stack traces embedded in the exn argument (if any) are used. Specifically, this function looks for a stacktrace via errortrace-key in the continuation marks of exn and continuation-mark-set->context.

If stack is not false, that stack is added to the stacks already in the exception.

This should be called in the same eventspace and on the same thread as the error.

> procedure (drracket:debug:make-debug-error-display-handler oedh)
> → (-> string? (or/c any/c exn?) any)
> oedh : (-> string? (or/c any/c exn?) any)

This function implements an error-display-handler in terms of another error-display-handler.

See also Racket’s error-display-handler parameter.

If the current-error-port is the definitions window in DrRacket, this error handler inserts some debugging annotations, calls oedh, and then highlights the source location of the runtime error.

It looks for both stack trace information in the continuation marks both via the errortrace/errortrace-key module and via continuation-mark-set->context.

> procedure (drracket:debug:hide-backtrace-window) → void?

Hides the backtrace window.

> procedure (drracket:debug:add-prefs-panel) → void?

Adds the profiling preferences panel.

> procedure (drracket:debug:make-debug-eval-handler oe) → (-> any/c any)
> oe : (-> any/c any)

Returns a function suitable for use with current-eval.

The result function first adds debugging information to its argument and then passes it to oe.

> parameter (drracket:debug:test-coverage-enabled) → boolean?
> (drracket:debug:test-coverage-enabled enabled?) → void?
> enabled? : boolean?

Determines if the test-coverage annotation is added by the result of drracket:debug:make-debug-eval-handler.

> value drracket:debug:test-coverage-on-style-name : string?

The name of the style% object (in editor:get-standard-style-name) used to indicate a covered region of code.

> value drracket:debug:test-coverage-off-style-name : string?

The name of the style% object (in editor:get-standard-style-name) used to indicate a region of code that tests (or any code, really) didn’t cover.

> parameter (drracket:debug:profiling-enabled) → boolean?
> (drracket:debug:profiling-enabled enabled?) → void?
> enabled? : boolean?

Determines if the profiling annotation is added by the result of drracket:debug:make-debug-eval-handler.

> procedure (drracket:debug:bug-info->ticket-url query) → url?
> query : (listof (cons/c symbol? (or/c #f string?)))

Builds a url that goes to the trac report system. The query argument is used as the url’s query field.

> value drracket:debug:small-planet-bitmap : (is-a?/c bitmap%)

The icon used in the DrRacket REPL when an exception is raised that includes blame information blaming a PLaneT package. (Clicking the icon connects to the PLaneT bug report form.)

> > procedure
> > (drracket:debug:open-and-highlight-in-file |  | debug-info |
> > | [ | edition-pair]) |
> → void?
> debug-info : (or/c srcloc? (listof srcloc?))
> | edition-pair |  | : |  |
> (or/c #f (cons/c (λ (x) (and (weak-box? x)
> (let ([v (weak-box-value x)])
> (or (not v)
> (is-a?/c v editor<%>)))))
> number?))
> |  |  | = |  | #f

This function opens a DrRacket to display debug-info. Only the src the position and the span fields of the srcloc are considered.

The edition-pair is used to determine if a warning message is shown when before opening the file. If the edition-pair is not #f, it is compared with the result of get-edition-number of the editor that is loaded to determine if the file has been edited since the source location was recorded. If so, it puts up a warning dialog message to that effect.

> > procedure
> > (drracket:debug:show-backtrace-window/edition-pairs |
> > |  | error-message |
> > |  | dis |
> > |  | editions-pairs |
> > |  | defs |
> > |  | ints) |
> → void?
> error-message : string?
> dis : (listof srcloc?)
> | editions-pairs |  | : |  |
> (listof
> (or/c
> #f
> (cons/c (λ (x)
> (and (weak-box? x)
> (let ([v (weak-box-value x)])
> (or (not v)
> (is-a?/c v editor<%>)))))
> number?)))
> defs : (or/c #f (is-a?/c drracket:unit:definitions-text<%>))
> ints : (or/c #f (is-a?/c drracket:rep:text<%>))

Same as drracket:debug:show-backtrace-window/edition-pairs/two, where the dis2 and editions-pairs2 arguments are both '()

> > procedure
> > (drracket:debug:show-backtrace-window/edition-pairs/two |
> > |  | error-message |
> > |  | dis1 |
> > |  | editions-pairs1 |
> > |  | dis2 |
> > |  | editions-pairs2 |
> > |  | defs |
> > |  | ints) |
> → void?
> error-message : string?
> dis1 : (listof srcloc?)
> | editions-pairs1 |  | : |  |
> (listof
> (or/c
> #f
> (cons/c (λ (x)
> (and (weak-box? x)
> (let ([v (weak-box-value x)])
> (or (not v)
> (is-a?/c v editor<%>)))))
> number?)))
> dis2 : (listof srcloc?)
> | editions-pairs2 |  | : |  |
> (listof
> (or/c
> #f
> (cons/c (λ (x)
> (and (weak-box? x)
> (let ([v (weak-box-value x)])
> (or (not v)
> (is-a?/c v editor<%>)))))
> number?)))
> defs : (or/c #f (is-a?/c drracket:unit:definitions-text<%>))
> ints : (or/c #f (is-a?/c drracket:rep:text<%>))

Shows the backtrace window you get when clicking on the bug in DrRacket’s REPL.

The error-message argument is the text of the error, dis1 and dis2 are the stacktrace information, extracted from the continuation mark in the exception record, using errortrace-key and using continuation-mark-set->context.

The editions1 and editions2 arguments indicate the editions of any editors that are open editing the files corresponding to the source locations. The lists must have the same length as dis1 and dis2.

The defs argument should be non-#f if there are possibly stacktrace frames that contain unsaved versions of the definitions window from DrRacket. Similarly, the ints argument should be non-#f if there are possibly stacktrace frames that contain unsaved versions of the interactions window.

Use drracket:rep:current-rep to get the rep during evaluation of a program.

> procedure (drracket:debug:get-error-color) → (is-a?/c color%)

Returns the background color used to highlight errors in the definitions window (and other places, possibly).

The result depends on the 'framework:white-on-black? preference setting.

> > procedure
> > (drracket:debug:show-backtrace-window |  | error-message |  |  |  |
> > |  | dis |  |  |  |
> > | [ | rep |  |  |  |
> > |  | defs]) |  | → |  | void?
> error-message : string?
> | dis |  | : |  |
> (or/c exn?
> (listof srcloc?)
> (non-empty-listof (cons/c string? (listof srcloc?))))
> rep : (or/c #f (is-a?/c drracket:rep:text<%>)) = #f
> | defs |  | : |  | (or/c #f (is-a?/c drracket:unit:definitions-text<%>))
> |  |  | = |  | #f

Shows the backtrace window you get when clicking on the bug in DrRacket’s REPL.

This function simply calls drracket:debug:show-backtrace-window/edition-pairs, using drracket:debug:srcloc->edition/pair.

> > procedure
> > (drracket:debug:srcloc->edition/pair |  | srcloc |
> > |  | ints |
> > |  | defs |
> > | [ | cache]) |
> | → |  |
> (or/c #f (cons/c (let ([weak-box-containing-an-editor?
> (λ (x) (and (weak-box? x)
> (let ([v (weak-box-value x)])
> (or (not v)
> (is-a?/c v editor<%>)))))])
> weak-box-containing-an-editor?)
> number?))
> srcloc : srcloc?
> ints : (or/c #f (is-a?/c drracket:rep:text<%>))
> defs : (or/c #f (is-a?/c drracket:unit:definitions-text<%>))
> cache : (or/c #f (and/c hash? hash-equal?)) = #f

Constructs a edition pair from a source location, returning the current edition of the editor editing the source location (if any).

The ints and defs arguments are used to map source locations, in the case that the source location corresponds to the definitions window (when it has not been saved) or the interactions window. This calls normalize-path, so to avoid the severe performance penalty that can incur on some filesystems, the cache argument is consulted and updated, when it is provided. Use this argument if you’re calling drracket:debug:srcloc->edition/pair a number of times in a loop, when you do not expect the filesystem to change across iterations of the loop. The initial argument should be an empty equal hash (e.g., (make-hash)).

top ← prev up next →