How do I get the bash debugger to work with ddd?

482

Solution 1

I was able to get ddd and bashdb to play nice on Ubuntu 12.04 today:

  1. Remove the repo-supplied ddd:

    sudo apt-get remove ddd
    
  2. Fetch ddd v3.3.9 and install from source, e. g.:

    sudo apt-get build-dep ddd
    sudo apt-get install libmotif-dev
    wget http://ftp.gnu.org/gnu/ddd/ddd-3.3.9.tar.gz
    tar xvf ddd-3.3.9.tar.gz
    cd ddd-3.3.9
    ./configure
    make
    sudo make install
    

    Note: I had to make a single patch to the source code to get the build to work -- in ddd/strclass.C, we needed a #include <stdio.h>; at the top to define EOF.

  3. Make sure bashdb is installed:

    sudo apt-get install bashdb
    
  4. Launch with:

    ddd --debugger /usr/bin/bashdb -- {script name} {parameters}
    

Could not live without ddd + Bash.

Optional: gpg verification:

Search for sign on https://www.gnu.org/software/ddd/ will redirect to https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=ddd

  1. Download ddd-keyring.gpg.

  2. Import it into your key chain:

    gpg --import ddd-keyring.gpg
    
  3. Verify the signature:

    wget http://ftp.gnu.org/gnu/ddd/ddd-3.3.9.tar.gz.sig
    gpg --verify
    

Solution 2

To get ddd to work with the bash debugger on bash scripts, it's necessary to install bashdb too.

If it's not installed, you get:

enter image description here

Afterwards, ddd seems to work normally:

enter image description here

Solution 3

This is a regression introduced in DDD 3.3.12, see bug #41649.

The last usable version is 3.3.11.

Share:
482

Related videos on Youtube

Juanu
Author by

Juanu

Updated on September 18, 2022

Comments

  • Juanu
    Juanu almost 2 years

    In my project, I have a service that connects to an HTTP to see if it's online. Everything works great, It does connect.

    The problem is when my device goes to sleep.

    I use the AlarmManager to trigger the check events, using RTC_WAKEUP, so that the process is run even when the screen is off...

    The problem is that this is not really happening. I created a Logging Method to see what happens behind the curtains of my app.

    I log every step, writing the time it happened to see when and how things are happening.

    When i set my device to sleep, and come back after a few minutes, I can see that the Alarm is triggering ONLY when I wake the device up, and not while it's sleeping.

    Here is the code in which I create the alarm:

    public static void AddAlarm(Context pContext, Server pServer)
    {
        // Create pending with intent and server object with a helper that creates  my pending intent.
        PendingIntent pending = IntentGenerator.GetPendingIntentForAlarm(pContext,pServer.ServerId);
    
        // Get alarm manager
        AlarmManager alarm = (AlarmManager)pContext.getSystemService("alarm");
    
        // Get current time to start now.
        long startNow = new Date().getTime()-10;
    
        // Set repeating alarm with current time to start, and interval.
        alarm.setRepeating(AlarmManager.RTC_WAKEUP ,startNow, pServer.GetIntervalInMilliseconds(), pending);
    }
    

    And in case you are wondering how i create the pending intent:

    public static Intent GetIntentForService(Context pContext, int pServerId)
    {
        // Comienzo la alarma.
        Intent retVal = new Intent(pContext, ServerStatusCheckService.class);
        retVal.putExtra("SERVER_ID", pServerId);
    
        return retVal; 
    }
    
  • ish
    ish almost 12 years
    @JamesMitch, yes, I'm on Precise 12.04 (64-bit, though).
  • James Mitch
    James Mitch almost 12 years
    Did you actually test to step through a bash script? I booted the Precise 12.04 64-bit DVD, installed ddd and bashdb and still couldn't open a bash script without seeing the hourglass.
  • Stabledog
    Stabledog almost 12 years
    I did get it working on Ubuntu 12.04, by using an old version of ddd (3.3.9). Had to build it from source, and install the libmotif-dev package first.
  • Stabledog
    Stabledog almost 12 years
    Additional details here: askubuntu.com/a/178692/73165
  • Wes Miller
    Wes Miller over 10 years
    Just followed your instructions on 12.04 / 64. Almost works. After bashdb loads the script I click "step" and go into an infinite wait for bash to finish starting. Suggestions?
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 6 years
    Your bug report is from April 2014. The OP's question is from June 2012.
  • Bass
    Bass about 6 years
    I’ve checked all four versions from 3.3.9 to 3.3.12. There’s definely a regression introduced in 3.3.12 (they’ve made lots of changes related to remake, bashdb and pydb). And 3.3.12 was released in 2009, so there’s a pretty good chance the OP was running this very version.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 6 years
    OK but this is the year 2018. An answer was written and accepted in 2012. Plus the answer received 4 up-votes. The OP hasn't signed on in over five years an is unlikely to comment on your answer.
  • Bass
    Bass about 6 years
    @WinEunuuchs2Unix Okay, maybe mine is the answer to a slightly different question, but this page appears in Google's top 10 for those seeking the answer to "why bashdb integration doesn't work". So I'm not expecting any comments or upvotes, just accumulating the knowledge.
  • Erasmus Cedernaes
    Erasmus Cedernaes almost 6 years
    Works on Ubuntu 16.04