@@ -93,7 +93,7 @@ web_exec.py - example CGI script for deploying backend on CGI-enabled webservers
9393
9494The backend works with both Python 2 and 3.
9595
96- ## Hacking on the backend
96+ ## Hacking the backend
9797
9898To modify the backend, you will mainly need to understand ` pg_logger.py ` and ` pg_encoder.py ` .
9999
@@ -205,7 +205,10 @@ It executes the contents of `script_str` in a modified global environment (`user
205205Ok, the debugger has just started executing the program that the user passed in (from ` example.py ` in our example).
206206What happens now? Here's where the magic happens. Look at the methods called
207207` user_call ` , ` user_return ` , ` user_exception ` , and ` user_line ` . Again, those are all
208- [ inherited from bdb.Bdb] ( http://docs.python.org/library/bdb.html#bdb ) . As the user's program is running, bdb
208+ [ inherited from bdb.Bdb] ( http://docs.python.org/library/bdb.html#bdb.Bdb ) ;
209+ take a minute to read up on what they're supposed to do.
210+
211+ As the user's program is running, bdb
209212will pause execution at every function call, return, exception, and single-step and transfer control
210213over to the respective handler methods. Since ` PGLogger ` overrides those methods, it can hijack control at
211214crucial points during program execution to do what it needs to do.
@@ -225,3 +228,12 @@ entry is created. At the end of execution, `self.trace` contains as many trace e
225228in the user's program execution.
226229(To guard against infinite loops, ` PGLogger ` terminates execution when ` MAX_EXECUTED_LINES ` steps have been executed.)
227230
231+ ### Execution Trace Format
232+
233+ A lot of complicated stuff happens within ` interaction ` to grab a snapshot of the execution state and encode
234+ it into an execution trace entry. I've written up a separate document describing the exact format of an execution trace:
235+
236+
237+ ## Hacking the frontend
238+
239+ (TODO: write me sometime!)
0 commit comments