basic gdb use

# start gdb debugger
$ (gdb) gdb myprogram
# run your program
$ (gdb) run
# list code
$ (gdb) list
# list code between lines 1 and 30
$ (gdb) list 1,30
#set breakpoint at main
$ (gdb) break main
$ (gdb) b main
#set breakpoint at line 7
$ (gdb) break 7
$ (gdb) b 11
# list all break points
$ (gdb) info break
$ (gdb) info b
# after breaking, step through code
$ (gdb) next
# continue to next break
$ (gdb) continue
# display current local variables
$ (gdb) info locals
# show assembly code
$ (gdb) disass
# show assembly code only for mian function
$ (gdb) disass main
# step into a function call in assembly
$ (gdb) nexti
# jump in assembly to next instruction
$ (gdb) stepi
# print value of variable a
$ (gdb) print a
# print address of variable a
$ (gdb) print &a
# print / examine value decimal mode in esp register offset by 0x14
$ (gdb) x /d $esp+0x14
# print all registers
$ (gdb) info reg
# backtrace. gives current stack of all the recursive calls made to function
$ (gdb) bt
# quit the GNU Project debugger
$ (gdb) quit
#
# output of segfaults . . .
# Program received signal SIGSEGV, Segmentation fault.
# 0x0000000000400736 in segfault1 () at testgdb.c:15
# 15 *str = 'b';
# Program received signal SIGSEGV, Segmentation fault.
# 0x0000000000400743 in segfault2 (x=) at testgdb.c:19
# 19 int segfault2(int x){

Setting Up Apache Virtual Hosts on Ubuntu

# make directory to serve website
$ sudo mkdir -p newsubdomain.myurl.com/public_html
# copy config file
$ sudo cp /etc/apache2/sites-available/subdomain.myurl.com.conf /etc/apache2/sites-available/newsubdomain.myurl.com.conf
# edit config file
$ sudo nano /etc/apache2/sites-available/newsubdomain.myurl.com.conf
# enable apache virtual host
$ sudo a2ensite newsubdomain.myurl.com.conf
# restart apache server for changes to stick
$ sudo service apache2 restart
# disable site
$ sudo a2dissite example.com.conf
# enable an apache2 module
$ sudo a2enmod
# disable an apache2 module
$ sudo a2dismod