source:
webkit/trunk/JavaScriptCore/kjs/debugger.cpp@
10563
Last change on this file since 10563 was 10084, checked in by darin, 20 years ago | |
---|---|
WebCore:
|
|
|
|
File size: 3.2 KB |
Line | |
---|---|
1 | // -*- c-basic-offset: 2 -*- |
2 | /* |
3 | * This file is part of the KDE libraries |
4 | * Copyright (C) 1999-2001 Harri Porten ([email protected]) |
5 | * Copyright (C) 2001 Peter Kelly ([email protected]) |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301 USA |
20 | * |
21 | */ |
22 | |
23 | #include "debugger.h" |
24 | #include "value.h" |
25 | #include "object.h" |
26 | #include "types.h" |
27 | #include "interpreter.h" |
28 | #include "internal.h" |
29 | #include "ustring.h" |
30 | |
31 | using namespace KJS; |
32 | |
33 | // ------------------------------ Debugger ------------------------------------- |
34 | |
35 | namespace KJS { |
36 | struct AttachedInterpreter |
37 | { |
38 | public: |
39 | AttachedInterpreter(Interpreter *i, AttachedInterpreter *ai) : interp(i), next(ai) { ++Debugger::debuggersPresent; } |
40 | ~AttachedInterpreter() { --Debugger::debuggersPresent; } |
41 | Interpreter *interp; |
42 | AttachedInterpreter *next; |
43 | }; |
44 | |
45 | } |
46 | |
47 | int Debugger::debuggersPresent = 0; |
48 | |
49 | Debugger::Debugger() |
50 | { |
51 | rep = new DebuggerImp(); |
52 | } |
53 | |
54 | Debugger::~Debugger() |
55 | { |
56 | detach(0); |
57 | delete rep; |
58 | } |
59 | |
60 | void Debugger::attach(Interpreter *interp) |
61 | { |
62 | Debugger *other = interp->imp()->debugger(); |
63 | if (other == this) |
64 | return; |
65 | if (other) |
66 | other->detach(interp); |
67 | interp->imp()->setDebugger(this); |
68 | rep->interps = new AttachedInterpreter(interp, rep->interps); |
69 | } |
70 | |
71 | void Debugger::detach(Interpreter *interp) |
72 | { |
73 | if (interp && interp->imp()->debugger() == this) |
74 | interp->imp()->setDebugger(0); |
75 | |
76 | // iterate the addresses where AttachedInterpreter pointers are stored |
77 | // so we can unlink items from the list |
78 | AttachedInterpreter **p = &rep->interps; |
79 | AttachedInterpreter *q; |
80 | while ((q = *p)) { |
81 | if (!interp || q->interp == interp) { |
82 | *p = q->next; |
83 | delete q; |
84 | } else { |
85 | p = &q->next; |
86 | } |
87 | } |
88 | } |
89 | |
90 | bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, const UString &/*sourceURL*/, |
91 | const UString &/*source*/, int /*errorLine*/) |
92 | { |
93 | return true; |
94 | } |
95 | |
96 | bool Debugger::sourceUnused(ExecState */*exec*/, int /*sourceId*/) |
97 | { |
98 | return true; |
99 | } |
100 | |
101 | bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/, |
102 | ObjectImp */*exceptionObj*/) |
103 | { |
104 | return true; |
105 | } |
106 | |
107 | bool Debugger::atStatement(ExecState */*exec*/, int /*sourceId*/, int /*firstLine*/, |
108 | int /*lastLine*/) |
109 | { |
110 | return true; |
111 | } |
112 | |
113 | bool Debugger::callEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/, |
114 | ObjectImp */*function*/, const List &/*args*/) |
115 | { |
116 | return true; |
117 | } |
118 | |
119 | bool Debugger::returnEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/, |
120 | ObjectImp */*function*/) |
121 | { |
122 | return true; |
123 | } |
124 |
Note:
See TracBrowser
for help on using the repository browser.