From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16148 invoked by alias); 22 Feb 2008 01:12:37 -0000 Received: (qmail 16122 invoked by uid 9629); 22 Feb 2008 01:12:36 -0000 Date: Fri, 22 Feb 2008 01:12:00 -0000 Message-ID: <20080222011236.16107.qmail@sourceware.org> From: npremji@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Removed step and nexti commands. Added -instruction/-i parameter to step and next commands. Fixes bugzilla 5593 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 2ac8ff9e34c085e91cccfb9a2d4915ef7a73f893 X-Git-Newrev: f0df1c7855297f1d4c4ea143655f7546ca80fb5b Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00242.txt.bz2 The branch, master has been updated via f0df1c7855297f1d4c4ea143655f7546ca80fb5b (commit) from 2ac8ff9e34c085e91cccfb9a2d4915ef7a73f893 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit f0df1c7855297f1d4c4ea143655f7546ca80fb5b Author: Nurdin Premji Date: Thu Feb 21 20:10:45 2008 -0500 Removed step and nexti commands. Added -instruction/-i parameter to step and next commands. Fixes bugzilla 5593 ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 14 +++ frysk-core/frysk/hpd/StepCommand.java | 31 ++++++- frysk-core/frysk/hpd/StepInstructionCommand.java | 95 -------------------- frysk-core/frysk/hpd/StepNextCommand.java | 29 ++++++- frysk-core/frysk/hpd/StepNextiCommand.java | 100 ---------------------- frysk-core/frysk/hpd/TestHelp.java | 2 - frysk-core/frysk/hpd/TopLevelCommand.java | 2 - 7 files changed, 67 insertions(+), 206 deletions(-) delete mode 100644 frysk-core/frysk/hpd/StepInstructionCommand.java delete mode 100644 frysk-core/frysk/hpd/StepNextiCommand.java First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index ce23747..7862c42 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,17 @@ +2008-02-21 Nurdin Premji + + * StepCommand.java (StepCommand): Added -instruction parameter. + Bugzilla 5593. + (Options): Added. + (options): Added. + (interpret): Check instruction parameter. + * StepNextCommand.java: Ditto. + * StepInstructionCommand.java: Removed. + * StepNextiCommand.java: Removed. + * TopLevelCommand.java(TopLevelCommand): Removed references to "stepi" + and "nexti". + * TestHelp.java: Ditto. + 2008-02-21 Rick Moseley * PTSet.java: Add removeProc(int procid) interface. diff --git a/frysk-core/frysk/hpd/StepCommand.java b/frysk-core/frysk/hpd/StepCommand.java index ec4892b..a8cc3c0 100644 --- a/frysk-core/frysk/hpd/StepCommand.java +++ b/frysk-core/frysk/hpd/StepCommand.java @@ -44,14 +44,32 @@ import java.util.LinkedList; import java.util.List; import frysk.proc.Task; import frysk.debuginfo.DebugInfoFrame; +import frysk.rsl.Log; import frysk.scopes.SourceLocation; public class StepCommand extends ParameterizedCommand { + + private static Log fine = Log.fine(StepCommand.class); StepCommand() { super("Step a process.", "step", - ("Line step a process which has been attached to, and is" - + " currently blocked.")); + ("Step a process which has been attached to, and is" + + " currently blocked. Default is line stepping.")); + + add(new CommandOption("instruction", 'i', "step by instruction", null) { + void parse(String argument, Object options) { + ((Options)options).instruction = true; + } + }); + } + + private class Options { + boolean instruction = false; } + + Object options() { + return new Options(); + } + void interpret(CLI cli, Input cmd, Object options) { PTSet ptset = cli.getCommandPTSet(cmd); @@ -61,7 +79,14 @@ public class StepCommand extends ParameterizedCommand { taskList.add(taskIter.next()); } if (cli.steppingObserver != null) { - cli.getSteppingEngine().stepLine(taskList); + + if (((Options) options).instruction == false) { + fine.log(this, "Stepping line"); + cli.getSteppingEngine().stepLine(taskList); + } else { + fine.log(this, "Stepping instruction"); + cli.getSteppingEngine().stepInstruction(taskList); + } synchronized (cli.steppingObserver.getMonitor()) { try { diff --git a/frysk-core/frysk/hpd/StepInstructionCommand.java b/frysk-core/frysk/hpd/StepInstructionCommand.java deleted file mode 100644 index f683f1d..0000000 --- a/frysk-core/frysk/hpd/StepInstructionCommand.java +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2007, 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; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import frysk.proc.Task; -import frysk.debuginfo.DebugInfoFrame; -import frysk.scopes.SourceLocation; - -public class StepInstructionCommand extends ParameterizedCommand { - private static final String full = "Step a process by an instruction. " - + "The process must be attached to and blocked."; - - StepInstructionCommand() { - super("Instruction step a process.", "stepi", full); - } - - public void interpret(CLI cli, Input cmd, Object options) { - PTSet ptset = cli.getCommandPTSet(cmd); - if (cli.steppingObserver != null) { - LinkedList taskList = new LinkedList(); - Iterator taskIter = ptset.getTasks(); - while (taskIter.hasNext()) { - taskList.add(taskIter.next()); - } - cli.getSteppingEngine().stepInstruction(taskList); - - synchronized (cli.steppingObserver.getMonitor()) { - try { - cli.steppingObserver.getMonitor().wait(); - } catch (InterruptedException ie) { - } - } - Iterator stepped = ptset.getTasks(); - while (stepped.hasNext()) { - Task task = (Task) stepped.next(); - DebugInfoFrame rf = cli.getTaskFrame(task); - - if (rf.getLine() == SourceLocation.UNKNOWN) - cli.addMessage("Task stopped at address 0x" - + Long.toHexString(rf.getAdjustedAddress()), - Message.TYPE_NORMAL); - else - cli.addMessage("Task stopped at line " - + rf.getLine().getLine() + " in file " - + rf.getLine().getFile(), Message.TYPE_NORMAL); - } - } else - cli.addMessage("Not attached to any process", - Message.TYPE_ERROR); - } - - int completer(CLI cli, Input input, int cursor, List completions) { - return -1; - } -} diff --git a/frysk-core/frysk/hpd/StepNextCommand.java b/frysk-core/frysk/hpd/StepNextCommand.java index 2f4398d..8b996e8 100644 --- a/frysk-core/frysk/hpd/StepNextCommand.java +++ b/frysk-core/frysk/hpd/StepNextCommand.java @@ -44,18 +44,33 @@ import java.util.LinkedList; import java.util.List; import frysk.debuginfo.DebugInfoFrame; import frysk.proc.Task; +import frysk.rsl.Log; import frysk.scopes.SourceLocation; public class StepNextCommand extends ParameterizedCommand { + private static Log fine = Log.fine(StepNextCommand.class); StepNextCommand() { super("Step over next function", "next", ("The next command defines a 'step-over' operation, " + - "which is used during stepping, when the user wishes " + - "to line step through the current function of interest " + + "which is used when the user wishes " + + "to step through the current function of interest " + "and avoid descending into any further function calls. " + "This operation will skip over any function call, and will " + - "otherwise just perform a line step.")); + "otherwise just perform a step. Default line step")); + add(new CommandOption("instruction", 'i', "step by instruction", null) { + void parse(String argument, Object options) { + ((Options)options).instruction = true; + } + }); + } + + private class Options { + boolean instruction = false; + } + + Object options() { + return new Options(); } public void interpret(CLI cli, Input cmd, Object options) { @@ -67,7 +82,13 @@ public class StepNextCommand extends ParameterizedCommand { } if (cli.steppingObserver != null) { - cli.getSteppingEngine().stepOver(taskList); + if (((Options) options).instruction == false) { + fine.log(this, "Stepping next line"); + cli.getSteppingEngine().stepOver(taskList); + } else { + fine.log(this, "Stepping next instruction"); + cli.getSteppingEngine().stepNextInstruction(taskList); + } synchronized (cli.steppingObserver.getMonitor()) { diff --git a/frysk-core/frysk/hpd/StepNextiCommand.java b/frysk-core/frysk/hpd/StepNextiCommand.java deleted file mode 100644 index 58386b0..0000000 --- a/frysk-core/frysk/hpd/StepNextiCommand.java +++ /dev/null @@ -1,100 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2007, 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; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import frysk.debuginfo.DebugInfoFrame; -import frysk.proc.Task; -import frysk.scopes.SourceLocation; - -public class StepNextiCommand extends ParameterizedCommand { - - StepNextiCommand() { - super("Step over next function", "nexti", - "The next command defines an 'instruction step-over'," - + " which is used during stepping, when the user wishes" - + " to line step through the current function of interestn" - + " and avoid descending into any further function calls. This" - + " operation will skip over any function call, and will" - + " otherwise just perform an instruction step."); - } - - void interpret(CLI cli, Input cmd, Object options) { - PTSet ptset = cli.getCommandPTSet(cmd); - LinkedList taskList = new LinkedList(); - Iterator taskIter = ptset.getTasks(); - while (taskIter.hasNext()) { - taskList.add(taskIter.next()); - } - if (cli.steppingObserver != null) - { - cli.getSteppingEngine().stepNextInstruction(taskList); - - synchronized (cli.steppingObserver.getMonitor()) - { - try - { - //XXX This looks racy. - cli.steppingObserver.getMonitor().wait(); - } - catch (InterruptedException ie) {} - } - taskIter = ptset.getTasks(); - while (taskIter.hasNext()) - { - Task task = (Task)taskIter.next(); - DebugInfoFrame rf = cli.getTaskFrame(task); - - if (rf.getLine() == SourceLocation.UNKNOWN) - cli.addMessage("Task stopped at address 0x" + Long.toHexString(rf.getAdjustedAddress()), Message.TYPE_NORMAL); - else - cli.addMessage("Task stopped at line " + rf.getLine().getLine() + " in file " + rf.getLine().getFile(), Message.TYPE_NORMAL); - } - } - else - cli.addMessage("Not attached to any process", Message.TYPE_ERROR); - } - - int completer(CLI cli, Input input, int cursor, List completions) { - return -1; - } -} diff --git a/frysk-core/frysk/hpd/TestHelp.java b/frysk-core/frysk/hpd/TestHelp.java index cb9414d..735a077 100644 --- a/frysk-core/frysk/hpd/TestHelp.java +++ b/frysk-core/frysk/hpd/TestHelp.java @@ -75,7 +75,6 @@ public class TestHelp "list", "load", "next", - "nexti", "peek", "print", "quit", @@ -83,7 +82,6 @@ public class TestHelp "run", "set", "step", - "stepi", "unalias", "undefset", "unset", diff --git a/frysk-core/frysk/hpd/TopLevelCommand.java b/frysk-core/frysk/hpd/TopLevelCommand.java index 78c226b..b2013e2 100644 --- a/frysk-core/frysk/hpd/TopLevelCommand.java +++ b/frysk-core/frysk/hpd/TopLevelCommand.java @@ -111,9 +111,7 @@ public class TopLevelCommand extends MultiLevelCommand { add(new StartCommand(), "start"); add(new StepCommand(), "s|tep"); add(new StepFinishCommand(), "finish"); - add(new StepInstructionCommand(), "stepi"); add(new StepNextCommand(), "n|ext"); - add(new StepNextiCommand(), "nexti"); add(new UnloadCommand(), "un|load"); add(new WhatCommand(), "what"); add(new WhichsetsCommand(), "whichsets"); hooks/post-receive -- frysk system monitor/debugger