[nemiver/better-variable-format: 7/8] Avoid emitting useless -enable-pretty-printing
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/better-variable-format: 7/8] Avoid emitting useless -enable-pretty-printing
- Date: Tue, 30 Aug 2011 15:33:45 +0000 (UTC)
commit 3f25dfd5c6296643642618fac526a0947a3792b3
Author: Dodji Seketeli <dodji seketeli org>
Date: Wed Mar 2 15:28:29 2011 +0100
Avoid emitting useless -enable-pretty-printing
* src/dbgengine/nmv-gdb-engine.cc
(GDBEngine::Priv::pretty_printing_enabled_once): New member.
(GDBEngine::Priv::on_conf_key_changed_signal): Don't emit
-enable-pretty-printing if it has already been emitted once.
(GDBEngine::load_program): Likewise.
src/dbgengine/nmv-gdb-engine.cc | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index f2fa126..402dd5f 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -229,6 +229,11 @@ public:
UString disassembly_flavor;
GDBMIParser gdbmi_parser;
bool enable_pretty_printing;
+ // Once pretty printing has been globally enabled once, there is
+ // no command to globally disable it. So once it has been enabled
+ // globally, we shouldn't try to globally enable it again. So
+ // let's keep track of if we enabled it once.
+ bool pretty_printing_enabled_once;
sigc::signal<void> gdb_died_signal;
sigc::signal<void, const UString& > master_pty_signal;
sigc::signal<void, const UString& > gdb_stdout_signal;
@@ -557,7 +562,8 @@ public:
follow_fork_mode ("parent"),
disassembly_flavor ("att"),
gdbmi_parser (GDBMIParser::BROKEN_MODE),
- enable_pretty_printing (true)
+ enable_pretty_printing (true),
+ pretty_printing_enabled_once (false)
{
enable_pretty_printing =
@@ -1183,11 +1189,17 @@ public:
follow_fork_mode,
a_namespace)) {
set_debugger_parameter ("follow-fork-mode", follow_fork_mode);
- } else if (a_key == CONF_KEY_PRETTY_PRINTING
- && conf_mgr->get_key_value (a_key,
- enable_pretty_printing,
- a_namespace)) {
- queue_command (Command ("-enable-pretty-printing"));
+ } else if (a_key == CONF_KEY_PRETTY_PRINTING) {
+ // Don't react if the new value == the old value.
+ bool e = false;
+ conf_mgr->get_key_value (a_key, e, a_namespace);
+ if (e != enable_pretty_printing) {
+ enable_pretty_printing = e;
+ if (!pretty_printing_enabled_once && enable_pretty_printing) {
+ queue_command (Command ("-enable-pretty-printing"));
+ pretty_printing_enabled_once = true;
+ }
+ }
} else if (a_key == CONF_KEY_DISASSEMBLY_FLAVOR
&& conf_mgr->get_key_value (a_key,
disassembly_flavor,
@@ -3029,7 +3041,8 @@ GDBEngine::load_program (const UString &a_prog,
} else {
LOG_DD ("not setting LD_BIND_NOW environment variable ");
}
- if (m_priv->enable_pretty_printing)
+ if (m_priv->enable_pretty_printing
+ && !m_priv->pretty_printing_enabled_once)
queue_command (Command ("-enable-pretty-printing"));
} else {
Command command ("load-program",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]