public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Improve fstack, et.al., output; add Frame.toPrint PrintStackOptions param. Date: Tue, 10 Jun 2008 17:34:00 -0000 [thread overview] Message-ID: <20080610173400.30514.qmail@sourceware.org> (raw) The branch, master has been updated via 65837bf7e7a75451a6d5971e52ed06edef716ed3 (commit) from 1916e00aa7394b36d0231ec093d7badaf736141d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 65837bf7e7a75451a6d5971e52ed06edef716ed3 Author: Andrew Cagney <cagney@redhat.com> Date: Tue Jun 10 13:21:49 2008 -0400 Improve fstack, et.al., output; add Frame.toPrint PrintStackOptions param. This changes the following in fstack et.al.: -> prints the shared library by default -> prints FUNC() _at_ FILE#line -> tightens tests to explicit check for parameter names, and not values (and adds framework for adding a -print values option). -> makes ferror consistent with other utilities - print an abi frame by default -> for -rich, don't print local variable information With this in place fstack et.al. support: default: a raw ABI stack backtrace lite: a minimial debug-info stack backtrace rich: a full inline stack backtrace The patches size comes from me replacing a some what arbitrary and confusing list of boolean flags to Frame.toPrint et.al. with Print*StackOptions classes. frysk-core/frysk/bindir/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * TestFstack.java (testBackTraceWithRich()): Mark as unresolved; bug 6616. * ferror.java: Use PrintDebugInfoStackOptions; don't specify the default stack options. * ftrace.java: Ditto. * fstack.java: Ditto. frysk-core/frysk/debuginfo/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * DebugInfoFrame.java (toPrint(PrintWriter,boolean,boolean)): Delete. (toPrint(PrintWriter,DebugInfoStackOptions)): New. * PrintParameterOptions.java: New. * VirtualDebugInfoFrame.java: Ditto. * PrintDebugInfoStackOptions.java: Rename PrintStackOptions, extend frysk.stack.PrintStackOptions. * TestFrameDebugInfo.java: Update. frysk-core/frysk/ftrace/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * Ftrace.java: Use PrintDebugInfoStackOptions. * Reporter.java: Ditto. frysk-core/frysk/proc/dead/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * TestLinuxCore.java: Use PrintDebugInfoStackOptions. frysk-core/frysk/scopes/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * Function.java (printParameters): Add boolean printValues parameter. frysk-core/frysk/stack/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * Frame.java (toPrint(PrintWriter,PrintStackOptions)): Replace toPrint(PrintWriter,boolean,boolean). (toPrint(PrintWriter)): Delete. * PrintStackOptions.java: New. * StackFactory.java: Use. frysk-core/frysk/util/ChangeLog 2008-06-10 Andrew Cagney <cagney@redhat.com> * TestStackTraceAction.java: Use PrintDebugInfoStackOptions. * StackPrintUtil.java: Ditto. * StacktraceAction.java: Ditto. * FCatch.java: Ditto. * StressTestStackTraceAction.java: Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 9 ++ frysk-core/frysk/bindir/TestFstack.java | 10 +- frysk-core/frysk/bindir/ferror.java | 6 +- frysk-core/frysk/bindir/fstack.java | 6 +- frysk-core/frysk/bindir/ftrace.java | 6 +- frysk-core/frysk/debuginfo/ChangeLog | 10 ++ frysk-core/frysk/debuginfo/DebugInfoFrame.java | 34 ++---- .../frysk/debuginfo/DebugInfoStackFactory.java | 42 +++---- ...ptions.java => PrintDebugInfoStackOptions.java} | 124 ++++++++++--------- frysk-core/frysk/debuginfo/TestFrameDebugInfo.java | 13 +- .../frysk/debuginfo/VirtualDebugInfoFrame.java | 6 +- frysk-core/frysk/ftrace/ChangeLog | 5 + frysk-core/frysk/ftrace/Ftrace.java | 6 +- frysk-core/frysk/ftrace/Reporter.java | 8 +- frysk-core/frysk/hpd/StackCommands.java | 10 +- frysk-core/frysk/proc/dead/ChangeLog | 4 + frysk-core/frysk/proc/dead/TestLinuxCore.java | 7 +- frysk-core/frysk/scopes/ChangeLog | 5 + frysk-core/frysk/scopes/Function.java | 24 ++-- frysk-core/frysk/stack/ChangeLog | 8 ++ frysk-core/frysk/stack/Frame.java | 41 +++---- .../PrintStackOptions.java} | 72 +++++++++--- frysk-core/frysk/stack/StackFactory.java | 17 ++-- frysk-core/frysk/util/ChangeLog | 8 ++ frysk-core/frysk/util/FCatch.java | 5 +- frysk-core/frysk/util/StackPrintUtil.java | 22 +++-- frysk-core/frysk/util/StacktraceAction.java | 60 +++++----- .../frysk/util/StressTestStackTraceAction.java | 6 +- frysk-core/frysk/util/TestStackTraceAction.java | 6 +- 29 files changed, 333 insertions(+), 247 deletions(-) rename frysk-core/frysk/debuginfo/{PrintStackOptions.java => PrintDebugInfoStackOptions.java} (66%) copy frysk-core/frysk/{debuginfo/VirtualDebugInfoFrame.java => stack/PrintStackOptions.java} (59%) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 0429ed3..226c6d7 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,12 @@ +2008-06-10 Andrew Cagney <cagney@redhat.com> + + * TestFstack.java (testBackTraceWithRich()): Mark as unresolved; + bug 6616. + * ferror.java: Use PrintDebugInfoStackOptions; don't specify the + default stack options. + * ftrace.java: Ditto. + * fstack.java: Ditto. + 2008-06-04 Sami Wagiaalla <swagiaal@redhat.com> * TestFstep.java: Marked tests are unresolved. diff --git a/frysk-core/frysk/bindir/TestFstack.java b/frysk-core/frysk/bindir/TestFstack.java index aafeb66..837aa3e 100644 --- a/frysk-core/frysk/bindir/TestFstack.java +++ b/frysk-core/frysk/bindir/TestFstack.java @@ -90,7 +90,7 @@ public class TestFstack extends TestLib { TearDownExpect e = fstack("funit-stack-outlined", new String[] { "-print", "debug-names,params" }); - e.expect("\\#0 .* in third\\(int arg3\\) .*\\/funit-stack-outlined\\.c#"); + e.expect("\\#0 .* in third\\(int arg3\\) at funit-stack-outlined\\.c#"); e.expect("\\#1"); } @@ -136,11 +136,13 @@ public class TestFstack extends TestLib { } public void testBackTraceWithRich() { + if (unresolved(6616)) + return; TearDownExpect e = fstack("funit-stack-inlined", new String[] { "-rich" }); - e.expect("\\#0 .* third\\(int arg3.*\\)"); - e.expect("\\#1 .* second\\(int arg2.*\\)"); - e.expect("\\#2 .* first\\(int arg1.*\\)"); + e.expect("\\#0 .* third\\(int arg3\\)"); + e.expect("\\#1 .* second\\(int arg2\\)"); + e.expect("\\#2 .* first\\(int arg1\\)"); e.expect("\\#3 .* main\\(\\)"); } diff --git a/frysk-core/frysk/bindir/ferror.java b/frysk-core/frysk/bindir/ferror.java index ed0cbdb..3592edd 100644 --- a/frysk-core/frysk/bindir/ferror.java +++ b/frysk-core/frysk/bindir/ferror.java @@ -43,7 +43,7 @@ import java.io.PrintWriter; import java.util.regex.Matcher; import java.util.regex.Pattern; -import frysk.debuginfo.PrintStackOptions; +import frysk.debuginfo.PrintDebugInfoStackOptions; import frysk.isa.syscalls.Syscall; import frysk.proc.Action; import frysk.proc.Task; @@ -58,8 +58,8 @@ import gnu.classpath.tools.getopt.OptionGroup; public class ferror { - private static final PrintStackOptions stackPrintOptions - = new PrintStackOptions().setRich(); + private static final PrintDebugInfoStackOptions stackPrintOptions + = new PrintDebugInfoStackOptions(); private static final PrintWriter printWriter = new PrintWriter(System.out); private static Pattern writePattern; private static OptionGroup[] options() { diff --git a/frysk-core/frysk/bindir/fstack.java b/frysk-core/frysk/bindir/fstack.java index a59bd43..89988a9 100644 --- a/frysk-core/frysk/bindir/fstack.java +++ b/frysk-core/frysk/bindir/fstack.java @@ -42,7 +42,7 @@ package frysk.bindir; import java.io.PrintWriter; import java.util.Iterator; import java.util.TreeMap; -import frysk.debuginfo.PrintStackOptions; +import frysk.debuginfo.PrintDebugInfoStackOptions; import frysk.event.Event; import frysk.event.ProcEvent; import frysk.proc.Proc; @@ -55,8 +55,8 @@ import gnu.classpath.tools.getopt.OptionGroup; public final class fstack { private static PrintWriter printWriter = new PrintWriter(System.out); - private static PrintStackOptions stackPrintOptions - = new PrintStackOptions(); + private static PrintDebugInfoStackOptions stackPrintOptions + = new PrintDebugInfoStackOptions(); private static final Log fine = Log.fine(fstack.class); public static void main(String[] args) { diff --git a/frysk-core/frysk/bindir/ftrace.java b/frysk-core/frysk/bindir/ftrace.java index 86cb8fc..34baff7 100644 --- a/frysk-core/frysk/bindir/ftrace.java +++ b/frysk-core/frysk/bindir/ftrace.java @@ -52,7 +52,7 @@ import gnu.classpath.tools.getopt.OptionException; import gnu.classpath.tools.getopt.OptionGroup; import inua.util.PrintWriter; -import frysk.debuginfo.PrintStackOptions; +import frysk.debuginfo.PrintDebugInfoStackOptions; import frysk.expr.FQIdentParser; import frysk.expr.FQIdentifier; import frysk.ftrace.AddrRule; @@ -94,8 +94,8 @@ class ftrace { private final FtraceController controller = new FtraceController(); private boolean allowInterpTracing = false; - private final PrintStackOptions stackPrintOptions - = new PrintStackOptions(); + private final PrintDebugInfoStackOptions stackPrintOptions + = new PrintDebugInfoStackOptions(); private final Ftrace tracer = new Ftrace(stackPrintOptions); private interface RuleMatcher { diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index f74532f..649fe31 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,13 @@ +2008-06-10 Andrew Cagney <cagney@redhat.com> + + * DebugInfoFrame.java (toPrint(PrintWriter,boolean,boolean)): Delete. + (toPrint(PrintWriter,DebugInfoStackOptions)): New. + * PrintParameterOptions.java: New. + * VirtualDebugInfoFrame.java: Ditto. + * PrintDebugInfoStackOptions.java: Rename PrintStackOptions, + extend frysk.stack.PrintStackOptions. + * TestFrameDebugInfo.java: Update. + 2008-06-06 Andrew Cagney <cagney@redhat.com> * DebugInfo.java: Let DwflDie adjust for bias. diff --git a/frysk-core/frysk/debuginfo/DebugInfoFrame.java b/frysk-core/frysk/debuginfo/DebugInfoFrame.java index 02ecdca..ea0b1b7 100644 --- a/frysk-core/frysk/debuginfo/DebugInfoFrame.java +++ b/frysk-core/frysk/debuginfo/DebugInfoFrame.java @@ -39,10 +39,10 @@ package frysk.debuginfo; +import frysk.util.ArchFormatter; import java.io.PrintWriter; import java.util.Iterator; import java.util.LinkedList; - import lib.dwfl.DwarfDie; import lib.dwfl.Dwfl; import lib.dwfl.DwflDie; @@ -186,39 +186,31 @@ public class DebugInfoFrame extends FrameDecorator { } private LineXXX lineXXX; - public void toPrint(PrintWriter writer, boolean printParameters, - boolean fullpath){ + public void toPrint(PrintWriter writer, + PrintDebugInfoStackOptions options) { Function subprogram = this.getSubprogram(); - if (subprogram != null) { - writer.print("0x"); - String addr = Long.toHexString(this.getAddress()); - int padding = 2 * this.getTask().getISA().wordSize() - addr.length(); - - for (int i = 0; i < padding; ++i) - writer.print('0'); - - writer.print(addr); - writer.print(" in " + subprogram.getName() + "("); - if (printParameters) { - subprogram.printParameters(writer, this); + writer.write(ArchFormatter.toHexString(getTask(), getAddress())); + writer.print(" in "); + writer.print(subprogram.getName()); + writer.print("("); + if (options.printParameters()) { + subprogram.printParameters(writer, this, options.printValues()); } - writer.print(") "); - - if (fullpath) { + writer.print(") at "); + if (options.printFullPaths()) { SourceLocation line = this.getLine(); writer.print(line.getFile().getPath()); writer.print("#"); writer.print(line.getLine()); } else { SourceLocation line = this.getLine(); - writer.print(".../"+line.getFile().getName()); + writer.print(line.getFile().getName()); writer.print("#"); writer.print(line.getLine()); } - } else { - super.toPrint(writer, true, fullpath); + super.toPrint(writer, options); } } diff --git a/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java b/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java index 7023da6..4adec65 100644 --- a/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java +++ b/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java @@ -51,9 +51,6 @@ import frysk.stack.StackFactory; */ public class DebugInfoStackFactory { - public static final PrintStackOptions DEFAULT - = new PrintStackOptions().setRich(); - /** * Create an ABI stack backtrace, make the simpler debug-info * methods. @@ -100,29 +97,31 @@ public class DebugInfoStackFactory { return innermostFrame; } - public static final void printTaskStackTrace (PrintWriter printWriter, Task task, PrintStackOptions options) - { - if (task != null){ - printWriter.println("Task #" + task.getTid()); - DebugInfoFrame frame = createDebugInfoStackTrace(task); - printStackTrace(printWriter, frame, options); - } - printWriter.flush(); + public static final void printTaskStackTrace(PrintWriter printWriter, + Task task, + PrintDebugInfoStackOptions options) { + if (task != null) { + printWriter.println("Task #" + task.getTid()); + DebugInfoFrame frame = createDebugInfoStackTrace(task); + printStackTrace(printWriter, frame, options); + } + printWriter.flush(); } - public static final void printVirtualTaskStackTrace (PrintWriter printWriter, Task task, PrintStackOptions options) - { - if (task != null){ - printWriter.println("Task #" + task.getTid()); - DebugInfoFrame frame = createVirtualStackTrace(task); - printStackTrace(printWriter,frame, options); - } - printWriter.flush(); + public static final void printVirtualTaskStackTrace(PrintWriter printWriter, + Task task, + PrintDebugInfoStackOptions options) { + if (task != null) { + printWriter.println("Task #" + task.getTid()); + DebugInfoFrame frame = createVirtualStackTrace(task); + printStackTrace(printWriter,frame, options); + } + printWriter.flush(); } public static void printStackTrace(PrintWriter writer, DebugInfoFrame topFrame, - PrintStackOptions options) { + PrintDebugInfoStackOptions options) { int count = 0; for (DebugInfoFrame frame = topFrame; frame != null; @@ -142,8 +141,7 @@ public class DebugInfoStackFactory { frame.printLevel(writer); writer.print(" "); - frame.toPrint(writer, options.printParams(), - options.printFullPaths()); + frame.toPrint(writer, options); writer.println(); if (options.printLocals()) { frame.printScopes(writer); diff --git a/frysk-core/frysk/debuginfo/PrintStackOptions.java b/frysk-core/frysk/debuginfo/PrintDebugInfoStackOptions.java similarity index 66% rename from frysk-core/frysk/debuginfo/PrintStackOptions.java rename to frysk-core/frysk/debuginfo/PrintDebugInfoStackOptions.java index acae8e0..c2110e1 100644 --- a/frysk-core/frysk/debuginfo/PrintStackOptions.java +++ b/frysk-core/frysk/debuginfo/PrintDebugInfoStackOptions.java @@ -39,103 +39,109 @@ package frysk.debuginfo; -public class PrintStackOptions { +import frysk.stack.PrintStackOptions; - private int numberOfFrames = 10; +public class PrintDebugInfoStackOptions extends PrintStackOptions { - private boolean printFullPaths = false; - - private boolean printParams = false; - private boolean printLocals = false; - private boolean printLibraries = false; - private boolean printInlineFunctions = false; - private boolean printDebugNames = false; - - public PrintStackOptions() { + public PrintDebugInfoStackOptions() { + // Note, the super calls clear. } + private boolean printParameters; + private boolean printLocals; + private boolean printInlineFunctions; + private boolean printDebugNames; + private boolean printValues; + /** - * Set things up for a light-weight, or low-cost, back-trace by - * limiting things to just the elf information. + * Clear all options. */ - public PrintStackOptions setLite() { - printParams = false; + public void clear() { + super.clear(); + printParameters = false; printLocals = false; - printLibraries = true; printInlineFunctions = false; - printDebugNames = true; - return this; + printDebugNames = false; + printValues = false; + } + + /** + * Set things up for a light-weight, or low-cost, back-trace by + * limiting things to just the elf information. + */ + public void setLite() { + setAbi(); + setPrintDebugNames(true); } /** * Set things up for a rich, or detailed, back-trace by including * inline frames and parameter information. */ - public PrintStackOptions setRich() { - printParams = true; - printLocals = true; - printLibraries = true; - printInlineFunctions = true; - printDebugNames = true; - return this; + public void setRich() { + setAbi(); + setPrintParameters(true); + setPrintInlineFunctions(true); + setPrintDebugNames(true); } /** - * Specify the number of frames to include in the back-trace, 0 to - * include all frames. + * Print the parameter list (see also printValues). */ - public void setNumberOfFrames(int numberOfFrames) { - this.numberOfFrames = numberOfFrames; + public boolean printParameters() { + return printParameters; } - public int numberOfFrames() { - return numberOfFrames; + public void setPrintParameters(boolean printParameters) { + this.printParameters = printParameters; } - public void setPrintParams(boolean printParams) { - this.printParams = printParams; + /** + * Print paramter and variable values (rather than just their + * names). + */ + public boolean printValues() { + return printValues; } - public boolean printParams() { - return printParams; + public void setPrintValues(boolean printValues) { + this.printValues = printValues; } - public void setPrintLocals(boolean printLocals) { - this.printLocals = printLocals; - } + /** + * Print the function's local variables. + */ public boolean printLocals() { return printLocals; } - - public void setPrintFullPaths(boolean printFullPaths) { - this.printFullPaths = printFullPaths; - } - public boolean printFullPaths() { - return printFullPaths; + public void setPrintLocals(boolean printLocals) { + this.printLocals = printLocals; } - public void setPrintLibraries(boolean printLibraries) { - this.printLibraries = printLibraries; - } - public boolean printLibraries() { - return printLibraries; + /** + * Print inline function instances. + */ + public boolean printInlineFunctions() { + return printInlineFunctions; } - public void setPrintInlineFunctions(boolean printInlineFunctions) { this.printInlineFunctions = printInlineFunctions; } - public boolean printInlineFunctions() { - return printInlineFunctions; - } - public void setPrintDebugNames(boolean printDebugNames) { - this.printDebugNames = printDebugNames; - } + /** + * Print function and variable names using debug, rather than ABI, + * information. + */ public boolean printDebugNames() { return printDebugNames; } + public void setPrintDebugNames(boolean printDebugNames) { + this.printDebugNames = printDebugNames; + } - public boolean elfOnly() { - return ! (printLocals || printInlineFunctions || printParams + public boolean abiOnly() { + return ! (printLocals + || printInlineFunctions + || printParameters + || printValues || printDebugNames); } - } diff --git a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java index 439218f..ec0c65d 100644 --- a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java +++ b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java @@ -45,7 +45,6 @@ import java.util.Iterator; import java.util.LinkedList; import javax.naming.NameNotFoundException; - import lib.dwfl.DwTag; import lib.dwfl.DwarfDie; import lib.dwfl.Dwfl; @@ -85,9 +84,9 @@ public class TestFrameDebugInfo extends TestLib { StringWriter stringWriter = new StringWriter(); DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(task); - PrintStackOptions options = new PrintStackOptions(); + PrintDebugInfoStackOptions options = new PrintDebugInfoStackOptions(); options.setNumberOfFrames(20); - options.setPrintParams(true); + options.setPrintParameters(true); options.setPrintLocals(true); options.setPrintFullPaths(true); DebugInfoStackFactory.printStackTrace(new PrintWriter(stringWriter),frame, options); @@ -307,9 +306,9 @@ public class TestFrameDebugInfo extends TestLib { Task task = (new DaemonBlockedAtSignal("funit-stack-inlined" + ext)).getMainTask(); StringWriter stringWriter = new StringWriter(); - PrintStackOptions options = new PrintStackOptions(); + PrintDebugInfoStackOptions options = new PrintDebugInfoStackOptions(); options.setNumberOfFrames(0); - options.setPrintParams(true); + options.setPrintParameters(true); options.setPrintLocals(true); options.setPrintFullPaths(true); DebugInfoStackFactory.printVirtualTaskStackTrace(new PrintWriter(stringWriter), task, options); @@ -326,9 +325,9 @@ public class TestFrameDebugInfo extends TestLib { Task task = (new DaemonBlockedAtSignal("funit-stack-inlined")).getMainTask(); - PrintStackOptions options = new PrintStackOptions(); + PrintDebugInfoStackOptions options = new PrintDebugInfoStackOptions(); options.setNumberOfFrames(0); - options.setPrintParams(true); + options.setPrintParameters(true); options.setPrintLocals(true); hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-06-10 17:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080610173400.30514.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).