Menu

calling debugger from inside script (Ubuntu)

2009-01-10
2012-12-10
  • Adam Monsen

    Adam Monsen - 2009-01-10

    I had a little trouble starting the BASH debugger from inside my program on Ubuntu 8.10. I found something that works and thought I'd float it in this forum to figure out if
    * I'm doing the right thing
    * I should be doing something else
    * there's a bug in the debugger that should be filed

    Following the guide installed at /usr/share/doc/bashdb/bashdb.html (part of the "bashdb" package) I tried the first step:

      source /usr/share/bashdb/bashdb-trace

    And got the following error:

      test.sh: cannot read .  Perhaps bashdb is installed wrong.
      test.sh: or try using -L (with a different directory).

    Aside from "cannot read .", this turned out to be a decent error message. I added "-L /usr/share/bashdb" to the line sourcing the bashdb-trace script, and the error message went away. I was then able to call _Dbg_set_trace and enter the debugger. Yay!

    Looking at the bashdb-trace script, I noticed that it expects $prefix to be set, but $prefix did not appear to be defined anywhere (this is what I thought might be a bug). Adding

      export prefix=/usr

    to my script also allowed bashdb-trace to be sourced properly.

    --
    Adam Monsen

     
    • Rocky Bernstein

      Rocky Bernstein - 2009-01-11

      I'm delighted to learn that someone other than myself has been able to use this.

      There was a major revision that came out the end of last October and part of that specifically tries to fix of the weirdnesses with this code. In fact, even that error message has changed to mention that the problem is in finding the *library* directory.

      I've mentioned the new revision Alex Moskalenko -- a good guy for having undertaken packaging this (and is a good guy otherwise too!) But it looks though like he hasn't gotten around updating this or the Python debugger (pydb) yet.

      By the way, in the most recent version although you can still call _Dbg_set_trace, that is sort of depricated (it's a Pythonism ;-) in favor of the more straighforward (I think) _Dbg_debugger.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.