From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28752 invoked by alias); 4 Feb 2008 15:05:32 -0000 Received: (qmail 28707 invoked by uid 9639); 4 Feb 2008 15:05:27 -0000 Date: Mon, 04 Feb 2008 15:05:00 -0000 Message-ID: <20080204150527.28692.qmail@sourceware.org> From: moore@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Print out hex address of breakpoint when hit. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 12f10b3aab52bfe1a88c2715cce51d65db013258 X-Git-Newrev: 3919b14c40e034b714048f6670af116b8a1d4754 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/msg00150.txt.bz2 The branch, master has been updated via 3919b14c40e034b714048f6670af116b8a1d4754 (commit) via dbea52facf3d6f308be053241d388fc2b4564a1f (commit) via 42313817ebb480773f08825012a7a9b40f4ead01 (commit) via 77c111a61b418b8a3cc4a2fdc4d7ece90c43c1b9 (commit) via 79798400b9179c4e32fda6bec75a11cd13610f87 (commit) from 12f10b3aab52bfe1a88c2715cce51d65db013258 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 3919b14c40e034b714048f6670af116b8a1d4754 Author: Tim Moore Date: Mon Feb 4 15:59:45 2008 +0100 Print out hex address of breakpoint when hit. frysk-core/frysk/hpd/ChangeLog: 2008-02-04 Tim Moore * BreakpointCommand.java (interpret): Print out hex address when breakpoint is hit. frysk-core/frysk/rt/ChangeLog: 2008-02-04 Tim Moore * BreakpointManager.java (enableBreakpoint, disableBreakpoint): Pass breakpoint in question to observers. commit dbea52facf3d6f308be053241d388fc2b4564a1f Author: Tim Moore Date: Thu Jan 31 18:19:06 2008 +0100 Java reformatting commit 42313817ebb480773f08825012a7a9b40f4ead01 Author: Tim Moore Date: Thu Jan 31 18:09:21 2008 +0100 Pass breakpoint to observer. frysk-core/frysk/rt/ChangeLog: 2008-01-31 Tim Moore * BreakpointManager.java (enableBreakpoint, disableBreakpoint): Pass break point to observer. commit 77c111a61b418b8a3cc4a2fdc4d7ece90c43c1b9 Author: Tim Moore Date: Thu Jan 31 17:45:34 2008 +0100 Java formatting commit 79798400b9179c4e32fda6bec75a11cd13610f87 Author: Tim Moore Date: Tue Jan 22 15:50:48 2008 +0100 ObserveringTerminal that reports when line is being edited frysk-core/frysk/bindir/ChangeLog: 2008-02-04 Tim Moore * fhpd.java (main): Use ObservingTerminal instead of PtyTerminal. frysk-core/frysk/util/ChangeLog: 2008-02-04 Tim Moore * ObservingTerminal.java: New file. frysk-imports/jline/ChangeLog: 2008-02-04 Tim Moore * src/jline/Terminal.java (beforeReadLine, afterReadLine): methods from 0.9.98. * src/jline/ConsoleReader.java (readLine): Call them. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 4 + frysk-core/frysk/bindir/fhpd.java | 224 ++++++------ frysk-core/frysk/hpd/BreakpointCommand.java | 12 +- frysk-core/frysk/hpd/ChangeLog | 3 + frysk-core/frysk/rt/BreakpointManager.java | 4 +- frysk-core/frysk/rt/ChangeLog | 5 + frysk-core/frysk/rt/SourceBreakpoint.java | 402 +++++++++----------- frysk-core/frysk/util/ChangeLog | 4 + ...{CountDownLatch.java => ObservingTerminal.java} | 101 +++--- frysk-imports/jline/ChangeLog | 6 + frysk-imports/jline/src/jline/ConsoleReader.java | 179 +++++----- frysk-imports/jline/src/jline/Terminal.java | 16 + 12 files changed, 483 insertions(+), 477 deletions(-) copy frysk-core/frysk/util/{CountDownLatch.java => ObservingTerminal.java} (57%) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index e4741e9..9e23ebb 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,7 @@ +2008-02-04 Tim Moore + + * fhpd.java (main): Use ObservingTerminal instead of PtyTerminal. + 2008-01-28 Teresa Thomas * fdebuginfo.java (PrintDebuginfoEvent): New. diff --git a/frysk-core/frysk/bindir/fhpd.java b/frysk-core/frysk/bindir/fhpd.java index f42aab1..5a985b1 100644 --- a/frysk-core/frysk/bindir/fhpd.java +++ b/frysk-core/frysk/bindir/fhpd.java @@ -51,138 +51,128 @@ import frysk.util.CoreExePair; import frysk.proc.Manager; import frysk.proc.ProcId; import frysk.util.CommandlineParser; -import frysk.util.PtyTerminal; +//import frysk.util.PtyTerminal; +import frysk.util.ObservingTerminal; import gnu.classpath.tools.getopt.Option; import gnu.classpath.tools.getopt.OptionException; import frysk.sys.FileDescriptor; -public class fhpd -{ - static int pid; - static File execFile; - static File core; - static File exeFile; - static boolean noExe = false; - static String sysroot; +public class fhpd { + static int pid; + static File execFile; + static File core; + static File exeFile; + static boolean noExe = false; + static String sysroot; - final static class FhpdCompletor implements Completor - { - CLI cli; - public FhpdCompletor (CLI cli) - { - this.cli = cli; + final static class FhpdCompletor implements Completor { + CLI cli; + public FhpdCompletor (CLI cli) { + this.cli = cli; + } + public int complete (String buffer, int cursor, List candidates) { + return cli.complete (buffer, cursor, candidates); + } } - public int complete (String buffer, int cursor, List candidates) - { - return cli.complete (buffer, cursor, candidates); - } - } - public static void main (String[] args) - { - CLI cli; - CommandlineParser parser = new CommandlineParser ("fhpd") - { + public static void main (String[] args) { + CLI cli; + CommandlineParser parser = new CommandlineParser ("fhpd") { - //@Override - public void parseCommand (String[] command) - { - execFile = new File (command[0]); - if (execFile.canRead() == false) - { - printHelp(); - throw new RuntimeException("command not readable: " - + command[0]); - } - } + //@Override + public void parseCommand (String[] command) { + execFile = new File (command[0]); + if (execFile.canRead() == false) { + printHelp(); + throw new RuntimeException("command not readable: " + + command[0]); + } + } - //@Override - public void parsePids (ProcId[] pids) - { - pid = pids[0].id; - } + //@Override + public void parsePids (ProcId[] pids) { + pid = pids[0].id; + } - public void parseCores(CoreExePair[] corePairs) { - core = corePairs[0].coreFile; - exeFile = corePairs[0].exeFile; - } - }; - parser.add(new Option("noexe", "Do not attempt to read an"+ - " executable for a corefile ") { - public void parsed(String exeValue) throws OptionException { - try { - noExe = true; + public void parseCores(CoreExePair[] corePairs) { + core = corePairs[0].coreFile; + exeFile = corePairs[0].exeFile; + } + }; + parser.add(new Option("noexe", "Do not attempt to read an"+ + " executable for a corefile ") { + public void parsed(String exeValue) throws OptionException { + try { + noExe = true; - } catch (IllegalArgumentException e) { - throw new OptionException("Invalid noexe parameter " - + exeValue); - } - } - }); - parser.add(new Option("sysroot", 's', - "Assume the executable is from a sysroot build ", - "SysRoot-Path") { - public void parsed(String sysrootValue) throws OptionException { - try { - sysroot = sysrootValue; - } catch (IllegalArgumentException e) { - throw new OptionException("Invalid sysroot parameter " - + sysrootValue); - } - } - }); + } catch (IllegalArgumentException e) { + throw new OptionException("Invalid noexe parameter " + + exeValue); + } + } + }); + parser.add(new Option("sysroot", 's', + "Assume the executable is from a sysroot build ", + "SysRoot-Path") { + public void parsed(String sysrootValue) throws OptionException { + try { + sysroot = sysrootValue; + } catch (IllegalArgumentException e) { + throw new OptionException("Invalid sysroot parameter " + + sysrootValue); + } + } + }); - parser.setHeader("Usage: fhpd || fhpd || fhpd []"); - parser.parse(args); - Manager.eventLoop.start(); - String line = ""; + parser.setHeader("Usage: fhpd || fhpd || fhpd []"); + parser.parse(args); + Manager.eventLoop.start(); + String line = ""; - try - { - if (pid > 0) - line = "attach " + pid; - else if (execFile != null) - line = "load " + execFile.getCanonicalPath(); - else if (core != null) { - line = "core " + core.getCanonicalPath(); - if (exeFile != null) - line += " " + exeFile.getCanonicalPath(); - else if (noExe) - line +=" -noexe"; - } - if (sysroot != null) - line = line + " -sysroot " + sysroot; - } - catch (IOException ignore) {} + try { + if (pid > 0) + line = "attach " + pid; + else if (execFile != null) + line = "load " + execFile.getCanonicalPath(); + else if (core != null) { + line = "core " + core.getCanonicalPath(); + if (exeFile != null) + line += " " + exeFile.getCanonicalPath(); + else if (noExe) + line +=" -noexe"; + } + if (sysroot != null) + line = line + " -sysroot" + sysroot; + } + catch (IOException ignore) {} - cli = new CLI("(fhpd) ", System.out); - ConsoleReader reader = null; // the jline reader - - try { - reader = new ConsoleReader(new FileInputStream(java.io.FileDescriptor.in), - new PrintWriter(System.out), - null, - new PtyTerminal(FileDescriptor.in)); - } - catch (IOException ioe) { - System.out.println("ERROR: Could not create a command line"); - System.out.print(ioe.getMessage()); - } + cli = new CLI("(fhpd) ", System.out); + ConsoleReader reader = null; // the jline reader - Completor fhpdCompletor = new FhpdCompletor(cli); - reader.addCompletor(fhpdCompletor); - try { - cli.execCommand(line); - while (line != null && ! (line.equals("quit") || line.equals("q") || line.equals("exit"))) - { - line = reader.readLine(cli.getPrompt()); - cli.execCommand(line); - } + try { + reader = new ConsoleReader(new FileInputStream(java.io.FileDescriptor.in), + new PrintWriter(System.out), + null, + new ObservingTerminal(FileDescriptor.in)); + } + catch (IOException ioe) { + System.out.println("ERROR: Could not create a command line"); + System.out.print(ioe.getMessage()); + } + Completor fhpdCompletor = new FhpdCompletor(cli); + reader.addCompletor(fhpdCompletor); + try { + cli.execCommand(line); + while (line != null && ! (line.equals("quit") || line.equals("q") + || line.equals("exit"))) { + line = reader.readLine(cli.getPrompt()); + cli.execCommand(line); + } + } + catch (IOException ioe) { + System.out.println("ERROR: Could not read from command line"); + System.out.print(ioe.getMessage()); + } } - catch (IOException ioe) { - System.out.println("ERROR: Could not read from command line"); - System.out.print(ioe.getMessage()); - } - } } diff --git a/frysk-core/frysk/hpd/BreakpointCommand.java b/frysk-core/frysk/hpd/BreakpointCommand.java index 832624f..c31d630 100644 --- a/frysk-core/frysk/hpd/BreakpointCommand.java +++ b/frysk-core/frysk/hpd/BreakpointCommand.java @@ -113,7 +113,7 @@ class BreakpointCommand extends ParameterizedCommand { actionpoint = bpManager.addLineBreakpoint(fileName, lineNumber, 0); actionpoint.addObserver(new CLIBreakpointObserver() { public void updateHit(final SourceBreakpoint bpt, Task task, - long address) { + final long address) { // Output the message in an Event in order to // allow all actions, fired by events currently in // the loop, to run. @@ -125,7 +125,9 @@ class BreakpointCommand extends ParameterizedCommand { outWriter.print(" #"); outWriter.print(lbpt.getFileName()); outWriter.print("#"); - outWriter.println(lbpt.getLineNumber()); + outWriter.print(lbpt.getLineNumber()); + outWriter.print(" 0x"); + outWriter.println(Long.toHexString(address)); } }); } @@ -148,7 +150,7 @@ class BreakpointCommand extends ParameterizedCommand { actionpoint = bpManager.addFunctionBreakpoint(breakpt, die); actionpoint.addObserver(new CLIBreakpointObserver() { public void updateHit(final SourceBreakpoint bpt, - Task task, long address) { + Task task, final long address) { // See comment in case above. Manager.eventLoop.add(new Event() { public void execute() { @@ -157,7 +159,9 @@ class BreakpointCommand extends ParameterizedCommand { outWriter.print("Breakpoint "); outWriter.print(fbpt.getId()); outWriter.print(" "); - outWriter.println(fbpt.getName()); + outWriter.print(fbpt.getName()); + outWriter.print(" 0x"); + outWriter.println(Long.toHexString(address)); } }); } diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 434c3c3..8694e49 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,6 @@ +2008-02-04 Tim Moore + * BreakpointCommand.java (interpret): Print out hex address when breakpoint is hit. + 2008-02-02 Rick Moseley * GoCommand.java: Fix bz #5714. diff --git a/frysk-core/frysk/rt/BreakpointManager.java b/frysk-core/frysk/rt/BreakpointManager.java index 87dffa0..b7748d6 100644 --- a/frysk-core/frysk/rt/BreakpointManager.java +++ b/frysk-core/frysk/rt/BreakpointManager.java @@ -190,7 +190,7 @@ public class BreakpointManager } breakpoint.setState(task, SourceBreakpoint.ENABLED); setChanged(); - notifyObservers(); + notifyObservers(breakpoint); return SourceBreakpoint.ENABLED; } @@ -202,7 +202,7 @@ public class BreakpointManager public void disableBreakpoint(SourceBreakpoint breakpoint, Task task) { breakpoint.disableBreakpoint(task, this.steppingEngine); setChanged(); - notifyObservers(); + notifyObservers(breakpoint); } public Iterator getBreakpointTableIterator() { diff --git a/frysk-core/frysk/rt/ChangeLog b/frysk-core/frysk/rt/ChangeLog index 270730d..ce3d9d1 100644 --- a/frysk-core/frysk/rt/ChangeLog +++ b/frysk-core/frysk/rt/ChangeLog @@ -1,3 +1,8 @@ +2008-02-04 Tim Moore + + * BreakpointManager.java (enableBreakpoint, disableBreakpoint): Pass breakpoint in + question to observers. + 2008-01-24 swagiaal * LineXXX.java: Fix for NullPointerException diff --git a/frysk-core/frysk/rt/SourceBreakpoint.java b/frysk-core/frysk/rt/SourceBreakpoint.java index 3257e60..d894284 100644 --- a/frysk-core/frysk/rt/SourceBreakpoint.java +++ b/frysk-core/frysk/rt/SourceBreakpoint.java @@ -62,9 +62,8 @@ import frysk.stepping.SteppingEngine; * */ public abstract class SourceBreakpoint - implements Comparable, BreakpointObserver -{ - private HashMap procMap; + implements Comparable, BreakpointObserver { + private HashMap procMap; // Possible actionpoint states public static class State { @@ -141,219 +140,196 @@ public abstract class SourceBreakpoint userState = state; } - private class ProcEntry - { - LinkedList addrs = null; // The "raw" addresses - LinkedList breakpoints = null; // RunState breakpoints - } - - public SourceBreakpoint(int id, State state) - { - procMap = new HashMap(); - this.userState = state; - this.id = id; - } - - public SourceBreakpoint(int id) - { - this(id, DISABLED); - } + private class ProcEntry { + LinkedList addrs = null; // The "raw" addresses + LinkedList breakpoints = null; // RunState breakpoints + } + + public SourceBreakpoint(int id, State state) { + procMap = new HashMap(); + this.userState = state; + this.id = id; + } + + public SourceBreakpoint(int id) { + this(id, DISABLED); + } - /** - * Get the list of raw address objects for a process - * - * @param The process - * @return the list - */ - public LinkedList getAddrs(Proc proc) - { - ProcEntry procEntry = (ProcEntry)procMap.get(proc); - if (procEntry != null) - return procEntry.addrs; - else - return null; - } - - /** - * Set the list of raw address objects. - * @param addrs the address objects - */ - public void setAddrs(Proc proc, LinkedList addrs) - { - ProcEntry procEntry = (ProcEntry)procMap.get(proc); - if (procEntry == null) - { - procEntry = new ProcEntry(); - procMap.put(proc, procEntry); - } - procEntry.addrs = addrs; - } - - /** - * Return the address to use as a breakpoint from the object stored - * in the list of breakpoints. - * @param addr the object stored in the addrs list - * @return the raw address at which a breakpoint will be set - */ - abstract long getRawAddress(Object addr); + /** + * Get the list of raw address objects for a process + * + * @param The process + * @return the list + */ + public LinkedList getAddrs(Proc proc) { + ProcEntry procEntry = (ProcEntry)procMap.get(proc); + if (procEntry != null) + return procEntry.addrs; + else + return null; + } + + /** + * Set the list of raw address objects. + * @param addrs the address objects + */ + public void setAddrs(Proc proc, LinkedList addrs) { + ProcEntry procEntry = (ProcEntry)procMap.get(proc); + if (procEntry == null) + { + procEntry = new ProcEntry(); + procMap.put(proc, procEntry); + } + procEntry.addrs = addrs; + } + + /** + * Return the address to use as a breakpoint from the object stored + * in the list of breakpoints. + * @param addr the object stored in the addrs list + * @return the raw address at which a breakpoint will be set + */ + abstract long getRawAddress(Object addr); - /** - * Add this object's raw breakpoints to the process via the RunState object. - * @param task task to which breakpoints are added, although they are in - * fact added to the entire process. - * @param steppingEngine The SteppingEngine to notify. - * @param runState the RunState object - */ - public void enableBreakpoint(Task task, SteppingEngine steppingEngine) - { - Proc proc = task.getProc(); - - LinkedList addressList = getBreakpointRawAddresses(task); - setAddrs(proc, addressList); - ProcEntry procEntry = (ProcEntry)procMap.get(proc); - Iterator bpts = procEntry.addrs.iterator(); - procEntry.breakpoints = new LinkedList(); - while (bpts.hasNext()) - { - Object bpt = bpts.next(); - long address = getRawAddress(bpt); - Breakpoint.PersistentBreakpoint breakpoint - = new Breakpoint.PersistentBreakpoint(task, address, - steppingEngine); hooks/post-receive -- frysk system monitor/debugger