Binary Tree Debug (pre-order)

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 34
Breakpoint 1 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"?
Pre Order Display

Breakpoint 1, print_preorder (tree=0x601010) at btree-c.c:35
35	  if (tree)
(gdb) print *tree
$1 = {data = 9, right = 0x601050, left = 0x601030}
(gdb) print *(tree->right)
$2 = {data = 15, right = 0x6010b0, left = 0x601090}
(gdb) print *tree
$3 = {data = 9, right = 0x601050, left = 0x601030}
(gdb) print *(tree->left)
$4 = {data = 4, right = 0x601070, left = 0x6010d0}
(gdb) next
37	      printf("%dn",tree->data);
(gdb) next
9
38	      print_preorder(tree->left);
(gdb) next

Breakpoint 1, print_preorder (tree=0x601030) at btree-c.c:35
35	  if (tree)
(gdb) print tree
$5 = (node *) 0x601030
(gdb) print *tree
$6 = {data = 4, right = 0x601070, left = 0x6010d0}
(gdb) next
37	      printf("%dn",tree->data);
(gdb) next
4
38	      print_preorder(tree->left);
(gdb) next

Breakpoint 1, 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) next

Breakpoint 1, print_preorder (tree=0x0) at btree-c.c:35
35	  if (tree)
(gdb) print tree-left
No symbol "left" in current context.
(gdb) print tree->left
Cannot access memory at address 0x10
(gdb) next
42	}
(gdb) next
print_preorder (tree=0x6010d0) at btree-c.c:39
39	      print_preorder(tree->right);
(gdb) print tree->left
$7 = (struct bin_tree *) 0x0
(gdb) next

Breakpoint 1, 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) next

Breakpoint 1, print_preorder (tree=0x601070) at btree-c.c:35
35	  if (tree)
(gdb) print tree->right
$8 = (struct bin_tree *) 0x0
(gdb) next
37	      printf("%dn",tree->data);
(gdb) next
6
38	      print_preorder(tree->left);
(gdb) next

Breakpoint 1, print_preorder (tree=0x0) at btree-c.c:35
35	  if (tree)
(gdb) bt
#0  print_preorder (tree=0x0) at btree-c.c:35
#1  0x00000000004006b9 in print_preorder (tree=0x601070) at btree-c.c:38
#2  0x00000000004006c9 in print_preorder (tree=0x601030) at btree-c.c:39
#3  0x00000000004006b9 in print_preorder (tree=0x601010) at btree-c.c:38
#4  0x00000000004008ce in main () at btree-c.c:113
(gdb)

Binary Tree Debug II ( Insert Function )

commandline and also gdb session related

$pwd
/home/jeffrin
$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 1
Breakpoint 1 at 0x4005db: file btree-c.c, line 1.
(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, insert (tree=0x7fffffffe830, val=9) at btree-c.c:12
12	  node *temp = NULL;
(gdb) l
7	};
8	typedef struct bin_tree node;
9
10	void insert(node ** tree, int val)
11	{
12	  node *temp = NULL;
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
(gdb) watch temp
Hardware watchpoint 2: temp
(gdb) bt
#0  insert (tree=0x7fffffffe830, val=9) at btree-c.c:12
#1  0x0000000000400852 in main () at btree-c.c:103
(gdb) next
13	  if(!(*tree))
(gdb) print *tree
$1 = (node *) 0x0
(gdb) print !(*tree)
$2 = 1
(gdb) next
15	      temp = (node *)malloc(sizeof(node));
(gdb) print temp
$3 = (node *) 0x0
(gdb) next
Hardware watchpoint 2: temp

Old value = (node *) 0x0
New value = (node *) 0x601010
insert (tree=0x7fffffffe830, val=9) at btree-c.c:16
16	      temp->left = temp->right = NULL;
(gdb) print *temp
$4 = {data = 0, right = 0x0, left = 0x0}
(gdb) watch *temp
Hardware watchpoint 3: *temp
(gdb) bt
#0  insert (tree=0x7fffffffe830, val=9) at btree-c.c:16
#1  0x0000000000400852 in main () at btree-c.c:103
(gdb) l
11	{
12	  node *temp = NULL;
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
17	      temp->data = val;
18	      *tree = temp;
19	      return;
20	    }
(gdb) next
17	      temp->data = val;
(gdb) print val
$5 = 9
(gdb) next
Hardware watchpoint 3: *temp

Old value = {data = 0, right = 0x0, left = 0x0}
New value = {data = 9, right = 0x0, left = 0x0}
insert (tree=0x7fffffffe830, val=9) at btree-c.c:18
18	      *tree = temp;
(gdb) next
19	      return;
(gdb) next
31	}
(gdb) next

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.

Watchpoint 3 deleted because the program has left the block in
which its expression is valid.
main () at btree-c.c:104
104	  insert(&root, 4);
(gdb) bt
#0  main () at btree-c.c:104
(gdb) l
99	  //int i;
100
101	  root = NULL;
102	  /* Inserting nodes into tree */
103	  insert(&root, 9);
104	  insert(&root, 4);
105	  insert(&root, 15);
106	  insert(&root, 6);
107	  insert(&root, 12);
108	  insert(&root, 17);
(gdb) next

Breakpoint 1, insert (tree=0x7fffffffe830, val=4) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) print *tree
$6 = (node *) 0x601010
(gdb) print !(*tree)
$7 = 0
(gdb) l
8	typedef struct bin_tree node;
9
10	void insert(node ** tree, int val)
11	{
12	  node *temp = NULL;
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
17	      temp->data = val;
(gdb) next
22	  if(val data)
(gdb) l
17	      temp->data = val;
18	      *tree = temp;
19	      return;
20	    }
21
22	  if(val data)
23	    {
24	      insert(&(*tree)->left, val);
25	    }
26	  else if(val > (*tree)->data)
(gdb) print (*tree)->data
$8 = 9
(gdb) print val
$9 = 4
(gdb) next
24	      insert(&(*tree)->left, val);
(gdb) l
19	      return;
20	    }
21
22	  if(val data)
23	    {
24	      insert(&(*tree)->left, val);
25	    }
26	  else if(val > (*tree)->data)
27	    {
28	      insert(&(*tree)->right, val);
(gdb) next

Breakpoint 1, insert (tree=0x601020, val=4) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) next
15	      temp = (node *)malloc(sizeof(node));
(gdb) l
10	void insert(node ** tree, int val)
11	{
12	  node *temp = NULL;
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
17	      temp->data = val;
18	      *tree = temp;
19	      return;
(gdb) next
16	      temp->left = temp->right = NULL;
(gdb) next
17	      temp->data = val;
(gdb) print val
$10 = 4
(gdb) next
18	      *tree = temp;
(gdb) print *tree
$11 = (node *) 0x0
(gdb) print *temp
$12 = {data = 4, right = 0x0, left = 0x0}
(gdb) next
19	      return;
(gdb) bt
#0  insert (tree=0x601020, val=4) at btree-c.c:19
#1  0x00000000004001005 in insert (tree=0x7fffffffe830, val=4) at btree-c.c:24
#2  0x0000000000400863 in main () at btree-c.c:104
(gdb) next
31	}
(gdb) l
26	  else if(val > (*tree)->data)
27	    {
28	      insert(&(*tree)->right, val);
29	    }
30
31	}
32
33	void print_preorder(node * tree)
34	{
35	  if (tree)
(gdb) next
31	}
(gdb) bt
#0  insert (tree=0x7fffffffe830, val=4) at btree-c.c:31
#1  0x0000000000400863 in main () at btree-c.c:104
(gdb) next
main () at btree-c.c:105
105	  insert(&root, 15);
(gdb) next

Breakpoint 1, insert (tree=0x7fffffffe830, val=15) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) print!(*tree)
$13 = 0
(gdb) next
22	  if(val data)
(gdb) print (*tree)
$14 = (node *) 0x601010
(gdb) next
26	  else if(val > (*tree)->data)
(gdb) next
28	      insert(&(*tree)->right, val);
(gdb) next

Breakpoint 1, insert (tree=0x601018, val=15) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) next
15	      temp = (node *)malloc(sizeof(node));
(gdb) next
16	      temp->left = temp->right = NULL;
(gdb) next
17	      temp->data = val;
(gdb) print val
$15 = 15
(gdb) print temp-data
No symbol "data" in current context.
(gdb) print temp->data
$16 = 0
(gdb) print val
$17 = 15
(gdb) next
18	      *tree = temp;
(gdb) print temp->data
$18 = 15
(gdb) bt
#0  insert (tree=0x601018, val=15) at btree-c.c:18
#1  0x000000000040067d in insert (tree=0x7fffffffe830, val=15) at btree-c.c:28
#2  0x0000000000400874 in main () at btree-c.c:105
(gdb) l
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
17	      temp->data = val;
18	      *tree = temp;
19	      return;
20	    }
21
22	  if(val data)
(gdb) l
23	    {
24	      insert(&(*tree)->left, val);
25	    }
26	  else if(val > (*tree)->data)
27	    {
28	      insert(&(*tree)->right, val);
29	    }
30
31	}
32
(gdb)

Binary Tree Debug

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 1
Breakpoint 1 at 0x4005db: file btree-c.c, line 1.
(gdb) l
92	    }
93	}
94
95	void main()
96	{
97	  node *root;
98	  node *tmp;
99	  //int i;
100
101	  root = NULL;
(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, insert (tree=0x7fffffffe830, val=9) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) next
15	      temp = (node *)malloc(sizeof(node));
(gdb) l
10	void insert(node ** tree, int val)
11	{
12	  node *temp = NULL;
13	  if(!(*tree))
14	    {
15	      temp = (node *)malloc(sizeof(node));
16	      temp->left = temp->right = NULL;
17	      temp->data = val;
18	      *tree = temp;
19	      return;
(gdb) next
16	      temp->left = temp->right = NULL;
(gdb) print temp
$1 = (node *) 0x601010
(gdb) print temp-left
No symbol "left" in current context.
(gdb) print temp->left
$2 = (struct bin_tree *) 0x0
(gdb) print temp->left
$3 = (struct bin_tree *) 0x0
(gdb) pwd
Working directory /home/jeffrin.
(gdb) ls
Undefined command: "ls".  Try "help".
(gdb) break 1
Note: breakpoint 1 also set at pc 0x4005db.
Breakpoint 2 at 0x4005db: file btree-c.c, line 1.
(gdb) watch *temp
Hardware watchpoint 3: *temp
(gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Temporary breakpoint 4 at 0x400839: file btree-c.c, line 101.
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"?

Temporary breakpoint 4, main () at btree-c.c:101
101	  root = NULL;
(gdb) info watchpoints
No watchpoints.
(gdb) info watchpoint
No watchpoints.
(gdb) watch *temp
No symbol "temp" in current context.
(gdb) watch root
Hardware watchpoint 5: root
(gdb) info watchpoints
Num     Type           Disp Enb Address            What
5       hw watchpoint  keep y                      root
(gdb) next
Hardware watchpoint 5: root

Old value = (node *) 0x7fffffffe920
New value = (node *) 0x0
main () at btree-c.c:103
103	  insert(&root, 9);
(gdb) next

Breakpoint 1, insert (tree=0x7fffffffe830, val=9) at btree-c.c:12
12	  node *temp = NULL;
(gdb) next
13	  if(!(*tree))
(gdb) print !(*tree)
$4 = 1
(gdb) next
15	      temp = (node *)malloc(sizeof(node));
(gdb) print temp
$5 = (node *) 0x0
(gdb) next
16	      temp->left = temp->right = NULL;
(gdb) print temp
$6 = (node *) 0x601010
(gdb) print temp->left
$7 = (struct bin_tree *) 0x0
(gdb) next
17	      temp->data = val;
(gdb) print temp->left
$8 = (struct bin_tree *) 0x0
(gdb) print temp->left
$9 = (struct bin_tree *) 0x0
(gdb) next
18	      *tree = temp;
(gdb) print temp->left
$10 = (struct bin_tree *) 0x0
(gdb) print *tree
$11 = (node *) 0x0
(gdb) next
Hardware watchpoint 5: root

Old value = (node *) 0x0
New value = (node *) 0x601010
insert (tree=0x7fffffffe830, val=9) at btree-c.c:19
19	      return;
(gdb) next
31	}
(gdb) print *tree
$12 = (node *) 0x601010
(gdb) info watchpoints
Num     Type           Disp Enb Address            What
5       hw watchpoint  keep y                      root
	breakpoint already hit 2 times
(gdb)

Using Valgrind to detect Memory Leaks (still reachable)

ABOUT Memory Leak

In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations[1] in such a way that memory which is no longer needed is not released. A memory leak may also happen when an object is stored in memory but cannot be accessed by the running code.[2] A memory leak has symptoms similar to a number of other problems and generally can only be diagnosed by a programmer with access to the program's source code.

A space leak occurs when a computer program uses more memory than necessary. In contrast to memory leaks, where the leaked memory is never released, the memory consumed by a space leak is released, but later than expected. [3]

Because they can exhaust available system memory as an application runs, memory leaks are often the cause of or a contributing factor to software aging.

ABOUT Valgrind

Valgrind /ˈvælɡrɪnd/ is a programming tool for memory debugging, memory leak detection, and profiling.

Valgrind was originally designed to be a free memory debugging tool for Linux on x86, but has since evolved to become a generic framework for creating dynamic analysis tools such as checkers and profilers.

The name Valgrind is a reference to the main entrance of Valhalla from Norse Mythology. During development (before release) the project was named Heimdall; however, the name would have conflicted with a security package.

TYPICAL COMMANDLINE SESSION
[text light=”true”]
$valgrind -v –tool=memcheck –leak-check=full ./ethstatus -i eth1
==19477== Memcheck, a memory error detector
==19477== Copyright (C) 2002-2012, and GNU GPL’d, by Julian Seward et al.
==19477== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==19477== Command: ./ethstatus -i eth1
==19477==
–19477– Valgrind options:
–19477– –suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
–19477– -v
–19477– –tool=memcheck
–19477– –leak-check=full
–19477– Contents of /proc/version:
–19477– Linux version 3.11.0 (root@debian) (gcc version 4.7.3 (Debian 4.7.3-4) ) #1 SMP Mon Sep 16 00:32:04 IST 2013
–19477– Arch and hwcaps: AMD64, amd64-sse3-cx16-lzcnt-avx
–19477– Page sizes: currently 4096, max supported 4096
–19477– Valgrind library directory: /usr/lib/valgrind
–19477– Reading syms from /home/jeffrin/Cloud/debian-develop/ethstatus-0.4.3/ethstatus
–19477– Reading syms from /lib/x86_64-linux-gnu/ld-2.17.so
–19477– Considering /lib/x86_64-linux-gnu/ld-2.17.so ..
–19477– .. CRC mismatch (computed bf253f8a wanted e079394a)
–19477– Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.17.so ..
–19477– .. CRC is valid
–19477– Reading syms from /usr/lib/valgrind/memcheck-amd64-linux
–19477– Considering /usr/lib/valgrind/memcheck-amd64-linux ..
–19477– .. CRC mismatch (computed 3468463e wanted c047c437)
–19477– Considering /usr/lib/debug/usr/lib/valgrind/memcheck-amd64-linux ..
–19477– .. CRC is valid
–19477– object doesn’t have a dynamic symbol table
–19477– Scheduler: using generic scheduler lock implementation.
–19477– Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
–19477– Reading suppressions file: /usr/lib/valgrind/default.supp
==19477== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-19477-by-jeffrin-on-???
==19477== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-19477-by-jeffrin-on-???
==19477== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-19477-by-jeffrin-on-???
==19477==
==19477== TO CONTROL THIS PROCESS USING vgdb (which you probably
==19477== don’t want to do, unless you know exactly what you’re doing,
==19477== or are doing some strange experiment):
==19477== /usr/lib/valgrind/../../bin/vgdb –pid=19477 …command…
==19477==
==19477== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==19477== /path/to/gdb ./ethstatus
==19477== and then give GDB the following command
==19477== target remote | /usr/lib/valgrind/../../bin/vgdb –pid=19477
==19477== –pid is optional if only one valgrind process is running
==19477==
–19477– REDIR: 0x4017890 (strlen) redirected to 0x3806c661 (vgPlain_amd64_linux_REDIR_FOR_strlen)
–19477– Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so
–19477– Considering /usr/lib/valgrind/vgpreload_core-amd64-linux.so ..
–19477– .. CRC mismatch (computed 3468909c wanted 2ffaf283)
–19477– Considering /usr/lib/debug/usr/lib/valgrind/vgpreload_core-amd64-linux.so ..
–19477– .. CRC is valid
–19477– Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
–19477– Considering /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so ..
–19477– .. CRC mismatch (computed c6ae4a33 wanted 21397e4b)
–19477– Considering /usr/lib/debug/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so ..
–19477– .. CRC is valid
–19477– REDIR: 0x4017700 (index) redirected to 0x4c2c4b0 (index)
–19477– REDIR: 0x4017780 (strcmp) redirected to 0x4c2d4c0 (strcmp)
–19477– Reading syms from /usr/lib/debug/libncurses.so.5.9
–19477– Reading syms from /usr/lib/debug/libtinfo.so.5.9
–19477– Reading syms from /lib/x86_64-linux-gnu/libc-2.17.so
–19477– Considering /lib/x86_64-linux-gnu/libc-2.17.so ..
–19477– .. CRC mismatch (computed b0b3185d wanted a268c1003)
–19477– Considering /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.17.so ..
–19477– .. CRC is valid
–19477– Reading syms from /lib/x86_64-linux-gnu/libdl-2.17.so
–19477– Considering /lib/x86_64-linux-gnu/libdl-2.17.so ..
–19477– .. CRC mismatch (computed 2a2457cb wanted a5918d1a)
–19477– Considering /usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.17.so ..
–19477– .. CRC is valid
–19477– REDIR: 0x5317e40 (strcasecmp) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5314200 (strnlen) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x531a110 (strncasecmp) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5316c50 (memset) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5316c00 (memcpy@GLIBC_2.2.5) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5315bf0 (__GI_strrchr) redirected to 0x4c2c2d0 (__GI_strrchr)
–19477– REDIR: 0xffffffffff600400 (???) redirected to 0x3806c64d (vgPlain_amd64_linux_REDIR_FOR_vtime)
–19477– REDIR: 0x5314120 (__GI_strlen) redirected to 0x4c2c830 (__GI_strlen)
–19477– REDIR: 0x530e4f0 (free) redirected to 0x4c2aa70 (free)
–19477– REDIR: 0x530e0d0 (malloc) redirected to 0x4c2bd80 (malloc)
–19477– REDIR: 0x5313ab0 (__GI_strcpy) redirected to 0x4c2c920 (__GI_strcpy)
–19477– REDIR: 0x5312620 (__GI_strcmp) redirected to 0x4c2d470 (__GI_strcmp)
–19477– REDIR: 0x531dc10 (__GI___rawmemchr) redirected to 0x4c2ee90 (__GI___rawmemchr)
–19477– REDIR: 0x531de20 (strchrnul) redirected to 0x4c2ee40 (strchrnul)
–19477– REDIR: 0x5314230 (__GI_strnlen) redirected to 0x4c2c7e0 (__GI_strnlen)
–19477– REDIR: 0x5312560 (__GI_strchr) redirected to 0x4c2c3b0 (__GI_strchr)
Running EthStatus v0.4a…–19477– REDIR: 0x5314320 (__GI_strncmp) redirected to 0x4c2cd00 (__GI_strncmp)
–19477– REDIR: 0x53140d0 (strlen) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x530ea30 (calloc) redirected to 0x4c29ba0 (calloc)
–19477– REDIR: 0x5315bb0 (rindex) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5312520 (index) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x5313a70 (strcpy) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x53125e0 (strcmp) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x531c7f0 (memcpy@@GLIBC_2.14) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x531c840 (__GI_memcpy) redirected to 0x4c2d7f0 (memcpy@@GLIBC_2.14)
–19477– REDIR: 0x530e580 (realloc) redirected to 0x4c2bf80 (realloc)
–19477– REDIR: 0x5315b70 (strncpy) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x53214b0 (__GI_strncpy) redirected to 0x4c2cb40 (__GI_strncpy)
–19477– REDIR: 0x532b4f0 (strstr) redirected to 0x4a24710 (_vgnU_ifunc_wrapper)
–19477– REDIR: 0x532b060 (__GI_strstr) redirected to 0x4c2f240 (strstr)

EthStatus v0.4a – Gabriel Montenegro / Christoph Haas

==19477==
==19477== HEAP SUMMARY:
==19477== in use at exit: 85,525 bytes in 122 blocks
==19477== total heap usage: 22,300 allocs, 22,178 frees, 6,549,861 bytes allocated
==19477==
==19477== Searching for pointers to 122 not-freed blocks
==19477== Checked 227,344 bytes
==19477==
==19477== LEAK SUMMARY:
==19477== definitely lost: 0 bytes in 0 blocks
==19477== indirectly lost: 0 bytes in 0 blocks
==19477== possibly lost: 0 bytes in 0 blocks
==19477== still reachable: 85,525 bytes in 122 blocks
==19477== suppressed: 0 bytes in 0 blocks
==19477== Reachable blocks (those to which a pointer was found) are not shown.
==19477== To see them, rerun with: –leak-check=full –show-reachable=yes
==19477==
==19477== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
–19477–
–19477– used_suppression: 2 dl-hack3-cond-1
==19477==
==19477== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
$

[/text]
LINKS
https://en.wikipedia.org/wiki/Valgrind
https://en.wikipedia.org/wiki/Memory_leak
https://stackoverflow.com/questions/26137356/how-to-check-actual-memory-leaks-during-runtime-using-valgrind
https://www.ibm.com/developerworks/library/l-memory-leaks/index.html
https://www.ibm.com/developerworks/systems/library/es-debug/index.html

Detecting Memory Leaks (leak: + ive)

commandline session

$gcc -g leak.c
$valgrind --tool=memcheck --leak-check=full ./a.out
==4353== Memcheck, a memory error detector
==4353== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==4353== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==4353== Command: ./a.out
==4353==
==4353==
==4353== HEAP SUMMARY:
==4353==     in use at exit: 100 bytes in 1 blocks
==4353==   total heap usage: 1 allocs, 0 frees, 100 bytes allocated
==4353==
==4353== 100 bytes in 1 blocks are definitely lost in loss record 1 of 1
==4353==    at 0x4C2BDEB: malloc (vg_replace_malloc.c:270)
==4353==    by 0x40050D: main (leak.c:4)
==4353==
==4353== LEAK SUMMARY:
==4353==    definitely lost: 100 bytes in 1 blocks
==4353==    indirectly lost: 0 bytes in 0 blocks
==4353==      possibly lost: 0 bytes in 0 blocks
==4353==    still reachable: 0 bytes in 0 blocks
==4353==         suppressed: 0 bytes in 0 blocks
==4353==
==4353== For counts of detected and suppressed errors, rerun with: -v
==4353== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
$cat leak.c
#include 
int main()
{
  char *x = (char*) malloc(100); //Mem Leak!
  return 0;
}
$

Detecting Memory Leaks II

commandline session

$gcc -g -ansi -pedantic -W -Wall algorithm.c
algorithm.c: In function ‘main’:
algorithm.c:47:5: warning: unused variable ‘value’ [-Wunused-variable]
algorithm.c:36:7: warning: unused variable ‘p’ [-Wunused-variable]
algorithm.c:35:5: warning: unused variable ‘i’ [-Wunused-variable]
algorithm.c:34:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
algorithm.c:34:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
$valgrind --tool=memcheck --leak-check=full ./a.out
==23555== Memcheck, a memory error detector
==23555== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==23555== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==23555== Command: ./a.out
==23555==
found in: htop-0.9
found in: .
==23555==
==23555== HEAP SUMMARY:
==23555==     in use at exit: 0 bytes in 0 blocks
==23555==   total heap usage: 74 allocs, 74 frees, 45,235 bytes allocated
==23555==
==23555== All heap blocks were freed -- no leaks are possible
==23555==
==23555== For counts of detected and suppressed errors, rerun with: -v
==23555== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
$

Detecting Memory leaks

commandline session

$valgrind --tool=memcheck --leak-check=full ./a.out
==6002== Memcheck, a memory error detector
==6002== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==6002== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==6002== Command: ./a.out
==6002==
-31
0
1
2
2
4
100
83
99
782
==6002==
==6002== HEAP SUMMARY:
==6002==     in use at exit: 0 bytes in 0 blocks
==6002==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==6002==
==6002== All heap blocks were freed -- no leaks are possible
==6002==
==6002== For counts of detected and suppressed errors, rerun with: -v
==6002== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
$

Running Unit tests

commandline session

$./utils/unittest_suite.py
Number of test modules found: 59
autotest.client.kernel_versions_unittest: PASS
autotest.client.shared.profiler_manager_unittest: PASS
autotest.mirror.database_unittest: PASS
autotest.client.shared.autotemp_unittest: PASS
autotest.tko.utils_unittest: PASS
autotest.client.harness_unittest: PASS
autotest.client.shared.hosts.base_classes_unittest: PASS
autotest.client.setup_job_unittest: PASS
autotest.mirror.source_unittest: PASS
autotest.client.fsinfo_unittest: PASS
autotest.client.shared.base_job_unittest: PASS
autotest.server.hosts.remote_unittest: PASS
autotest.database_legacy.database_connection_unittest: FAIL
autotest.server.hosts.monitors.monitors_util_unittest: PASS
autotest.server.hosts.monitors.console_patterns_unittest: FAIL
autotest.client.net.net_tc_unittest: PASS
autotest.client.partition_unittest: PASS
autotest.cli.user_unittest: PASS
autotest.scheduler.drone_manager_unittest: PASS
autotest.client.local_host_unittest: PASS
autotest.cli.rpc_unittest: PASS
autotest.scheduler.drones_unittest: PASS
autotest.cli.job_unittest: PASS
autotest.client.net.net_utils_unittest: FAIL
autotest.server.hosts.bootloader_unittest: PASS
autotest.cli.test_unittest: PASS
autotest.cli.topic_common_unittest: PASS
autotest.client.shared.settings_unittest: FAIL
autotest.client.shared.boottool_unittest: PASS
autotest.server.hosts.monitors.console_unittest: PASS
autotest.scheduler.gc_stats_unittest: PASS
autotest.server.rpm_kernel_unittest: PASS
autotest.server.base_utils_unittest: PASS
autotest.tko.status_lib_unittest: PASS
autotest.client.shared.control_data_unittest: PASS
autotest.tko.parsers.version_0_unittest: PASS
autotest.cli.atest_unittest: PASS
autotest.server.hosts.base_classes_unittest: PASS
autotest.server.subcommand_unittest: PASS
autotest.server.autoserv_parser_unittest: PASS
autotest.client.shared.mail_unittest: PASS
autotest.client.shared.test_unittest: PASS
autotest.server.deb_kernel_unittest: PASS
autotest.client.fsdev_disks_unittest: PASS
autotest.tko.parsers.version_1_unittest: PASS
autotest.server.server_job_unittest: PASS
autotest.cli.acl_unittest: PASS
autotest.client.kernelexpand_unittest: PASS
autotest.cli.atomicgroup_unittest: PASS
autotest.server.autotest_remote_unittest: PASS
autotest.cli.action_common_unittest: PASS
autotest.server.source_kernel_unittest: PASS
autotest.cli.host_unittest: PASS
autotest.cli.label_unittest: PASS
autotest.client.job_unittest: PASS
autotest.scheduler.drone_utility_unittest: PASS
autotest.client.kernel_unittest: PASS
autotest.client.shared.base_utils_unittest: PASS
autotest.cli.threads_unittest: PASS
4 tests resulted in an error/failure:
	autotest.database_legacy.database_connection_unittest failed
	autotest.server.hosts.monitors.console_patterns_unittest failed
	autotest.client.net.net_utils_unittest failed
	autotest.client.shared.settings_unittest failed
Rerun ./utils/unittest_suite.py --debug to see the failure details.
$

Autotest Unittest suite. Setting up dependencies

Get The Hang

$sudo ./utils/build_externals.py
20:28:50 INFO | imported setuptools version 0.6.
20:28:50 INFO | A new Setuptools is not needed on this system.
20:28:50 INFO | MySQLdb isn't present. Will install.
20:28:50 INFO | Fetching http://downloads.sourceforge.net/project/mysql-python/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz
20:28:52 INFO | Good checksum.
20:28:52 INFO | imported django version 1.5.1.
20:28:52 INFO | A new Django is not needed on this system.
20:28:52 INFO | imported numpy version 1.6.2.
20:28:52 INFO | A new Numpy is not needed on this system.
20:28:52 INFO | imported matplotlib version 1.1.1rc2.
20:28:52 INFO | A new Matplotlib is not needed on this system.
20:28:52 INFO | atfork isn't present. Will install.
20:28:52 INFO | Fetching http://python-atfork.googlecode.com/files/atfork-0.1.2.zip
20:28:53 INFO | Good checksum.
20:28:53 INFO | imported paramiko version 1.7.7.1 (George).
20:28:53 INFO | A new Paramiko is not needed on this system.
20:28:53 INFO | imported simplejson version 2.6.2.
20:28:53 INFO | A new Simplejson is not needed on this system.
20:28:53 INFO | imported httplib2 version 0.6.0.
20:28:53 INFO | A new Httplib2 is not needed on this system.
20:28:53 INFO | gwt not installed for autotest
20:28:53 INFO | Fetching http://google-web-toolkit.googlecode.com/files/gwt-2.4.0.zip
20:35:03 INFO | Good checksum.
20:35:03 INFO | tar -xzf '/usr/local/lib/python2.7/dist-packages/autotest/ExternalSource/MySQL-python-1.2.2.tar.gz'
20:35:03 INFO | '/usr/bin/python' setup.py bdist_egg
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
deleting MySQL_python.egg-info/native_libs.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
In file included from _mysql.c:35:0:
/usr/include/mysql/my_config.h:422:0: warning: "HAVE_WCSCOLL" redefined [enabled by default]
In file included from /usr/include/python2.7/pyconfig.h:3:0,
                 from /usr/include/python2.7/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h:902:0: note: this is the location of the previous definition
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql_exceptions.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql.so -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/release.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/cursors.py -> build/bdist.linux-x86_64/egg/MySQLdb
creating build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FLAG.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/ER.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CLIENT.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CR.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/REFRESH.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/times.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/connections.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/converters.py -> build/bdist.linux-x86_64/egg/MySQLdb
byte-compiling build/bdist.linux-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/release.py to release.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/times.py to times.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/converters.py to converters.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.linux-x86_64/egg/_mysql.py to _mysql.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/MySQL_python-1.2.2-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
20:35:07 INFO | unzip -q -o -d '/usr/local/lib/python2.7/dist-packages/autotest/site-packages' 'dist/MySQL_python-1.2.2-py2.7-linux-x86_64.egg'
20:35:07 INFO | unzip '/usr/local/lib/python2.7/dist-packages/autotest/ExternalSource/atfork-0.1.2.zip'
Archive:  /usr/local/lib/python2.7/dist-packages/autotest/ExternalSource/atfork-0.1.2.zip
  inflating: atfork-0.1.2/setup.py
  inflating: atfork-0.1.2/PKG-INFO
  inflating: atfork-0.1.2/atfork/__init__.py
  inflating: atfork-0.1.2/atfork/stdlib_fixer.py
  inflating: atfork-0.1.2/atfork/tests/test_atfork.py
  inflating: atfork-0.1.2/atfork/tests/test_stdlib_fixer.py
20:35:07 INFO | '/usr/bin/python' setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/atfork
copying atfork/__init__.py -> build/lib.linux-x86_64-2.7/atfork
copying atfork/stdlib_fixer.py -> build/lib.linux-x86_64-2.7/atfork
package init file 'atfork/tests/__init__.py' not found (or not a regular file)
creating build/lib.linux-x86_64-2.7/atfork/tests
copying atfork/tests/test_atfork.py -> build/lib.linux-x86_64-2.7/atfork/tests
copying atfork/tests/test_stdlib_fixer.py -> build/lib.linux-x86_64-2.7/atfork/tests
package init file 'atfork/tests/__init__.py' not found (or not a regular file)
20:35:07 INFO | '/usr/bin/python' setup.py install --no-compile --prefix='/var/tmp/tmpaniaRy'
running install
running build
running build_py
package init file 'atfork/tests/__init__.py' not found (or not a regular file)
package init file 'atfork/tests/__init__.py' not found (or not a regular file)
running install_lib
creating /var/tmp/tmpaniaRy/lib
creating /var/tmp/tmpaniaRy/lib/python2.7
creating /var/tmp/tmpaniaRy/lib/python2.7/site-packages
creating /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork
copying build/lib.linux-x86_64-2.7/atfork/__init__.py -> /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork
creating /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork/tests
copying build/lib.linux-x86_64-2.7/atfork/tests/test_atfork.py -> /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork/tests
copying build/lib.linux-x86_64-2.7/atfork/tests/test_stdlib_fixer.py -> /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork/tests
copying build/lib.linux-x86_64-2.7/atfork/stdlib_fixer.py -> /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork
running install_egg_info
Writing /var/tmp/tmpaniaRy/lib/python2.7/site-packages/atfork-0.1.2-py2.7.egg-info
20:35:07 INFO | rsync -r '/var/tmp/tmpaniaRy/lib/python2.7/site-packages/' '/usr/local/lib/python2.7/dist-packages/autotest/site-packages/'
20:35:07 INFO | unzip '/usr/local/lib/python2.7/dist-packages/autotest/ExternalSource/gwt-2.4.0.zip'

SICP CHAPTER 1 SECTION "NAMING AND ENVIRONMENT”

commandline session

$scm
SCM version 5e5, Copyright (C) 1990-2006 Free Software Foundation.
SCM comes with ABSOLUTELY NO WARRANTY; for details type `(terms)'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `(terms)' for details.
;loading /usr/share/slib/require
;done loading /usr/share/slib/require.scm
;loading /usr/share/slib/require
;done loading /usr/share/slib/require.scm
;loading /usr/lib/scm/Link
;done loading /usr/lib/scm/Link.scm
;loading /usr/lib/scm/Transcen
;done loading /usr/lib/scm/Transcen.scm
> (define a 2)
#
> (define aa 2)
#
> define a 2
(#@keyword . #<primitive-macro! #>)
> 2
> 2
> (define size 2)
#
> (define>> a 2)

;ERROR: "/usr/lib/scm/Iedline.scm": unbound variable:  define>>
; in expression: (define>> a 2)
; in top level environment.
;STACK TRACE
1; (#@let ((tail (#@lambda (c) (#@if (#@char? #@c) #@c (#@let* (( ...
2; (define>> a 2)

>