X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/ab403787c2b0a4850b1c7791bb7dc190ef83b35c..refs/heads/master:/testprogs/visopts.py diff --git a/testprogs/visopts.py b/testprogs/visopts.py index ef316c60..f7df45a5 100755 --- a/testprogs/visopts.py +++ b/testprogs/visopts.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ -This program parse the output from pcap_compile() to visualize the CFG after +This program parses the output from pcap_compile() to visualize the CFG after each optimize phase. Usage guide: -1. Enable optimizier debugging code when configure libpcap, +1. Enable optimizer debugging code when configure libpcap, and build libpcap & the test programs ./configure --enable-optimizer-dbg make @@ -15,34 +15,33 @@ Usage guide: testprogs/filtertest -g EN10MB host 192.168.1.1 > a.txt 3. Send a.txt to this program's standard input cat a.txt | testprogs/visopts.py + (Graphviz must be installed) 4. Step 2&3 can be merged: testprogs/filtertest -g EN10MB host 192.168.1.1 | testprogs/visopts.py 5. The standard output is something like this: generated files under directory: /tmp/visopts-W9ekBw the directory will be removed when this programs finished. open this link: http://localhost:39062/expr1.html -6. Using open link at the 3rd line `http://localhost:39062/expr1.html' +6. Open the URL at the 3rd line in a browser. Note: -1. The CFG is translated to SVG an document, expr1.html embeded them as external - document. If you open expr1.html as local file using file:// protocol, some - browsers will deny such requests so the web pages will not shown properly. - For chrome, you can run it using following command to avoid this: +1. The CFG is translated to SVG images, expr1.html embeds them as external + documents. If you open expr1.html as local file using file:// protocol, some + browsers will deny such requests so the web page will not work properly. + For Chrome, you can run it using the following command to avoid this: chromium --disable-web-security - That's why this program start a localhost http server. -2. expr1.html use jquery from https://ajax.googleapis.com, so you need internet - access to show the web page. + That's why this program starts a localhost HTTP server. +2. expr1.html uses jQuery from https://ajax.googleapis.com, so it needs Internet + access to work. """ import sys, os import string -import subprocess -import json html_template = string.Template("""
-