This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Module editing; debugging with gdb



> Two pretty unrelated questions -- both things I'd like to do differently 
> and better, though!

> 1) Often when I'm working with our Scwm modules, I'd like to test a
> change to a procedure defined in the module w/o restarting scwm/guile.
> What is the best way to do this?  Should I edit the module and then
> re-evaluate a (use-modules ... ) declaration?  Is there any way to give
> use-modules an explicit filename (since I do not want to overwrite the
> module.scm file in the installed place until I've tested my change)?

I think you'll just need to LOAD the file again.  Re-evaluating
the use-modules expression doesn't reload anything.  However, load
won't affect the repl's current module:

    $ cat incoming/foo.scm
    (define-module (incoming foo))

    (define (foo) (display "foo") (newline))
    (define-public (bar)
      (foo)
      (display "bar")
      (newline))

    (display "hi!")
    (newline)

    $ guile
    guile> (load "incoming/foo.scm")
    hi!

Note that we haven't imported the module yet:
    guile> (bar)          
    ERROR: In expression (bar):
    ERROR: Unbound variable: bar
    ABORT: (misc-error)
    guile> (use-modules (incoming foo))
    guile> (bar)
    foo
    bar

Here I've changed the definition of bar, so I need to reload:
    guile> (load "incoming/foo.scm")
    hi!
    guile> (bar)
    foo
    barbie
    guile> $ 


> 2) Debugging scheme objects from within GDB is pretty painful.  I see
> the gdbint files under libguile, but am not sure how to use them.  Could 
> someone with experience debugging Scheme objects under GDB explain their 
> setup, techniques, and maybe post example interactions?

Mikael Djurfeldt started working on that, and it worked quite well:
GDB would call Guile to print objects, and such, in a very natural
way.

However, the syntax wasn't acceptable to the GDB maintainers --- I
think they felt it wasn't really very general-purpose.  I could post
Mikael's patches, but 1) they're out of date, and 2) they're
unfinished, and Mikael is extremely uncomfortable about posting code
he considers unfinished.

I'll ask Mikael for permission to post his GDB patches.