Javascript execution trace file
Koos Vriezen
koos.vriezen at xs4all.nl
Mon May 27 23:24:34 BST 2002
On Mon, 27 May 2002, David Joham wrote:
>
> I tried that, but what happens after I uncomment the KJS_DEBUGGER and
> recompile? I didn't see a log file or any different behavior from Konq.
> Did I miss something?
I didn't say it was just recompiling with -DKJS_DEBUGGER, just suggesting
were I would look first.
Anyway, if you want to see a lot of debug traces, try the attached patch.
Expect to see a Segmentation fault at the end.
Koos
>
> Thanks for your reply.
>
> David
>
> --- Koos Vriezen <koos.vriezen at xs4all.nl> wrote:
> > On Mon, 27 May 2002, David Joham wrote:
> > >
> > > I'm wondering if it would be (is?) possible for Konqueror to spit
> > out
> > > to a file each exact line of javascript that it is executing. This
> > > execution file would theoretically create a large recreation for
> > me.
> > > What I would do afterwards would be to take the file and pare it
> > down
> > > to build a recreation that's useful to developers in fixing the
> > > problem.
> > >
> > > In order to be really helpful, modification of CSS properties via
> > > javascript would have to be logged as well.
> > >
> > > Is there an easy way to do this or to add it to Konq?
> >
> > I think the '#ifdef KJS_DEBUGGER' are the places for this.
> >
> > BTW, I always wondered what the '#warning TODO port the debugger'
> > message
> > meant. Was it usable before qt3?
> >
> > Regards,
> >
> > Koos Vriezen
> >
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
-------------- next part --------------
Index: khtml/ecma/kjs_proxy.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_proxy.cpp,v
retrieving revision 1.74
diff -u -3 -p -r1.74 kjs_proxy.cpp
--- khtml/ecma/kjs_proxy.cpp 2002/04/26 16:04:49 1.74
+++ khtml/ecma/kjs_proxy.cpp 2002/05/27 22:02:22
@@ -23,6 +23,7 @@
#include "kjs_window.h"
#include "kjs_events.h"
+#include "../../kjs/debugger.h"
#include <khtml_part.h>
#include <kprotocolmanager.h>
#include <kdebug.h>
@@ -33,7 +34,7 @@ extern "C" {
KJSProxy *kjs_html_init(KHTMLPart *khtmlpart);
}
-class KJSProxyImpl : public KJSProxy {
+class KJSProxyImpl : public KJSProxy, KJS::Debugger {
public:
KJSProxyImpl(KHTMLPart *part);
virtual ~KJSProxyImpl();
@@ -48,6 +49,31 @@ public:
virtual void setSourceFile(QString url, QString code);
virtual void appendSourceFile(QString url, QString code);
+ virtual bool sourceParsed(ExecState *, int sourceId,
+ const UString &source, int) {
+ kdDebug(6070) << sourceId << ":" << source.qstring() << endl;
+ return true;
+ }
+ virtual bool exception(ExecState *exec, int sourceId, int lineno,
+ Object &ex) {
+ kdDebug(6070) << sourceId << "(" << lineno << "): " << ex.toString(exec).qstring() << endl;
+ return true;
+ }
+ virtual bool atStatement(ExecState *, int sourceId, int firstLine,
+ int lastLine) {
+ kdDebug(6070) << sourceId << " at:" << firstLine << "-" << lastLine << endl;
+ return true;
+ };
+ virtual bool callEvent(ExecState *exec, int sourceId, int lineno,
+ Object &function, const List &args) {
+ kdDebug(6070) << sourceId << "(" << lineno << "): " << function.toString(exec).qstring() << endl;
+ return true;
+ }
+ virtual bool returnEvent(ExecState *exec, int sourceId, int lineno,
+ Object &function) {
+ kdDebug(6070) << sourceId << "(" << lineno << "): " << function.toString(exec).qstring() << endl;
+ return true;
+ }
void initScript();
private:
@@ -75,6 +101,8 @@ KJSProxyImpl::KJSProxyImpl(KHTMLPart *pa
KJSProxyImpl::~KJSProxyImpl()
{
//kdDebug() << "KJSProxyImpl::~KJSProxyImpl deleting interpreter " << m_script << endl;
+ if (m_script)
+ detach(m_script);
delete m_script;
#ifndef NDEBUG
s_count--;
@@ -266,7 +294,7 @@ void KJSProxyImpl::initScript()
// Create a KJS interpreter for this part
m_script = new KJS::ScriptInterpreter(globalObject, m_part);
-
+ attach(m_script);
#ifdef KJS_DEBUGGER
m_script->setDebuggingEnabled(m_debugEnabled);
#endif
Index: kjs/debugger.cpp
===================================================================
RCS file: /home/kde/kdelibs/kjs/debugger.cpp,v
retrieving revision 1.11
diff -u -3 -p -r1.11 debugger.cpp
--- kjs/debugger.cpp 2001/10/29 15:05:27 1.11
+++ kjs/debugger.cpp 2002/05/27 22:20:36
@@ -77,7 +77,7 @@ void Debugger::attach(Interpreter *inter
void Debugger::detach(Interpreter *interp)
{
if (interp->imp()->debugger() == this)
- interp->imp()->setDebugger(this);
+ interp->imp()->setDebugger(0L);
// remove from the list of attached interpreters
if (rep->interps->interp == interp) {
Index: kjs/internal.cpp
===================================================================
RCS file: /home/kde/kdelibs/kjs/internal.cpp,v
retrieving revision 1.125
diff -u -3 -p -r1.125 internal.cpp
--- kjs/internal.cpp 2002/04/26 16:06:45 1.125
+++ kjs/internal.cpp 2002/05/27 22:20:36
@@ -1031,8 +1031,8 @@ Completion InterpreterImp::evaluate(cons
void InterpreterImp::setDebugger(Debugger *d)
{
- if (d)
- d->detach(m_interpreter);
+ if (dbg)
+ dbg->detach(m_interpreter);
dbg = d;
}
More information about the kfm-devel
mailing list