001    // This file is part of the program FRYSK.
002    //
003    // Copyright 2007, 2008, Red Hat Inc.
004    //
005    // FRYSK is free software; you can redistribute it and/or modify it
006    // under the terms of the GNU General Public License as published by
007    // the Free Software Foundation; version 2 of the License.
008    //
009    // FRYSK is distributed in the hope that it will be useful, but
010    // WITHOUT ANY WARRANTY; without even the implied warranty of
011    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012    // General Public License for more details.
013    //
014    // You should have received a copy of the GNU General Public License
015    // along with FRYSK; if not, write to the Free Software Foundation,
016    // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
017    //
018    // In addition, as a special exception, Red Hat, Inc. gives You the
019    // additional right to link the code of FRYSK with code not covered
020    // under the GNU General Public License ("Non-GPL Code") and to
021    // distribute linked combinations including the two, subject to the
022    // limitations in this paragraph. Non-GPL Code permitted under this
023    // exception must only link to the code of FRYSK through those well
024    // defined interfaces identified in the file named EXCEPTION found in
025    // the source code files (the "Approved Interfaces"). The files of
026    // Non-GPL Code may instantiate templates or use macros or inline
027    // functions from the Approved Interfaces without causing the
028    // resulting work to be covered by the GNU General Public
029    // License. Only Red Hat, Inc. may make changes or additions to the
030    // list of Approved Interfaces. You must obey the GNU General Public
031    // License in all respects for all of the FRYSK code and other code
032    // used in conjunction with FRYSK except the Non-GPL Code covered by
033    // this exception. If you modify this file, you may extend this
034    // exception to your version of the file, but you are not obligated to
035    // do so. If you do not wish to provide this exception without
036    // modification, you must delete this exception statement from your
037    // version and license this file solely under the GPL without
038    // exception.
039    
040    package frysk.debuginfo;
041    
042    import frysk.stack.PrintStackOptions;
043    
044    public class PrintDebugInfoStackOptions extends PrintStackOptions {
045    
046        public PrintDebugInfoStackOptions() {
047            // Note, the super calls clear.
048        }
049        
050        private boolean printParameters;
051        private boolean printLocals;
052        private boolean printInlineFunctions;
053        private boolean printDebugNames;
054        private boolean printValues;
055        private boolean printSourcePaths;
056        
057        /**
058         * Clear all options.
059         */
060        public void clear() {
061            super.clear();
062            printParameters = false;
063            printLocals = false;
064            printInlineFunctions = false;
065            printDebugNames = false;
066            printValues = false;
067        }
068    
069        /**
070         * Set things up for a light-weight, or low-cost, back-trace by
071         * limiting things to just the elf information.
072         */
073        public void setLite() {
074            setAbi();
075            setPrintDebugNames(true);
076        }
077    
078        /**
079         * Set things up for a rich, or detailed, back-trace by including
080         * inline frames and parameter information.
081         */
082        public void setRich() {
083            setAbi();
084            setPrintParameters(true);
085            setPrintInlineFunctions(true);
086            setPrintDebugNames(true);
087        }
088    
089        /**
090         * Print the full path to any source file.
091         */
092        public void setPrintPaths(boolean printPaths) {
093            super.setPrintPaths(printPaths);
094            setPrintSourcePaths(printPaths);
095        }
096    
097        /**
098         * Print the parameter list (see also printValues).
099         */
100        public boolean printParameters() {
101            return printParameters;
102        }
103        public void setPrintParameters(boolean printParameters) {
104            this.printParameters = printParameters;
105        }
106    
107        /**
108         * Print paramter and variable values (rather than just their
109         * names).
110         */
111        public boolean printValues() {
112            return printValues;
113        }
114        public void setPrintValues(boolean printValues) {
115            this.printValues = printValues;
116        }
117    
118        /**
119         * Print the function's local variables.
120         */
121        public boolean printLocals() {
122            return printLocals;
123        }
124        public void setPrintLocals(boolean printLocals) {
125            this.printLocals = printLocals;
126        }
127    
128        /**
129         * Print inline function instances.
130         */
131        public boolean printInlineFunctions() {
132            return printInlineFunctions;
133        }
134        public void setPrintInlineFunctions(boolean printInlineFunctions) {
135            this.printInlineFunctions = printInlineFunctions;
136        }
137    
138        /**
139         * Print function and variable names using debug, rather than ABI,
140         * information.
141         */
142        public boolean printDebugNames() {
143            return printDebugNames;
144        }
145        public void setPrintDebugNames(boolean printDebugNames) {
146            this.printDebugNames = printDebugNames;
147        }
148    
149        /**
150         * Print the full path to source files (instead of just the file
151         * name).
152         */
153        public boolean printSourcePaths() {
154            return printSourcePaths;
155        }
156        public void setPrintSourcePaths(boolean printSourcePaths) {
157            this.printSourcePaths = printSourcePaths;
158        }
159    
160        public boolean abiOnly() {
161            return ! (printLocals
162                      || printInlineFunctions
163                      || printParameters
164                      || printValues
165                      || printDebugNames);
166        }
167    }