[nemiver/better-variable-format: 8/9] Initialize IDebugger dynmods with gconf in tests
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/better-variable-format: 8/9] Initialize IDebugger dynmods with gconf in tests
- Date: Sun, 12 Sep 2010 18:08:42 +0000 (UTC)
commit 48a4ef1a32ba8e41d230fd6716c9eb2bcb5bb187
Author: Dodji Seketeli <dodji gnome org>
Date: Sun Sep 12 19:25:10 2010 +0200
Initialize IDebugger dynmods with gconf in tests
* src/dbgengine/nmv-debugger-utils.[h,cc]
(load_debugger_iface_with_gconf): New entry point.
* tests/test-cpptrait.cc (test_debugger)
* tests/test-deref.cc (test_main)
* tests/test-disassemble.cc (test_main)
* tests/test-local-vars-list.cc (test_main)
* tests/test-types.cc (test_main)
* tests/test-var-list.cc (test_main)
* tests/test-var-walker.cc (test_main)
* tests/test-variable-format.cc (test_main)
* tests/test-varobj-walker.cc (test_main)
* tests/test-vars.cc (test_main)
* tests/test-watchpoint.cc (test_main):
Use load_debugger_iface_with_gconf.
* tests/Makefile.am: Link all the tests loading the IDebugger
interface with $(top_builddir)/src/dbgengine/libdebuggerutils.la
src/dbgengine/nmv-debugger-utils.cc | 24 ++++++++++++++++++++++++
src/dbgengine/nmv-debugger-utils.h | 2 ++
tests/Makefile.am | 27 ++++++++++++++++++---------
tests/test-cpptrait.cc | 4 ++--
tests/test-deref.cc | 8 ++++----
tests/test-disassemble.cc | 5 ++---
tests/test-local-vars-list.cc | 10 +++++-----
tests/test-types.cc | 6 ++----
tests/test-var-list.cc | 11 ++++++-----
tests/test-var-walker.cc | 11 +++++------
tests/test-variable-format.cc | 10 +++++-----
tests/test-varobj-walker.cc | 10 +++++-----
tests/test-vars.cc | 12 ++++++------
tests/test-watchpoint.cc | 4 ++--
14 files changed, 88 insertions(+), 56 deletions(-)
---
diff --git a/src/dbgengine/nmv-debugger-utils.cc b/src/dbgengine/nmv-debugger-utils.cc
index b6214a8..f07e766 100644
--- a/src/dbgengine/nmv-debugger-utils.cc
+++ b/src/dbgengine/nmv-debugger-utils.cc
@@ -157,5 +157,29 @@ variable_format_to_string (IDebugger::Variable::Format a_format)
return result;
}
+/// Load the debugger interface using the default
+/// DynamicModuleManager, and initialize it with the gconf
+/// based IConfMgr.
+/// \return the IDebuggerSafePtr
+IDebuggerSafePtr
+load_debugger_iface_with_gconf ()
+{
+
+ // Load the confmgr interface
+ IConfMgrSafePtr conf_mgr =
+ common::DynamicModuleManager::load_iface_with_default_manager<IConfMgr>
+ ("gconfmgr", "IConfMgr");
+
+ // load the IDebugger interface
+ IDebuggerSafePtr debugger =
+ common::DynamicModuleManager::load_iface_with_default_manager<IDebugger>
+ ("gdbengine", "IDebugger");
+
+ // Initialize the debugger interface.
+ debugger->do_init (conf_mgr);
+
+ return debugger;
+}
+
NEMIVER_END_NAMESPACE (debugger_utils)
NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/dbgengine/nmv-debugger-utils.h b/src/dbgengine/nmv-debugger-utils.h
index 61f4265..886f6f6 100644
--- a/src/dbgengine/nmv-debugger-utils.h
+++ b/src/dbgengine/nmv-debugger-utils.h
@@ -45,6 +45,8 @@ IDebugger::Variable::Format string_to_variable_format (const std::string &);
std::string variable_format_to_string (IDebugger::Variable::Format);
+IDebuggerSafePtr load_debugger_iface_with_gconf ();
+
NEMIVER_END_NAMESPACE (debugger_utils)
NEMIVER_END_NAMESPACE (nemiver)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2b179c6..25afd4d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -54,7 +54,8 @@ $(top_builddir)/src/common/libnemivercommon.la
runtestwatchpoint_SOURCES=test-watchpoint.cc
runtestwatchpoint_LDADD= NEMIVERCOMMON_LIBS@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestvarpathexpr_SOURCES=test-var-path-expr.cc
runtestvarpathexpr_LDADD= NEMIVERCOMMON_LIBS@ \
@@ -85,7 +86,8 @@ $(top_builddir)/src/common/libnemivercommon.la
runtestcpptrait_SOURCES=test-cpptrait.cc
runtestcpptrait_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestunicode_SOURCES=test-unicode.cc
runtestunicode_LDADD= NEMIVERCOMMON_LIBS@ \
@@ -94,23 +96,28 @@ $(top_builddir)/src/common/libnemivercommon.la
runtestvars_SOURCES=test-vars.cc
runtestvars_LDADD= NEMIVERCOMMON_LIBS@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestvarlist_SOURCES=test-var-list.cc
runtestvarlist_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestvarwalker_SOURCES=test-var-walker.cc
runtestvarwalker_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestderef_SOURCES=test-deref.cc
runtestderef_LDADD= NEMIVERCOMMON_LIBS@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestlocalvarslist_SOURCES=test-local-vars-list.cc
runtestlocalvarslist_LDADD= NEMIVERCOMMON_LIBS@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
#runtestglobalvariables_SOURCES=test-global-variables.cc
#runtestglobalvariables_LDADD= NEMIVERCOMMON_LIBS@ \
@@ -142,11 +149,13 @@ $(top_builddir)/src/common/libnemivercommon.la
runtesttypes_SOURCES=test-types.cc
runtesttypes_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
runtestdisassemble_SOURCES=test-disassemble.cc
runtestdisassemble_LDADD= NEMIVERCOMMON_LIBS@ \
-$(top_builddir)/src/common/libnemivercommon.la
+$(top_builddir)/src/common/libnemivercommon.la \
+$(top_builddir)/src/dbgengine/libdebuggerutils.la
docore_SOURCES=do-core.cc
docore_LDADD= NEMIVERCOMMON_LIBS@
diff --git a/tests/test-cpptrait.cc b/tests/test-cpptrait.cc
index 511342a..24aeaa8 100644
--- a/tests/test-cpptrait.cc
+++ b/tests/test-cpptrait.cc
@@ -3,6 +3,7 @@
#include "common/nmv-exception.h"
#include "nmv-i-lang-trait.h"
#include "nmv-i-debugger.h"
+#include "nmv-debugger-utils.h"
using namespace std;
using nemiver::common::Initializer;
@@ -45,8 +46,7 @@ void test_debugger ()
using nemiver::IDebugger;
using nemiver::IDebuggerSafePtr;
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine", "IDebugger");
+ nemiver::debugger_utils::load_debugger_iface_with_gconf ();
BOOST_REQUIRE (debugger);
ILangTrait &trait = debugger->get_language_trait ();
BOOST_REQUIRE (trait.get_name () == "cpptrait");
diff --git a/tests/test-deref.cc b/tests/test-deref.cc
index bb4787d..2edbcc3 100644
--- a/tests/test-deref.cc
+++ b/tests/test-deref.cc
@@ -4,6 +4,7 @@
#include "nmv-i-debugger.h"
#include "nmv-i-lang-trait.h"
#include "common/nmv-initializer.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -129,15 +130,14 @@ test_main (int argc, char **argv)
{
if (argc || argv) {}
- NEMIVER_TRY
+ NEMIVER_TRY;
Initializer::do_init ();
BOOST_REQUIRE (loop);
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
+
//setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
diff --git a/tests/test-disassemble.cc b/tests/test-disassemble.cc
index 6210c24..24f0a1c 100644
--- a/tests/test-disassemble.cc
+++ b/tests/test-disassemble.cc
@@ -32,6 +32,7 @@
#include "common/nmv-asm-utils.h"
#include "nmv-i-debugger.h"
#include "nmv-dbg-common.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -138,9 +139,7 @@ test_main (int, char**)
THROW_IF_FAIL (loop);
- DynamicModuleManager module_manager;
- debugger = module_manager.load_iface<IDebugger> ("gdbengine",
- "IDebugger");
+ debugger = debugger_utils::load_debugger_iface_with_gconf ();
debugger->set_event_loop_context (loop->get_context ());
diff --git a/tests/test-local-vars-list.cc b/tests/test-local-vars-list.cc
index 8bd929d..faf185d 100644
--- a/tests/test-local-vars-list.cc
+++ b/tests/test-local-vars-list.cc
@@ -4,6 +4,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list.h"
+#include "nmv-debugger-utils.h"
using namespace std;
using namespace nemiver;
@@ -126,15 +127,14 @@ test_main (int argc, char **argv)
{
if (argc || argv) {/*keep compiler happy*/}
- NEMIVER_TRY
+ NEMIVER_TRY;
Initializer::do_init ();
//load the IDebugger interface
debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
+
//setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
@@ -165,7 +165,7 @@ test_main (int argc, char **argv)
debugger->run ();
loop->run ();
- NEMIVER_CATCH_AND_RETURN_NOX (-1)
+ NEMIVER_CATCH_AND_RETURN_NOX (-1);
return 0;
}
diff --git a/tests/test-types.cc b/tests/test-types.cc
index f456295..739a642 100644
--- a/tests/test-types.cc
+++ b/tests/test-types.cc
@@ -4,6 +4,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-safe-ptr-utils.h"
#include "nmv-i-debugger.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -77,9 +78,8 @@ test_main (int, char **)
Initializer::do_init();
THROW_IF_FAIL (loop);
- DynamicModuleManager module_manager;
IDebuggerSafePtr debugger =
- module_manager.load_iface<IDebugger> ("gdbengine", "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
debugger->set_event_loop_context (loop->get_context ());
@@ -107,5 +107,3 @@ test_main (int, char **)
NEMIVER_CATCH_NOX
return 0;
}
-
-
diff --git a/tests/test-var-list.cc b/tests/test-var-list.cc
index 44ca7c7..5e9ac13 100644
--- a/tests/test-var-list.cc
+++ b/tests/test-var-list.cc
@@ -4,6 +4,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list.h"
+#include "nmv-debugger-utils.h"
using namespace std;
using namespace nemiver;
@@ -191,15 +192,15 @@ NEMIVER_API int
test_main (int argc, char **argv)
{
if (argc || argv) {/*keep compiler happy*/}
- NEMIVER_TRY
+
+ NEMIVER_TRY;
Initializer::do_init ();
//load the IDebugger interface
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
+
//setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
@@ -255,7 +256,7 @@ test_main (int argc, char **argv)
//run the event loop.
//****************************************
s_loop->run ();
- NEMIVER_CATCH_AND_RETURN_NOX (-1)
+ NEMIVER_CATCH_AND_RETURN_NOX (-1);
return 0;
}
diff --git a/tests/test-var-walker.cc b/tests/test-var-walker.cc
index 3264594..ab847c8 100644
--- a/tests/test-var-walker.cc
+++ b/tests/test-var-walker.cc
@@ -7,6 +7,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list-walker.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -181,16 +182,14 @@ test_main (int argc, char **argv)
{
if (argc || argv) {/*keep compiler happy*/}
- NEMIVER_TRY
+ NEMIVER_TRY;
Initializer::do_init ();
-
//load the IDebugger interface
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
+
//setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
@@ -263,7 +262,7 @@ test_main (int argc, char **argv)
BOOST_FAIL (str.c_str ());
}
- NEMIVER_CATCH_AND_RETURN_NOX (-1)
+ NEMIVER_CATCH_AND_RETURN_NOX (-1);
return 0;
}
diff --git a/tests/test-variable-format.cc b/tests/test-variable-format.cc
index 745eb1c..1268d64 100644
--- a/tests/test-variable-format.cc
+++ b/tests/test-variable-format.cc
@@ -8,6 +8,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list-walker.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -106,15 +107,14 @@ on_stopped_signal (IDebugger::StopReason a_reason,
NEMIVER_API int
test_main (int, char **)
{
- NEMIVER_TRY
+ NEMIVER_TRY;
Initializer::do_init ();
//load the IDebugger interface
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
+
//setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
@@ -141,7 +141,7 @@ test_main (int, char **)
s_loop->run ();
- NEMIVER_CATCH_AND_RETURN_NOX (-1)
+ NEMIVER_CATCH_AND_RETURN_NOX (-1);
BOOST_REQUIRE (s_got_format);
diff --git a/tests/test-varobj-walker.cc b/tests/test-varobj-walker.cc
index b07460d..7518d03 100644
--- a/tests/test-varobj-walker.cc
+++ b/tests/test-varobj-walker.cc
@@ -8,6 +8,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list-walker.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -151,12 +152,11 @@ test_main (int, char **)
Initializer::do_init ();
- //load the IDebugger interface
+ // load the IDebugger interface
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
- //setup the debugger with the glib mainloop
+ debugger_utils::load_debugger_iface_with_gconf ();
+
+ // setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
//*******************************
diff --git a/tests/test-vars.cc b/tests/test-vars.cc
index cb1a0dc..9fc4097 100644
--- a/tests/test-vars.cc
+++ b/tests/test-vars.cc
@@ -6,6 +6,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-exception.h"
#include "nmv-i-var-list-walker.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -244,16 +245,14 @@ NEMIVER_API int
test_main (int argc __attribute__((unused)),
char **argv __attribute__ ((unused)))
{
- NEMIVER_TRY
+ NEMIVER_TRY;
Initializer::do_init ();
- //load the IDebugger interface
IDebuggerSafePtr debugger =
- DynamicModuleManager::load_iface_with_default_manager<IDebugger>
- ("gdbengine",
- "IDebugger");
- //setup the debugger with the glib mainloop
+ debugger_utils::load_debugger_iface_with_gconf ();
+
+ // setup the debugger with the glib mainloop
debugger->set_event_loop_context (Glib::MainContext::get_default ());
//*******************************
@@ -270,6 +269,7 @@ test_main (int argc __attribute__((unused)),
debugger));
debugger->variable_deleted_signal ().connect
(sigc::bind (&on_variable_deleted_signal2, debugger));
+
//*******************************
//</connect to IDebugger events>
//******************************
diff --git a/tests/test-watchpoint.cc b/tests/test-watchpoint.cc
index f945390..f24b6d1 100644
--- a/tests/test-watchpoint.cc
+++ b/tests/test-watchpoint.cc
@@ -4,6 +4,7 @@
#include "common/nmv-initializer.h"
#include "common/nmv-safe-ptr-utils.h"
#include "nmv-i-debugger.h"
+#include "nmv-debugger-utils.h"
using namespace nemiver;
using namespace nemiver::common;
@@ -80,9 +81,8 @@ test_main (int, char **)
THROW_IF_FAIL (loop);
- DynamicModuleManager module_manager;
IDebuggerSafePtr debugger =
- module_manager.load_iface<IDebugger> ("gdbengine", "IDebugger");
+ debugger_utils::load_debugger_iface_with_gconf ();
debugger->set_event_loop_context (loop->get_context ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]