[PATCH] bug in showing/setting remake options

"R. Bernstein" <[email protected]>
Newsgroups gmane.comp.debugging.ddd.general
Message-ID <[email protected]>
I just discovered a bug in rc2 in trying to show/set remake options.
(Also athere was small bug in remake, but that's been fixed in the git
source now.)

Attached is a proposed patch which contains 3 hunks. 

The first hunk tells ddd that multi-line remake's "set xx" output
doesn't show subcommands like it does in gdb.

The second hunk silences a gcc warning about operator precedence more
explicit. Not strictly needed.

The final changes are sort of a defensive measure against the kind of
looping that just occurred - a limit (75) is put on the maximum number
of button settings.

Andrew: if you want me to apply direcly to SVN let me know. Or
modify/amend as appropriate.

_______________________________________________
ddd mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ddd
ddd-settings.C.patch (application/octet-stream, 1.4 KB)
svn diff ddd/settings.C
Index: ddd/settings.C
===================================================================
--- ddd/settings.C	(revision 7173)
+++ ddd/settings.C	(working copy)
@@ -1634,7 +1634,7 @@
 		}
 
 		value = cached_gdb_question(show_command);
-		if (is_set && value.freq('\n') > 1)
+		if (is_set && value.freq('\n') > 1 && type != MAKE)
 		{
 		    // Generic command - list `set' subcommands
 		    add_settings(form, row, max_width,
@@ -2246,7 +2246,7 @@
 	// Make entry insensitive if part of initialization commands.
 	string init = app_data.gdb_init_commands;
 	int idx = init.index(set_command);
-	bool insensitive = (idx == 0 || idx > 0 && init[idx - 1] == '\n');
+	bool insensitive = (idx == 0 || (idx > 0 && init[idx - 1] == '\n'));
 
 	// Make entry insensitive if one of Perl taboos
 	if (!insensitive && gdb->type() == PERL)
@@ -2300,6 +2300,8 @@
     row++;
 }
 
+static unsigned int button_count=0;
+
 // Add buttons
 static void add_settings(Widget form, int& row, Dimension& max_width,
 			 DebuggerType type, EntryType entry_filter,
@@ -2373,11 +2375,12 @@
 
     if (commands.contains('\n'))
     {
-	while (!commands.empty())
+        while (!commands.empty() && button_count < 75)
 	{
 	    string line = commands.before('\n');
 	    commands    = commands.after('\n');
 	    add_button(form, row, max_width, type, entry_filter, line);
+	    button_count++;
 	}
     }
     else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.