Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

debugging bash script in emacs using bashdb

355 views
Skip to first unread message

fiftyeight

unread,
Jun 29, 2011, 7:22:04 PM6/29/11
to Help-gn...@gnu.org

Hi, I'm new to emacs and I'm trying to debug bash script with it.
I've downloaded the bashdb package and it works for me
when I use it from the terminal.

But I read in the bashdb website that you can use it with emacs,
they have a link there to a project called emacs-dbgr,
but after downloading and installing the emacs-dbgr
I enter emacs and do M-x load-libarary dbgr like the installation
instructions
say but I just tells me "cannot open load file".

Can anybody tell me how I debug bash scripts using emacs?
either with the emacs-dbgr library or anything else
--
View this message in context: http://old.nabble.com/debugging-bash-script-in-emacs-using-bashdb-tp31959141p31959141.html
Sent from the Emacs - Help mailing list archive at Nabble.com.


Andreas Röhler

unread,
Jun 30, 2011, 2:41:42 AM6/30/11
to help-gn...@gnu.org
Am 30.06.2011 01:22, schrieb fiftyeight:
>
> Hi, I'm new to emacs and I'm trying to debug bash script with it.
> I've downloaded the bashdb package and it works for me
> when I use it from the terminal.
>
> But I read in the bashdb website that you can use it with emacs,
> they have a link there to a project called emacs-dbgr,
> but after downloading and installing the emacs-dbgr
> I enter emacs and do M-x load-libarary dbgr like the installation
> instructions
> say but I just tells me "cannot open load file".
>
> Can anybody tell me how I debug bash scripts using emacs?
> either with the emacs-dbgr library or anything else

Hi,

when using the command line debugger from the emacs shell -- `M-x shell'
-- you will already have a great advantage, as the output is within the
editor.

Strategically, if you are new to Emacs, I recommend exploring Emacs
itself first rather than running third-party programs, which may need
some adaption. Quit often that jumps into complexity.


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/components-python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/


Peter Dyballa

unread,
Jun 30, 2011, 7:08:16 AM6/30/11
to help-gnu-emacs@gnu.org List

Am 30.06.2011 01:22, schrieb fiftyeight:

>> "cannot open load file"


The dbgr library file needs to be saved in a directory recorded in the
variable load-path (can be overridden/augmented by environment
variable EMACSLOADPATH). This way GNU Emacs will find it
automatically. Best is to use a directory "site-lisp", because this is
meant to contain locally maintained ELisp files.

--
Greetings

Pete

A blizzard is when it snows sideways.


rocky

unread,
Jun 30, 2011, 9:08:50 AM6/30/11
to help-gn...@gnu.org
fiftyeight <fiftyeight <at> walla.com> writes:

> ... I read in the bashdb website that you can use it with emacs,


> they have a link there to a project called emacs-dbgr,
> but after downloading and installing the emacs-dbgr
> I enter emacs and do M-x load-libarary dbgr like the installation
> instructions
> say but I just tells me "cannot open load file".
>
> Can anybody tell me how I debug bash scripts using emacs?
> either with the emacs-dbgr library or anything else


I think I found the problem (which was introduced recently) and it should be
fixed now. So try again. Thanks.


zackp

unread,
Jun 15, 2012, 3:49:59 PM6/15/12
to help-gn...@gnu.org, ro...@gnu.org
Hi,

I just tried to install the dbgr package again using the following bash script posted on git hub:

#!/bin/bash
for pkg in emacs-{test-unit,load-relative,loc-changes,dbgr} ; do
echo Trying to install ${pkg}...
git clone http://github.com/rocky/${pkg}.git
(cd $pkg && \
sh ./autogen.sh && ./configure && make && make check && sudo make install
)
done

At the end, I got:

make -C ../../test check
make[3]: Entering directory `/root/emacs-dbgr/test'
(cd ../test && /usr/bin/emacs --batch --no-site-file --no-splash --load test-bp.el)
Cannot open load file: test-simple
make[3]: *** [test-bp.run] Error 255
make[3]: Leaving directory `/root/emacs-dbgr/test'
make[2]: *** [check] Error 2
make[2]: Leaving directory `/root/emacs-dbgr/dbgr/debugger'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/root/emacs-dbgr/dbgr'
make: *** [check-recursive] Error 1

> > say but I just tells me "cannot open load file".
> >
> > Can anybody tell me how I debug bash scripts using emacs?
> > either with the emacs-dbgr library or anything else
>
>
> I think I found the problem (which was introduced recently) and it should be
> fixed now. So try again. Thanks.

I am using GNU Emacs 23.2.1 in Ubuntu 11.04 64bit.

root@nb1:~# emacs --version
GNU Emacs 23.2.1
Copyright (C) 2010 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

In emacs, as myself (regular user, not 'root'), I also encountered the "cannot open load file" error too.

I would appreciate any help.

Regards,

Zack

zack....@sbcglobal.net

unread,
Jun 15, 2012, 4:04:30 PM6/15/12
to help-gn...@gnu.org, ro...@gnu.org
OK, I made a bit progress. After some googling, I found this:

https://github.com/rocky/emacs-test-simple

That's where you can get the required test-simple.el

The following bash script should be enhanced with this pre-requisite.

>
> #!/bin/bash
> for pkg in emacs-{test-unit,load-relative,loc-changes,dbgr} ; do
> echo Trying to install ${pkg}...
> git clone http://github.com/rocky/${pkg}.git
> (cd $pkg && \
> sh ./autogen.sh && ./configure && make && make check && sudo make install
> )
> done
>

Will see if I can figure out the rest. But would be grateful to any hints.

Regards,

Zack

zackp

unread,
Jun 15, 2012, 3:49:59 PM6/15/12
to gnu.ema...@googlegroups.com, ro...@gnu.org, help-gn...@gnu.org
Hi,

I just tried to install the dbgr package again using the following bash script posted on git hub:

#!/bin/bash
for pkg in emacs-{test-unit,load-relative,loc-changes,dbgr} ; do
echo Trying to install ${pkg}...
git clone http://github.com/rocky/${pkg}.git
(cd $pkg && \
sh ./autogen.sh && ./configure && make && make check && sudo make install
)
done

At the end, I got:

make -C ../../test check
make[3]: Entering directory `/root/emacs-dbgr/test'
(cd ../test && /usr/bin/emacs --batch --no-site-file --no-splash --load test-bp.el)
Cannot open load file: test-simple
make[3]: *** [test-bp.run] Error 255
make[3]: Leaving directory `/root/emacs-dbgr/test'
make[2]: *** [check] Error 2
make[2]: Leaving directory `/root/emacs-dbgr/dbgr/debugger'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/root/emacs-dbgr/dbgr'
make: *** [check-recursive] Error 1

> > say but I just tells me "cannot open load file".
> >
> > Can anybody tell me how I debug bash scripts using emacs?
> > either with the emacs-dbgr library or anything else
>
>
> I think I found the problem (which was introduced recently) and it should be
> fixed now. So try again. Thanks.

zack....@sbcglobal.net

unread,
Jun 15, 2012, 4:04:30 PM6/15/12
to gnu.ema...@googlegroups.com, ro...@gnu.org, help-gn...@gnu.org
OK, I made a bit progress. After some googling, I found this:

https://github.com/rocky/emacs-test-simple

That's where you can get the required test-simple.el

The following bash script should be enhanced with this pre-requisite.

>
> #!/bin/bash
> for pkg in emacs-{test-unit,load-relative,loc-changes,dbgr} ; do
> echo Trying to install ${pkg}...
> git clone http://github.com/rocky/${pkg}.git
> (cd $pkg && \
> sh ./autogen.sh && ./configure && make && make check && sudo make install
> )
> done
>

rocky

unread,
Jun 15, 2012, 5:22:19 PM6/15/12
to ro...@gnu.org, help-gn...@gnu.org
I have updated that install script to also install test-simple now. I'm sorry for the breakage.

The longer story is that I've been converting tests that validate emacs-dbgr to use a much simpler test framework. I'm in the middle of converting the tests. As I rarely get feedback on emacs-dbgr I tend to lose site that anyone other than myself might be using it let alone installing it for the first time.

By the way, I think test-simple is cool. My epiphany on this came from a little talk I gave http://rocky.github.com/NYC-Lisp-Elisp-talk where I realized that needed too many slide to describe how to write tests.

rocky

unread,
Jun 15, 2012, 5:28:01 PM6/15/12
to help-gn...@gnu.org
On Thursday, June 30, 2011 2:41:42 AM UTC-4, Andreas Röhler wrote:
> Am 30.06.2011 01:22, schrieb fiftyeight:
> >
> > Hi, I'm new to emacs and I'm trying to debug bash script with it.
> > I've downloaded the bashdb package and it works for me
> > when I use it from the terminal.
> >
> > But I read in the bashdb website that you can use it with emacs,
> > they have a link there to a project called emacs-dbgr,
> > but after downloading and installing the emacs-dbgr
> > I enter emacs and do M-x load-libarary dbgr like the installation
> > instructions
> > say but I just tells me "cannot open load file".
> >
> > Can anybody tell me how I debug bash scripts using emacs?
> > either with the emacs-dbgr library or anything else
>
> Hi,
>
> when using the command line debugger from the emacs shell -- `M-x shell'
> -- you will already have a great advantage, as the output is within the
> editor.

One of the cool things about emacs-dbgr is that yes you can start off in a shell and then later go into a minor mode which tracks your position from debugger output. This is set up via M-x dbgr-track-mode. And as with other modes one can turn that on or off or switch the kinds of debuggers one is working with.

That said, for those that want more context shown inside the shell (whether in emacs or not) bashdb and a number of other debuggers have the command "set autolist on".

Rocky Bernstein

unread,
Jun 15, 2012, 5:18:34 PM6/15/12
to zackp, help-gn...@gnu.org, gnu.ema...@googlegroups.com
I have updated that install script to also install test-simple now.  I'm sorry for the breakage. 

The longer story is that I've been converting tests that validate emacs-dbgr to use a much simpler test framework. I'm in the middle of converting the tests. As I rarely get feedback on emacs-dbgr I tend to lose site that anyone other than myself might be installing it for the first time.


By the way, I think test-simple is cool. My epiphany on this came from a little talk I gave http://rocky.github.com/NYC-Lisp-Elisp-talk where I realized that needed too many slide to describe how to write tests.

rocky

unread,
Jun 15, 2012, 5:22:19 PM6/15/12
to gnu.ema...@googlegroups.com, ro...@gnu.org, help-gn...@gnu.org
I have updated that install script to also install test-simple now. I'm sorry for the breakage.

The longer story is that I've been converting tests that validate emacs-dbgr to use a much simpler test framework. I'm in the middle of converting the tests. As I rarely get feedback on emacs-dbgr I tend to lose site that anyone other than myself might be using it let alone installing it for the first time.

By the way, I think test-simple is cool. My epiphany on this came from a little talk I gave http://rocky.github.com/NYC-Lisp-Elisp-talk where I realized that needed too many slide to describe how to write tests.

On Friday, June 15, 2012 3:49:59 PM UTC-4, zackp wrote:

rocky

unread,
Jun 15, 2012, 5:28:01 PM6/15/12
to gnu.ema...@googlegroups.com, help-gn...@gnu.org
On Thursday, June 30, 2011 2:41:42 AM UTC-4, Andreas Röhler wrote:
> Am 30.06.2011 01:22, schrieb fiftyeight:
> >
> > Hi, I'm new to emacs and I'm trying to debug bash script with it.
> > I've downloaded the bashdb package and it works for me
> > when I use it from the terminal.
> >
> > But I read in the bashdb website that you can use it with emacs,
> > they have a link there to a project called emacs-dbgr,
> > but after downloading and installing the emacs-dbgr
> > I enter emacs and do M-x load-libarary dbgr like the installation
> > instructions
> > say but I just tells me "cannot open load file".
> >
> > Can anybody tell me how I debug bash scripts using emacs?
> > either with the emacs-dbgr library or anything else
>
> Hi,
>
> when using the command line debugger from the emacs shell -- `M-x shell'
> -- you will already have a great advantage, as the output is within the
> editor.

One of the cool things about emacs-dbgr is that yes you can start off in a shell and then later go into a minor mode which tracks your position from debugger output. This is set up via M-x dbgr-track-mode. And as with other modes one can turn that on or off or switch the kinds of debuggers one is working with.

That said, for those that want more context shown inside the shell (whether in emacs or not) bashdb and a number of other debuggers have the command "set autolist on".


>

zackp

unread,
Jun 16, 2012, 2:42:51 PM6/16/12
to ro...@gnu.org
Hi Rocky,


> I have updated that install script to also install test-simple now.  I'm sorry for the breakage.

Many thanks for the quick help! May I remind you that you updated the
following:

https://raw.github.com/rocky/emacs-dbgr/master/install-from-git.sh

but the snippet in the section The full instructions is still missing
the test-simple. Should I open an Issue there as reminder, or this
follow-up is sufficient for you?


>
> The longer story is that I've been converting tests that validate emacs-dbgr to use a much simpler test framework. I'm in the middle of converting the tests. As I rarely get feedback on emacs-dbgr I tend to lose site that anyone other than myself might be using it let alone installing it for the first time.
>

It's a pity that to many people, their way of debugging bash/sh script
is still the -v option! They are missing bashdb big time!

> By the way, I think test-simple is cool. My epiphany on this came from a little talk I gavehttp://rocky.github.com/NYC-Lisp-Elisp-talkwhere I realized that needed too many slide to describe how to write tests.

Definitely will check it out. Last night, I switched to Emacs 24 on
this notebook running Ubuntu 11.04. So far so good. bashdb runs fine
happily so far.

Best Regards, and have a great weekend,

Zack
0 new messages