guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python's pdb module


From: Matt Wette
Subject: Re: Python's pdb module
Date: Fri, 30 Apr 2021 06:20:20 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1


On 4/29/21 8:26 PM, Tim Meehan wrote:
Is there something in Guile that is similar to Python's "pdb" module?
For instance, sometimes I find it helpful to pause right before something
bad happens with:

#!/usr/bin/env python3
import pdb; pdb.set_trace()
some_function_that_is_going_to_fail_miserably()

I started on something years ago but never got it working as nice as python,
as the guile debugger still needs some help to get there.   Try this snippet.

(define-syntax-rule (jump-to-debugger)
  (if (eqv? 'regular (vm-engine))
      (give-warning)
      (start-repl
       #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t))))

You'll need some of this mess to resolve procedures:

(use-modules (system repl repl))
(use-modules (system repl debug))
(use-modules (system repl common))
(use-modules (system repl command))
(use-modules (system vm frame))
(use-modules (system vm vm))
(use-modules (ice-9 control))
(use-modules (ice-9 rdelim))
(use-modules (ice-9 pretty-print))
(use-modules (system base compile))

Matt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]