From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32303 invoked by alias); 7 Jan 2008 21:17:20 -0000 Received: (qmail 32272 invoked by uid 367); 7 Jan 2008 21:17:15 -0000 Date: Mon, 07 Jan 2008 21:17:00 -0000 Message-ID: <20080107211715.32257.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Move breakpoint code from frysk.proc to frysk.proc.live. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: eb0b2795d7a587efa279c1b304414a045048b5dc X-Git-Newrev: a0deee775fc738e37ff3ccf5ecb1c774c8016c9c 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/msg00024.txt.bz2 The branch, master has been updated via a0deee775fc738e37ff3ccf5ecb1c774c8016c9c (commit) from eb0b2795d7a587efa279c1b304414a045048b5dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit a0deee775fc738e37ff3ccf5ecb1c774c8016c9c Author: Andrew Cagney Date: Mon Jan 7 16:15:06 2008 -0500 Move breakpoint code from frysk.proc to frysk.proc.live. frysk-core/frysk/proc/ChangeLog 2008-01-07 Andrew Cagney * Proc.java (getOutOfLineAddress()): Move to frysk.proc.live.LinuxPtraceProc. (breakpoints): Ditto. (requestedOutofLineAddresses): Ditto. (outOfLineAddresses): Ditto. (doneOutOfLine()): Ditto. * Task.java (getIsaFIXME()): Delete. (steppingBreakpoint): Move to frysk.proc.live.LinuxPtraceTask. * Breakpoint.java: Move to frysk.proc.live. * BreakpointAddress.java: Ditto. * Isa.java: Ditto. * LinuxIa32.java: Ditto. * LinuxX8664.java: Ditto. * IsaPowerPC.java: Ditto. * LinuxPPC32.java: Ditto. * LinuxPPC64.java: Ditto. * IsaFactory.java: Ditto. * Instruction.java: Ditto. * IA32InstructionParser.java: Ditto. * X8664InstructionParser.java: Ditto. frysk-core/frysk/proc/live/ChangeLog 2008-01-07 Andrew Cagney * Breakpoint.java: Moved from frysk.proc.live. * BreakpointAddress.java: Ditto. * Isa.java: Ditto. * LinuxIA32.java: Ditto. * LinuxX8664.java: Ditto. * IsaPowerPC.java: Ditto. * LinuxPPC32.java: Ditto. * LinuxPPC64.java: Ditto. * IsaFactory.java: Ditto. * Instruction.java: Ditto. * IA32InstructionParser.java: Ditto. * X8664InstructionParser.java: Ditto. * Proc.java (getOutOfLineAddress()): Move from frysk.proc.Proc. (breakpoints): Ditto. (requestedOutofLineAddresses): Ditto. (outOfLineAddresses): Ditto. (doneOutOfLine()): Ditto. * LinuxPtraceTask.java (steppingBreakpoint): Move from frysk.proc.Task. * TestByteBuffer.java: Update. * LogicalMemoryBuffer.java: Update. * LinuxPtraceTaskState.java: Update. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/ChangeLog | 21 ++++++++ frysk-core/frysk/proc/Proc.java | 54 ------------------- frysk-core/frysk/proc/Task.java | 18 ------ frysk-core/frysk/proc/{ => live}/Breakpoint.java | 17 +++--- .../frysk/proc/{ => live}/BreakpointAddresses.java | 10 +++- frysk-core/frysk/proc/live/ChangeLog | 23 ++++++++ .../proc/{ => live}/IA32InstructionParser.java | 5 +- frysk-core/frysk/proc/{ => live}/Instruction.java | 5 +- frysk-core/frysk/proc/{ => live}/Isa.java | 4 +- frysk-core/frysk/proc/{ => live}/IsaFactory.java | 9 ++-- frysk-core/frysk/proc/{ => live}/IsaPowerPC.java | 6 ++- .../proc/{LinuxIa32.java => live/LinuxIA32.java} | 13 +++-- frysk-core/frysk/proc/{ => live}/LinuxPPC32.java | 3 +- frysk-core/frysk/proc/{ => live}/LinuxPPC64.java | 3 +- frysk-core/frysk/proc/live/LinuxPtraceProc.java | 55 +++++++++++++++++++- frysk-core/frysk/proc/live/LinuxPtraceTask.java | 15 ++++-- .../frysk/proc/live/LinuxPtraceTaskState.java | 2 - frysk-core/frysk/proc/{ => live}/LinuxX8664.java | 5 ++- .../frysk/proc/live/LogicalMemoryBuffer.java | 6 -- frysk-core/frysk/proc/live/TestByteBuffer.java | 1 - .../proc/{ => live}/X8664InstructionParser.java | 4 +- 21 files changed, 163 insertions(+), 116 deletions(-) rename frysk-core/frysk/proc/{ => live}/Breakpoint.java (96%) rename frysk-core/frysk/proc/{ => live}/BreakpointAddresses.java (96%) rename frysk-core/frysk/proc/{ => live}/IA32InstructionParser.java (97%) rename frysk-core/frysk/proc/{ => live}/Instruction.java (98%) rename frysk-core/frysk/proc/{ => live}/Isa.java (98%) rename frysk-core/frysk/proc/{ => live}/IsaFactory.java (96%) rename frysk-core/frysk/proc/{ => live}/IsaPowerPC.java (97%) rename frysk-core/frysk/proc/{LinuxIa32.java => live/LinuxIA32.java} (96%) rename frysk-core/frysk/proc/{ => live}/LinuxPPC32.java (97%) rename frysk-core/frysk/proc/{ => live}/LinuxPPC64.java (97%) rename frysk-core/frysk/proc/{ => live}/LinuxX8664.java (98%) rename frysk-core/frysk/proc/{ => live}/X8664InstructionParser.java (97%) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog index 3a72a91..2715e70 100644 --- a/frysk-core/frysk/proc/ChangeLog +++ b/frysk-core/frysk/proc/ChangeLog @@ -1,5 +1,26 @@ 2008-01-07 Andrew Cagney + * Proc.java (getOutOfLineAddress()): Move to + frysk.proc.live.LinuxPtraceProc. + (breakpoints): Ditto. + (requestedOutofLineAddresses): Ditto. + (outOfLineAddresses): Ditto. + (doneOutOfLine()): Ditto. + * Task.java (getIsaFIXME()): Delete. + (steppingBreakpoint): Move to frysk.proc.live.LinuxPtraceTask. + * Breakpoint.java: Move to frysk.proc.live. + * BreakpointAddress.java: Ditto. + * Isa.java: Ditto. + * LinuxIa32.java: Ditto. + * LinuxX8664.java: Ditto. + * IsaPowerPC.java: Ditto. + * LinuxPPC32.java: Ditto. + * LinuxPPC64.java: Ditto. + * IsaFactory.java: Ditto. + * Instruction.java: Ditto. + * IA32InstructionParser.java: Ditto. + * X8664InstructionParser.java: Ditto. + * Task.java (getIsaFIXME()): New; replace getIsa(). (isa, sendrecIsa()): Delete. (hasIsa()): Update. diff --git a/frysk-core/frysk/proc/Proc.java b/frysk-core/frysk/proc/Proc.java index 591f0fd..c082155 100644 --- a/frysk-core/frysk/proc/Proc.java +++ b/frysk-core/frysk/proc/Proc.java @@ -39,7 +39,6 @@ package frysk.proc; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -145,58 +144,6 @@ public abstract class Proc { } /** - * XXX: Should not be public. - */ - public final BreakpointAddresses breakpoints; - - // List of available addresses for out of line stepping. - // Used a lock in getOutOfLineAddress() and doneOutOfLine(). - private final ArrayList outOfLineAddresses = new ArrayList(); - - // Whether the Isa has been asked for addresses yet. - // Guarded by outOfLineAddresses in getOutOfLineAddress. - private boolean requestedOutOfLineAddresses; - - /** - * Returns an available address for out of line stepping. Blocks - * till an address is available. Queries the Isa if not done so - * before. Returned addresses should be returned by calling - * doneOutOfLine(). - */ - long getOutOfLineAddress() { - synchronized (outOfLineAddresses) { - while (outOfLineAddresses.isEmpty()) { - if (! requestedOutOfLineAddresses) { - Isa isa = getMainTask().getIsaFIXME(); - outOfLineAddresses.addAll(isa.getOutOfLineAddresses(this)); - if (outOfLineAddresses.isEmpty()) - throw new IllegalStateException("Isa.getOutOfLineAddresses" - + " returned empty List"); - requestedOutOfLineAddresses = true; - } else { - try { - outOfLineAddresses.wait(); - } catch (InterruptedException ignored) { - // Just try again... - } - } - } - return ((Long) outOfLineAddresses.remove(0)).longValue(); - } - } - - /** - * Called by Breakpoint with an address returned by - * getOutOfLineAddress() to put it back in the pool. - */ - void doneOutOfLine(long address) { - synchronized (outOfLineAddresses) { - outOfLineAddresses.add(Long.valueOf(address)); - outOfLineAddresses.notifyAll(); - } - } - - /** * Create a new Proc skeleton. Since PARENT could be NULL, * explicitly specify the HOST. */ @@ -205,7 +152,6 @@ public abstract class Proc { this.id = id; this.parent = parent; this.creator = creator; - this.breakpoints = new BreakpointAddresses(this); // Keep parent informed. if (parent != null) parent.add(this); diff --git a/frysk-core/frysk/proc/Task.java b/frysk-core/frysk/proc/Task.java index 4798f2a..fe2ff2a 100644 --- a/frysk-core/frysk/proc/Task.java +++ b/frysk-core/frysk/proc/Task.java @@ -105,15 +105,6 @@ public abstract class Task { private ISA currentISA; protected abstract ISA sendrecISA(); - /** - * Returns this Task's Instruction Set Architecture. - * - * FIXME: Should instead be using ISA. - */ - public Isa getIsaFIXME() { - return null; - } - public final boolean hasIsa() { return (currentISA != null); } @@ -341,15 +332,6 @@ public abstract class Task { public abstract void requestDeleteCodeObserver(TaskObserver.Code o, long a); /** - * Whether we are currently stepping over a breakpoint. Used in - * the running task state when a trap event occurs after a step - * has been issued. Null when no step is being performed. - * - * XXX: This variable belongs in the Linux/PTRACE state machine. - */ - public Breakpoint steppingBreakpoint; - - /** * Request the addition of a Instruction observer that will be * notified as soon as the task executes an instruction. * o.updateExecuted is called as soon as the Task diff --git a/frysk-core/frysk/proc/Breakpoint.java b/frysk-core/frysk/proc/live/Breakpoint.java similarity index 96% rename from frysk-core/frysk/proc/Breakpoint.java rename to frysk-core/frysk/proc/live/Breakpoint.java index 8fc7e29..579e7b0 100644 --- a/frysk-core/frysk/proc/Breakpoint.java +++ b/frysk-core/frysk/proc/live/Breakpoint.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2006, 2007 Red Hat Inc. +// Copyright 2006, 2007, 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 @@ -38,10 +38,11 @@ // exception. -package frysk.proc; +package frysk.proc.live; +import frysk.proc.Proc; +import frysk.proc.Task; import inua.eio.ByteBuffer; - import java.util.HashMap; /** @@ -146,7 +147,7 @@ public class Breakpoint implements Comparable private void set(Task task) { ByteBuffer buffer = task.getRawMemory(); - Isa isa = task.getIsaFIXME(); + Isa isa = ((LinuxPtraceTask)task).getIsaFIXME(); Instruction bpInstruction = isa.getBreakpointInstruction(); origInstruction = isa.getInstruction(buffer, address); @@ -180,7 +181,7 @@ public class Breakpoint implements Comparable ByteBuffer buffer = task.getRawMemory(); buffer.position(address); - Isa isa = task.getIsaFIXME(); + Isa isa = ((LinuxPtraceTask)task).getIsaFIXME(); Instruction bpInstruction = isa.getBreakpointInstruction(); byte[] bp = bpInstruction.getBytes(); @@ -213,7 +214,7 @@ public class Breakpoint implements Comparable // Proc will collect an address for our usage, our wait // till one if available. We need to return it to Proc // afterwards in stepDone(). - oo_address = proc.getOutOfLineAddress(); + oo_address = ((LinuxPtraceProc)proc).getOutOfLineAddress(); origInstruction.setupExecuteOutOfLine(task, address, oo_address); } else if (origInstruction.canSimulate()) @@ -253,7 +254,7 @@ public class Breakpoint implements Comparable // at the original pc address. And let Proc know the address // is available again. origInstruction.fixupExecuteOutOfLine(task, address, oo_address); - proc.doneOutOfLine(oo_address); + ((LinuxPtraceProc)proc).doneOutOfLine(oo_address); oo_address = 0; } else if (origInstruction.canSimulate()) @@ -287,7 +288,7 @@ public class Breakpoint implements Comparable // No step took place, so no fixup needed. Just but // breakpoint back and cleaer oo_address for Proc. set(task); - proc.doneOutOfLine(oo_address); + ((LinuxPtraceProc)proc).doneOutOfLine(oo_address); oo_address = 0; } else if (origInstruction.canSimulate()) diff --git a/frysk-core/frysk/proc/BreakpointAddresses.java b/frysk-core/frysk/proc/live/BreakpointAddresses.java similarity index 96% rename from frysk-core/frysk/proc/BreakpointAddresses.java rename to frysk-core/frysk/proc/live/BreakpointAddresses.java index 15553c9..dc59c34 100644 --- a/frysk-core/frysk/proc/BreakpointAddresses.java +++ b/frysk-core/frysk/proc/live/BreakpointAddresses.java @@ -38,9 +38,15 @@ // exception. -package frysk.proc; +package frysk.proc.live; -import java.util.*; +import frysk.proc.TaskObserver; +import frysk.proc.Proc; +import java.util.Collection; +import java.util.Iterator; +import java.util.HashMap; +import java.util.TreeSet; +import java.util.ArrayList; /** * Keeps track of address breakpoints for a Proc (all Tasks of a Proc diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog index 2d16ceb..8a0dfba 100644 --- a/frysk-core/frysk/proc/live/ChangeLog +++ b/frysk-core/frysk/proc/live/ChangeLog @@ -1,5 +1,28 @@ 2008-01-07 Andrew Cagney + * Breakpoint.java: Moved from frysk.proc.live. + * BreakpointAddress.java: Ditto. + * Isa.java: Ditto. + * LinuxIA32.java: Ditto. + * LinuxX8664.java: Ditto. + * IsaPowerPC.java: Ditto. + * LinuxPPC32.java: Ditto. + * LinuxPPC64.java: Ditto. + * IsaFactory.java: Ditto. + * Instruction.java: Ditto. + * IA32InstructionParser.java: Ditto. + * X8664InstructionParser.java: Ditto. + * Proc.java (getOutOfLineAddress()): Move from frysk.proc.Proc. + (breakpoints): Ditto. + (requestedOutofLineAddresses): Ditto. + (outOfLineAddresses): Ditto. + (doneOutOfLine()): Ditto. + * LinuxPtraceTask.java (steppingBreakpoint): Move from + frysk.proc.Task. + * TestByteBuffer.java: Update. + * LogicalMemoryBuffer.java: Update. + * LinuxPtraceTaskState.java: Update. + * LinuxPtraceTask.java (getIsaFIXME()): Rename sendrecIsa(). * LinuxPtraceTaskState.java: Update. diff --git a/frysk-core/frysk/proc/IA32InstructionParser.java b/frysk-core/frysk/proc/live/IA32InstructionParser.java similarity index 97% rename from frysk-core/frysk/proc/IA32InstructionParser.java rename to frysk-core/frysk/proc/live/IA32InstructionParser.java index fa88f4d..8285b12 100644 --- a/frysk-core/frysk/proc/IA32InstructionParser.java +++ b/frysk-core/frysk/proc/live/IA32InstructionParser.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007 Red Hat Inc. +// Copyright 2007, 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 @@ -37,8 +37,9 @@ // version and license this file solely under the GPL without // exception. -package frysk.proc; +package frysk.proc.live; +import frysk.proc.Task; import inua.eio.ByteBuffer; // Package private helper class that can parse instructions from a diff --git a/frysk-core/frysk/proc/Instruction.java b/frysk-core/frysk/proc/live/Instruction.java similarity index 98% rename from frysk-core/frysk/proc/Instruction.java rename to frysk-core/frysk/proc/live/Instruction.java index 0e9aab5..b76760e 100644 --- a/frysk-core/frysk/proc/Instruction.java +++ b/frysk-core/frysk/proc/live/Instruction.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 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 @@ -38,9 +38,10 @@ // exception. -package frysk.proc; +package frysk.proc.live; import inua.eio.ByteBuffer; +import frysk.proc.Task; /** * An architecture independent way of representing an assembly level diff --git a/frysk-core/frysk/proc/Isa.java b/frysk-core/frysk/proc/live/Isa.java similarity index 98% rename from frysk-core/frysk/proc/Isa.java rename to frysk-core/frysk/proc/live/Isa.java index c81fd12..41bb1c0 100644 --- a/frysk-core/frysk/proc/Isa.java +++ b/frysk-core/frysk/proc/live/Isa.java @@ -37,8 +37,10 @@ // version and license this file solely under the GPL without // exception. -package frysk.proc; +package frysk.proc.live; +import frysk.proc.Task; +import frysk.proc.Proc; import java.util.List; import inua.eio.ByteBuffer; diff --git a/frysk-core/frysk/proc/IsaFactory.java b/frysk-core/frysk/proc/live/IsaFactory.java similarity index 96% rename from frysk-core/frysk/proc/IsaFactory.java rename to frysk-core/frysk/proc/live/IsaFactory.java index f48a0d0..ae454b3 100644 --- a/frysk-core/frysk/proc/IsaFactory.java +++ b/frysk-core/frysk/proc/live/IsaFactory.java @@ -37,7 +37,7 @@ // version and license this file solely under the GPL without // exception. -package frysk.proc; +package frysk.proc.live; import java.util.logging.Level; import java.util.logging.Logger; @@ -49,11 +49,12 @@ import lib.dwfl.ElfEHeader; import lib.dwfl.ElfEMachine; import lib.dwfl.ElfException; import lib.dwfl.ElfFileException; +import frysk.proc.Task; public class IsaFactory { private static IsaFactory factory; - static final Logger logger = Logger.getLogger(ProcLogger.LOGGER_ID); + static final Logger logger = Logger.getLogger("frysk"); private Hashtable isaHash; IsaFactory() { @@ -63,7 +64,7 @@ public class IsaFactory isaHash.put(Integer.valueOf(ElfEMachine.EM_PPC64), LinuxPPC64.isaSingleton()); isaHash.put(Integer.valueOf(ElfEMachine.EM_386), - LinuxIa32.isaSingleton()); + LinuxIA32.isaSingleton()); isaHash.put(Integer.valueOf(ElfEMachine.EM_PPC), LinuxPPC32.isaSingleton()); } @@ -133,7 +134,7 @@ public class IsaFactory Isa isa = null; switch (machineType) { case ElfEMachine.EM_386: - isa = LinuxIa32.isaSingleton(); + isa = LinuxIA32.isaSingleton(); break; case ElfEMachine.EM_PPC: isa = LinuxPPC32.isaSingleton(); diff --git a/frysk-core/frysk/proc/IsaPowerPC.java b/frysk-core/frysk/proc/live/IsaPowerPC.java similarity index 97% rename from frysk-core/frysk/proc/IsaPowerPC.java rename to frysk-core/frysk/proc/live/IsaPowerPC.java index db0110b..bc18f79 100644 --- a/frysk-core/frysk/proc/IsaPowerPC.java +++ b/frysk-core/frysk/proc/live/IsaPowerPC.java @@ -37,12 +37,16 @@ // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. -package frysk.proc; + +package frysk.proc.live; import java.util.LinkedList; import java.util.List; import inua.eio.ByteBuffer; import frysk.isa.Register; +import frysk.proc.Task; +import frysk.proc.Proc; +import frysk.proc.Auxv; abstract class IsaPowerPC implements Isa { protected IsaPowerPC(Register PC) { diff --git a/frysk-core/frysk/proc/LinuxIa32.java b/frysk-core/frysk/proc/live/LinuxIA32.java similarity index 96% rename from frysk-core/frysk/proc/LinuxIa32.java rename to frysk-core/frysk/proc/live/LinuxIA32.java index f779ba1..df23642 100644 --- a/frysk-core/frysk/proc/LinuxIa32.java +++ b/frysk-core/frysk/proc/live/LinuxIA32.java @@ -37,14 +37,17 @@ // version and license this file solely under the GPL without // exception. -package frysk.proc; +package frysk.proc.live; import frysk.isa.IA32Registers; import inua.eio.ByteBuffer; import java.util.List; import java.util.LinkedList; +import frysk.proc.Task; +import frysk.proc.Proc; +import frysk.proc.Auxv; -class LinuxIa32 implements Isa { +class LinuxIA32 implements Isa { private static final Instruction IA32Breakpoint = new Instruction(new byte[] { (byte)0xcc }, false); @@ -151,10 +154,10 @@ class LinuxIa32 implements Isa { return result; } - private static LinuxIa32 isa; - static LinuxIa32 isaSingleton () { + private static LinuxIA32 isa; + static LinuxIA32 isaSingleton () { if (isa == null) - isa = new LinuxIa32 (); + isa = new LinuxIA32 (); return isa; } } diff --git a/frysk-core/frysk/proc/LinuxPPC32.java b/frysk-core/frysk/proc/live/LinuxPPC32.java similarity index 97% rename from frysk-core/frysk/proc/LinuxPPC32.java rename to frysk-core/frysk/proc/live/LinuxPPC32.java index a4806d6..522e8aa 100644 --- a/frysk-core/frysk/proc/LinuxPPC32.java +++ b/frysk-core/frysk/proc/live/LinuxPPC32.java @@ -1,6 +1,7 @@ // This file is part of the program FRYSK. // // Copyright 2006 IBM Corp. +// 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 @@ -37,7 +38,7 @@ // version and license this file solely under the GPL without // exception. -package frysk.proc; +package frysk.proc.live; import frysk.isa.PPC32Registers; diff --git a/frysk-core/frysk/proc/LinuxPPC64.java b/frysk-core/frysk/proc/live/LinuxPPC64.java similarity index 97% rename from frysk-core/frysk/proc/LinuxPPC64.java rename to frysk-core/frysk/proc/live/LinuxPPC64.java index 444ebb0..647ad6b 100644 --- a/frysk-core/frysk/proc/LinuxPPC64.java +++ b/frysk-core/frysk/proc/live/LinuxPPC64.java @@ -1,6 +1,7 @@ // This file is part of the program FRYSK. // // Copyright 2006 IBM Corp. +// Copyright 2008, Red Hat Inc. hooks/post-receive -- frysk system monitor/debugger