public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Simplify back-trace options (mostly). Date: Tue, 01 Apr 2008 19:01:00 -0000 [thread overview] Message-ID: <20080401190110.14190.qmail@sourceware.org> (raw) The branch, master has been updated via 4c1d1937456e7b84679d5cbef12f8698b027dec4 (commit) from 34f0852ac261e169bb990acc21ec6f5906e1ae08 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 4c1d1937456e7b84679d5cbef12f8698b027dec4 Author: Andrew Cagney <cagney@redhat.com> Date: Tue Apr 1 14:47:27 2008 -0400 Simplify back-trace options (mostly). frysk-core/frysk/bindir/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * TestFstack.java: Ditto. (testBackTraceWithDashA()): Delete. (testBackTraceWithDashC()): Delete. (testBackTraceWithDashV()): Delete. (testBackTraceWithRich()): New. (testBackTraceWithDashN(): Delete. (testBackTraceWithNumberOfFramesAll()): New. (testBackTraceWithNumberOfFrames0()): New. (testBackTraceWithNumberOfFrames4()): New. (testBackTraceWithNumberOfFrames5()): New. (testBackTraceWithDashNDashA()): Delete. (testBackTraceWithRichNumberOfFrames()): New * ferror.java: Update to match PrintStackOptions. frysk-core/frysk/debuginfo/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * PrintStackOptions.java (printLocals(), setPrintLocals(boolean)): Replace printScopes() and setPrintScopes(boolean). (printInlineFunctions(), setPrintInlineFunctions(boolean)): Replace printVirtualFrames() and setPrintVirtualFrames(boolean). (setPrintFullPaths(boolean), printFullPaths()): Replace fullPath(), setFullPath(boolean). (setPrintLibraries(boolean), printLibraries()): Replace setPrintLibrary(boolean) and printLibrary(). (elfOnly, setElfOnly()): Delete. (elfOnly()): Re-implement. * DebugInfoStackFactory.java: Update. * TestFrameDebugInfo.java: Update. frysk-core/frysk/hpd/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * StackCommands.java: Update to match PrintStackOptions. * TestStackCommands.java: Ditto. frysk-core/frysk/proc/dead/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * TestLinuxCore.java: Update to match PrintStackOptions. frysk-core/frysk/stack/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * StackFactory.java: Update to match PrintStackOptions. frysk-core/frysk/util/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * StackPrintUtil.java: Drop '-n', '-f', '-full-path', '-all', '-a', '-virtual', '-v', '-common', '-c'. Add '-lite', '-rich'. Change '-print' options to 'debug-names', 'locals', 'params', 'full-path', 'inline'. * TestStackTraceAction.java: Update. * StressTestStackTraceAction.java: Update. frysk-gui/frysk/gui/monitor/ChangeLog 2008-04-01 Andrew Cagney <cagney@redhat.com> * eventviewer/Event.java: Update to match PrintStackOptions. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 16 +++ frysk-core/frysk/bindir/TestFstack.java | 139 +++++++++++-------- frysk-core/frysk/bindir/ferror.java | 7 +- frysk-core/frysk/debuginfo/ChangeLog | 15 ++ .../frysk/debuginfo/DebugInfoStackFactory.java | 15 +-- frysk-core/frysk/debuginfo/PrintStackOptions.java | 102 ++++++++++----- frysk-core/frysk/debuginfo/TestFrameDebugInfo.java | 12 +- frysk-core/frysk/hpd/ChangeLog | 5 + frysk-core/frysk/hpd/StackCommands.java | 14 +- frysk-core/frysk/hpd/TestStackCommands.java | 12 +- frysk-core/frysk/proc/dead/ChangeLog | 9 +- frysk-core/frysk/proc/dead/TestLinuxCore.java | 2 - frysk-core/frysk/stack/ChangeLog | 11 ++ frysk-core/frysk/stack/StackFactory.java | 3 +- frysk-core/frysk/util/ChangeLog | 9 ++ frysk-core/frysk/util/StackPrintUtil.java | 101 ++++++--------- frysk-core/frysk/util/StacktraceAction.java | 2 +- .../frysk/util/StressTestStackTraceAction.java | 2 +- frysk-core/frysk/util/TestStackTraceAction.java | 115 ++++++++--------- frysk-core/frysk/util/stack-options.xml | 5 +- frysk-gui/frysk/gui/monitor/ChangeLog | 4 + frysk-gui/frysk/gui/monitor/eventviewer/Event.java | 2 +- 22 files changed, 343 insertions(+), 259 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 74e1fbf..de1ef95 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,19 @@ +2008-04-01 Andrew Cagney <cagney@redhat.com> + + * TestFstack.java: Ditto. + (testBackTraceWithDashA()): Delete. + (testBackTraceWithDashC()): Delete. + (testBackTraceWithDashV()): Delete. + (testBackTraceWithRich()): New. + (testBackTraceWithDashN(): Delete. + (testBackTraceWithNumberOfFramesAll()): New. + (testBackTraceWithNumberOfFrames0()): New. + (testBackTraceWithNumberOfFrames4()): New. + (testBackTraceWithNumberOfFrames5()): New. + (testBackTraceWithDashNDashA()): Delete. + (testBackTraceWithRichNumberOfFrames()): New + * ferror.java: Update to match PrintStackOptions. + 2008-03-31 Andrew Cagney <cagney@redhat.com> * ftrace.java (commandAndArguments): Change type to Proc. diff --git a/frysk-core/frysk/bindir/TestFstack.java b/frysk-core/frysk/bindir/TestFstack.java index 8896b93..398a065 100644 --- a/frysk-core/frysk/bindir/TestFstack.java +++ b/frysk-core/frysk/bindir/TestFstack.java @@ -86,94 +86,118 @@ public class TestFstack extends TestLib { e.expect ("main"); } - public void testBackTraceWithParams () { - TearDownExpect e = fstack("funit-stack-outlined", - new String[] { "-print", "params" }); - e.expect("\\#0 .* third\\(int arg3.*\\)"); - e.expect("\\#1 .* second\\(int arg2.*\\)"); - e.expect("\\#2 .* first\\(int arg1.*\\)"); - e.expect("\\#3 .* main\\(\\)"); - } - - public void testBackTraceWithScopes () { - TearDownExpect e = fstack("funit-stack-outlined", - new String[] { "--print", "scopes" }); - e.expect("\\#0 .* third\\(\\)"); - e.expect("int var3"); - e.expect("\\#1 .* second\\(\\)"); - e.expect("int var2"); - e.expect("\\#2 .* first\\(\\)"); - e.expect("int var1"); - e.expect("\\#3 .* main\\(\\)"); - e.expect("int some_int"); + public void testBackTraceWithDebugNamesAndParams() { + 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("\\#1"); } - public void testBackTraceWithFullpath () { - TearDownExpect e = fstack("funit-stack-outlined", - new String[] { "--print", "fullpath" }); + public void testBackTraceWithFullPath () { + TearDownExpect e = fstack("funit-stack-outlined", new String[] { + "-rich", "-print", "full-path" + }); e.expect (getCanonicalAbsRootSrcDir() + ".*" + "funit-stack-outlined" + ".c#"); } - public void testBackTraceWithDashA () { + public void testBackTraceWithInline() { + TearDownExpect e = fstack("funit-stack-inlined", + new String[] { "--print", "inline" }); + e.expect("\\#0 .* third"); + e.expect("\\#1 .* second"); + e.expect("\\#2 .* first"); + e.expect("\\#3 .* main"); + } + + public void testBackTraceWithLocals() { TearDownExpect e = fstack("funit-stack-outlined", - new String[] { "-a" }); - e.expect("\\#0 .* in third\\(int arg3\\)" - + ".*" + getCanonicalAbsRootSrcDir() - + ".*" + "funit-stack-outlined" + "\\.c#" - + ".*int var3.*"); - e.expect("\\#1"); + new String[] { "-print", "locals" }); + e.expect("\\#0 .* third\\("); + e.expect("int var3 = "); + e.expect("\\#1 .* second\\("); + e.expect("int var2 = "); + e.expect("\\#2 .* first\\("); + e.expect("int var1 = "); + e.expect("\\#3 .* main\\("); + e.expect("int some_int = "); } - public void testBackTraceWithDashC () { + public void testBackTraceWithParams () { TearDownExpect e = fstack("funit-stack-outlined", - new String[] { "-c" }); - e.expect("\\#0 .* in third\\(int arg3\\)" - + ".*" + getCanonicalAbsRootSrcDir() - + ".*" + "funit-stack-outlined" + "\\.c#"); - e.expect("\\#1"); - } + new String[] { "-print", "params" }); + e.expect("\\#0 .* third\\(int arg3.*\\)"); + e.expect("\\#1 .* second\\(int arg2.*\\)"); + e.expect("\\#2 .* first\\(int arg1.*\\)"); + e.expect("\\#3 .* main\\(\\)"); + } - public void testBackTraceWithDashV () { + public void testBackTraceWithRich() { TearDownExpect e = fstack("funit-stack-inlined", - new String[] { "-v", "-a" }); - e.expect("\\#0 .*third[^\\r\\n]*\\[inline\\]"); - e.expect("\\#1 .*second[^\\r\\n]*\\[inline\\]"); - e.expect("\\#2 .*first[^\\r\\n]*\\[inline\\]"); - e.expect("\\#3 .*main"); + new String[] { "-rich" }); + e.expect("\\#0 .* third\\(int arg3.*\\)"); + e.expect("\\#1 .* second\\(int arg2.*\\)"); + e.expect("\\#2 .* first\\(int arg1.*\\)"); + e.expect("\\#3 .* main\\(\\)"); } - public void testBackTraceWithDashN () { - - TearDownExpect e = fstack("funit-long-stack", new String[]{"-n","5"}); + public void testBackTraceWithRichWithoutInline() { + TearDownExpect e = fstack("funit-stack-inlined", new String[] { + "-rich", "-print", "-inline" + }); + e.expect("\\#0 .* main\\(\\)"); + } + + public void testBackTraceWithLite() { + TearDownExpect e = fstack("funit-stack-inlined", + new String[] { "-lite" }); + e.expect("\\#0 .*main"); + } + + public void testBackTraceWithNumberFrames5() { + TearDownExpect e = fstack("funit-long-stack", new String[]{ + "-number-of-frames", "5" + }); e.expect("\\#0 .*crash[^\\r\\n]*"); e.expect("\\#1 [^\r\n]*first[^\\r\\n]*"); e.expect("\\#2 [^\r\n]*first[^\\r\\n]*"); e.expect("\\#3 [^\r\n]*first[^\\r\\n]*"); e.expect("\\#4 [^\r\n]*first[^\\r\\n]*"); e.expect("..."); - e.close(); + } - e = fstack("funit-long-stack", new String[]{"-n","4"}); + public void testBackTraceWithNumberFrames4() { + TearDownExpect e = fstack("funit-long-stack", new String[] { + "-number-of-frames", "4" + }); e.expect("\\#0 .*crash[^\\r\\n]*"); e.expect("\\#1 [^\r\n]*first[^\\r\\n]*"); e.expect("\\#2 [^\r\n]*first[^\\r\\n]*"); e.expect("\\#3 [^\r\n]*first[^\\r\\n]*"); e.expect("..."); - e.close(); + } - e = fstack("funit-long-stack", new String[]{"-n","0"}); + public void testBackTraceWithNumberFrames0() { + TearDownExpect e = fstack("funit-long-stack", new String[]{ + "-number-of-frames", "0" + }); e.expect("\\#51 .*first[^\\r\\n]*"); - e.close(); - } - public void testBackTraceWithDashNDashA () { - - TearDownExpect e = fstack("funit-long-stack", - new String[]{"-n","5", "-a"}); + public void testBackTraceWithNumberFramesAll() { + TearDownExpect e = fstack("funit-long-stack", new String[]{ + "-number-of-frames", "all" + }); + e.expect("\\#51 .*first[^\\r\\n]*"); + } + + public void testBackTraceWithRichNumberOfFrames() { + TearDownExpect e = fstack("funit-long-stack", new String[] { + "-rich", "-number-of-frames", "5" + }); e.expect("\\#0 .*crash[^\\r\\n]*"); e.expect("\\#1 .*first[^\\r\\n]*"); e.expect("\\#2 .*first[^\\r\\n]*"); @@ -182,7 +206,4 @@ public class TestFstack extends TestLib { e.expect("..."); e.close(); } - - - } diff --git a/frysk-core/frysk/bindir/ferror.java b/frysk-core/frysk/bindir/ferror.java index 0ba5a85..06cb1ca 100644 --- a/frysk-core/frysk/bindir/ferror.java +++ b/frysk-core/frysk/bindir/ferror.java @@ -59,7 +59,7 @@ import gnu.classpath.tools.getopt.OptionGroup; public class ferror { private static final PrintStackOptions stackPrintOptions - = new PrintStackOptions(); + = new PrintStackOptions().setRich(); private static final PrintWriter printWriter = new PrintWriter(System.out); private static Pattern writePattern; private static OptionGroup[] options() { @@ -77,11 +77,6 @@ public class ferror { } public static void main(String[] args) { - stackPrintOptions.setPrintFullpath(false); - stackPrintOptions.setPrintParameters(true); - stackPrintOptions.setPrintVirtualFrames(true); - stackPrintOptions.setPrintLibrary(true); - ProcFollowUtil procRunningUtil = new ProcFollowUtil("ferror", "ferror -e \"<error string>\" -- <executbale|PID> [ARGS]", diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index 65a7859..8305c5d 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,18 @@ +2008-04-01 Andrew Cagney <cagney@redhat.com> + + * PrintStackOptions.java (printLocals(), setPrintLocals(boolean)): + Replace printScopes() and setPrintScopes(boolean). + (printInlineFunctions(), setPrintInlineFunctions(boolean)): + Replace printVirtualFrames() and setPrintVirtualFrames(boolean). + (setPrintFullPaths(boolean), printFullPaths()): Replace + fullPath(), setFullPath(boolean). + (setPrintLibraries(boolean), printLibraries()): Replace + setPrintLibrary(boolean) and printLibrary(). + (elfOnly, setElfOnly()): Delete. + (elfOnly()): Re-implement. + * DebugInfoStackFactory.java: Update. + * TestFrameDebugInfo.java: Update. + 2008-03-21 Petr Machata <pmachata@redhat.com> * TestDebugInfoStackTrace: Use lib.dwfl.ElfSymbol instead of diff --git a/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java b/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java index 8556395..a5f6c6e 100644 --- a/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java +++ b/frysk-core/frysk/debuginfo/DebugInfoStackFactory.java @@ -51,13 +51,9 @@ import frysk.stack.StackFactory; */ public class DebugInfoStackFactory { - public static final PrintStackOptions DEFAULT = new PrintStackOptions(); - static{ - DEFAULT.setPrintParameters(true); - DEFAULT.setPrintFullpath(false); - DEFAULT.setPrintScopes(false); - DEFAULT.setPrintVirtualFrames(true); - } + public static final PrintStackOptions DEFAULT + = new PrintStackOptions().setRich(); + /** * Create an ABI stack backtrace, make the simpler debug-info * methods. @@ -146,9 +142,10 @@ public class DebugInfoStackFactory { frame.printLevel(writer); writer.print(" "); - frame.toPrint(writer, options.printParameters(), options.fullpath()); + frame.toPrint(writer, options.printParams(), + options.printFullPaths()); writer.println(); - if (options.printScopes()) { + if (options.printLocals()) { frame.printScopes(writer); } writer.flush(); diff --git a/frysk-core/frysk/debuginfo/PrintStackOptions.java b/frysk-core/frysk/debuginfo/PrintStackOptions.java index 02ebf8c..acae8e0 100644 --- a/frysk-core/frysk/debuginfo/PrintStackOptions.java +++ b/frysk-core/frysk/debuginfo/PrintStackOptions.java @@ -41,65 +41,101 @@ package frysk.debuginfo; public class PrintStackOptions { - private boolean elfOnly; - - private int numberOfFrames; - private boolean printParameters; - private boolean printScopes; - private boolean fullpath; - private boolean printLibrary; - private boolean virtualFrames; + private int numberOfFrames = 10; + + 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() { } + /** + * Set things up for a light-weight, or low-cost, back-trace by + * limiting things to just the elf information. + */ + public PrintStackOptions setLite() { + printParams = false; + printLocals = false; + printLibraries = true; + printInlineFunctions = false; + printDebugNames = true; + return this; + } + + /** + * 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; + } + + /** + * Specify the number of frames to include in the back-trace, 0 to + * include all frames. + */ public void setNumberOfFrames(int numberOfFrames) { this.numberOfFrames = numberOfFrames; } public int numberOfFrames() { return numberOfFrames; } - public void setPrintParameters(boolean printParameters) { - this.printParameters = printParameters; + + public void setPrintParams(boolean printParams) { + this.printParams = printParams; } - public boolean printParameters() { - return printParameters; + public boolean printParams() { + return printParams; } - public void setPrintScopes(boolean printScopes) { - this.printScopes = printScopes; + + public void setPrintLocals(boolean printLocals) { + this.printLocals = printLocals; } - public boolean printScopes() { - return printScopes; + public boolean printLocals() { + return printLocals; } - public void setPrintFullpath(boolean fullpath) { - this.fullpath = fullpath; + + public void setPrintFullPaths(boolean printFullPaths) { + this.printFullPaths = printFullPaths; } - public boolean fullpath() { - return fullpath; + public boolean printFullPaths() { + return printFullPaths; } - public void setPrintLibrary(boolean printLibrary) { - this.printLibrary = printLibrary; + public void setPrintLibraries(boolean printLibraries) { + this.printLibraries = printLibraries; } - - public boolean printLibrary() { - return printLibrary; + public boolean printLibraries() { + return printLibraries; } - public void setPrintVirtualFrames(boolean virtualFrames) { - this.virtualFrames = virtualFrames; + public void setPrintInlineFunctions(boolean printInlineFunctions) { + this.printInlineFunctions = printInlineFunctions; } - - public boolean printVirtualFrames() { - return virtualFrames; + public boolean printInlineFunctions() { + return printInlineFunctions; } - public void setElfOnly(boolean elfOnly) { - this.elfOnly = elfOnly; + public void setPrintDebugNames(boolean printDebugNames) { + this.printDebugNames = printDebugNames; + } + public boolean printDebugNames() { + return printDebugNames; } public boolean elfOnly() { - return elfOnly; + return ! (printLocals || printInlineFunctions || printParams + || printDebugNames); } } diff --git a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java index fbd9f36..b9b17c2 100644 --- a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java +++ b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java @@ -86,9 +86,9 @@ public class TestFrameDebugInfo extends TestLib { DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(task); PrintStackOptions options = new PrintStackOptions(); options.setNumberOfFrames(20); - options.setPrintParameters(true); - options.setPrintScopes(true); - options.setPrintFullpath(true); + options.setPrintParams(true); + options.setPrintLocals(true); + options.setPrintFullPaths(true); DebugInfoStackFactory.printStackTrace(new PrintWriter(stringWriter),frame, options); String string = stringWriter.getBuffer().toString(); @@ -308,9 +308,9 @@ public class TestFrameDebugInfo extends TestLib { PrintStackOptions options = new PrintStackOptions(); options.setNumberOfFrames(0); - options.setPrintParameters(true); - options.setPrintScopes(true); - options.setPrintFullpath(true); + options.setPrintParams(true); + options.setPrintLocals(true); + options.setPrintFullPaths(true); DebugInfoStackFactory.printVirtualTaskStackTrace(new PrintWriter(stringWriter), task, options); assertTrue("contains inline", stringWriter.getBuffer().toString().contains("inline")); diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index e431b70..f0a926e 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,8 @@ +2008-04-01 Andrew Cagney <cagney@redhat.com> + + * StackCommands.java: Update to match PrintStackOptions. + * TestStackCommands.java: Ditto. + 2008-03-31 Stan Cox <scox@redhat.com> * LoadCommand.java (interpret): Pass sysroot to createProc. diff --git a/frysk-core/frysk/hpd/StackCommands.java b/frysk-core/frysk/hpd/StackCommands.java index 4452c09..8fd8a9f 100644 --- a/frysk-core/frysk/hpd/StackCommands.java +++ b/frysk-core/frysk/hpd/StackCommands.java @@ -50,7 +50,7 @@ import frysk.proc.Task; abstract class StackCommands extends ParameterizedCommand { private static class Options { - boolean printScopes; + boolean printLocals; } Object options() { return new Options(); @@ -58,9 +58,9 @@ abstract class StackCommands extends ParameterizedCommand { StackCommands(String description, String syntax, String full) { super(description, syntax, full); - add(new CommandOption("scopes", "include scopes") { + add(new CommandOption("locals", "include locals") { void parse(String arg, Object options) { - ((Options)options).printScopes = true; + ((Options)options).printLocals = true; } }); } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-04-01 19:01 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=20080401190110.14190.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).