Thomas Owens
Thomas Owens

Reputation: 116169

How do I step through and debug a Scheme program using Dr. Racket?

I'm using the Dr. Racket development environment and the language definition #lang scheme to do work for a course. However, I'm not sure how to best use this tool for debugging. I would like to be able to execute a function and step through it, observing the values of different functions at various points in execution.

Is this possible? If not, what is the typical method of stepping through the execution of a Scheme program and debugging it?

Upvotes: 12

Views: 11003

Answers (2)

dheerosaur
dheerosaur

Reputation: 15172

DrRacket includes a graphical debugging interface. Clicking on the Debug button will enable debugging mode. Now, hovering your mouse over any parenthesis will show a pink dot. Right-click on it and a context menu will appear with options to set break-points. Use Go, Step etc.. You can observe the stack and variables in the context in the side-pane.

See docs.

Upvotes: 16

Eli Barzilay
Eli Barzilay

Reputation: 29546

Look in the toolbar -- there is a button labeled "debug" that starts executing the code in debug mode. Once you click it, you can set break points and inspect local variables.

Upvotes: 2

Related Questions