Ways to view Python's trace

Source: Internet
Author: User

Lptrace is essentially GDB-based, enters the process memory space, and executes a python command to print out the trace at the time.

Use tool: Https://github.com/khamidou/lptrace

1, Linux is very simple:

Installation

Yum Install GDB

Pip Install Lptrace

Use:

[email protected]:/vagrant$ python -m SimpleHTTPServer 8080 &[1] 1818[email protected]:/vagrant$ Serving HTTP on 0.0.0.0 port 8080 ...


[email protected]:/vagrant$ sudo python lptrace-p1818... Fileno (/usr/lib/python2.7/socketserver.py:438) Meth (/usr/lib/python2.7/socket.py:223) Fileno (/usr/lib/ python2.7/socketserver.py:438) Meth (/usr/lib/python2.7/socket.py:223) _handle_request_noblock (/usr/lib/python2.7 /socketserver.py:271) Get_request (/usr/lib/python2.7/socketserver.py:446) Accept (/usr/lib/python2.7/socket.py : 201) __init__ (/usr/lib/python2.7/socket.py:185) verify_request (/usr/lib/python2.7/socketserver.py:296) Process_ Request (/usr/lib/python2.7/socketserver.py:304) finish_request (/usr/lib/python2.7/socketserver.py:321) __init__ ( /usr/lib/python2.7/socketserver.py:632) Setup (/usr/lib/python2.7/socketserver.py:681) makefile (/usr/lib/ python2.7/socket.py:212) __init__ (/usr/lib/python2.7/socket.py:246) makefile (/usr/lib/python2.7/socket.py:212) __ init__ (/usr/lib/python2.7/socket.py:246) handle (/usr/lib/python2.7/basehttpserver.py:336) handle_one_request (/ usr/lib/python2.7/basehttpserver.py:301) ^creceived ctrl-c, quitting[email protected]:/vagrant$

You can see, the server is handling the request in real time! After pressing Ctrl-c, the trace was removed and the program execution resumes normally.

2, the Mac is a little complicated: The key I did not try to succeed

Setting method Reference: HTTP://WWW.JIANSHU.COM/P/CE2D77D7D1C4

Https://sourceware.org/gdb/wiki/BuildingOnDarwin

Ways to view Python's trace

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.