source: webkit/trunk/JavaScriptCore/kjs/debugger.cpp@ 11962

Last change on this file since 11962 was 11962, checked in by thatcher, 19 years ago

Removes svn:keywords from all files.

  • Property svn:eol-style set to native
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 "config.h"
24#include "debugger.h"
25#include "value.h"
26#include "object.h"
27#include "types.h"
28#include "interpreter.h"
29#include "internal.h"
30#include "ustring.h"
31
32using namespace KJS;
33
34// ------------------------------ Debugger -------------------------------------
35
36namespace KJS {
37 struct AttachedInterpreter
38 {
39 public:
40 AttachedInterpreter(Interpreter *i, AttachedInterpreter *ai) : interp(i), next(ai) { ++Debugger::debuggersPresent; }
41 ~AttachedInterpreter() { --Debugger::debuggersPresent; }
42 Interpreter *interp;
43 AttachedInterpreter *next;
44 };
45
46}
47
48int Debugger::debuggersPresent = 0;
49
50Debugger::Debugger()
51{
52 rep = new DebuggerImp();
53}
54
55Debugger::~Debugger()
56{
57 detach(0);
58 delete rep;
59}
60
61void Debugger::attach(Interpreter *interp)
62{
63 Debugger *other = interp->imp()->debugger();
64 if (other == this)
65 return;
66 if (other)
67 other->detach(interp);
68 interp->imp()->setDebugger(this);
69 rep->interps = new AttachedInterpreter(interp, rep->interps);
70}
71
72void Debugger::detach(Interpreter *interp)
73{
74 if (interp && interp->imp()->debugger() == this)
75 interp->imp()->setDebugger(0);
76
77 // iterate the addresses where AttachedInterpreter pointers are stored
78 // so we can unlink items from the list
79 AttachedInterpreter **p = &rep->interps;
80 AttachedInterpreter *q;
81 while ((q = *p)) {
82 if (!interp || q->interp == interp) {
83 *p = q->next;
84 delete q;
85 } else {
86 p = &q->next;
87 }
88 }
89}
90
91bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, const UString &/*sourceURL*/,
92 const UString &/*source*/, int /*errorLine*/)
93{
94 return true;
95}
96
97bool Debugger::sourceUnused(ExecState */*exec*/, int /*sourceId*/)
98{
99 return true;
100}
101
102bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
103 JSObject */*exceptionObj*/)
104{
105 return true;
106}
107
108bool Debugger::atStatement(ExecState */*exec*/, int /*sourceId*/, int /*firstLine*/,
109 int /*lastLine*/)
110{
111 return true;
112}
113
114bool Debugger::callEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
115 JSObject */*function*/, const List &/*args*/)
116{
117 return true;
118}
119
120bool Debugger::returnEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
121 JSObject */*function*/)
122{
123 return true;
124}
125
Note: See TracBrowser for help on using the repository browser.