]> khamidou — GitHub mirrors - lptrace.git/commitdiff
Make README clearer. 1.0.0
authorKarim Hamidou <khamidou@gmail.com>
Thu, 20 Oct 2016 13:27:46 +0000 (06:27 -0700)
committerKarim Hamidou <khamidou@gmail.com>
Thu, 20 Oct 2016 13:27:46 +0000 (06:27 -0700)
README.md

index 4172a8a686739f6e0f07e2c4e4f7a37014f0c411..bc9cd0e8b3a6c7c05a3f6d2fa7750ec68c8a1bb5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ lptrace is strace for Python programs. It lets you see in real-time
 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:
 
 ```
@@ -16,7 +16,7 @@ vagrant@precise32:/vagrant$ Serving HTTP on 0.0.0.0 port 8080 ...
 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)
@@ -46,6 +46,24 @@ vagrant@precise32:/vagrant$
 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,
@@ -74,24 +92,6 @@ sudo python lptrace -p <process_id> -d
 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)