Changeset 9929 in webkit for trunk/JavaScriptCore/kjs/debugger.cpp
- Timestamp:
- Jul 27, 2005, 4:10:48 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/debugger.cpp
r9768 r9929 37 37 { 38 38 public: 39 AttachedInterpreter(Interpreter *i) : interp(i) {} 39 AttachedInterpreter(Interpreter *i, AttachedInterpreter *ai) : interp(i), next(ai) { ++Debugger::debuggersPresent; } 40 ~AttachedInterpreter() { --Debugger::debuggersPresent; } 40 41 Interpreter *interp; 41 42 AttachedInterpreter *next; … … 43 44 44 45 } 46 47 int Debugger::debuggersPresent = 0; 45 48 46 49 Debugger::Debugger() … … 51 54 Debugger::~Debugger() 52 55 { 53 // detach from all interpreters 54 while (rep->interps) 55 detach(rep->interps->interp); 56 56 detach(0); 57 57 delete rep; 58 58 } … … 60 60 void Debugger::attach(Interpreter *interp) 61 61 { 62 if (interp->imp()->debugger() != this) 63 interp->imp()->setDebugger(this); 64 65 // add to the list of attached interpreters 66 if (!rep->interps) 67 rep->interps = new AttachedInterpreter(interp); 68 else { 69 AttachedInterpreter *ai = rep->interps; 70 while (ai->next) 71 ai = ai->next; 72 ai->next = new AttachedInterpreter(interp);; 73 } 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); 74 69 } 75 70 76 71 void Debugger::detach(Interpreter *interp) 77 72 { 78 if (interp ->imp()->debugger() == this)79 interp->imp()->setDebugger( this);73 if (interp && interp->imp()->debugger() == this) 74 interp->imp()->setDebugger(0); 80 75 81 // remove from the list of attached interpreters 82 if (rep->interps->interp == interp) { 83 AttachedInterpreter *old = rep->interps; 84 rep->interps = rep->interps->next; 85 delete old; 86 } 87 88 AttachedInterpreter *ai = rep->interps; 89 while (ai->next && ai->next->interp != interp) 90 ai = ai->next; 91 if (ai->next) { 92 AttachedInterpreter *old = ai->next; 93 ai->next = ai->next->next; 94 delete old; 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 } 95 87 } 96 88 } 97 89 98 bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, 99 90 bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, const UString &/*sourceURL*/, 91 const UString &/*source*/, int /*errorLine*/) 100 92 { 101 93 return true;
Note:
See TracChangeset
for help on using the changeset viewer.