Make it easier to debug reference counts in LTL nodes.
* src/ltlast/automatop.cc, src/ltlast/automatop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh: Add a dump_instance() static method to all class. * src/ltltest/readltl.cc: Add option -r to dump all instances with their reference count, after parsing and after deletion.
This commit is contained in:
parent
3488bf45e0
commit
631f4b5bea
10 changed files with 133 additions and 19 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
||||||
|
2009-11-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
|
Make it easier to debug reference counts in LTL nodes.
|
||||||
|
|
||||||
|
* src/ltlast/automatop.cc, src/ltlast/automatop.hh,
|
||||||
|
src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/multop.cc,
|
||||||
|
src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh:
|
||||||
|
Add a dump_instance() static method to all class.
|
||||||
|
* src/ltltest/readltl.cc: Add option -r to dump all instances
|
||||||
|
with their reference count, after parsing and after deletion.
|
||||||
|
|
||||||
2009-11-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
2009-11-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
Better types for instance maps.
|
Better types for instance maps.
|
||||||
|
|
|
||||||
|
|
@ -117,5 +117,19 @@ namespace spot
|
||||||
{
|
{
|
||||||
return instances.size();
|
return instances.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
automatop::dump_instances(std::ostream& os)
|
||||||
|
{
|
||||||
|
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
|
||||||
|
{
|
||||||
|
os << i->second << " = "
|
||||||
|
<< i->second->ref_count_() << " * "
|
||||||
|
<< i->second->dump()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
# define SPOT_LTLAST_AUTOMATOP_HH
|
# define SPOT_LTLAST_AUTOMATOP_HH
|
||||||
|
|
||||||
# include <vector>
|
# include <vector>
|
||||||
|
# include <iosfwd>
|
||||||
# include <map>
|
# include <map>
|
||||||
# include "nfa.hh"
|
# include "nfa.hh"
|
||||||
# include "refformula.hh"
|
# include "refformula.hh"
|
||||||
|
|
@ -72,6 +73,10 @@ namespace spot
|
||||||
/// Number of instantiated multop operators. For debugging.
|
/// Number of instantiated multop operators. For debugging.
|
||||||
static unsigned instance_count();
|
static unsigned instance_count();
|
||||||
|
|
||||||
|
/// Dump all instances. For debugging.
|
||||||
|
static std::ostream& dump_instances(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::pair<std::pair<nfa::ptr, bool>, vec*> triplet;
|
typedef std::pair<std::pair<nfa::ptr, bool>, vec*> triplet;
|
||||||
/// Comparison functor used internally by ltl::automatop.
|
/// Comparison functor used internally by ltl::automatop.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2005, 2009 Laboratoire d'Informatique de Paris
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "binop.hh"
|
#include "binop.hh"
|
||||||
#include "visitor.hh"
|
#include "visitor.hh"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
@ -149,5 +150,21 @@ namespace spot
|
||||||
{
|
{
|
||||||
return instances.size();
|
return instances.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
binop::dump_instances(std::ostream& os)
|
||||||
|
{
|
||||||
|
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
|
||||||
|
{
|
||||||
|
os << i->second << " = "
|
||||||
|
<< i->second->ref_count_() << " * "
|
||||||
|
<< i->second->dump()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
# define SPOT_LTLAST_BINOP_HH
|
# define SPOT_LTLAST_BINOP_HH
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <iosfwd>
|
||||||
#include "refformula.hh"
|
#include "refformula.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
|
|
@ -70,6 +71,9 @@ namespace spot
|
||||||
/// Number of instantiated binary operators. For debugging.
|
/// Number of instantiated binary operators. For debugging.
|
||||||
static unsigned instance_count();
|
static unsigned instance_count();
|
||||||
|
|
||||||
|
/// Dump all instances. For debugging.
|
||||||
|
static std::ostream& dump_instances(std::ostream& os);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::pair<formula*, formula*> pairf;
|
typedef std::pair<formula*, formula*> pairf;
|
||||||
typedef std::pair<type, pairf> pair;
|
typedef std::pair<type, pairf> pair;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2004, 2005, 2009 Laboratoire d'Informatique de
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
#include "multop.hh"
|
#include "multop.hh"
|
||||||
#include "constant.hh"
|
#include "constant.hh"
|
||||||
#include "visitor.hh"
|
#include "visitor.hh"
|
||||||
|
|
@ -208,5 +209,19 @@ namespace spot
|
||||||
{
|
{
|
||||||
return instances.size();
|
return instances.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
multop::dump_instances(std::ostream& os)
|
||||||
|
{
|
||||||
|
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
|
||||||
|
{
|
||||||
|
os << i->second << " = "
|
||||||
|
<< i->second->ref_count_() << " * "
|
||||||
|
<< i->second->dump()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <iosfwd>
|
||||||
#include "refformula.hh"
|
#include "refformula.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
|
|
@ -95,6 +96,9 @@ namespace spot
|
||||||
/// Number of instantiated multi-operand operators. For debugging.
|
/// Number of instantiated multi-operand operators. For debugging.
|
||||||
static unsigned instance_count();
|
static unsigned instance_count();
|
||||||
|
|
||||||
|
/// Dump all instances. For debugging.
|
||||||
|
static std::ostream& dump_instances(std::ostream& os);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::pair<type, vec*> pair;
|
typedef std::pair<type, vec*> pair;
|
||||||
/// Comparison functor used internally by ltl::multop.
|
/// Comparison functor used internally by ltl::multop.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2005, 2009 Laboratoire d'Informatique de Paris
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "unop.hh"
|
#include "unop.hh"
|
||||||
#include "visitor.hh"
|
#include "visitor.hh"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
@ -117,5 +118,19 @@ namespace spot
|
||||||
{
|
{
|
||||||
return instances.size();
|
return instances.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
unop::dump_instances(std::ostream& os)
|
||||||
|
{
|
||||||
|
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
|
||||||
|
{
|
||||||
|
os << i->second << " = "
|
||||||
|
<< i->second->ref_count_() << " * "
|
||||||
|
<< i->second->dump()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
# define SPOT_LTLAST_UNOP_HH
|
# define SPOT_LTLAST_UNOP_HH
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <iosfwd>
|
||||||
#include "refformula.hh"
|
#include "refformula.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
|
|
@ -59,6 +60,9 @@ namespace spot
|
||||||
/// Number of instantiated unary operators. For debugging.
|
/// Number of instantiated unary operators. For debugging.
|
||||||
static unsigned instance_count();
|
static unsigned instance_count();
|
||||||
|
|
||||||
|
/// Dump all instances. For debugging.
|
||||||
|
static std::ostream& dump_instances(std::ostream& os);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::pair<type, formula*> pair;
|
typedef std::pair<type, formula*> pair;
|
||||||
typedef std::map<pair, unop*> map;
|
typedef std::map<pair, unop*> map;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2003, 2008 Laboratoire d'Informatique de Paris 6
|
// Copyright (C) 2003, 2008, 2009 Laboratoire d'Informatique de Paris 6
|
||||||
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||||
// Pierre et Marie Curie.
|
// Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
@ -36,6 +36,16 @@ syntax(char* prog)
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dump_instances(const std::string& label)
|
||||||
|
{
|
||||||
|
std::cerr << "=== " << label << " ===" << std::endl;
|
||||||
|
spot::ltl::atomic_prop::dump_instances(std::cerr);
|
||||||
|
spot::ltl::unop::dump_instances(std::cerr);
|
||||||
|
spot::ltl::binop::dump_instances(std::cerr);
|
||||||
|
spot::ltl::multop::dump_instances(std::cerr);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
@ -45,6 +55,7 @@ main(int argc, char** argv)
|
||||||
syntax(argv[0]);
|
syntax(argv[0]);
|
||||||
|
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
bool debug_ref = false;
|
||||||
int formula_index = 1;
|
int formula_index = 1;
|
||||||
|
|
||||||
if (!strcmp(argv[1], "-d"))
|
if (!strcmp(argv[1], "-d"))
|
||||||
|
|
@ -54,6 +65,13 @@ main(int argc, char** argv)
|
||||||
syntax(argv[0]);
|
syntax(argv[0]);
|
||||||
formula_index = 2;
|
formula_index = 2;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[1], "-r"))
|
||||||
|
{
|
||||||
|
debug_ref = true;
|
||||||
|
if (argc < 3)
|
||||||
|
syntax(argv[0]);
|
||||||
|
formula_index = 2;
|
||||||
|
}
|
||||||
|
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::ltl::parse_error_list pel;
|
spot::ltl::parse_error_list pel;
|
||||||
|
|
@ -63,8 +81,12 @@ main(int argc, char** argv)
|
||||||
exit_code =
|
exit_code =
|
||||||
spot::ltl::format_parse_errors(std::cerr, argv[formula_index], pel);
|
spot::ltl::format_parse_errors(std::cerr, argv[formula_index], pel);
|
||||||
|
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
|
if (debug_ref)
|
||||||
|
dump_instances("before");
|
||||||
|
|
||||||
#ifdef DOTTY
|
#ifdef DOTTY
|
||||||
spot::ltl::dotty(std::cout, f);
|
spot::ltl::dotty(std::cout, f);
|
||||||
#else
|
#else
|
||||||
|
|
@ -72,6 +94,9 @@ main(int argc, char** argv)
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
#endif
|
#endif
|
||||||
spot::ltl::destroy(f);
|
spot::ltl::destroy(f);
|
||||||
|
|
||||||
|
if (debug_ref)
|
||||||
|
dump_instances("after");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue