edebug, why you rule

Edebug is really easy to use. The emacswiki has a description of how to use SourceLevelDebugging. The info doc has an extensive description on how to use edebug too.

I’ve been using the gud-jdb debugger for java. I’d like to see the gud-jdb behavior be more like edebug, where typing interacts with the debugger rather than modifying the source buffer.

Here’s a screenshot of debugging a simple defun:

I’ve had some problems with gud and jdb. Mainly it chokes on 1.5 syntax, import static makes parsing fail. Attaching to a remote vm, actually the easiest way to debug a complicated java application with multiple classloaders, only works when you have gud-jdb-use-classpath and gud-jdb-directories set. I typically run a quick command to get the directory containing the class I want to debug to gud-jdb-directries, like:

(add-to-list 'gud-jdb-directories (file-name-directory (buffer-file-name (current-buffer))))

I created a small function for adding a java(jde-mode) buffer to the gud-jdb-directories. This function let’s the debugger find a source file when you do a where.

<code>
(defun dmb-add-current-class-gud-jdb-directories()
“add the current buffers directory “
(interactive)
(if (not (eq major-mode ‘jde-mode))
(error “Must be a jde-mode buffer to add it to the debugger”))
(add-to-list ‘gud-jdb-directories (file-name-directory (buffer-file-name (current-buffer))))
)
</code>

About these ads

About this entry