what functions a Python program is running. It's particularly useful
to debug weird issues on production.
-For example, let's debugging a non-trivial program, the Python SimpleHTTPServer.
+For example, let's debug a non-trivial program, the Python SimpleHTTPServer.
First, let's run the server:
```
Now let's connect lptrace to it:
```
-vagrant@precise32:/vagrant$ sudo python ttrace.py -p 1818
+vagrant@precise32:/vagrant$ sudo python lptrace.py -p 1818
...
fileno (/usr/lib/python2.7/SocketServer.py:438)
meth (/usr/lib/python2.7/socket.py:223)
You can see that the server is handling the request in real time! After pressing Ctrl-C, the trace is removed and the program
execution resumes normally.
+# How it works
+
+gdb is an awesome debugger. It lets you attach to any running program, as long as you're root. It
+also lets you call any C function this program exposes.
+
+What's interesting is that among the C functions the Python interpreter exposes,
+one function `PyRun\_SimpleString`, lets you run a single expression of Python code.
+
+We use this function to ask the Python process to read a temporary file `lptrace` created. This file
+contains a hook to the `sys.settrace` function, which allows us to get notified whenever a function is
+called.
+
+Finally, we need to output the tracing data somewhere. We could do this in the program we're tracing
+but that wouldn't be very useful. Instead, we write it to a FIFO so that `lptrace` can display it in
+its own window.
+
+That's about it. I encourage you to read the source --- it's short and pretty simple!
+
# Running lptrace
lptrace was written to be run on production servers. Because of this,
lptrace requires Python 2.x and GDB 7.x. It has been tested on Linux
successfully, and it should run on most recent Unices.
-# Technical details
-
-gdb is an awesome debugger. It lets you attach to any running program, as long as you're root. It
-also lets you call any C function this program exposes.
-
-What's interesting is that among the C functions the Python interpreter exposes,
-one function `PyRun\_SimpleString`, lets you run a single expression of Python code.
-
-We use this function to ask the Python process to read a temporary file `lptrace` created. This file
-contains a hook to the `sys.settrace` function, which allows us to get notified whenever a function is
-called.
-
-Finally, we need to output the tracing data somewhere. We could do this in the program we're tracing
-but that wouldn't be very useful. Instead, we write it to a FIFO so that `lptrace` can display it in
-its own window.
-
-That's about it. I encourage you to read the source --- it's short and pretty simple!
-
# Issues
Please open a ticket [here](https://github.com/khamidou/lptrace/issues)