▼ |  | Plugins: Extending Dr Scheme

1 | Implementing Dr Scheme Tools
2 | Adding Languages to Dr Scheme
3 | Creating New Kinds of Dr Scheme Frames
4 | Extending the Existing Dr Scheme Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | #lang-specific tools
8 | Language-specific capabilities
9 | drscheme: get/ extend
10 | drscheme: unit
11 | drscheme: language
12 | drscheme: language-configuration
13 | drscheme: debug
14 | drscheme: rep
15 | drscheme: frame
16 | drscheme: help-desk
17 | drscheme: eval
18 | drscheme: modes
| Index

On this page:

drscheme: debug: profile-unit-frame-mixin
drscheme: debug: profile-interactions-text-mixin
drscheme: debug: profile-definitions-text-mixin
drscheme: debug: error-display-handler/ stacktrace
drscheme: debug: make-debug-error-display-handler
drscheme: debug: hide-backtrace-window
drscheme: debug: add-prefs-panel
drscheme: debug: open-and-highlight-in-file
drscheme: debug: show-backtrace-window/ edition-pairs
drscheme: debug: show-backtrace-window
drscheme: debug: srcloc->edition/ pair

top← prev up next →

### 13`` drscheme:debug

drscheme:debug:profile-unit-frame-mixin : (class? . -> . class?)

argument extends/implements: | drscheme:frame:<%>
| drscheme:unit:frame<%>

drscheme:debug:profile-interactions-text-mixin : (class? . -> . class?)

argument extends/implements: | drscheme:rep:text<%>

drscheme:debug:profile-definitions-text-mixin : (class? . -> . class?)

argument extends/implements: | drscheme:unit:definitions-text<%>
| text%

(drscheme: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 drscheme:unit:definitions-text<%>))
|  |  | = |  | #f

ints : (or/c #f (is-a?/c drscheme:rep:text<%>)) = #f

Displays the error message represented by the string, adding embellishments like those that appears in the DrScheme 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.

(drscheme: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 MzScheme’s error-display-handler parameter.

If the current-error-port is the definitions window in drscheme, 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.

(drscheme:debug:hide-backtrace-window) → void?

Hides the backtrace window.

(drscheme:debug:add-prefs-panel) → void?

Adds the profiling preferences panel.

(drscheme: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 DrScheme 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.

(drscheme: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 drscheme:unit:definitions-text<%>))
ints : (or/c #f (is-a?/c drscheme:rep:text<%>))

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

The error-message argument is the text of the error, dis is the debug information, extracted from the continuation mark in the exception record, using errortrace-key.

The editions argument indicates the editions of any editors that are open editing the files corresponding to the source locations

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

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

(drscheme: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 drscheme:rep:text<%>)) = #f

| defs |  | : |  | (or/c #f (is-a?/c drscheme:unit:definitions-text<%>))
|  |  | = |  | #f

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

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

(drscheme:debug:srcloc->edition/pair |  | srcloc |
|  | ints |
|  | defs) |

→

(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 drscheme:rep:text<%>))
defs : (or/c #f (is-a?/c drscheme:unit:definitions-text<%>))

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.

top← prev up next →