2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is the Sablotron XSLT Processor.
14 * The Initial Developer of the Original Code is Ginger Alliance Ltd.
15 * Portions created by Ginger Alliance are Copyright (C) 2000-2002
16 * Ginger Alliance Ltd. All Rights Reserved.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU General Public License Version 2 or later (the
22 * "GPL"), in which case the provisions of the GPL are applicable
23 * instead of those above. If you wish to allow use of your
24 * version of this file only under the terms of the GPL and not to
25 * allow others to use your version of this file under the MPL,
26 * indicate your decision by deleting the provisions above and
27 * replace them with the notice and other provisions required by
28 * the GPL. If you do not delete the provisions above, a recipient
29 * may use your version of this file under either the MPL or the
40 #ifdef SABLOT_DEBUGGER
53 class ArgList: public PList<Str*> {};
57 Breakpoint(): line(-1), enabled(true),
58 valid(false), element(NULL), expr(NULL), ignoreNum(0),
59 hitTotal(0), hitEnabled(0), hitMatched(0), hitBreak(0) {};
62 Bool buildExpression(Sit);
63 Bool matches(Sit S, Context* c, Bool& wasError);
64 Bool countMatches(Sit S, Context* c, Bool& wasError);
82 class BPList: public PList<Breakpoint*> {
84 ~BPList() { freeall(FALSE); };
85 Breakpoint* setBP(Str& uri, int line);
86 Breakpoint* getBP(Str& uri, int line);
87 Bool clearBP(int idx, Bool running);
88 Bool disableBP(int idx);
92 void getLinesForURI(Str& uri, List<int>& lines);
94 Bool ignore(long int idx, long int num);
95 Bool setExpression(Sit, int, ArgList&, Bool);
132 struct DbgCommandDescription {
136 Bool joinRest; //take rest params as one
137 Bool strict; //prevent ambiguous abbreviations
146 Bool isRunning() { return running; };
147 Bool outputActive() {return output; };
149 eFlag prompt(Sit S, Element *e, Context *c, Bool& quited);
150 eFlag breakOnElement(Sit S, Element *e, Context *c);
151 void setBreakpoints(Sit S, Tree*);
152 void printOutput(const char* buff, int size);
154 eFlag doCommand(Sit S, Element *e, Context *c, char* line, Bool&, Bool&);
155 void reportTrace(const char* msg, Str& uri, int line, Element *e);
156 Bool elementBreakable(Sit S, Element *e, Context *c, Bool report);
157 Bool tokenize(char* what, ArgList &where, DbgCommandDescription& desc);
158 Bool lookupArg(Str &str, char** lst, int &op);
159 Bool lookupCommand(Str& str, DbgCommandDescription& out);
160 const char* nodeTypeName(Vertex *v);
161 void listNode(Sit S, NodeHandle node, Bool detailed);
162 void listContext(Sit S, Element *e, Context *c, ArgList &args);
163 void setBreakpoint(Sit S, Element *e, ArgList& args);
164 void doSetBreakpoint(Str& uri, int line);
165 void setBreakpointsOnElement(Sit S, Element *e);
166 Bool findElementForBreakpoint(Element *e, Breakpoint* bp);
167 Bool setBreakpointRunning(Breakpoint *bp);
171 void reportError(const char* msg, Bool details);
172 void eval(Sit S, Context *c, Element *e, ArgList& args);
173 void playBatch(Sit S, Element *e, Context *c, Str& file);
175 void addParam(ArgList& args);
176 void report(Sit S, MsgType type, MsgCode code,
177 const Str& arg1, const Str& arg2) const;
178 Bool checkArgs(DbgCommandDescription& desc, ArgList& args);
179 static MH_ERROR mhMakeCode(void *userData, SablotHandle processor_,
180 int severity, unsigned short facility,
181 unsigned short code);
182 static MH_ERROR mhLog(void *userData, SablotHandle processor_,
183 MH_ERROR code, MH_LEVEL level, char **fields);
184 static MH_ERROR mhError(void *userData, SablotHandle processor_,
185 MH_ERROR code, MH_LEVEL level,
198 MessageHandler msgHandler;
201 SubtreeInfo *currentInfo; //used for bp setting
202 List<int> currentLines; //used for bp setting
210 extern Debugger* debugger;
212 #endif //SABLOT_DEBUGGER
213 #endif //DebuggerHIncl