Skip to content

Instantly share code, notes, and snippets.

View buttercutter's full-sized avatar

Phung Cheng Fei buttercutter

View GitHub Profile
@jlblancoc
jlblancoc / Install_gcc7_ubuntu_16.04.md
Last active July 8, 2024 06:37
Installing gcc-7 & g++-7 in Ubuntu 16.04LTS Xenial

Run the following in the terminal:

Install the gcc-7 packages:

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y

Set it up so the symbolic links gcc, g++ point to the newer version:

Writing 16 bit value 0xbbaa (ByteCount = 2) at various offsets
+-----------------------------------+---------------------------------------------------------+
| DW | |
+--------+--------+--------+--------+-------------+-------------------------------------------+
+ byte 3 | byte 2 | byte 1 | byte 0 | Address & 3 | ((LowerAddress & 3) + ByteCount + 3) >> 2 |
+--------+--------+--------+--------+-------------+-------------------------------------------+
| | | bb | aa | 0 | ((0 & 3) + (2 + 3)) >> 2 = 5 / 4 = 1 |
| | | | | | |
@tonyc
tonyc / gist:1384523
Last active June 3, 2024 15:34
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)