[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: Wed, 2 Mar 2011 18:40:08 +0000 (UTC)
commit c9a0ce279ff4de19b8201c78973e50ad70d3fdea
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 | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 7508c74..4d05b41 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -142,6 +142,11 @@ public:
UString follow_fork_mode;
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;
@@ -465,7 +470,8 @@ public:
cur_thread_num (1),
follow_fork_mode ("parent"),
gdbmi_parser (GDBMIParser::BROKEN_MODE),
- enable_pretty_printing (true)
+ enable_pretty_printing (true),
+ pretty_printing_enabled_once (false)
{
enable_pretty_printing =
@@ -1072,9 +1078,16 @@ public:
follow_fork_mode = boost::get<UString> (a_value).raw ();
set_debugger_parameter ("follow-fork-mode", follow_fork_mode);
} else if (a_key == CONF_KEY_PRETTY_PRINTING) {
- enable_pretty_printing = boost::get<bool> (a_value);
- if (enable_pretty_printing) {
- queue_command (Command ("-enable-pretty-printing"));
+ bool e = boost::get<bool> (a_value);
+ // Don't react if the new value == the old value.
+ if (e != enable_pretty_printing) {
+ enable_pretty_printing = e;
+ if (!pretty_printing_enabled_once
+ && enable_pretty_printing) {
+ queue_command (Command ("-enable-pretty-printing"));
+ if (!pretty_printing_enabled_once)
+ pretty_printing_enabled_once = true;
+ }
}
}
@@ -2865,7 +2878,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]