* Patch for PR 5809 @ 2008-03-05 13:51 Tom Tromey 2008-03-05 18:14 ` Mark Wielaard 0 siblings, 1 reply; 3+ messages in thread From: Tom Tromey @ 2008-03-05 13:51 UTC (permalink / raw) To: frysk This fixes PR 5809. An earlier patch removed the Comparator, forgetting that that Map.Entry is not comparable. I'm a little surprised nobody caught this before. If you have a breakpoint and type "actions", you will get a stack trace. Tom 2008-03-05 Tom Tromey <tromey@redhat.com> Bug 5809 * ActionPointCommands.java (Actions.interpret): Use Comparator to sort the task set. diff --git a/frysk-core/frysk/hpd/ActionPointCommands.java b/frysk-core/frysk/hpd/ActionPointCommands.java index 5fdaaf1..3c6c681 100644 --- a/frysk-core/frysk/hpd/ActionPointCommands.java +++ b/frysk-core/frysk/hpd/ActionPointCommands.java @@ -46,6 +46,7 @@ import frysk.rt.SourceBreakpoint; import frysk.rt.UpdatingDisplayValue; import java.util.List; import java.util.Arrays; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -213,7 +214,13 @@ abstract class ActionPointCommands extends ParameterizedCommand { Map.Entry[] taskEntries = new Map.Entry[taskEntrySet.size()]; taskEntrySet.toArray(taskEntries); - Arrays.sort(taskEntries); + Arrays.sort(taskEntries, new Comparator() { + public int compare(Object o1, Object o2) { + Map.Entry me1 = (Map.Entry) o1; + Map.Entry me2 = (Map.Entry) o2; + return ((Task) me1.getKey()).compareTo(me2.getKey()); + } + }); for (int i = 0; i < taskEntries.length; i++) { int id = ((Task) taskEntries[i].getKey()).getTid(); SourceBreakpoint.State state = (SourceBreakpoint.State) taskEntries[i] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch for PR 5809 2008-03-05 13:51 Patch for PR 5809 Tom Tromey @ 2008-03-05 18:14 ` Mark Wielaard 2008-03-10 10:16 ` Mark Wielaard 0 siblings, 1 reply; 3+ messages in thread From: Mark Wielaard @ 2008-03-05 18:14 UTC (permalink / raw) To: Tom Tromey; +Cc: frysk [-- Attachment #1: Type: text/plain, Size: 638 bytes --] Hi Tom, On Wed, 2008-03-05 at 05:55 -0700, Tom Tromey wrote: > An earlier patch removed the Comparator, forgetting that that > Map.Entry is not comparable. > > I'm a little surprised nobody caught this before. If you have a > breakpoint and type "actions", you will get a stack trace. Yeah, there should have been written a testcase when this code was changed. I created one that fails before and succeeds after your patch (attached). > 2008-03-05 Tom Tromey <tromey@redhat.com> > > Bug 5809 > * ActionPointCommands.java (Actions.interpret): Use Comparator to > sort the task set. Thanks, committed and pushed. Cheers, Mark [-- Attachment #2: TestActionsCommand.java --] [-- Type: text/x-java, Size: 2655 bytes --] // This file is part of the program FRYSK. // // Copyright 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; version 2 of the License. // // FRYSK is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with FRYSK; if not, write to the Free Software Foundation, // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // // In addition, as a special exception, Red Hat, Inc. gives You the // additional right to link the code of FRYSK with code not covered // under the GNU General Public License ("Non-GPL Code") and to // distribute linked combinations including the two, subject to the // limitations in this paragraph. Non-GPL Code permitted under this // exception must only link to the code of FRYSK through those well // defined interfaces identified in the file named EXCEPTION found in // the source code files (the "Approved Interfaces"). The files of // Non-GPL Code may instantiate templates or use macros or inline // functions from the Approved Interfaces without causing the // resulting work to be covered by the GNU General Public // License. Only Red Hat, Inc. may make changes or additions to the // list of Approved Interfaces. You must obey the GNU General Public // License in all respects for all of the FRYSK code and other code // used in conjunction with FRYSK except the Non-GPL Code covered by // this exception. If you modify this file, you may extend this // exception to your version of the file, but you are not obligated to // do so. If you do not wish to provide this exception without // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. package frysk.hpd; public class TestActionsCommand extends TestLib { public void testBreakpointActionsCommand() { HpdTestbed hpd = new HpdTestbed(); hpd = HpdTestbed.load("funit-hello"); hpd.send("break print\n"); hpd.expect("breakpoint.*\n" + prompt); hpd.send("run\n"); hpd.expect("Breakpoint 0.*\n"); hpd.send("actions\n"); hpd.expect("actions.*\n"); hpd.expect("BREAKPOINTS.*\n"); hpd.expect("0 y print [0-9]+.*\n"); hpd.send("quit\n"); hpd.expect("quit.*\nQuitting..."); hpd.close(); } } ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch for PR 5809 2008-03-05 18:14 ` Mark Wielaard @ 2008-03-10 10:16 ` Mark Wielaard 0 siblings, 0 replies; 3+ messages in thread From: Mark Wielaard @ 2008-03-10 10:16 UTC (permalink / raw) To: Tom Tromey; +Cc: frysk Hi, On Wed, 2008-03-05 at 19:14 +0100, Mark Wielaard wrote: > Yeah, there should have been written a testcase when this code was > changed. I created one that fails before and succeeds after your patch > (attached). Here is a slightly better one that has tighter regexps for the expect output. The original could sometimes gobble up too much output through .* if it was already available. This expects the output more stricly by explicitly matching the \r\n at the end of line output that fhpd does. frysk-core/frysk/hpd/ChangeLog 2008-03-10 Mark Wielaard <mwielaard@redhat.com> * TestActionsCommand: Use tighter expect regular expressions. Cheers, Mark diff --git a/frysk-core/frysk/hpd/TestActionsCommand.java b/frysk-core/frysk/hpd index a01b9e8..b72be4d 100644 --- a/frysk-core/frysk/hpd/TestActionsCommand.java +++ b/frysk-core/frysk/hpd/TestActionsCommand.java @@ -47,15 +47,15 @@ public class TestActionsCommand extends TestLib { hpd = HpdTestbed.load("funit-hello"); hpd.send("break print\n"); - hpd.expect("breakpoint.*\n" + prompt); + hpd.expect("breakpoint 0 deferred\r\n" + prompt); hpd.send("run\n"); - hpd.expect("Breakpoint 0.*\n"); + hpd.expect("Breakpoint 0 print 0x[0-9a-f]+\r\n"); - hpd.send("actions\n"); - hpd.expect("actions.*\n"); - hpd.expect("BREAKPOINTS.*\n"); - hpd.expect("0 y print [0-9]+.*\n"); + hpd.send("actions\r\n"); + hpd.expect("actions\r\n"); + hpd.expect("BREAKPOINTS\r\n"); + hpd.expect("0 y print [0-9]+ \r\n"); hpd.send("quit\n"); hpd.expect("quit.*\nQuitting..."); ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-10 10:16 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-03-05 13:51 Patch for PR 5809 Tom Tromey 2008-03-05 18:14 ` Mark Wielaard 2008-03-10 10:16 ` Mark Wielaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).