Git Product home page Git Product logo

bashdb's Introduction

Build Status Circle

Packaging status

Here, we have a debugger for Bash 5.2 and higher.

Other branches in this repository support earlier versions of Bash. For example, use branch 4.1 for Bash version 4.1.

The command syntax generally follows that of the zsh debugger , trepanning debuggers and, more generally, GNU debugger gdb.

There are 3 ways to get into the debugger. If bash (with debugger support enabled which is the default) is installed and the debugger are both installed properly. Then:

   bash --debugger -- bash-script-name script-arg1 script-arg2...

If bash isn't installed in a way that will find bashdb, then:

   bashdb [bashdb-opts] -- bash-script-name script-arg1 script-arg2...

The downside here is that $0 will be "bashdb" not bash-script-name. Also call stack will show the invocation to bashdb.

Finally, to invoke the debugger from the script

  # my script
  # work, work, work, ...

  # Load debugger support
  source <bashdb-installation>/bashdb-trace -L <bashdb-installation>
  # work, work, work or not...
  _Dbg_debugger; :   # Calls the debugger at the line below
  stop_here

An advantage of the above is that there is no overhead up until you invoke the debugger. Typically for large bash programs like configuration scripts, this is a big win.

IMPORTANT NOTE IF YOU USE THE ABOVE TO DEBUG CONFIGURE SCRIPTS...

stdin is closed by configure early on. This causes the debugger to quit. You can get around this invoking a command script that sets debugger up input and output. Run tty to figure out what the terminal tty is set to.

  $ tty
  /dev/pts/3
  $

Above it came out to /dev/pts/3. Let's go with that. Put the folliwng in a file say /tmp/bashdb-configure

  source /dev/pts/3
  tty /dev/pts/3

Now arrange to read that configuration file using the -x or --eval-command switch:

  source <bashdb-installation>/bashdb-trace -L <bashdb-installation> -x /tmp/bashdb-configure

See INSTALL for generic GNU configure installation instructions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.