Debugging with emacs?

I've noticed a lot of posts around here about how emacs is the
greatest development environment for Java, better than the 'fancy'
IDEs. While I can see how emacs could be very fast for writing and
formatting code, I don't see how it can measure up to IDEs for
debugging, I'm wondering if I'm missing something here?

Say I want to debug a multithread program and suspend and resume
threads at will, whilst inspecting all the variables and using a watch
window; or if I want the debugger to stop when an exception is thrown
(like in Eclipse). Is there a way to get emacs to do such things? My
experience with it so far has just been usign it as a front end for
jdb, which Sun describes as a 'proof of concept' debugger, not a
professional-standard solution.

Is there some amazing emacs extension which will give the same debug
capabilities as Eclipse or JBuilder?

(Or are real emacs programmers just so macho that they never write
bugs...?)

Advertisements

Charles> I've noticed a lot of posts around here about how emacs is
Charles> the greatest development environment for Java, better than
Charles> the 'fancy' IDEs. While I can see how emacs could be very
Charles> fast for writing and formatting code, I don't see how it
Charles> can measure up to IDEs for debugging, I'm wondering if I'm
Charles> missing something here?

Charles> Say I want to debug a multithread program and suspend and
Charles> resume threads at will, whilst inspecting all the variables
Charles> and using a watch window; or if I want the debugger to stop
Charles> when an exception is thrown (like in Eclipse). Is there a
Charles> way to get emacs to do such things? My experience with it
Charles> so far has just been usign it as a front end for jdb, which
Charles> Sun describes as a 'proof of concept' debugger, not a
Charles> professional-standard solution.

Charles> Is there some amazing emacs extension which will give the
Charles> same debug capabilities as Eclipse or JBuilder?

The JDEE (http://jdee.sunsite.dk) provides support for more advanced
debugging, over and above the front end for jdb. I have a limited
experience of using, though, so I can't vouch for it. I doubt it will
give you the same debug capabilities as Eclipse. If you want this, why
not use Eclipse?

Charles> (Or are real emacs programmers just so macho that they
Charles> never write bugs...?)

Everybody writes bugs. Personally, though, I tend to rely more on unit
testing, and, when all else fails, debug statements, than a
debugger. Especially with test cases the knowledge of the debugging
remains in a code base, which you can find again if you get a similar
bug. With a debugger, all that knowledge is lost once you switch the
debugger off.

Of course you experiences may differ, but not everyone who eschews a
debugger is doing so because they are macho assholes.

Thanks for the tips -- I will have a good look at JDEE. I'm still not
sure about the status of GNU/emacs world, it seems to depend very much
on who you ask and what you read. The GNU books are so rampant that
you get the impression that anyone who has to use a non-GNU IDE is an
insignificant script-kiddie who should be using VB. But do I really
have to memorise bookloads of Meta-X keyboard shortcuts to write Java
'properly'? I love the idea of the GNU stuff, its just that the
reality seem so over-complicated when I actually need to write
something to a deadline! I was looking at Eclipse too, that seems to
have some of the best multithread debugging capabilities of the free
IDEs.

Any further comments would be welcome, should I put in the effort to
learn the emacs stuff or do we think that's just GNU snobbery?

Charles Fox wrote:
> Thanks for the tips -- I will have a good look at JDEE. I'm still not
> sure about the status of GNU/emacs world, it seems to depend very much
> on who you ask and what you read. The GNU books are so rampant that
> you get the impression that anyone who has to use a non-GNU IDE is an
> insignificant script-kiddie who should be using VB. But do I really
> have to memorise bookloads of Meta-X keyboard shortcuts to write Java
> 'properly'?

Absolutely not. You can get by with only those you use *regularly* and can
forget the others since you'll never use them. My day is spent with:

CTRL+x+f -> Load file
CTRL+x+b -> Switch buffers
CTRL+x+1 -> Go back to a single buffer when I screw up my display <g>
CTRL+c+v . -> Get a list of available completions
CTRL+c+v+. -> Get the first available completion
CTRL+x s -> Save everything
ESC % -> Search and replace
CTRL+c+v+b -> Build

Charles Fox wrote:
<snip>
> Any further comments would be welcome, should I put in the effort to
> learn the emacs stuff or do we think that's just GNU snobbery?

One of the best programmers I ever met had such a finely-tuned
emacs environment that he could pump out code like nobody's
business. He also had it customized to the hilt, to the point
that noone else (even someone who knew emacs) could use his
environment.
Who am I to argue with success?
OTOH, larger projects typically standardize on the toolset
used. It helps if everyone can use everyone else's computer
(essential for XP).
I wouldn't go back and learn emacs today. I can use vi for Q&D
(quick and dirty) development or step up to Eclipse if I need
to debug servlets and/or EJBs in my J2EE servers.
YMMV

Charles> Thanks for the tips -- I will have a good look at JDEE.
Charles> I'm still not sure about the status of GNU/emacs world, it
Charles> seems to depend very much on who you ask and what you read.

Well, of course it does. Choice of an editor, IDE, or other
environment is a entirely personal decision. This is as true of emacs
as anything else.

Charles> The GNU books are so rampant that you get the impression
Charles> that anyone who has to use a non-GNU IDE is an
Charles> insignificant script-kiddie who should be using VB.

Which "Gnu books" would these be.

Charles> But do
Charles> I really have to memorise bookloads of Meta-X keyboard
Charles> shortcuts to write Java 'properly'?

No. Emacs has now, and has for many years had, a menu system. The
keyboard shortcuts are a feature, which you do not have to use. It's
just that most Emacs users do use them. Once you get going with them,
having a keyboard driven interface is very fast, very easy on the
wrists.

Most people start using new Emacs functionality with the menu system,
and then migrate to the keyboard when they get used to it for this
reason.

Charles> Any further comments would be welcome, should I put in the
Charles> effort to learn the emacs stuff or do we think that's just
Charles> GNU snobbery?

If you learn to use emacs well it will pay you back. Whether it pays
you back enough to be worth the effort is not something anyone here
can answer.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!