Changeset 35037 in webkit for trunk/JavaScriptCore/kjs/debugger.h
- Timestamp:
- Jul 7, 2008, 9:01:06 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/debugger.h
r34587 r35037 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 * This file is part of the KDE libraries4 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 5 3 * Copyright (C) 2001 Peter Kelly ([email protected]) 4 * Copyright (C) 2008 Apple Inc. All rights reserved. 6 5 * 7 6 * This library is free software; you can redistribute it and/or … … 24 23 #define Debugger_h 25 24 25 #include "protect.h" 26 26 #include <wtf/HashSet.h> 27 #include "protect.h"28 27 29 28 namespace KJS { 30 29 31 class DebuggerCallFrame; 32 class ExecState; 33 class JSGlobalObject; 34 class JSObject; 35 class JSValue; 36 class ArgList; 37 class SourceProvider; 38 class UString; 39 40 /** 41 * @internal 42 * 43 * Provides an interface which receives notification about various 44 * script-execution related events such as statement execution and function 45 * calls. 46 */ 47 class Debugger { 48 public: 30 class ArgList; 31 class DebuggerCallFrame; 32 class ExecState; 33 class JSGlobalObject; 34 class JSObject; 35 class JSValue; 36 class SourceProvider; 37 class UString; 49 38 50 /**51 * Creates a new debugger52 */53 Debugger();39 class Debugger { 40 public: 41 Debugger(); 42 virtual ~Debugger(); 54 43 55 /** 56 * Destroys the debugger. If the debugger is attached to any global objects, 57 * it is automatically detached. 58 */ 59 virtual ~Debugger(); 44 void attach(JSGlobalObject*); 45 void detach(JSGlobalObject*); 60 46 61 /** 62 * Attaches the debugger to specified global object. This will cause this 63 * object to receive notification of events during execution. 64 * 65 * If the global object is deleted, it will detach the debugger. 66 * 67 * Note: only one debugger can be attached to a global object at a time. 68 * Attaching another debugger to the same global object will cause the 69 * original debugger to be detached. 70 * 71 * @param The global object to attach to. 72 */ 73 void attach(JSGlobalObject*); 47 virtual void sourceParsed(ExecState*, int sourceId, const UString& sourceURL, 48 const SourceProvider& source, int startingLineNumber, int errorLine, const UString& errorMsg) = 0; 49 virtual void exception(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 50 virtual void atStatement(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 51 virtual void callEvent(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 52 virtual void returnEvent(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 74 53 75 /** 76 * Detach the debugger from a global object. 77 * 78 * @param The global object to detach from. 79 */ 80 void detach(JSGlobalObject*); 54 virtual void willExecuteProgram(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 55 virtual void didExecuteProgram(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 56 virtual void didReachBreakpoint(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 81 57 82 /** 83 * Called to notify the debugger that some javascript source code has 84 * been parsed. For calls to Interpreter::evaluate(), this will be called 85 * with the supplied source code before any other code is parsed. 86 * Other situations in which this may be called include creation of a 87 * function using the Function() constructor, or the eval() function. 88 * 89 * The default implementation does nothing. Override this method if 90 * you want to process this event. 91 * 92 * @param exec The current execution state 93 * @param sourceId The ID of the source code (corresponds to the 94 * sourceId supplied in other functions such as atStatement() 95 * @param sourceURL Where the source code that was parsed came from 96 * @param source The source code that was parsed 97 * @param startingLineNumber The line number at which parsing started 98 * @param errorLine The line number at which parsing encountered an 99 * error, or -1 if the source code was valid and parsed successfully 100 * @param errorMsg The error description, or null if the source code 101 was valid and parsed successfully 102 */ 103 virtual void sourceParsed(ExecState*, int sourceId, const UString& sourceURL, 104 const SourceProvider& source, int startingLineNumber, int errorLine, const UString& errorMsg) = 0; 105 106 /** 107 * Called when an exception is thrown during script execution. 108 * 109 * The default implementation does nothing. Override this method if 110 * you want to process this event. 111 * 112 * @param exec The current execution state 113 * @param sourceId The ID of the source code being executed 114 * @param lineno The line at which the error occurred 115 * @param exceptionObj The exception object 116 */ 117 virtual void exception(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 118 119 /** 120 * Called when a line of the script is reached (before it is executed) 121 * 122 * The default implementation does nothing. Override this method if 123 * you want to process this event. 124 * 125 * @param exec The current execution state 126 * @param sourceId The ID of the source code being executed 127 * @param firstLine The starting line of the statement that is about to be 128 * executed 129 * @param lastLine The ending line of the statement that is about to be 130 * executed (usually the same as firstLine) 131 */ 132 virtual void atStatement(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 133 /** 134 * Called on each function call. Use together with @ref #returnEvent 135 * if you want to keep track of the call stack. 136 * 137 * Note: This only gets called for functions that are declared in ECMAScript 138 * source code or passed to eval(), not for internal KJS or 139 * application-supplied functions. 140 * 141 * The default implementation does nothing. Override this method if 142 * you want to process this event. 143 * 144 * @param exec The current execution state 145 * @param sourceId The ID of the source code being executed 146 * @param lineno The line that is about to be executed 147 */ 148 virtual void callEvent(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 149 150 /** 151 * Called on each function exit. The function being returned from is that 152 * which was supplied in the last callEvent(). 153 * 154 * Note: This only gets called for functions that are declared in ECMAScript 155 * source code or passed to eval(), not for internal KJS or 156 * application-supplied functions. 157 * 158 * The default implementation does nothing. Override this method if 159 * you want to process this event. 160 * 161 * @param exec The current execution state 162 * @param sourceId The ID of the source code being executed 163 * @param lineno The line that is about to be executed 164 */ 165 virtual void returnEvent(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 166 167 virtual void willExecuteProgram(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 168 virtual void didExecuteProgram(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 169 virtual void didReachBreakpoint(const DebuggerCallFrame&, int sourceId, int lineno) = 0; 170 171 private: 172 HashSet<JSGlobalObject*> m_globalObjects; 173 }; 58 private: 59 HashSet<JSGlobalObject*> m_globalObjects; 60 }; 174 61 175 62 } // namespace KJS 176 63 177 #endif 64 #endif // Debugger_h
Note:
See TracChangeset
for help on using the changeset viewer.