[youtube https://www.youtube.com/watch?v=UWKmWcqOodY?rel=0&w=560&h=315]
How To Apply a Patch To The Linux Kernel Stable Tree
[youtube https://www.youtube.com/watch?v=6zUVS4kJtrA?rel=0&w=560&h=315]
CLI Academy Related : GNU/Linux "mkdir" command
[youtube https://www.youtube.com/watch?v=zc6a9tbG9iI?rel=0&w=560&h=315]
How Linux is Built
[youtube https://www.youtube.com/watch?v=yVpbFMhOAwE?rel=0&w=560&h=315]
htop process monitor
[youtube https://www.youtube.com/watch?v=Dbop7NX3ki4?rel=0&w=560&h=315]
GNU grep Debug II
commandline session
$gdb grep
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/jeffrin/GNUgrep/grep-2.0/grep...done.
(gdb) break 598
Breakpoint 1 at 0x401f99: file grep.c, line 598.
(gdb) r errno grep.c
Starting program: /home/jeffrin/GNUgrep/grep-2.0/grep errno grep.c
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Breakpoint 1, main (argc=3, argv=0x7fffffffe8d8) at grep.c:600
600 {
(gdb) l
595
596 int
597 main(argc, argv)
598 int argc;
599 char *argv[];
600 {
601 char *keys;
602 size_t keycc, oldcc, keyalloc;
603 int keyfound, count_matches, no_filenames, list_files, suppress_errors;
604 int opt, cc, desc, count, status;
(gdb) next
609 prog = argv[0];
(gdb) print argc
$1 = 3
(gdb) print argv
$2 = (char **) 0x7fffffffe8d8
(gdb) print *argv
$3 = 0x7fffffffeb6a "/home/jeffrin/GNUgrep/grep-2.0/grep"
(gdb) print **argv
$4 = 47 '/'
(gdb) l
604 int opt, cc, desc, count, status;
605 FILE *fp;
606 extern char *optarg;
607 extern int optind;
608
609 prog = argv[0];
610 if (prog && strrchr(prog, '/'))
611 prog = strrchr(prog, '/') + 1;
612
613 keys = NULL;
(gdb) next
610 if (prog && strrchr(prog, '/'))
(gdb) print prog
$5 = 0x7fffffffeb6a "/home/jeffrin/GNUgrep/grep-2.0/grep"
(gdb) bt
#0 main (argc=3, argv=0x7fffffffe8d8) at grep.c:610
(gdb) bt full
#0 main (argc=3, argv=0x7fffffffe8d8) at grep.c:610
keys =
keycc =
oldcc =
keyalloc =
keyfound =
count_matches =
no_filenames =
list_files =
suppress_errors =
opt =
cc =
desc =
count =
status =
fp =
(gdb) next
611 prog = strrchr(prog, '/') + 1;
(gdb) print prog
$6 = 0x7fffffffeb6a "/home/jeffrin/GNUgrep/grep-2.0/grep"
(gdb) call strchr(prog,'/')
$7 = -5270
(gdb) next
620 matcher = NULL;
(gdb) print prog
$8 = 0x7fffffffeb89 "grep"
(gdb) info locals
keys = 0x0
keycc = 0
oldcc =
keyalloc =
keyfound = 0
count_matches = 0
no_filenames = 0
list_files = 0
suppress_errors = 0
opt =
cc =
desc =
count =
status =
fp =
(gdb) bt
#0 main (argc=3, argv=0x7fffffffe8d8) at grep.c:620
(gdb) next
619 suppress_errors = 0;
(gdb) next
618 list_files = 0;
(gdb) next
617 no_filenames = 0;
(gdb) next
616 count_matches = 0;
(gdb) next
615 keyfound = 0;
(gdb) next
614 keycc = 0;
(gdb) next
613 keys = NULL;
(gdb) next
622 while ((opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy"))
(gdb) print opt
$9 =
(gdb) next
755 if (!keyfound)
(gdb) print opt
$10 = -1
(gdb)
GNU grep Debug
commandline session
$gdb grep
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/jeffrin/GNUgrep/grep-2.0/grep...done.
(gdb) break 1
Breakpoint 1 at 0x401595: file grep.c, line 1.
(gdb) r errno grep.c
Starting program: /home/jeffrin/GNUgrep/grep-2.0/grep errno grep.c
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
#include
#ifndef errno
extern int errno;
strerror(errno));
error("writing output", errno);
error(filename, errno);
fatal(optarg, errno);
error(argv[optind], errno);
[Inferior 1 (process 29324) exited normally]
(gdb) start
Temporary breakpoint 2 at 0x401f99: file grep.c, line 600.
Starting program: /home/jeffrin/GNUgrep/grep-2.0/grep errno grep.c
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Temporary breakpoint 2, main (argc=3, argv=0x7fffffffe8d8) at grep.c:600
600 {
(gdb) bt
#0 main (argc=3, argv=0x7fffffffe8d8) at grep.c:600
(gdb) break 1
Note: breakpoint 1 also set at pc 0x401595.
Breakpoint 3 at 0x401595: file grep.c, line 1.
(gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Temporary breakpoint 4 at 0x401f99: file grep.c, line 600.
Starting program: /home/jeffrin/GNUgrep/grep-2.0/grep errno grep.c
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Temporary breakpoint 4, main (argc=3, argv=0x7fffffffe8d8) at grep.c:600
600 {
(gdb) l
595
596 int
597 main(argc, argv)
598 int argc;
599 char *argv[];
600 {
601 char *keys;
602 size_t keycc, oldcc, keyalloc;
603 int keyfound, count_matches, no_filenames, list_files, suppress_errors;
604 int opt, cc, desc, count, status;
(gdb) call memchar
No symbol "memchar" in current context.
(gdb) next
609 prog = argv[0];
(gdb) l
604 int opt, cc, desc, count, status;
605 FILE *fp;
606 extern char *optarg;
607 extern int optind;
608
609 prog = argv[0];
610 if (prog && strrchr(prog, '/'))
611 prog = strrchr(prog, '/') + 1;
612
613 keys = NULL;
(gdb) bt
#0 main (argc=3, argv=0x7fffffffe8d8) at grep.c:609
(gdb) break 82
Note: breakpoints 1 and 3 also set at pc 0x401595.
Breakpoint 5 at 0x401595: file grep.c, line 82.
(gdb) continue
Continuing.
#include
#ifndef errno
extern int errno;
strerror(errno));
error("writing output", errno);
error(filename, errno);
fatal(optarg, errno);
error(argv[optind], errno);
[Inferior 1 (process 30092) exited normally]
(gdb)
ls -X sort alphabetically by entry extension
commandline session
$ls -lX total 1144 -rwxr-xr-x 1 jeffrin jeffrin 115430 Sep 28 01:11 bwt -rwxr-xr-x 1 jeffrin jeffrin 129354 Sep 28 01:11 ds -rw-r--r-- 1 jeffrin jeffrin 1063 May 18 19:23 Makefile -rw------- 1 jeffrin jeffrin 3793 Dec 13 2005 README -rwxr-xr-x 1 jeffrin jeffrin 141313 Sep 28 01:11 testlcp drwxr-xr-x 2 jeffrin jeffrin 4096 Sep 28 02:19 tests -rw-r--r-- 1 jeffrin jeffrin 32 Sep 28 19:32 text -rwxr-xr-x 1 jeffrin jeffrin 21008 Sep 28 01:11 unbwt -rw-r--r-- 1 jeffrin jeffrin 23164 Sep 28 01:11 bwtlcp.a -rw-r--r-- 1 jeffrin jeffrin 166190 Sep 28 01:11 ds_ssort.a -rw-r--r-- 1 jeffrin jeffrin 0 Oct 1 02:00 text.bwt -rw-r--r-- 1 jeffrin jeffrin 12024 May 18 19:08 blind2.c -rw-r--r-- 1 jeffrin jeffrin 9373 Nov 16 2006 bwt_aux.c -rw-r--r-- 1 jeffrin jeffrin 7068 Nov 16 2006 bwt.c -rw-r--r-- 1 jeffrin jeffrin 10074 May 18 19:07 deep2.c -rw-r--r-- 1 jeffrin jeffrin 9245 Nov 16 2006 ds.c -rw-r--r-- 1 jeffrin jeffrin 3804 Nov 16 2006 globals.c -rw-r--r-- 1 jeffrin jeffrin 20961 Nov 16 2006 helped.c -rw-r--r-- 1 jeffrin jeffrin 9930 Nov 16 2006 lcp_aux.c -rw-r--r-- 1 jeffrin jeffrin 17108 May 18 19:05 shallow.c -rw-r--r-- 1 jeffrin jeffrin 14561 Nov 16 2006 suftest2.c -rw-r--r-- 1 jeffrin jeffrin 9432 Nov 16 2006 testlcp.c -rw-r--r-- 1 jeffrin jeffrin 8673 Nov 16 2006 unbwt.c -rw-r--r-- 1 jeffrin jeffrin 912 Nov 16 2006 bwt_aux.h -rw-r--r-- 1 jeffrin jeffrin 1427 May 18 19:19 common.h -rw-r--r-- 1 jeffrin jeffrin 285 Nov 16 2006 ds_ssort.h -rw-r--r-- 1 jeffrin jeffrin 512 Nov 16 2006 lcp_aux.h -rw-r--r-- 1 jeffrin jeffrin 39648 Sep 28 01:11 blind2.o -rw-r--r-- 1 jeffrin jeffrin 11864 Sep 28 01:11 bwt_aux.o -rw-r--r-- 1 jeffrin jeffrin 15968 Sep 28 01:11 deep2.o -rw-r--r-- 1 jeffrin jeffrin 13648 Sep 28 01:11 ds.o -rw-r--r-- 1 jeffrin jeffrin 8944 Sep 28 01:11 globals.o -rw-r--r-- 1 jeffrin jeffrin 32248 Sep 28 01:11 helped.o -rw-r--r-- 1 jeffrin jeffrin 10832 Sep 28 01:11 lcp_aux.o -rw-r--r-- 1 jeffrin jeffrin 54088 Sep 28 01:11 shallow.o -rw-r--r-- 1 jeffrin jeffrin 41916 Sep 28 01:11 suftest2.o -rw-r--r-- 1 jeffrin jeffrin 49195 Jan 18 2011 ds.tgz -rw-r----- 1 jeffrin jeffrin 17992 Mar 22 2002 COPYRIGHT.GPL.txt -rw-r--r-- 1 jeffrin jeffrin 25385 Dec 16 2005 COPYRIGHT.MPL.txt $
Burrows–Wheeler Transform . 1994
commandline session
$cat hello Hello. How are you $../bwt hello $ls hello hello~ hello.bwt $rm hello~ $ls hello hello.bwt $cat hello.bwt u.weo rHellyHaoo $ $hexdump hello.bwt 0000000 750a 772e 6f100 200a 4872 6c100 796c 6148 0000010 6f6f 0520 0000 0000 0000017 $../unbwt hello.bwt $ls hello hello.bwt hello.bwt.y $cat hello.bwt.y Hello. How are you $
Binary Tree Debug (Pre-order Related)
commandline session
$gdb a.out
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/jeffrin/a.out...done.
(gdb) break 111
Breakpoint 1 at 0x4008b8: file btree-c.c, line 111.
(gdb) break 34
Breakpoint 2 at 0x40068b: file btree-c.c, line 34.
(gdb) r
Starting program: /home/jeffrin/a.out
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Breakpoint 1, main () at btree-c.c:112
112 printf("Pre Order Displayn");
(gdb) next
Pre Order Display
113 print_preorder(root);
(gdb) next
Breakpoint 2, print_preorder (tree=0x601010) at btree-c.c:35
35 if (tree)
(gdb) bt
#0 print_preorder (tree=0x601010) at btree-c.c:35
#1 0x00000000004008ce in main () at btree-c.c:113
(gdb) print tree
$1 = (node *) 0x601010
(gdb) print *tree
$2 = {data = 9, right = 0x601050, left = 0x601030}
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
9
38 print_preorder(tree->left);
(gdb) print tree-left
No symbol "left" in current context.
(gdb) print tree->left
$3 = (struct bin_tree *) 0x601030
(gdb) print *(tree->left)
$4 = {data = 4, right = 0x601070, left = 0x6010d0}
(gdb) next
Breakpoint 2, print_preorder (tree=0x601030) at btree-c.c:35
35 if (tree)
(gdb) print tree
$5 = (node *) 0x601030
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
4
38 print_preorder(tree->left);
(gdb) next
Breakpoint 2, print_preorder (tree=0x6010d0) at btree-c.c:35
35 if (tree)
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
2
38 print_preorder(tree->left);
(gdb) print tree->left
$6 = (struct bin_tree *) 0x0
(gdb) print *(tree->left)
Cannot access memory at address 0x0
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x6010d0) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) print tree->data
$7 = 2
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x601030) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) print tree->right
$8 = (struct bin_tree *) 0x601070
(gdb) next
Breakpoint 2, print_preorder (tree=0x601070) at btree-c.c:35
35 if (tree)
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
6
38 print_preorder(tree->left);
(gdb) print tree->left
$9 = (struct bin_tree *) 0x0
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x601070) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x601010) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) next
Breakpoint 2, print_preorder (tree=0x601050) at btree-c.c:35
35 if (tree)
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
15
38 print_preorder(tree->left);
(gdb) print tree->left
$10 = (struct bin_tree *) 0x601090
(gdb) next
Breakpoint 2, print_preorder (tree=0x601090) at btree-c.c:35
35 if (tree)
(gdb) next
37 printf("%dn",tree->data);
(gdb) print *(tree->left)
Cannot access memory at address 0x0
(gdb) print *(tree->right)
Cannot access memory at address 0x0
(gdb) next
12
38 print_preorder(tree->left);
(gdb) print *(tree->left)
Cannot access memory at address 0x0
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x601090) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) print *(tree->right)
Cannot access memory at address 0x0
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x601050) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) print *(tree->right)
$11 = {data = 17, right = 0x0, left = 0x0}
(gdb) next
Breakpoint 2, print_preorder (tree=0x6010b0) at btree-c.c:35
35 if (tree)
(gdb) next
37 printf("%dn",tree->data);
(gdb) next
17
38 print_preorder(tree->left);
(gdb) print *(tree->left)
Cannot access memory at address 0x0
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
print_preorder (tree=0x6010b0) at btree-c.c:39
39 print_preorder(tree->right);
(gdb) next
Breakpoint 2, print_preorder (tree=0x0) at btree-c.c:35
35 if (tree)
(gdb) next
42 }
(gdb) next
main () at btree-c.c:115
115 printf("In Order Displayn");
(gdb)