1/*
2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
4 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#ifndef Debugger_h
23#define Debugger_h
24
25#include <debugger/DebuggerCallFrame.h>
26#include <wtf/HashSet.h>
27
28namespace JSC {
29
30 class ExecState;
31 class JSGlobalData;
32 class JSGlobalObject;
33 class JSValue;
34 class SourceCode;
35 class UString;
36
37 class Debugger {
38 public:
39 virtual ~Debugger();
40
41 void attach(JSGlobalObject*);
42 virtual void detach(JSGlobalObject*);
43
44#if PLATFORM(QT)
45#ifdef QT_BUILD_SCRIPT_LIB
46 virtual void scriptUnload(QT_PREPEND_NAMESPACE(qint64) id)
47 {
48 UNUSED_PARAM(id);
49 };
50 virtual void scriptLoad(QT_PREPEND_NAMESPACE(qint64) id, const UString &program,
51 const UString &fileName, int baseLineNumber)
52 {
53 UNUSED_PARAM(id);
54 UNUSED_PARAM(program);
55 UNUSED_PARAM(fileName);
56 UNUSED_PARAM(baseLineNumber);
57 };
58 virtual void contextPush() {};
59 virtual void contextPop() {};
60
61 virtual void evaluateStart(intptr_t sourceID)
62 {
63 UNUSED_PARAM(sourceID);
64 }
65 virtual void evaluateStop(const JSC::JSValue& returnValue, intptr_t sourceID)
66 {
67 UNUSED_PARAM(sourceID);
68 UNUSED_PARAM(returnValue);
69 }
70
71 virtual void exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler)
72 {
73 UNUSED_PARAM(frame);
74 UNUSED_PARAM(sourceID);
75 UNUSED_PARAM(hasHandler);
76 };
77 virtual void exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID)
78 {
79 UNUSED_PARAM(frame);
80 UNUSED_PARAM(sourceID);
81 };
82
83 virtual void functionExit(const JSC::JSValue& returnValue, intptr_t sourceID)
84 {
85 UNUSED_PARAM(returnValue);
86 UNUSED_PARAM(sourceID);
87 };
88#endif
89#endif
90
91 virtual void sourceParsed(ExecState*, const SourceCode&, int errorLineNumber, const UString& errorMessage) = 0;
92 virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler) = 0;
93 virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
94 virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
95 virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
96
97 virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
98 virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
99 virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
100
101 void recompileAllJSFunctions(JSGlobalData*);
102
103 private:
104 HashSet<JSGlobalObject*> m_globalObjects;
105 };
106
107 // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
108 JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
109
110} // namespace JSC
111
112#endif // Debugger_h
113

source code of qtscript/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h