[nemiver/varobjs-support] Properly parse empty result set of -var-update
- From: Dodji Seketeli <dodji src gnome org>
- To: svn-commits-list gnome org
- Subject: [nemiver/varobjs-support] Properly parse empty result set of -var-update
- Date: Sun, 12 Apr 2009 16:50:45 -0400 (EDT)
commit aeedc577f188df6a01b2f74f0e5f17f3278b4e0c
Author: Dodji Seketeli <dodji redhat com>
Date: Sun Apr 12 19:53:14 2009 +0200
Properly parse empty result set of -var-update
* GDBMIParser::parse_var_changed_list: Don't error when we get
an empty set of changed variables.
* tests/test-gdbmi.cc: New test for this case.
---
src/dbgengine/nmv-gdbmi-parser.cc | 7 +++++++
tests/test-gdbmi.cc | 8 ++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/dbgengine/nmv-gdbmi-parser.cc b/src/dbgengine/nmv-gdbmi-parser.cc
index 704e76a..56ce831 100644
--- a/src/dbgengine/nmv-gdbmi-parser.cc
+++ b/src/dbgengine/nmv-gdbmi-parser.cc
@@ -6299,6 +6299,13 @@ GDBMIParser::parse_var_changed_list (UString::size_type a_from,
return false;
}
+ // Have we got an empty list ?
+ if (result->value ()->get_list_content ()->empty ()) {
+ a_vars.clear ();
+ a_to = cur;
+ return true;
+ }
+
if (result->value ()->get_list_content ()->content_type ()
!= GDBMIList::VALUE_TYPE) {
LOG_ERROR ("expected a TUPLE content in the LIST value of "
diff --git a/tests/test-gdbmi.cc b/tests/test-gdbmi.cc
index e0ca024..6028040 100644
--- a/tests/test-gdbmi.cc
+++ b/tests/test-gdbmi.cc
@@ -56,6 +56,9 @@ static const char *gv_output_record6="^done,numchild=\"3\",children=[child={name
static const char *gv_output_record7="^done,changelist=[{name=\"var1.public.m_first_name.public.npos\",value=\"1\",in_scope=\"true\",type_changed=\"false\"}]\n";
+static const char *gv_output_record8="^done,changelist=[]\n";
+
+
//the partial result of a gdbmi command: -stack-list-argument 1 command
//this command is used to implement IDebugger::list_frames_arguments()
static const char* gv_stack_arguments0 =
@@ -330,6 +333,11 @@ test_output_record ()
is_ok = parser.parse_output_record (0, to, output);
BOOST_REQUIRE (is_ok);
BOOST_REQUIRE (output.result_record ().has_changed_var_list ());
+ // gv_output_record8 should result in 0 variable.
+ parser.push_input (gv_output_record8);
+ is_ok = parser.parse_output_record (0, to, output);
+ BOOST_REQUIRE (is_ok);
+ BOOST_REQUIRE (output.result_record ().has_changed_var_list ());
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]