Last Comment Bug 386997 - Need to support 'debugger' statement
: Need to support 'debugger' statement
Status: RESOLVED FIXED
:
Product: Rhino
Classification: Components
Component: Core (show other bugs)
: other
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-05 10:17 PDT by Bob Jervis
Modified: 2007-07-12 08:16 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Partal patch for 'debugger' statement. (5.33 KB, patch)
2007-07-05 10:22 PDT, Bob Jervis
no flags Details | Diff | Review
Full patch implementing 'debugger' statement (6.78 KB, patch)
2007-07-10 17:09 PDT, Bob Jervis
no flags Details | Diff | Review

Description Bob Jervis 2007-07-05 10:17:56 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: 

The 'debugger' statement is a useful debugging tool.  We should recognize it in user source and do something useful in a JavaScript debugger.

Reproducible: Always

Steps to Reproduce:
1. Take any working script and add 'debugger;' as a statement
2.
3.
Actual Results:  
Parse error

Expected Results:  
Normal execution (with 'debugger' behaving like a no-op).  A debugger should stop and report a breakpoint hit or some equivalent message.
Comment 1 Bob Jervis 2007-07-05 10:22:01 PDT
Created attachment 271087 [details] [diff] [review]
Partal patch for 'debugger' statement.

This is a partial patch.  It parses the 'debugger' statement and inserts a bytecode for it in the interpreted code path (and does nothing in the compiled path).  I have sent mail to Norris to get his opinion on how we should plumb this through to the DebugFrame interface.
Comment 2 Bob Jervis 2007-07-10 17:09:45 PDT
Created attachment 271769 [details] [diff] [review]
Full patch implementing 'debugger' statement

This revises the debugger support to include actual hitting of breakpoints within the debugger itself.
Comment 3 Norris Boyd 2007-07-12 08:16:39 PDT
Checked in proposed patch: 

Checking in src/org/mozilla/javascript/IRFactory.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/IRFactory.java,v  <--  IRFactory.java
new revision: 1.107; previous revision: 1.106
done
Checking in src/org/mozilla/javascript/Interpreter.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Interpreter.java,v  <--  Interpreter.java
new revision: 1.328; previous revision: 1.327
done
Checking in src/org/mozilla/javascript/Parser.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Parser.java,v  <--  Parser.java
new revision: 1.117; previous revision: 1.116
done
Checking in src/org/mozilla/javascript/Token.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Token.java,v  <--  Token.java
new revision: 1.41; previous revision: 1.40
done
Checking in src/org/mozilla/javascript/TokenStream.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/TokenStream.java,v  <--  TokenStream.java
new revision: 1.68; previous revision: 1.67
done
Checking in src/org/mozilla/javascript/debug/DebugFrame.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/debug/DebugFrame.java,v  <--  DebugFrame.java
new revision: 1.10; previous revision: 1.9
done
Checking in src/org/mozilla/javascript/optimizer/Codegen.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v  <--  Codegen.java
new revision: 1.249; previous revision: 1.248
done
Checking in toolsrc/org/mozilla/javascript/tools/debugger/Dim.java;
/cvsroot/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/Dim.java,v  <--  Dim.java
new revision: 1.13; previous revision: 1.12
done

Note You need to log in before you can comment on or make changes to this bug.