Monthly Archives: February 2013

remote debugging with gdb

… could not be easier.

On the remote machine start the gdbserver with a port:

$ gdbserver host:port programname [args]

Then on the machine that contains source code, start gdb, load symbols, and start debugging:

$ gdb
(gdb) symbol-file programname
(gdb) target remote tcp:host:port
(gdb) break main
(gdb) continue

More info on documentation pages:
gdbserver
connecting

tshark

A few very basic tshark usage examples:

List available interfaces

$ sudo tshark -D
1. eth0
2. wlan0
3. usbmon1 (USB bus number 1)
4. usbmon2 (USB bus number 2)
5. any (Pseudo-device that captures on all interfaces)
6. lo

Print packets to stdout

sudo tshark -i eth0

Capture 100 packets into a file

$ sudo tshark -i eth0 -c 100 -w /tmp/packets.pcap
Capturing on eth0
100

See packets

$ sudo tshark -r /tmp/packets.pcap

or

$ sudo wireshark /tmp/packets.pcap