Sourceware Bugzilla – Attachment 1392 Details for
Bug 3364
[tracker] fstep - single step a program printing instructions, and possible file/line information et.al.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
fstep program
fstep.java (text/plain), 3.83 KB, created by
Mark Wielaard
on 2006-10-31 13:17:31 UTC
(
hide
)
Description:
fstep program
Filename:
MIME Type:
Creator:
Mark Wielaard
Created:
2006-10-31 13:17:31 UTC
Size:
3.83 KB
patch
obsolete
>// This file is part of the program FRYSK. >// >// Copyright 2006, 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. > > >import frysk.proc.*; >import lib.opcodes.*; >import java.util.*; > >public class fstep > implements TaskObserver.Attached, > TaskObserver.Instruction, > TaskObserver.Terminated >{ > Disassembler disassembler; > long steps; > > public static void main(String[] command) > { > fstep step = new fstep(); > Manager.host.requestCreateAttachedProc(command, step); > Manager.eventLoop.start(); > } > > // TaskObserver.Attached interface > public Action updateAttached(Task task) > { > disassembler = new Disassembler(task.getMemory()); > task.requestAddTerminatedObserver(this); > task.requestAddInstructionObserver(this); > return Action.CONTINUE; > } > > // TaskObserver.Terminated interface > public Action updateTerminated(Task task, boolean signal, int exit) > { > System.err.println("Total steps: " + steps); > Manager.eventLoop.requestStop(); > return Action.CONTINUE; > } > > // TaskObserver.Instruction interface > public Action updateExecuted(Task task) > { > steps++; > try > { > if (steps % 10000 == 0) > { > long pc = task.getIsa().pc(task); > System.out.println("0x" + Long.toHexString(pc) > + " (steps: " + steps + ")"); > Iterator it; > it = disassembler.disassembleInstructions(pc, 5).iterator(); > while (it.hasNext()) > System.out.println("\t" + it.next()); > } > } > catch(TaskException te) > { > // Task disappeared? > te.printStackTrace(); > System.exit(-1); > } > catch(OpcodesException oe) > { > // Bad location? > oe.printStackTrace(); > System.exit(-1); > } > return Action.CONTINUE; > } > > > // Common interface methods > > public void addedTo (Object observable) > { > // Unused > } > > public void addFailed (Object observable, Throwable w) > { > w.printStackTrace(); > System.exit(-1); > } > > public void deletedFrom (Object observable) > { > // Unused > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3364
: 1392