A Humble Introduction to the Basics of GDB
What is GDB?
GDB is a user process that attaches on to another user process.
That's all.
Project Build Type
- Debug build:
gcc -g
- Works with gdb
- Shows source code
- Easy mode
- Release with debug information build:
- Works with gdb
- Shows source code, however messy because of optimizations
- Hard mode
- Release build:
gcc -O2
- Works with gdb
- No source code information available
- Debug with disassembled application
- Hell mode
Ubuntu 14.04 CUDA install
For Ubuntu 16.04 Users:
sudo apt-get -y install nvidia-361-updates-dev nvidia-prime nvidia-profiler \
nvidia-settings nvidia-visual-profiler \
nvidia-cuda-dev nvidia-cuda-toolkit nvidia-opencl-dev
And, that's it!
For Ubuntu 14.04 Users
Show me the reason: Why did my network fail? (Show error messages from NetworkManager)
The method is for systemd users.
In order to show the error messages printed from your NetworkManager, you need to manually start it from your command line.
Here's the instructions:
systemctl mask NetworkManager.service
systemctl stop NetworkManager.service
NM_PPP_DEBUG=1 /usr/sbin/NetworkManager --no-daemon
systemctl unmask NetworkManager.service
systemctl restart NetworkManager.service
Using one file as Linux Swap instead of a partition
Sometimes wasting a partition for Linux Swap is quite annoying, so let's use a file instead.
Steps are simple:
cd /whatever-dir/
dd if=/dev/zero of=./swapfile bs=1024 count=<num in KB>
mkswap ./swapfile
swapon ./swapfile
# That's it, you just enabled your swapfile
If you'd hope that it'll start at boot, add it to your /etc/fstab
:
echo "/whatever-dir/swapfile none swap sw 0 0" >> /etc/fstab
Find Out What Package Provides a File / Command (Debian / Ubuntu / RHEL / Fedora / CentOS Linux)
Exchange 'Caps_Lock' and 'Control_L' (Left Control) using xmodmap
The man page of xmodmap
is showing us a way of exchanging/swaping Caps_Lock
and Control_L
:
! file: ~/.xmodmap
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
How to run the script:
- Save the script in
~/.xmodmap
. - Run
xmodmap ~/.xmodmap
- Check your
Caps Lock
andLeft Control
to see the effect.
However, the script will really swap
it. Because if you rerun the script again, it'll swap it back.