nemiver r788 - in trunk: . src/dbgengine tests
- From: dodji svn gnome org
- To: svn-commits-list gnome org
- Subject: nemiver r788 - in trunk: . src/dbgengine tests
- Date: Sun, 6 Apr 2008 20:07:38 +0100 (BST)
Author: dodji
Date: Sun Apr 6 20:07:38 2008
New Revision: 788
URL: http://svn.gnome.org/viewvc/nemiver?rev=788&view=rev
Log:
make nemiver support pending breakpoints on function names
2008-04-06 Dodji Seketeli <dodji gnome org>
* src/dbgengine/nmv-gdbmi-parser.cc:
(parse_breakpoint): fix PENDING breakpoint parsing. This was leading
to a crash in cases where the breakpoint was being set using
"break function-name". It was okay for "break file-name:line-num"
though.
* tests/test-gdbmi.cc: add regression testing for this bugfix.
* src/dbgengine/nmv-gdb-engine.cc:
(GDBEngine::load_program): make sure to "set breakpoint pending on"
and not "set breakpoint pending auto", otherwise, pending breakpoint
will not be supported in nemiver.
(GDBEngine::set_breakpoint): when setting breakpoint on a function
name that is a not-yet-loaded library, give gdb a chance to set the
breakpoint 'pending'. For that, do not use the the MI syntax to set
the breakpoint because MI does not support pending breakpoints.
As the syntax is not MI, gdb won't return an MI notification about the
breakpoint being set. That is why we need to query gdb for the list of
breakpoints right after setting it this breakpoint.
Modified:
trunk/ChangeLog
trunk/src/dbgengine/nmv-gdb-engine.cc
trunk/src/dbgengine/nmv-gdbmi-parser.cc
trunk/tests/test-gdbmi.cc
Modified: trunk/src/dbgengine/nmv-gdb-engine.cc
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.cc (original)
+++ trunk/src/dbgengine/nmv-gdb-engine.cc Sun Apr 6 20:07:38 2008
@@ -2038,7 +2038,7 @@
Command command;
- queue_command (Command ("set breakpoint pending auto"));
+ queue_command (Command ("set breakpoint pending on"));
//tell gdb not to pass the SIGINT signal to the target.
queue_command (Command ("handle SIGINT stop print nopass"));
//tell the linker to do all relocations at program load
@@ -2819,8 +2819,9 @@
LOG_FUNCTION_SCOPE_NORMAL_DD;
THROW_IF_FAIL (m_priv);
queue_command (Command ("set-breakpoint",
- "-break-insert " + a_func_name,
+ "break " + a_func_name,
a_cookie));
+ list_breakpoints (a_cookie);
}
void
@@ -3529,4 +3530,3 @@
}//end extern C
-
Modified: trunk/src/dbgengine/nmv-gdbmi-parser.cc
==============================================================================
--- trunk/src/dbgengine/nmv-gdbmi-parser.cc (original)
+++ trunk/src/dbgengine/nmv-gdbmi-parser.cc Sun Apr 6 20:07:38 2008
@@ -211,21 +211,26 @@
LOG_D ("got pending breakpoint: '" << pending << "'",
GDBMI_OUTPUT_DOMAIN);
vector<UString> str_tab = pending.split (":");
- LOG_D ("filepath: '" << str_tab[0] << "'", GDBMI_OUTPUT_DOMAIN);
- LOG_D ("linenum: '" << str_tab[1] << "'", GDBMI_OUTPUT_DOMAIN);
- if (str_tab.size () != 2) {
+ if (str_tab.size () > 1) {
+ LOG_D ("filepath: '" << str_tab[0] << "'", GDBMI_OUTPUT_DOMAIN);
+ LOG_D ("linenum: '" << str_tab[1] << "'", GDBMI_OUTPUT_DOMAIN);
+ }
+ if (str_tab.size () == 2) {
+ string path = Glib::locale_from_utf8 (str_tab[0]);
+ if (Glib::path_is_absolute (path)) {
+ attrs["file"] = Glib::locale_to_utf8
+ (Glib::path_get_basename (path));
+ attrs["fullname"] = Glib::locale_to_utf8 (path);
+ } else {
+ attrs["file"] = Glib::locale_to_utf8 (path);;
+ }
+ attrs["line"] = str_tab[1];
+ } else if (str_tab.size () == 1) {
+ attrs["func"] = str_tab[0];
+ } else {
LOG_PARSING_ERROR (a_input, cur);
return false;
}
- string path = Glib::locale_from_utf8 (str_tab[0]);
- if (Glib::path_is_absolute (path)) {
- attrs["file"] = Glib::locale_to_utf8
- (Glib::path_get_basename (path));
- attrs["fullname"] = Glib::locale_to_utf8 (path);
- } else {
- attrs["file"] = Glib::locale_to_utf8 (path);;
- }
- attrs["line"] = str_tab[1];
}
map<UString, UString>::iterator iter, null_iter = attrs.end ();
Modified: trunk/tests/test-gdbmi.cc
==============================================================================
--- trunk/tests/test-gdbmi.cc (original)
+++ trunk/tests/test-gdbmi.cc Sun Apr 6 20:07:38 2008
@@ -89,10 +89,13 @@
static const char* gv_memory_values =
"addr=\"0x000013a0\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"0x000013c0\",prev-row=\"0x0000139c\",next-page=\"0x000013c0\",prev-page=\"0x00001380\",memory=[{addr=\"0x000013a0\",data=[\"0x10\",\"0x11\",\"0x12\",\"0x13\"],ascii=\"xxxx\"}]";
-static const char* gv_breakpoint_table =
+static const char* gv_breakpoint_table0 =
"BreakpointTable={nr_rows=\"1\",nr_cols=\"6\",hdr=[{width=\"3\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"10\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x08081566\",func=\"main\",file=\"main.cc\",fullname=\"/home/jonathon/Projects/agave.git/src/main.cc\",line=\"70\",times=\"0\"}]}";
+static const char* gv_breakpoint_table1 =
+"BreakpointTable={nr_rows=\"2\",nr_cols=\"6\",hdr=[{width=\"7\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"10\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0805e404\",func=\"main\",file=\"/usr/include/boost/test/minimal.hpp\",fullname=\"/usr/include/boost/test/minimal.hpp\",line=\"113\",times=\"1\"},bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"nemiver_common_create_dynamic_module_instance\",times=\"0\"}]}";
+
void
test_str0 ()
{
@@ -485,8 +488,8 @@
std::map<int, IDebugger::BreakPoint> breakpoints;
UString::size_type cur = 0;
- BOOST_REQUIRE (parse_breakpoint_table (gv_breakpoint_table,
- cur, cur, breakpoints)) ;
+ BOOST_REQUIRE (parse_breakpoint_table (gv_breakpoint_table0,
+ cur, cur, breakpoints)) ;
BOOST_REQUIRE_EQUAL (breakpoints.size (), 1u);
std::map<int, IDebugger::BreakPoint>::const_iterator iter;
iter = breakpoints.find (1);
@@ -496,8 +499,13 @@
BOOST_REQUIRE_EQUAL (iter->second.address (), "0x08081566");
BOOST_REQUIRE_EQUAL (iter->second.function (), "main");
BOOST_REQUIRE_EQUAL (iter->second.file_name (), "main.cc");
- BOOST_REQUIRE_EQUAL (iter->second.file_full_name (), "/home/jonathon/Projects/agave.git/src/main.cc");
+ BOOST_REQUIRE_EQUAL (iter->second.file_full_name (),
+ "/home/jonathon/Projects/agave.git/src/main.cc");
BOOST_REQUIRE_EQUAL (iter->second.line (), 70);
+
+ cur = 0, cur = 0, breakpoints.clear();
+ BOOST_REQUIRE (parse_breakpoint_table (gv_breakpoint_table1,
+ cur, cur, breakpoints)) ;
}
using boost::unit_test::test_suite ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]