21sh may be compiled for various purposes, each option including or restricting the compilation of individual files in various ways. To compile the project with no added libraries, $> make
. To compile the project with debug options (e.g., gcc -g -fsanitize=address ...
), compile with make TEST={1|FULL}
, where TEST=FULL
will compile all project files with the debug options, and TEST=1
includes debug options only with files inside the src
directory. Similarly, make LEAKS={1|FULL}
will compile the bproject with files needed for debugging.
When executing 21sh for development purposes, two environment variables will affect the execution of the shell. When the env variable SHELL_TTY={ttyid}
is present, 21sh will open the ttyid id given and use it as the basis for STDIN|STDOUT|STDERR
of the shell. When SHELL_LEAKS
is present and set to a value, the shell will exit after a given command and hang indefinetely, until x
followed by <return>
is entered into the STDIN.
When using a debugger to debug & step through program, certain restrictions apply. Chiefly, it is not possible to currently step into/through exec_pipe or exec_command functions. Since debuggers work by emitting a SIGTRAP
signal after the next statement executed, placing one inside a child fork will cause the forked child process to fail early, returning SIGTRAP
and not executing fully nor correctly.