0

For compilation I used:

   1)  ./configure --enable-dddmp --enable-obj --enable-shared --enable-static; make
   2)  gcc test.c -o testprogram -I /path/to/cudd-3.0.0/cudd -I /path/to/cudd-3.0.0/util -I /path/to/cudd-3.0.0/ -static -L /path/to/cudd-3.0.0/cudd/.libs/ -lcudd -lm

The program is compiled successfully. I am using cudd3.0.0 package. After that I am getting this segmentation error in execution:

enter image description here

Please suggest the proper way to execute this and why I am getting this error?

I am adding the main function:

int main (int argc, char *argv[])
{
    char filename[30];
    DdManager *gbm; /* Global BDD manager. */
    gbm = Cudd_Init(0,0,CUDD_UNIQUE_SLOTS,CUDD_CACHE_SLOTS,0); /* Initialize a new BDD manager. */
    DdNode *bdd, *var, *tmp_neg, *tmp;
    int i;
    bdd = Cudd_ReadOne(gbm); /*Returns the logic one constant of the manager*/
    Cudd_Ref(bdd); /*Increases the reference count of a node*/

    for (i = 3; i >= 0; i--) {
        var = Cudd_bddIthVar(gbm,i); /*Create a new BDD variable*/
        tmp_neg = Cudd_Not(var); /*Perform NOT boolean operation*/
        tmp = Cudd_bddAnd(gbm, tmp_neg, bdd); /*Perform AND boolean operation*/
        Cudd_Ref(tmp);
        Cudd_RecursiveDeref(gbm,bdd);
        bdd = tmp;
    }

    bdd = Cudd_BddToAdd(gbm, bdd); /*Convert BDD to ADD for display purpose*/
    print_dd (gbm, bdd, 2,4);   /*Print the dd to standard output*/
    sprintf(filename, "./bdd/graph.dot"); /*Write .dot filename to a string*/
    write_dd(gbm, bdd, filename);  /*Write the resulting cascade dd to a file*/
    Cudd_Quit(gbm);
    return 0;
}
Aadil Hoda
  • 592
  • 7
  • 17

1 Answers1

0

Yes, It is resolved. I have not made the folder named 'bdd' in the proper location for the code line:

sprintf(filename, "./bdd/graph.dot");

Now, it is executing. Sorry, I thought it was some conceptual error.

Aadil Hoda
  • 592
  • 7
  • 17
  • Note that a missing folder should never lead to a segfault. As far as I can see, you wrote the function "write_dd" yourself (it is not part of CUDD but also not part of your posted code), and if a missing folder leads an segfault, you are most likely not checking the return value of the "fopen" call (CUDD's dumping function get a FILE* as parameter). So the problem really has nothing to do with CUDD. – DCTLib Dec 18 '19 at 07:37
  • it was just the missing folder in my case. @DCTLib – Aadil Hoda Jan 15 '20 at 18:39
  • Have you created bdd file using CUDD package? I am creating BDD and able to view it aslo, but not able to store it in BDD file. @DCTLib – Aadil Hoda Jan 23 '20 at 19:55
  • 1
    You are using the DDDMP package for storing the BDD? – DCTLib Jan 24 '20 at 07:27
  • I think, there should be a way to store BDD through DDDMP? One of the functions in DDDMP is **static int BddStore(DdManager *ddMgr, DdNode **operandBdd, dddmpVarInfo_t *varInfo);**. But the argument varInfo is a struct which has many variables, we have to manually fill it all? Or there is another way to store BDD in a file and I am getting it wrong? – Aadil Hoda Jan 25 '20 at 05:44
  • Yes, I am using DDDMP package @DCTLib – Aadil Hoda Jan 25 '20 at 09:00
  • 1
    You seem to be looking at the internal functions of DDDMP - the official API for use can be viewed at http://www.cs.uleth.ca/~rice/cudd_docs/dddmp/dddmpExt.html - it's not too hard to use but a bit cumbersome. An array with variable indices of interest has to be filled, though. Make sure to interpret the return value. Search google for examples on using the Dddmp_cuddBddStore function. – DCTLib Jan 25 '20 at 20:45