iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.59k stars 3.88k forks source link

examples/tracing/undump.py: Add --hexdump argument #4933

Closed Rtoax closed 8 months ago

Rtoax commented 8 months ago

Use print and %x to print out the data: (Considering compatibility, it is best not to delete the original output method)

    $ sudo ./undump.py
    ...
    Recv 32 bytes
        01 20 c6 5e 01 00 00 00 06 00 00 00 00 00 00 00
        01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

However, hexdump is the more standard approach:

    $ sudo ./undump.py --hexdump
    ...
    Recv 32 bytes
    1c00eb615b03ad00780100001f6eb420
    00000000000000000000000000000000

At the same time, remove useless 'import' lines.