Index: doc/theses/lynn_tran_SE499/.gitignore
===================================================================
--- doc/theses/lynn_tran_SE499/.gitignore	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/.gitignore	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,242 @@
+## Core latex/pdflatex auxiliary files:
+*.aux
+*.lof
+*.log
+*.lot
+*.fls
+*.out
+*.toc
+*.fmt
+*.fot
+*.cb
+*.cb2
+.*.lb
+
+## Intermediate documents:
+*.dvi
+*.xdv
+*-converted-to.*
+# these rules might exclude image files for figures etc.
+# *.ps
+# *.eps
+# *.pdf
+
+## Generated if empty string is given at "Please type another file name for output:"
+.pdf
+
+## Bibliography auxiliary files (bibtex/biblatex/biber):
+*.bbl
+*.bcf
+*.blg
+*-blx.aux
+*-blx.bib
+*.run.xml
+
+## Build tool auxiliary files:
+*.fdb_latexmk
+*.synctex
+*.synctex(busy)
+*.synctex.gz
+*.synctex.gz(busy)
+*.pdfsync
+
+## Auxiliary and intermediate files from other packages:
+# algorithms
+*.alg
+*.loa
+
+# achemso
+acs-*.bib
+
+# amsthm
+*.thm
+
+# beamer
+*.nav
+*.pre
+*.snm
+*.vrb
+
+# changes
+*.soc
+
+# cprotect
+*.cpt
+
+# elsarticle (documentclass of Elsevier journals)
+*.spl
+
+# endnotes
+*.ent
+
+# fixme
+*.lox
+
+# feynmf/feynmp
+*.mf
+*.mp
+*.t[1-9]
+*.t[1-9][0-9]
+*.tfm
+
+#(r)(e)ledmac/(r)(e)ledpar
+*.end
+*.?end
+*.[1-9]
+*.[1-9][0-9]
+*.[1-9][0-9][0-9]
+*.[1-9]R
+*.[1-9][0-9]R
+*.[1-9][0-9][0-9]R
+*.eledsec[1-9]
+*.eledsec[1-9]R
+*.eledsec[1-9][0-9]
+*.eledsec[1-9][0-9]R
+*.eledsec[1-9][0-9][0-9]
+*.eledsec[1-9][0-9][0-9]R
+
+# glossaries
+*.acn
+*.acr
+*.glg
+*.glo
+*.gls
+*.glsdefs
+
+# gnuplottex
+*-gnuplottex-*
+
+# gregoriotex
+*.gaux
+*.gtex
+
+# htlatex
+*.4ct
+*.4tc
+*.idv
+*.lg
+*.trc
+*.xref
+
+# hyperref
+*.brf
+
+# knitr
+*-concordance.tex
+# TODO Comment the next line if you want to keep your tikz graphics files
+*.tikz
+*-tikzDictionary
+
+# listings
+*.lol
+
+# makeidx
+*.idx
+*.ilg
+*.ind
+*.ist
+
+# minitoc
+*.maf
+*.mlf
+*.mlt
+*.mtc[0-9]*
+*.slf[0-9]*
+*.slt[0-9]*
+*.stc[0-9]*
+
+# minted
+_minted*
+*.pyg
+
+# morewrites
+*.mw
+
+# nomencl
+*.nlg
+*.nlo
+*.nls
+
+# pax
+*.pax
+
+# pdfpcnotes
+*.pdfpc
+
+# sagetex
+*.sagetex.sage
+*.sagetex.py
+*.sagetex.scmd
+
+# scrwfile
+*.wrt
+
+# sympy
+*.sout
+*.sympy
+sympy-plots-for-*.tex/
+
+# pdfcomment
+*.upa
+*.upb
+
+# pythontex
+*.pytxcode
+pythontex-files-*/
+
+# thmtools
+*.loe
+
+# TikZ & PGF
+*.dpth
+*.md5
+*.auxlock
+
+# todonotes
+*.tdo
+
+# easy-todo
+*.lod
+
+# xmpincl
+*.xmpi
+
+# xindy
+*.xdy
+
+# xypic precompiled matrices
+*.xyc
+
+# endfloat
+*.ttt
+*.fff
+
+# Latexian
+TSWLatexianTemp*
+
+## Editors:
+# WinEdt
+*.bak
+*.sav
+
+# Texpad
+.texpadtmp
+
+# Kile
+*.backup
+
+# KBibTeX
+*~[0-9]*
+
+# auto folder when using emacs and auctex
+./auto/*
+*.el
+
+# expex forward references with \gathertags
+*-tags.tex
+
+# standalone packages
+*.sta
+
+# generated if using elsarticle.cls
+*.spl
Index: doc/theses/lynn_tran_SE499/Bibliography.bib
===================================================================
--- doc/theses/lynn_tran_SE499/Bibliography.bib	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Bibliography.bib	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,90 @@
+@misc{Reference2,
+    Abstract = {The C language is like a carving knife: simple, sharp, and extremely useful in skilled hands. Like any sharp tool, C can injure people who don't know how to handle it.},
+	Author = {Andrew Koenig},
+	Title = {Pitfalls of {C}},
+    Url = {http://www.math.pku.edu.cn/teachers/qiuzy/c/reading/pitfall.htm},
+    Year = {2001}
+}
+
+@manual{Reference3,
+	Title = {GDB: The GNU Project Debugger},
+    Url = {https://www.gnu.org/software/gdb/},
+    Year = {2018}
+}
+
+@manual{Reference4,
+	Title = {Extending GDB},
+    Url =
+    {https://sourceware.org/gdb/onlinedocs/gdb/Extending-GDB.html#Extending-GDB},
+    Year = {2018}
+}
+
+@manual{Reference5,
+	Title = {GDB Internals Manual},
+    Url = {https://sourceware.org/gdb/wiki/Internals},
+    Year = {2018}
+}
+
+@manual{Reference6,
+	Title = {Compiling for Debugging},
+    Url = {https://sourceware.org/gdb/onlinedocs/gdb/Compilation.html#Compilation},
+    Year = {2018}
+}
+
+@misc{Reference7,
+	Title = {{DWARF Debugging Standard}},
+    Url = {http://dwarfstd.org/},
+    Year = {2007}
+}
+
+@misc{Reference8,
+	Title = {{DWARF}},
+    Url = {https://en.wikipedia.org/wiki/DWARF},
+	Year = {2017}
+}
+
+@misc{Reference9,
+	Title = {{Name Mangling}},
+    Url = {https://en.wikipedia.org/wiki/Name_mangling},
+	Year = {2018}
+}
+
+@techreport{Reference10,
+	Author = {Peter A. Buhr},
+    Institution = {School of Computer Science, University of Waterloo},
+	Month = {January},
+	Title = {{$\mu$C++ Annotated Reference Manual}},
+	Url = {https://plg.uwaterloo.ca/~usystem/pub/uSystem/uC++.pdf},
+	Year = {2006}
+}
+
+@misc{Reference11,
+	Title = {{Selecting A Frame}},
+    Url = {ftp://ftp.gnu.org/old-gnu/Manuals/gdb/html_chapter/gdb_7.html#SEC44},
+    Year = {2002}
+}
+
+@misc{Reference12,
+	Title = {{Examining the Stack}},
+    Url = {ftp://ftp.gnu.org/old-gnu/Manuals/gdb/html_chapter/gdb_7.html},
+    Year = {2002}
+}
+
+@misc{Reference13,
+	Title = {{C$\mathbf{\forall} $ Language}},
+    Url = {https://cforall.uwaterloo.ca},
+    Year = {2017}
+}
+
+@misc{Reference14,
+	Title = {{KOS}},
+    Url = {https://cs.uwaterloo.ca/~mkarsten/kos.html},
+    Year = {2018}
+}
+
+@misc{Reference15,
+	Title = {{Continuing and Stepping}},
+    Url =
+    {https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html},
+    Year = {2018}
+}
Index: doc/theses/lynn_tran_SE499/Chapters/CFA.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/CFA.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/CFA.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,100 @@
+\chapter{\CFA} \label{CFA}
+
+\section{Introduction}
+Similar to \CC, C is a popular programming language especially in systems
+programming. For example, the Windows NT and Linux kernel are written in C, and they are the foundation of many higher level
+and popular projects. Therefore, it is unlikely that the programming language C is
+going to disappear any time soon.
+
+However, C has inherent problems in syntax, semantics and many
+more \cite{Reference2}. Even though \CC is meant to fix these problems, \CC has many
+irreversible legacy design choices, and newer versions of \CC require significantly more effort to convert C-based projects into \CC.
+
+To solve this problem, the programming language \CFA is being created at the University of Waterloo. The goal
+of the language is to extend C with modern language features that many new
+languages have, such as Rust and Go. Hence, the \CFA extension provides a
+backward-compatible version of C, while fixing existing problems known in C and
+modernizing the language at the same time.
+
+\section{Overloading}
+Overloading is when a compiler permits a name to have multiple meanings. All
+programming languages allow simple overloading of operators on basic types such
+as the \verb|+| operator (add) on integer and floating-point types. Most programming languages extend
+overloading of operators to user-defined types and/or general function
+overloading. \CFA also supports overloading of variables and the literals \verb|0/1|.
+
+\subsection{Variable}
+Variables in the same block are allowed to have the same name but different
+types. An assignment to a new variable uses that variable's type to infer the
+required type, and that type is used to select a variable containing the appropriate type.
+
+\begin{lstlisting}[numbers=left, xleftmargin=3.0ex, style=C++nokeyword, caption={Overloading variables in \CFA}, label={CFA-overload-var}]
+short int MAX = SHRT_MAX;
+int MAX = INT_MAX;
+double MAX = DBL_MAX;
+
+// select variable MAX based on its left-hand type
+short int s = MAX;      // s = SHRT_MAX
+int s = MAX;            // s = INT_MAX
+double s = MAX;         // s = DBL_MAX
+\end{lstlisting}
+
+The listing \ref{CFA-overload-var} shows that when variable overloading exists
+in the same scope, the variable is selected based on the left side of
+initialization/assignment and operands of the right side of the expression. For
+instance, the first assignment to variable \verb|s| at line 6, which is type short int,
+selects the MAX with the same type.
+
+\subsection{Function}
+Functions in the same block can be overloaded depending on the number and type of
+parameters and returns.
+
+\begin{lstlisting}[numbers=left, xleftmargin=3.0ex, style=C++nokeyword, caption={Overloading routines in \CFA},
+label={CFA-overload-func}]
+void f(<@\textcolor{red}{void}@>);              // (1)
+void f(<@\textcolor{red}{char}@>);              // (2)
+<@\textcolor{red}{char}@> f(void);              // (3)
+<@\textcolor{red}{[int,double]}@> f();           // (4)
+
+f();                      // pick (1)
+f('a');                   // pick (2)
+char s = f('a');          // pick (3)
+[int, double] s = f();    // pick (4)
+\end{lstlisting}
+
+The listing \ref{CFA-overload-func} shows that when many functions are overloaded in
+the same scope, a function is selected based on the combination of its return type and its
+arguments. For instance, from line 1-4, four different types of a function called
+\verb|f| are declared. For the call \verb|f('a')|, the function selected is the
+one on line 2, if the call voids the result. However, if the call assigns to a
+char, then the routine on line 3 is selected. This example can be seen on lines
+7-8.
+
+\subsection{Operator}
+An operator name is denoted with \verb|?| for the operand and any standard C
+operator. Operator names within the same block can be overloaded depending on
+the number and type of parameters and returns. However, operators \verb|&&|,
+\verb-||-, \verb|?:| cannot be overloaded because short-circuit semantics
+cannot be preserved.
+
+
+\begin{lstlisting}[style=C++nokeyword, caption={Overloading operators in \CFA},
+label={CFA-overload-ops}]
+int <@\textcolor{red}{++?}@>(int op);           // unary prefix increment
+int <@\textcolor{red}{?++}@>(int op);           // unary postfix increment
+int <@\textcolor{red}{?+?}@>(int op1, int op2); // unary postfix increment
+
+struct S { double x, double y }
+
+// overload operator plus-assignment
+S <@\textcolor{red}{?+?}@>(S a, S b) {
+    return (S) {a.x + b.x, a.y + b.y};
+}
+
+S a, b, c;
+a + b + c;
+\end{lstlisting}
+
+The listing \ref{CFA-overload-ops} shows that operator overloading is permitted
+similar to \CC. However, the difference is that the operator name is
+denoted with \verb|?| instead, and operator selection uses the return type.
Index: doc/theses/lynn_tran_SE499/Chapters/Conclusion.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/Conclusion.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/Conclusion.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,10 @@
+\chapter{Conclusion}
+New GDB extensions are created to support information display and touring among
+\uC user tasks, and new hooks are added to the GNU Debugger to support a
+\CFA demangler. The GDB extensions are implemented using the Python API, and
+the hooks to add debugging support for \CFA are implemented using \uC. For
+the GDB extensions, writing Python extensions is easier and more robust.
+Furthermore, GDB provides sufficient hooks to make it possible for a new
+language to leverage existing infrastructure and codebase to add debugging
+support. The result provides significantly new capabilities for examining and
+debugging both \uC and \CFA programs.
Index: doc/theses/lynn_tran_SE499/Chapters/Demangler.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/Demangler.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/Demangler.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,195 @@
+\chapter{\CFA Demangler} \label{demangler}
+
+\section{Introduction}
+While \CFA is a translator for additional features that C does not support,
+all the extensions compiled down to C code.  As a result, the executable file
+marks the DWARF tag \verb|DW_AT_language| with the fixed hexadecimal value for
+the C language. Because it is possible to have one frame in C code and another
+frame in Assembly code, GDB encodes a language flag for each frame. \CFA adds
+to this list, as it is essential to know when a stack frame contains mangled
+names versus C and assembler unmangled names. Thus, GDB must be told \CFA is a
+distinct source-language.
+
+\section{Design Constraints}
+Most GDB targets use the DWARF format.  The GDB DWARF reader initializes all
+the appropriate information read from the DIE structures in object or
+executable files, as mentioned in Chapter \ref{GDB}. However, GDB currently
+does not understand the new DWARF language-code assigned to the language \CFA,
+so the DWARF reader must be updated to recognize \CFA.
+
+Additionally, when a user enters a name into GDB, GDB needs to lookup if the
+name exists in the program. However, different languages may have different
+hierarchical structure for dynamic scope, so an implementation for nonlocal
+symbol lookup is required, so an appropriate name lookup routine must be added.
+
+\section{Implementation}
+Most of the implementation work discussed below is from reading GDB's internals
+wiki page and understanding how other languages are supported in GDB \cite{Reference5}.
+
+A new entry is added to GDB's list of language definition in
+\verb|gdb/defs.h|. Hence, a new instance of type \verb|struct language_def|
+must be created to add a language definition for \CFA. This instance is the
+entry point for new functions that are only applicable to \CFA. These new
+functions are invoked by GDB during debugging if there are operations that are
+applicable specifically to \CFA. For instance, \CFA can implement its own
+symbol lookup function for non-local variables because \CFA can have a
+different scope hierarchy. The final step for registering \CFA in GDB, as a
+new source language, is adding the instance of type \verb|struct language_def|
+into the list of language definitions, which is found in
+\verb|gdb/language.h|. This setup is shown in listing \ref{cfa-lang-def}.
+
+\begin{figure}
+\begin{lstlisting}[style=C++, caption={Language definition declaration for
+\CFA}, label={cfa-lang-def}, basicstyle=\small]
+// In gdb/language.h
+extern const struct language_defn cforall_language_defn;
+
+// In gdb/language.c
+static const struct language_defn *languages[] = {
+    &unknown_language_defn,
+    &auto_language_defn,
+    &c_language_defn,
+    ...
+    &cforall_language_defn,
+    ...
+ }
+
+// In gdb/cforall-lang.c
+extern const struct language_defn cforall_language_defn = {
+    "cforall",                      /* Language name */
+    "CForAll",                      /* Natural name */
+    language_cforall,
+    range_check_off,
+    case_sensitive_on,
+    ...
+    cp_lookup_symbol_nonlocal,      /* lookup_symbol_nonlocal */
+    ...
+    cforall_demangle,               /* Language specific demangler */
+    cforall_sniff_from_mangled_name,
+    ..
+}
+\end{lstlisting}
+\end{figure}
+
+The next step is updating the DWARF reader, so the reader can translate the
+DWARF code to an enum value defined above. However, this assumes that the
+language has an assigned language code.  The language code is a hexadecimal
+literal value assigned to a particular language, which is maintained by
+GCC. For \CFA, the hexadecimal value \verb|0x0025| is added to
+\verb|include/dwarf2.h| to denote \CFA, which is shown in listing
+\ref{cfa-dwarf}.
+\begin{lstlisting}[style=C++, caption={DWARF language code for \CFA},
+label={cfa-dwarf}, basicstyle=\small]
+// In include/dwarf2.h
+enum dwarf_source_language { // Source language names and codes.
+    DW_LANG_C89 = 0x0001,
+    ...
+    DW_LANG_CForAll = 0x0025,
+}
+\end{lstlisting}
+
+Once the demangler implementation goes into the \verb|libiberty| directory
+along with other demanglers, the demangler can be called by updating the
+language definition defined in listing \ref{cfa-lang-def} with the entry point
+of the \CFA demangler, and adding a check if the current demangling style is
+\verb|CFORALL_DEMANGLING| as seen in listing \ref{cfa-demangler}. GDB then
+automatically invokes this \CFA demangler when GDB detects the source language
+is \CFA. In addition to the automatic invocation of the demangler, GDB provides
+an option to manually set which demangling style to use in the command line
+interface.  This option can be turned on for \CFA in GDB by adding a new enum
+value for \CFA in the list of demangling styles along with setting the
+appropriate mask for this style in \verb|include/demangle.h|. After doing this
+step, users can now choose if they want to use the \CFA demangler in GDB by
+calling \verb|set demangle-style <language>|, where the language name is
+defined by the preprocessor macro \verb|CFORALL_DEMANGLING_STYLE_STRING| in
+listing \ref{cfa-demangler-style}.
+
+\begin{figure}
+\begin{lstlisting}[style=C++, caption={libiberty setup for the \CFA demangler},
+label={cfa-demangler}, basicstyle=\small]
+// In libiberty/cplus-dem.c
+const struct demangler_engine libiberty_demanglers[] = {
+    {
+        NO_DEMANGLING_STYLE_STRING,
+        no_demangling,
+        "Demangling disabled"
+    },
+    ...
+    {
+        CFORALL_DEMANGLING_STYLE_STRING,
+        cforall_demangling,
+        "Cforall style demangling"
+    },
+}
+...
+char * cplus_demangle(const char *mangled, int options) {
+    ...
+    /* The V3 ABI demangling is implemented elsewhere.  */
+    if (GNU_V3_DEMANGLING || RUST_DEMANGLING || AUTO_DEMANGLING) { ... }
+    ...
+    if (CFORALL_DEMANGLING) {
+        ret = cforall_demangle (mangled, options);
+        if (ret) { return ret; }
+    }
+}
+\end{lstlisting}
+
+\begin{lstlisting}[style=C++, caption={Setup \CFA demangler style},
+label={cfa-demangler-style}, basicstyle=\small]
+// In gdb/demangle.h
+#define DMGL_CFORALL (1 << 18)
+...
+/* If none are set, use 'current_demangling_style' as the default. */
+#define DMGL_STYLE_MASK
+(DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3
+|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST|DMGL_CFORALL)
+...
+extern enum demangling_styles {
+    no_demangling = -1,
+    unknown_demangling = 0,
+    ...
+    cforall_demangling = DMGL_CFORALL
+} current_demangling_style;
+...
+#define CFORALL_DEMANGLING_STYLE_STRING  "cforall"
+...
+#define CFORALL_DEMANGLING (((int)CURRENT_DEMANGLING_STYLE)&DMGL_CFORALL)
+\end{lstlisting}
+\end{figure}
+
+However, the setup for the \CFA demangler above does not demangle mangled
+symbols during symbol-table lookup while the program is in progress. Therefore,
+additional work needs to be done in \verb|gdb/symtab.c|. Prior to looking up
+the symbol, GDB attempts to demangle the name of the symbol, which can either
+be a mangled or unmangled name, to see if it can detect the language, and select
+the appropriate demangler to demangle the symbol. This work enables invocation
+of the \CFA demangler during symbol lookup.
+\begin{lstlisting}[style=C++, caption={\CFA demangler setup for symbol lookup},
+label={cfa-symstab-setup}, basicstyle=\small]
+// In gdb/symtab.c
+const char * demangle_for_lookup ( const char *name, enum language lang,
+                                   demangle_result_storage &storage ) {
+    /* When using C++, D, or Go, demangle the name before doing a
+       lookup to use the binary search. */
+    if (lang == language_cplus) {
+        char *demangled_name = gdb_demangle(name, DMGL_ANSI|DMGL_PARAMS);
+        if (demangled_name != NULL)
+            return storage.set_malloc_ptr (demangled_name);
+    }
+    ...
+    else if (lang == language_cforall) {
+        char *demangled_name = cforall_demangle (name, 0);
+        if (demangled_name != NULL)
+            return storage.set_malloc_ptr (demangled_name);
+    }
+    ...
+}
+\end{lstlisting}
+
+\section{Result}
+The addition of hooks throughout GDB enables the invocation of the new \CFA
+demangler during symbol lookup and during the usage of \verb|binutils| tools
+such as \verb|objdump| and \verb|nm|. Additionally, these \verb|binutils| tools
+also understand \CFA because of the addition of the \CFA language code.
+However, as the language develops, symbol lookup for non-local variables must
+be implemented to produce the correct output.
Index: doc/theses/lynn_tran_SE499/Chapters/Extensions.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/Extensions.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/Extensions.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,368 @@
+\chapter{Extending GDB for \uC}
+
+\section{Introduction}
+A sequential program has a single call stack. A debugger knows about this call stack and provides
+commands to walk up/down the call frames to examine the values of local variables, as well as global
+variables. A concurrent program has multiple call stacks (for coroutines/tasks), so a debugger must
+be extended to locate these stacks for examination, similar to a sequential stack.  For example,
+when a concurrent program deadlocks, looking at the task's call stack can locate the resource and
+the blocking cycle that resulted in the deadlock. Hence, it is very useful to display the call stack
+of each task to know where it is executing and what values it is currently computing. Because each
+programming language's concurrency is different, GDB has to be specifically extended for \uC.
+
+\section{Design Constraints}
+As mentioned in Chapter \ref{GDB}, there are several ways to extend GDB. However, there are a few
+design constraints on the selected mechanism. All the functions implemented should maintain similar
+functionality to existing GDB commands. In addition to functional requirements, usability and
+flexibility are requirements for this project. These final requirements enable developers to be
+productive quickly and do more with the extensions. The extensions created for \uC are simple to use
+and versatile.
+
+The following new GDB command are all implemented through the Python API for GDB.  Python is a
+scripting language with built-in data structures and functions that enables the development of more
+complex operations and saves time on development.
+
+\section{\uC source-code example}
+Listing \ref{uC-src-code} shows a \uC program that implicitly creates two clusters, system and user,
+which implicitly have a processor (kernel thread) and processor task. The program explicitly creates
+three additional processors and ten tasks on the user cluster.
+
+\begin{figure}
+\begin{lstlisting}[numbers=left, xleftmargin=4.0ex, style=C++, caption={\uC source code used for GDB commands},label={uC-src-code}, basicstyle=\small]
+_Task T {
+    const int tid;
+    std::string name;
+
+    void f(int param) {
+        if ( param != 0 ) f( param - 1 );	// recursion
+	for ( volatile size_t i = 0; i < 100000000; i += 1 ); // delay
+        int x = 3;
+        std::string y = "example";
+    }						// breakpoint
+    void main() {
+	if ( tid != 0 )				// T0 goes first
+	    for ( volatile size_t i = 0; i < 1000000000; i += 1 ) // delay
+		if ( i % 10000000 == 0 ) yield(); // execute other tasks
+        f(3);
+    }
+  public:
+    T(const int tid) : tid( tid ) {
+        name = "T" + std::to_string(tid);
+        setName(name.c_str());
+    }
+};
+int main() {
+    uProcessor procs[3];			// extra processors
+    const int numTasks = 10;
+    T * tasks[numTasks];			// extra tasks
+    // allocate tasks with different names
+    for (int id = 0; id < numTasks; id += 1) {
+        tasks[id] = new T(id);
+    }
+    // deallocate tasks
+    for (int id = 0; id < numTasks; id += 1) {
+        delete tasks[id];
+    }
+}
+\end{lstlisting}
+\end{figure}
+
+\section{Existing User-defined GDB Commands}
+Listing \ref{uC-callstack} shows the GDB output at the base case of the recursion for one of the
+tasks created in the \uC program in listing \ref{uC-src-code}.  The task is stopped at line 10. The
+backtrace shows the three calls to function \verb|f|, started in the task's \verb|main|. The top two
+frames (5 and 6) are administrative frames from \uC. The values of the argument and local variables
+are printed.
+\begin{lstlisting}[caption={Call stack of function \texttt{a} in the \uC
+program from listing \ref{uC-src-code}}, label={uC-callstack}, basicstyle=\small\tt]
+(gdb) backtrace
+#0  T::f (this=0xa4f950, param=0) at test.cc:10
+#1  0x000000000041e509 in T::f (this=0xa4f950, param=1) at test.cc:6
+#2  0x000000000041e509 in T::f (this=0xa4f950, param=2) at test.cc:6
+#3  0x000000000041e509 in T::f (this=0xa4f950, param=3) at test.cc:6
+#4  0x000000000041e654 in T::main (this=0xa4f950) at test.cc:15
+#5  0x0000000000428de2 in ...::invokeTask (This=...) at ...
+#6  0x0000000000000000 in ?? ()
+(gdb) info args
+this = 0xa4f950
+param = 0
+(gdb) info locals
+x = 3
+y = "example"
+\end{lstlisting}
+
+\subsection{Listing all clusters in a \uC program}
+Listing \ref{clusters-command} shows the new command \verb|clusters| to list all program clusters
+along with their associated address.  The output shows the two \uC implicitly created clusters.
+\begin{lstlisting}[caption={clusters command}, label={clusters-command}, basicstyle=\small\tt]
+(gdb) clusters
+                Name           Address
+       systemCluster          0x65a300
+         userCluster          0x7ca300
+\end{lstlisting}
+
+\subsection{Listing all processors in a cluster}
+Listing \ref{cluster-procs} shows the new command \verb|processors|, which requires a cluster
+argument to show all the processors in that cluster. In particular, this example shows that there
+are four processors in the \verb|userCluster|, with their associated address, PID, preemption and
+spin.
+\begin{lstlisting}[caption={processors command}, label={cluster-procs}, basicstyle=\small\tt]
+(gdb) processors
+           Address                 PID          Preemption                Spin
+          0x7ccc30             8421504                  10                1000
+          0x8c9b50             9478272                  10                1000
+          0x8c9d10            10002560                  10                1000
+          0x8c9ed0            10530944                  10                1000
+\end{lstlisting}
+
+\subsection{Listing all tasks in all clusters}
+Listing \ref{tasks} shows the new command \verb|task| with the \verb|all| argument to list all the
+tasks in a \uC program at this point in the execution snapshot.  The internal \uC threads
+(implicitly created) are numbered with negative identifiers, while those created by the application
+are numbered with zero/positive. The \verb|*| indicates the \uC thread (\verb|T0|) that encountered
+the breakpoint at line 10. GDB stops all execution and the states of the other threads are ready,
+running, or blocked. If the argument \verb|all| is removed, only internal information about the
+\verb|userCluster| and its implicitly created threads is printed, which is sufficient for most
+applications.
+\begin{lstlisting}[caption={task command for displaying all tasks for all clusters}, label={tasks}, basicstyle=\footnotesize\tt]
+(gdb) task all
+        Cluster Name           Address
+       systemCluster          0x65a300
+  ID           Task Name           Address                    State
+  -1      uProcessorTask          0x6c99c0       uBaseTask::Blocked
+  -2         uSystemTask          0x789f40       uBaseTask::Blocked
+         userCluster          0x7ca300
+  ID           Task Name           Address                    State
+  -1      uProcessorTask          0x80ced0       uBaseTask::Blocked
+  -2           uBootTask          0x659dd0       uBaseTask::Blocked
+   0                main    0x7fffffffe490       uBaseTask::Blocked
+  -3      uProcessorTask          0x90e810       uBaseTask::Blocked
+  -4      uProcessorTask          0x98ee00       uBaseTask::Blocked
+  -5      uProcessorTask          0xa0f3f0       uBaseTask::Blocked
+ * 1                  T0          0xa4f950       uBaseTask::Running
+   2                  T1          0xa8fce0       uBaseTask::Running
+   3                  T2          0xad0070       uBaseTask::Running
+   4                  T3          0xb10400         uBaseTask::Ready
+   5                  T4          0xb50790         uBaseTask::Ready
+   6                  T5          0xb90b20         uBaseTask::Ready
+   7                  T6          0xbd0eb0         uBaseTask::Ready
+   8                  T7          0xc11240         uBaseTask::Ready
+   9                  T8          0xc515d0       uBaseTask::Running
+  10                  T9          0xc91960         uBaseTask::Ready
+\end{lstlisting}
+
+\subsection{Listing all tasks in a cluster}
+Listing \ref{cluster-tasks} shows the new command \verb|task| with a cluster argument to list only
+the names of the tasks on that cluster.  In this version of the command \verb|task|, the associated
+address for each task and its state is displayed.
+\begin{lstlisting}[caption={task command for displaying all tasks in a cluster}, label={cluster-tasks}, basicstyle=\small\tt]
+(gdb) task systemCluster
+  ID           Task Name           Address                    State
+  -1      uProcessorTask          0x6c99c0       uBaseTask::Blocked
+  -2         uSystemTask          0x789f40       uBaseTask::Blocked
+\end{lstlisting}
+
+\section{Changing Stacks}
+The next extension for displaying information is writing new commands that allow stepping from one
+\uC task to another. Each switching remembers the task tour in a LIFO way. This semantics means push
+and pop commands are needed. The push is performed by the \verb|task| command with a task argument.
+The pop is performed by the new command \verb|prevtask| or shorthand \verb|prev|.
+
+\subsection{Task Switching}
+The task argument for pushing is a relative id within a cluster or absolute address on any
+cluster. For instance, to switch from any task to task \verb|T2| seen in listing \ref{tasks}, the
+first command in listing \ref{task-addr-arguments} uses relative id (3) implicitly from the
+\verb|userCluster|, the second command uses an absolute address (\verb|0xad0070|), and the third
+command uses relative id (3) with the explicit \verb|userCluster|. Core functionality of these
+approaches is the same. Finally, the \verb|prevtask| command is used to unwind the stack until it is
+empty.
+\begin{lstlisting}[caption={task command arguments}, label={task-addr-arguments}, basicstyle=\small\tt]
+(gdb) task 3
+(gdb) task 0xad0070
+(gdb) task 3 userCluster
+(gdb) prevtask
+...
+(gdb) prev
+...
+(gdb) prev
+...
+(gdb) prev
+empty stack
+\end{lstlisting}
+
+
+\subsection{Switching Implementation}
+To implement the task tour, it is necessary to store the context information for every context
+switching. This requirement means the \verb|task| command needs to store this information every time
+it is invoked.
+
+\begin{figure}
+    \centering
+    \includegraphics[width=8cm]{uContext_stack}
+    \caption{Machine context (uMachContext) for each task}
+    \label{machine-context}
+
+\vspace*{0.5in}
+
+\begin{lstlisting}[style=Python, caption={Abridged \texttt{push\_task} source code}, label={pushtask-code}, basicstyle=\small\tt]
+# get GDB type of uContext_t *
+uContext_t_ptr_type = gdb.lookup_type('UPP::uMachContext::uContext_t').pointer()
+
+# retrieve the context object from a task and cast it to the type uContext_t *
+task_context = task['context'].cast(uContext_t_ptr_type)
+
+# the offset where sp would be starting from uSwitch function
+sp_address_offset = 48
+# lookup the value of stack pointer (sp), frame pointer (fp),
+# program counter (pc)
+xsp = task_context['SP'] + sp_address_offset
+xfp = task_context['FP']
+if not gdb.lookup_symbol('uSwitch'):
+    print('uSwitch symbol is unavailable')
+    return
+
+# This value is calculated here because we always here when the task is in
+# blocked state
+xpc = get_addr(gdb.parse_and_eval('uSwitch').address + 28)
+# must switch back to frame-0 to set 'pc' register with the value of xpc
+gdb.execute('select-frame 0')
+
+# retrieve register values and push sp, fp, pc into a global stack
+global STACK
+sp = gdb.parse_and_eval('$sp')
+fp = gdb.parse_and_eval('$fp')
+pc = gdb.parse_and_eval('$pc')
+stack_info = StackInfo(sp = sp, fp = fp, pc = pc)
+STACK.append(stack_info)
+
+# update registers for new task
+gdb.execute('set $rsp={}'.format(xsp))
+gdb.execute('set $rbp={}'.format(xfp))
+gdb.execute('set $pc={}'.format(xpc))
+\end{lstlisting}
+\end{figure}
+
+Figure \ref{machine-context} shows a task points to a structure containing a \verb|uContext_t| data
+structure, storing the stack and frame pointer, and the stack pointer. Listing \ref{pushtask-code}
+shows these pointers are copied into an instance of the Python tuple \verb|StackInfo| for every
+level of task switching. This tuple also stores information about the program counter that is
+calculated from the address of the \verb|uSwitch| assembly function because a task always stops in
+\verb|uSwitch| when its state is blocked.  Similarly, switching commands retrieve this context
+information but from the task that a user wants to switch to, and sets the equivalent registers to
+the new values.
+
+To push using the \verb|task| command, the value of the hardware stack pointer \verb|rsp| register,
+frame pointer \verb|rbp| register, and program counter register \verb|pc| are copied from the
+blocked task's save-area to the Python stack.  To pop using the \verb|prevtask| command, the three
+registers are moved from the Python stack to the appropriate hardware registers. Popping an empty
+stack prints a warning.
+
+Note, for tasks running when a breakpoint is encountered, the task's save-area is out-of-date; i.e.,
+the save area is only updated on a context switch, and a running task's stack represents the current
+unstored state for that task, which will be stored at the next context switch. Hence, to examine
+running tasks, it is necessary to use the GDB \verb|info threads| and \verb|thread| commands to
+examine and then step onto running tasks.
+
+Listing \ref{rr-tasks} shows how to examine ready and running tasks. Task \verb|T3| is ready (see
+Listing \ref{tasks}) because it was forced to context switch because of a time-slice preemption.
+Switching to \verb|T3|, which is relative id 4, and listing its the backtrace (stack frames) shows
+frames 0--6, which are the execution sequence for a time-slice preemption (and can be ignored), and
+frames 7--9, which are the frames at the point of preemption.  Frame 7 shows \verb|T3| is at line 14
+in the test program (see Listing \ref{uC-src-code}). Switching to running task \verb|T1|, which is
+relative id 2 (see Listing \ref{tasks}), and listing its backtrace shows a similar backtrace to
+ready task \verb|T3|. However, this backtrace contains stale information.  The GDB command
+\verb|info threads| shows the status of each kernel thread in the application, which represents the
+true location of each running thread. By observation, it can be seen that thread 2 is executing task
+\verb|0xa8fce0|, which is task \verb|T1|. Switching to kernel thread 2 via GDB command
+\verb|thread 2| and listing its backtrace show that task \verb|T1| is current executing at line 13
+in the test program.
+
+\begin{figure}
+\begin{lstlisting}[numbers=left, xleftmargin=3.0ex, caption={Examine ready/running tasks}, label={rr-tasks}, basicstyle=\footnotesize\tt]
+(gdb) task 4
+#0  T::f (this=0xa4f950, param=0) at test.cc:10
+(gdb) backtrace
+#0  uSwitch () at /u0/usystem/software/u++-7.0.0/src/kernel/uSwitch-x86_64.S:64
+#1  0x000000000042bd5c in uBaseCoroutine::taskCxtSw (this=0x8c9d28) ...
+#2  0x000000000042fff4 in UPP::uProcessorKernel::scheduleInternal ...
+#3  0x000000000042d4b6 in uBaseTask::uYieldInvoluntary ...
+#4  0x000000000042172f in uKernelModule::rollForward ...
+#5  0x000000000042f4fe in UPP::uSigHandlerModule::sigAlrmHandler ...
+#6  <signal handler called>
+#7  0x000000000041e620 in T::main (`this=0xb10400`) at test.cc:14
+#8  0x0000000000428de2 in UPP::uMachContext::invokeTask (This=...) ...
+#9  0x0000000000000000 in ?? ()
+(gdb) task 2
+(gdb) backtrace
+#0  uSwitch () at /u0/usystem/software/u++-7.0.0/src/kernel/uSwitch-x86_64.S:64
+#1  0x000000000042bd70 in uBaseCoroutine::taskCxtSw (this=0x8c9b68) ...
+#2  0x000000000042fff4 in UPP::uProcessorKernel::scheduleInternal ...
+#3  0x000000000042d4b6 in uBaseTask::uYieldInvoluntary ...
+#4  0x000000000042172f in uKernelModule::rollForward ...
+#5  0x000000000042f50c in UPP::uSigHandlerModule::sigAlrmHandler ...
+#6  <signal handler called>
+#7  0x000000000041e620 in T::main (`this=0xa8fce0`) at test.cc:14
+#8  0x0000000000428de2 in UPP::uMachContext::invokeTask (This=...) ...
+#9  0x0000000000000000 in ?? ()
+(gdb) info threads
+  Id Target Id                           Frame 
+  1  Thread 0x7ffff7fc8780 (LWP 7425) "a.out" 0x00007ffff6d74826 in ...
+  2  Thread 0x808080 (LWP 7923) "a.out"  0x41e5fc in T::main `(this=0xa8fce0`) at test.cc:13
+* 3  Thread 0x90a080 (LWP 7926) "a.out"  uSwitch () ...
+  4  Thread 0x98a080 (LWP 7929) "a.out"  T::main (this=0xad0070) at test.cc:14
+  5  Thread 0xa0b080 (LWP 7931) "a.out"  0x41e629 in T::main (this=0xc515d0) at test.cc:14
+(gdb) thread 2
+#1  0x000000000041e509 in T::f (this=0xa4f950, param=1) at test.cc:6
+6	        if ( param != 0 ) f( param - 1 );	// recursion
+[Switching to thread 2 (Thread 0x808080 (LWP 7923))]
+#0  0x000000000041e5fc in T::main (`this=0xa8fce0`) at test.cc:13
+13		    for ( volatile size_t i = 0; i < 1000000000; i += 1 ) // delay
+(gdb) backtrace
+#0  0x000000000041e5fc in T::main (`this=0xa8fce0`) at test.cc:13
+#1  0x0000000000428de2 in UPP::uMachContext::invokeTask (This=...) ...
+#2  0x0000000000000000 in ?? ()
+\end{lstlisting}
+\end{figure}
+
+\subsection{Continuing Implementation}
+When a breakpoint or error is encountered, all concurrent execution stops.  The state of the program
+can now be examined and changed; after which the program may be continued. Continuation must always
+occur from the top of the stack (current call) for each task, and at the specific task where GDB
+stopped execution.
+
+However, during a task tour, the new GDB commands change the notion of the task where execution
+stopped to make it possible to walk other stacks.  Hence, it is a requirement for continuation that
+the task walk always return to frame-0 of the original stopped task before any program continuation
+\cite{Reference11}.
+
+% For every new function call, a new stack frame is created and the values of all the registers are
+% changed for that frame. Therefore, in order to see the true value of hardware registers, innermost
+% frame that is frame-0 must be selected \cite{Reference11}. However, it is possible to not be in
+% frame-0, so prior to setting these values, the command must switch back to the innermost
+% (currently executing) frame first.
+
+To provide for this requirement, the original stop task is implicitly remembered, and there is a new
+\verb|reset| command that \emph{must} be explicitly executed before any continuation to restore the
+locate state.  To prevent errors from forgetting to call the \verb|reset| command, additional hooks
+are added to the existing built-in GDB continuation commands to implicitly call \verb|reset|. The
+following list of these commands results from GDB documentation \cite{Reference15} and similar work
+done for KOS \cite{Reference14}.
+\begin{lstlisting}[caption={Built-in GDB commands that allow continuation of a program}, label={continue-cmds}, basicstyle=\small\tt]
+continue,next,nexti,step,stepi,finish,advance,jump,signal,until,run,thread,
+reverse-next,reverse-step,reverse-stepi,reverse-continue,reverse-finish
+\end{lstlisting}
+
+% These hooks call a new command called \verb|reset| prior to executing the command to enable
+% continuation of a program to ensure that the program's context is automatically switched back to
+% the context of the task that initiates the first context switch. The \verb|reset| command behaves
+% as same as the command \verb|prevtask|, however, it goes back directly to where the task is when
+% the program last stops, which is the first task in the task tour.
+
+\section{Result}
+The current implementation successfully allows users to display a snapshot of \uC execution with
+respect to clusters, processors, and tasks. With this information it is possible to tour the call
+stacks of the tasks to see execution locations and data values. Additionally, users are allowed to
+continue the execution where the program last pauses assuming that the program has not crashed. The
+continuation of execution is done by automatically reversing the task walk from any existing GDB
+commands such as \verb|continue|, or a user can manually reverse the task walk using the command
+\verb|prevtask| and then continue.
Index: doc/theses/lynn_tran_SE499/Chapters/GDB.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/GDB.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/GDB.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,73 @@
+\chapter{GNU Debugger} \label{GDB}
+
+\section{Introduction}
+The GNU Project Debugger is a program that allows examination of what is going on
+inside another program while it executes, or examines the state of a program
+after it crashed \cite{Reference3}.
+
+\section{Debug Information}
+In order to allow effective inspection of program state, the
+debugger requires debugging information for a program. Debugging
+information is a collection of data generated by a compiler and/or an assembler
+program. This information is optional as it is only required for compilation,
+and hence, it is normally not present during program execution when debugging
+occurs. When requested, debugging information is stored in an object file, and it describes
+information such as the type of each variable or function and
+the correspondence between source line numbers and addresses in the executable
+code \cite{Reference6}. Debugging information is requested via the \verb|-g|
+flag during the compilation stage of the
+program.
+
+The debugging information must be written out in a canonical format for
+debuggers to read. DWARF is one of the supported debugging data formats, and its architecture is
+independent and applicable to any language, operating system, or processor \cite{Reference7}. This format uses a data structure called DIE to represent
+each variable, type, function, etc. A DIE is a pair: tag
+and its attribute \cite{Reference8}.
+
+\section{Stack-Frame Information}
+A stack frame, or frame for short, is a collection of all data associated with
+one function call. A frame consists of parameters received from the function call, local variables declared in that
+function, and the address where the
+function returns. The frame-pointer register stores the address of a frame,
+during execution of a call. A call stack can have many frames \cite{Reference12}.
+
+\section{Extending GDB}
+GDB provides three mechanisms for extending itself. The first is
+composition of GDB commands, the second is using the Python GDB API, and the third is defining new aliases for existing commands.
+
+\section{Symbol Handling}
+Symbols are a key part of GDB's operation. Symbols can be variables, functions and
+types. GDB has three kinds of symbol tables:
+\begin{itemize}
+    \item \textcolor{ForestGreen}{Full symbol-tables (symtabs)}: These contain the main information
+        about symbols and addresses
+    \item \textcolor{ForestGreen} {Partial symbol-tables (psymtabs)}: These contain enough information to
+        know when to read the corresponding part of the full symbol-table.
+    \item \textcolor{ForestGreen}{Minimal symbol-tables (msymtabs)}: These
+        contain information extracted from non-debugging symbols.
+\end{itemize}
+
+Debugging information for a large program can be very large, and reading all of
+these symbols can be a performance bottleneck in GDB, affecting the user
+experience. The solution is to lazily construct partial symbol-tables consisting of
+only selected symbols, and then eagerly expand them to full symbol-tables when
+necessary.
+The psymtabs is constructed by doing a quick pass over the executable file's
+debugging information.
+
+\section{Name Demangling in GDB}
+The library \verb|libiberty| provides many functions and features that can be
+divided into three groups:
+\begin{itemize}
+    \item \textcolor{ForestGreen}{Supplemental functions}: additional functions
+        that may be missing in
+        the underlying operating system.
+    \item \textcolor{ForestGreen}{Replacement functions}: simple and unified equivalent functions for
+        commonly used standard functions.
+    \item \textcolor{ForestGreen}{Extensions}: additional functions beyond the standard.
+\end{itemize}
+
+In particular, this library provides the \CC demangler that is used in GDB and
+by \uC. A new
+demangler can also be added in this library, which is what Rust did, and what
+is necessary for \CFA.
Index: doc/theses/lynn_tran_SE499/Chapters/Introduction.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/Introduction.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/Introduction.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,67 @@
+\chapter{Introduction} \label{introduction}
+Computer programming languages provide humans a means to instruct computers to
+perform a particular task. New programming languages are
+invented to simplify the task, or provide additional features, enhance
+performance, and improve developer productivity.
+
+A crucial companion tool to a programming language is a debugger. A debugger is a productivity tool to aid developers in testing
+and finding bugs in a program. By definition, a debugger executes
+any program written in one of a supported set of languages and allows developers
+to stop, monitor and examine state in the program for further investigation.
+
+Specifically, this report talks about how to add GNU Debugger (GDB) support for the
+concurrent programming-languages \uC and \CFA.
+Both languages provide an $M$:$N$ concurrency model, where $M$ user-level threads
+execute on $N$ kernel-level threads.
+Often debuggers either do not know about concurrency or only provide a simple
+understanding of concurrency provided by the operating system (kernel threads).
+For \CFA, new hooks are also added to allow GDB to understand that
+\CFA is a new source language that requires invocation of a demangler for
+variable and function names.
+
+Because \uC is a translator, all the code written in \uC is eventually
+compiled down to \CC code. This transformation gives \uC an advantage with
+GDB because GDB already understands \CC. However, since \uC introduced new objects
+and high-level execution constructs into the language, GDB does not understand
+these objects or the runtime environment. One objective of this
+project is to write new GDB extensions to understand concurrency among tasks, a new high-level execution construct that is discussed more in Chapter \ref{uC}.
+
+Additionally, if a programming language provides overloading functionality,
+which allows functions or variables in the same scope with the
+same identifier, then each of these entities must be assigned a unique name, otherwise,
+there are name collisions.
+
+However, uniquely numbering (naming) overloads is impossible with separate
+compilation, because the compiler does not have access to all translation
+units. Therefore, it is necessary to adopt a scheme related to the overloading
+mechanism for unique naming. For example, if a language uses the number and
+types of function parameters to disambiguate function names, than the number
+and parameter types are encoded into the name:
+\begin{lstlisting}[basicstyle=\normalfont\tt]
+void f( int i, double d, char c );  // f_3_i_d_c
+void f( int i, char c );            // f_2_i_c
+\end{lstlisting}
+Here, the mangled names for \lstinline@f@ contain the number of parameters and a code for
+each parameter type. For a complex type-system, the type codes become
+correspondingly complex, e.g., a generic structure. These names are now unique
+across all translation units.
+
+Unfortunately, a debugger only has access to the mangled names in a compiled
+translation units, versus the unmangled names in the program.  Therefore, the
+debugger can only look up mangled names versus original program names, which
+makes debugging extremely difficult for programmers. To solve this program, the
+language must provide the debugger with a "demangled" so it can convert
+mangled names back to program names, and correspondingly retrieve the type of
+the name~\cite{Reference9}.
+
+\CFA, a new language being developed at the University of Waterloo, has
+overloading, so names resolved by the debugger are mangled names. Therefore,
+another objective of this project is to add a \CFA demangler to GDB.
+
+% Name mangling is a technique used in compilers to resolve this
+% problem. This technique provides a mechanism to encode additional information in the
+% name of a function, or a variable to supply more semantic information from
+% compiler to debugger \cite{Reference9}. \CFA, a new language being developed at the University of
+% Waterloo, has overloading, so names resolved from
+% the debugger are mangled names. As with early versions of \CC, it is not user-friendly to debug a program using
+% mangled names. Therefore, another objective of this project is to add a \CFA demangler in GDB.
Index: doc/theses/lynn_tran_SE499/Chapters/uCPP.tex
===================================================================
--- doc/theses/lynn_tran_SE499/Chapters/uCPP.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Chapters/uCPP.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,46 @@
+\chapter{\uC} \label{uC}
+
+\section{Introduction}
+\uC \cite{Reference10} extends the \CC programming language with new
+mechanisms to
+facilitate control flow, and adds new objects to enable lightweight concurrency
+on uniprocessor and parallel execution on multiprocessor computers. Concurrency has tasks
+that can context switch, which is a control transfer from one execution state to
+another that is different from a function call. Tasks are selected to run on a
+processor from a ready queue of available tasks, and tasks may need to wait for an occurrence of an event.
+
+\section{Tasks}
+A \textcolor{ForestGreen}{task} behaves like a class object, but it maintains its own
+thread and execution state, which is the state information required to allow
+independent execution. A task provides mutual exclusion by default for calls to its
+public members. Public members allow communication among tasks.
+
+\section{\uC Runtime Structure}
+\uC introduces two new runtime entities for controlling concurrent execution:
+\begin{itemize}
+    \item Cluster
+    \item Virtual processor
+\end{itemize}
+
+\subsection{Cluster}
+A cluster is a group of tasks and virtual processors (discussed next) that
+execute tasks. The objective of a cluster is to control the amount of possible
+parallelism among tasks, which is only feasible if there are multiple
+hardware processors (cores).
+
+At the start of a \uC program, two clusters are created. One is the system
+cluster and the other is the user cluster. The system cluster has a processor
+that only performs management work such as error detection and correction from
+user clusters, if an execution in a user cluster results in errors, and cleans
+up at shutdown. The user cluster manages and executes user tasks on its
+processors. The benefits of clusters are maximizing utilization of processors
+and minimizing runtime through a scheduler that is appropriate for a particular
+workload. Tasks and virtual processors may be migrated among clusters.
+
+\subsection{Virtual Processor}
+A virtual processor is a software emulation of a processor that executes
+threads. Kernel threads are used to implement a virtual processor, which are
+scheduled for execution on a hardware processor by the underlying operating
+system. The operating system distributes kernel threads across a number of
+processors assuming that the program runs on a multiprocessor architecture. The
+usage of kernel threads enables parallel execution in \uC.
Index: doc/theses/lynn_tran_SE499/LICENSE
===================================================================
--- doc/theses/lynn_tran_SE499/LICENSE	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/LICENSE	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
Index: doc/theses/lynn_tran_SE499/SE499-master/.gdbinit
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/.gdbinit	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/.gdbinit	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,41 @@
+handle SIGALRM nostop noprint pass
+handle SIGUSR1 nostop noprint pass
+source utils-gdb.gdb
+source utils-gdb.py
+break test.cc:10
+# echo (gdb) run\n
+# run
+# echo (gdb) backtrace\n
+# backtrace
+# echo (gdb) info args\n
+# info args
+# echo (gdb) info local\n
+# info local
+# echo (gdb) clusters\n
+# clusters
+# echo (gdb) processors\n
+# processors
+# echo (gdb) task all\n
+# task all
+# echo (gdb) task systemCluster\n
+# task systemCluster
+# echo (gdb) task 3\n
+# task 3
+# echo (gdb) task 0xad0070\n
+# task 0xad0070
+# echo (gdb) task 3 userCluster\n
+# task 3 userCluster
+# echo (gdb) info threads\n
+# info threads
+# echo (gdb) thread 2\n
+# thread 2
+# echo (gdb) backtrace\n
+# backtrace
+# echo (gdb) task 6\n
+# task 6
+# echo (gdb) backtrace\n
+# backtrace
+# echo (gdb) prev\n
+# prev
+# echo (gdb) backtrace\n
+# backtrace
Index: doc/theses/lynn_tran_SE499/SE499-master/README.md
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/README.md	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/README.md	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,26 @@
+# SE499
+## How to use the extension
+* Compile utils-gdb.cpp
+* Ensure utils-gdb.py is in the same folder as the object file of utils.cpp
+* Run Makefile with -single flag if it's uniprocessor and with -multi if it's
+  multiprocessor
+    Ex: `make multi`
+* Run `gdb ./utils`
+* Verify that the python extension was properly loaded `info auto-load`. The
+  command should indicate the utils-gdb.py extension was loaded as a script
+* Run the program and call any of the commands as wish
+
+Or simplier solution:
+* Run gdb and then call command `source utils-gdb.py`
+
+## List of commands
+* clusters
+* processors <cluster_name>
+* task
+* task <cluster_name>
+* task <task_address>
+* task <task_name>
+* task <cluster_name> <task_id>
+* poptask
+
+https://github.com/lynnt/SE499
Index: doc/theses/lynn_tran_SE499/SE499-master/test.cc
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/test.cc	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/test.cc	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,39 @@
+_Task T {
+    const int tid;
+    std::string name;
+
+    void f(int param) {
+        if ( param != 0 ) f( param - 1 );	// recursion
+	for ( volatile size_t i = 0; i < 100000000; i += 1 ); // delay
+        int x = 3;
+        std::string y = "example";
+    }						// breakpoint
+    void main() {
+	if ( tid != 0 )				// T0 goes first
+	    for ( volatile size_t i = 0; i < 1000000000; i += 1 ) // delay
+		if ( i % 10000000 == 0 ) yield(); // execute other tasks
+        f(3);
+    }
+  public:
+    T(const int tid) : tid( tid ) {
+        name = "T" + std::to_string(tid);
+        setName(name.c_str());
+    }
+};
+int main() {
+    uProcessor procs[3];			// extra processors
+    const int numTasks = 10;
+    T * tasks[numTasks];			// extra tasks
+    // allocate tasks with different names
+    for (int id = 0; id < numTasks; id += 1) {
+        tasks[id] = new T(id);
+    }
+    // deallocate tasks
+    for (int id = 0; id < numTasks; id += 1) {
+        delete tasks[id];
+    }
+}
+
+// Local Variables: //
+// compile-command: "u++-work test.cc -g -multi" //
+// End: //
Index: doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.gdb
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.gdb	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.gdb	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,75 @@
+# 'server' keyword disables confirmation dialog when re-loading/re-defining
+# 'reset' restores the registers to the stack values at breakpoint to allow the movement commands to work correctly
+server define hook-continue
+reset
+end
+
+server define hook-next
+reset
+end
+
+server define hook-nexti
+reset
+end
+
+server define hook-step
+reset
+end
+
+server define hook-stepi
+reset
+end
+
+server define hook-finish
+reset
+end
+
+server define hook-advance
+reset
+end
+
+server define hook-jump
+reset
+end
+
+server define hook-signal
+reset
+end
+
+server define hook-until
+reset
+end
+
+server define hook-reverse-next
+reset
+end
+
+server define hook-reverse-step
+reset
+end
+
+server define hook-reverse-stepi
+reset
+end
+
+server define hook-reverse-continue
+reset
+end
+
+server define hook-reverse-finish
+reset
+end
+
+server define hook-run
+reset
+end
+
+server define hookpost-run
+# After recompile and 'run', the python global variables are lost, so the python macros must be reloaded.
+# However, this reloads the macros even when there has not been a recompile, but it is very fast.
+source utils-gdb.py
+end
+
+server define hook-thread
+reset
+end
Index: doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.py
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.py	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/utils-gdb.py	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,604 @@
+"""
+To run this extension, the python name has to be as same as one of the loaded library
+Additionally, the file must exist in a folder which is in gdb's safe path
+"""
+import collections
+import gdb
+
+# set these signal handlers with some settings (nostop, noprint, pass)
+gdb.execute('handle SIGALRM nostop noprint pass')
+gdb.execute('handle SIGUSR1 nostop noprint pass')
+
+# GDB types for various structures/types in uC++
+uCluster_ptr_type = gdb.lookup_type('uCluster').pointer()
+uClusterDL_ptr_type = gdb.lookup_type('uClusterDL').pointer()
+uBaseTask_ptr_type = gdb.lookup_type('uBaseTask').pointer()
+uBaseTaskDL_ptr_type = gdb.lookup_type('uBaseTaskDL').pointer()
+int_ptr_type = gdb.lookup_type('int').pointer()
+
+# A named tuple representing information about a stack
+StackInfo = collections.namedtuple('StackInfo', 'sp fp pc')
+
+# A global variable to keep track of stack information as one context switches
+# from one task to another task
+STACK = []
+
+# A global variable to keep all system task name
+SysTask_Name = ["uLocalDebuggerReader", "uLocalDebugger", "uProcessorTask", "uBootTask", "uSystemTask", 
+"uProcessorTask", "uPthread", "uProfiler"]
+
+def get_addr(addr):
+    """
+    NOTE: sketchy solution to retrieve address. There is a better solution...
+    @addr: str of an address that can be in a format 0xfffff <type of the object
+    at this address>
+    Return: str of just the address
+    """
+    str_addr = str(addr)
+    ending_addr_index = str_addr.find('<')
+    if ending_addr_index == -1:
+        return str(addr)
+    return str_addr[:ending_addr_index].strip()
+
+def print_usage(msg):
+    """
+    Print out usage message
+    @msg: str
+    """
+    print('Usage: ' + msg)
+
+def get_argv_list(args):
+    """
+    Split the argument list in string format, where each argument is separated
+    by whitespace delimiter, to a list of arguments like argv
+    @args: str of arguments
+    Return:
+        [] if args is an empty string
+        list if args is not empty
+    """
+    # parse the string format of arguments and return a list of arguments
+    argv = args.split(' ')
+    if len(argv) == 1 and argv[0] == '':
+        return []
+    return argv
+
+def get_cluster_root():
+    """
+    Return: gdb.Value of globalClusters.root (is an address)
+    """
+    cluster_root = gdb.parse_and_eval('uKernelModule::globalClusters.root')
+    if cluster_root.address == 0x0:
+        print('No clusters, program terminated')
+    return cluster_root
+
+def lookup_cluster_by_name(cluster_name):
+    """
+    Look up a cluster given its ID
+    @cluster_name: str
+    Return: gdb.Value
+    """
+    cluster_root = get_cluster_root()
+    if cluster_root.address == 0x0:
+        return cluster_root.address
+
+    # lookup for the task associated with the id
+    cluster = 0x0
+    curr = cluster_root
+    while True:
+        if curr['cluster_']['name'].string() == cluster_name:
+            cluster = curr['cluster_'].address
+            break
+        curr = curr['next'].cast(uClusterDL_ptr_type)
+        if curr == cluster_root:
+            break
+
+    if cluster == 0x0:
+        print("Cannot find a cluster with the name: {}.".format(cluster_name))
+    return cluster
+
+############################ COMMAND IMPLEMENTATION #########################
+
+class Clusters(gdb.Command):
+    """Print out the list of available clusters"""
+    usage_msg = 'cluster'
+    def __init__(self):
+        super(Clusters, self).__init__('clusters', gdb.COMMAND_USER)
+
+    def invoke(self, arg, from_tty):
+        """
+        Iterate through a circular linked list of clusters and print out its
+        name along with address associated to each cluster
+        @arg: str
+        @from_tty: bool
+        """
+        argv = get_argv_list(arg)
+        if len(argv) != 0:
+            print_usage(self.usage_msg)
+            return
+
+        cluster_root = get_cluster_root()
+        if cluster_root.address == 0x0:
+            return
+        curr = cluster_root
+        print('{:>20}{:>18}'.format('Name', 'Address'))
+
+        while True:
+            print('{:>20}{:>18}'.format(curr['cluster_']['name'].string(),
+                                        str(curr['cluster_'].reference_value())[1:]))
+            curr = curr['next'].cast(uClusterDL_ptr_type)
+            if curr == cluster_root:
+                break
+
+class ClusterProcessors(gdb.Command):
+    """Display a list of all info about all available processors on a particular cluster"""
+    usage_msg = 'processors <cluster_name>'
+    def __init__(self):
+        super(ClusterProcessors, self).__init__('processors', gdb.COMMAND_USER)
+
+    def invoke(self, arg, from_tty):
+        """
+        Iterate through a circular linked list of tasks and print out all
+        info about each processor in that cluster
+        @arg: str
+        @from_tty: bool
+        """
+        argv = get_argv_list(arg)
+        if len(argv) > 1:
+            print_usage(self.usage_msg)
+            return
+
+        if len(argv) == 0:
+            cluster_address = lookup_cluster_by_name("userCluster")
+        else:
+            cluster_address = lookup_cluster_by_name(argv[0])
+
+        if cluster_address == 0x0:
+            return
+
+        processor_root = cluster_address.cast(uCluster_ptr_type)['processorsOnCluster']['root']
+        if processor_root.address == 0x0:
+            print('There are no processors for cluster at address: {}'.format(cluster_address))
+            return
+
+        uProcessorDL_ptr_type = gdb.lookup_type('uProcessorDL').pointer()
+        print('{:>18}{:>20}{:>20}{:>20}'.format('Address', 'PID', 'Preemption', 'Spin'))
+        curr = processor_root
+
+        while True:
+            processor = curr['processor_']
+            print('{:>18}{:>20}{:>20}{:>20}'.format(get_addr(processor.address),
+                        str(processor['pid']), str(processor['preemption']),
+                        str(processor['spin'])))
+
+            curr = curr['next'].cast(uProcessorDL_ptr_type)
+            if curr == processor_root:
+                break
+
+class Task(gdb.Command):
+    usage_msg = """
+    task                            : print userCluster tasks, application tasks only
+    task <clusterName>              : print cluster tasks, application tasks only
+    task all                        : print all clusters, all tasks
+    task <id>                       : context switch to task id on userCluster
+    task 0x<address>	            : context switch to task on any cluster
+    task <id> <clusterName>         : context switch to task on specified cluster
+    """
+    def __init__(self):
+        # The first parameter of the line below is the name of the command. You
+        # can call it 'uc++ task'
+        super(Task, self).__init__('task', gdb.COMMAND_USER)
+
+    ############################ AUXILIARY FUNCTIONS #########################
+
+    def print_tasks_by_cluster_all(self, cluster_address):
+        """
+        Display a list of all info about all available tasks on a particular cluster
+        @cluster_address: gdb.Value
+        """
+        cluster_address = cluster_address.cast(uCluster_ptr_type)
+        task_root = cluster_address['tasksOnCluster']['root']
+
+        if task_root.address == 0x0:
+            print('There are no tasks for cluster at address: {}'.format(cluster_address))
+            return
+
+        print('{:>4}{:>20}{:>18}{:>25}'.format('ID', 'Task Name', 'Address', 'State'))
+        curr = task_root
+        task_id = 0
+        systask_id = -1
+
+        btstr = gdb.execute('bt', to_string = True)
+        break_addr = btstr.splitlines()[0].split('this=',1)[1].split(',')[0].split(')')[0]
+
+        while True:
+            global SysTask_Name
+            if (curr['task_']['name'].string() in SysTask_Name):
+                if str(curr['task_'].reference_value())[1:] == break_addr:
+                    print(
+                            ('{:>4}{:>20}{:>18}{:>25}'.format('* '+str(systask_id), curr['task_']['name'].string(),
+                            str(curr['task_'].reference_value())[1:],
+                            str(curr['task_']['state']))
+                        )
+                    )
+                else:
+                    print(
+                            ('{:>4}{:>20}{:>18}{:>25}'.format(systask_id, curr['task_']['name'].string(),
+                            str(curr['task_'].reference_value())[1:],
+                            str(curr['task_']['state']))
+                        )
+                    )
+                systask_id -= 1
+            else:
+                if str(curr['task_'].reference_value())[1:] == break_addr:
+                    print('{:>4}{:>20}{:>18}{:>25}'.format('* '+str(task_id), curr['task_']['name'].string(),
+                                                           str(curr['task_'].reference_value())[1:],
+                                                           str(curr['task_']['state']))
+                    )
+                else:
+                    print('{:>4}{:>20}{:>18}{:>25}'.format(task_id, curr['task_']['name'].string(),
+                                                           str(curr['task_'].reference_value())[1:],
+                                                           str(curr['task_']['state']))
+                    )
+                task_id += 1
+
+            curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+            if curr == task_root:
+                break
+
+    def print_tasks_by_cluster_address_all(self, cluster_address):
+        """
+        Display a list of all info about all available tasks on a particular cluster
+        @cluster_address: str
+        """
+        # Iterate through a circular linked list of tasks and print out its
+        # name along with address associated to each cluster
+
+        # convert hex string to hex number
+        try:
+            hex_addr = int(cluster_address, 16)
+        except:
+            print_usage(self.usage_msg)
+            return
+
+        cluster_address = gdb.Value(hex_addr)
+        self.print_tasks_by_cluster_all(cluster_address)
+
+    def print_tasks_by_cluster_address(self, cluster_address):
+        """
+        Display a list of limited info about all available tasks on a particular cluster
+        @cluster_address: str
+        """
+        # Iterate through a circular linked list of tasks and print out its
+        # name along with address associated to each cluster
+
+        # convert hex string to hex number
+        try:
+            hex_addr = int(cluster_address, 16)
+        except:
+            print_usage(self.usage_msg)
+            return
+
+        cluster_address = gdb.Value(hex_addr).cast(uCluster_ptr_type)
+        task_root = cluster_address['tasksOnCluster']['root']
+
+        if task_root.address == 0x0:
+            print('There are no tasks for cluster at address: {}'.format(cluster_address))
+            return
+
+        print('{:>4}{:>20}{:>18}{:>25}'.format('ID', 'Task Name', 'Address', 'State'))
+        curr = task_root
+        task_id = 0
+        btstr = gdb.execute('bt', to_string = True)
+        break_addr = btstr.splitlines()[0].split('this=',1)[1].split(',')[0].split(')')[0]
+
+        while True:
+            global SysTask_Name
+            if (curr['task_']['name'].string() not in SysTask_Name):
+                if str(curr['task_'].reference_value())[1:] == break_addr:            
+                    print(
+                        ('{:>4}{:>20}{:>18}{:>25}'.format('* '+str(task_id), curr['task_']['name'].string(),
+                        str(curr['task_'].reference_value())[1:],
+                        str(curr['task_']['state']))
+                    )
+                )
+                else:
+                    print('{:>4}{:>20}{:>18}{:>25}'.format(task_id, curr['task_']['name'].string(),
+                                                           str(curr['task_'].reference_value())[1:],
+                                                           str(curr['task_']['state']))
+                    )
+
+                curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+                task_id += 1
+                if curr == task_root:
+                    break
+            else:
+                curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+                if curr == task_root:
+                    break
+
+    ############################ COMMAND FUNCTIONS #########################
+
+    def print_user_tasks(self):
+        """Iterate only userCluster, print only tasks and main""" 
+
+        cluster_address = lookup_cluster_by_name("userCluster")
+        if cluster_address == 0x0:
+            return
+
+        self.print_tasks_by_cluster_address(str(cluster_address))
+
+
+    def print_all_tasks(self):
+        """Iterate through each cluster, iterate through all tasks and  print out info about all the tasks
+        in those clusters"""
+        cluster_root = get_cluster_root()
+        if cluster_root.address == 0x0:
+            return
+
+        curr = cluster_root
+        print('{:>20}{:>18}'.format('Cluster Name', 'Address'))
+
+        while True:
+            addr = str(curr['cluster_'].reference_value())[1:]
+            print('{:>20}{:>18}'.format(curr['cluster_']['name'].string(), addr))
+
+            self.print_tasks_by_cluster_address_all(addr)
+            curr = curr['next'].cast(uClusterDL_ptr_type)
+            if curr == cluster_root:
+                break
+
+    def pushtask_by_address(self, task_address):
+        """Change to a new task by switching to a different stack and manually
+        adjusting sp, fp and pc
+        @task_address: str
+            2 supported format:
+                in hex format
+                    <hex_address>: literal hexadecimal address
+                    Ex: 0xffffff
+                in name of the pointer to the task
+                    "task_name": pointer of the variable name of the cluster
+                        Ex: T* s -> task_name = s
+            Return: gdb.value of the cluster's address
+        """
+        # Task address has a format "task_address", which implies that it is the
+        # name of the variable, and it needs to be evaluated
+        if task_address.startswith('"') and task_address.endswith('"'):
+            task = gdb.parse_and_eval(task_address.replace('"', ''))
+        else:
+        # Task address format does not include the quotation marks, which implies
+        # that it is a hex address
+            # convert hex string to hex number
+            try:
+                hex_addr = int(task_address, 16)
+            except:
+                print_usage(self.usage_msg)
+                return
+            task_address = gdb.Value(hex_addr)
+            task = task_address.cast(uBaseTask_ptr_type)
+
+        uContext_t_ptr_type = gdb.lookup_type('UPP::uMachContext::uContext_t').pointer()
+
+        task_state = task['state']
+        if task_state == gdb.parse_and_eval('uBaseTask::Terminate'):
+            print('Cannot switch to a terminated thread')
+            return
+        task_context = task['context'].cast(uContext_t_ptr_type)
+
+        # lookup for sp,fp and uSwitch
+        xsp = task_context['SP'] + 48
+        xfp = task_context['FP']
+        if not gdb.lookup_symbol('uSwitch'):
+            print('uSwitch symbol is unavailable')
+            return
+
+        # convert string so we can strip out the address
+        xpc = get_addr(gdb.parse_and_eval('uSwitch').address + 28)
+        # must be at frame 0 to set pc register
+        gdb.execute('select-frame 0')
+
+        # push sp, fp, pc into a global stack
+        global STACK
+        sp = gdb.parse_and_eval('$sp')
+        fp = gdb.parse_and_eval('$fp')
+        pc = gdb.parse_and_eval('$pc')
+        stack_info = StackInfo(sp = sp, fp = fp, pc = pc)
+        STACK.append(stack_info)
+
+        # update registers for new task
+        gdb.execute('set $rsp={}'.format(xsp))
+        gdb.execute('set $rbp={}'.format(xfp))
+        gdb.execute('set $pc={}'.format(xpc))
+
+    def pushtask_by_id(self, task_id, cluster_name):
+        """
+        @cluster_name: str
+        @task_id: str
+        """
+        try:
+            task_id = int(task_id)
+        except:
+            print_usage(self.usage_msg)
+            return
+
+        # retrieve the address associated with the cluster name
+        cluster_address = lookup_cluster_by_name(cluster_name)
+        if cluster_address == 0x0:
+            return
+
+        task_root = cluster_address.cast(uCluster_ptr_type)['tasksOnCluster']['root']
+        if task_root.address == 0x0:
+            print('There are no tasks on this cluster')
+            return
+
+        user_id = 0
+        task_addr = None
+        systask_id = -1 # system search id starts with negative
+
+        # lookup for the task associated with the id
+        global SysTask_Name
+        if (task_id >= 0 and cluster_name == "systemCluster"):
+            print('internal error: systemCluster does not have ID >= 0')
+            return
+        #id is a system task
+        elif task_id < 0:
+            curr = task_root
+            rootflag = False
+            while (curr['task_']['name'].string() not in SysTask_Name):
+                curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+                if curr == task_root:
+                    rootflag = True
+                    break
+            if rootflag == False:
+                if task_id == systask_id:
+                    task_addr = str(curr['task_'].address)
+                else:
+                    while True:
+                        curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+
+                        if (curr['task_']['name'].string() in SysTask_Name):
+                            systask_id -= 1
+                            if curr == task_root:
+                                break
+                            if task_id == systask_id:
+                                task_addr = str(curr['task_'].address)
+                                break
+
+                        if curr == task_root:
+                            break
+        #id is a user task
+        else:
+            curr = task_root
+            rootflag = False
+            while (curr['task_']['name'].string() in SysTask_Name):
+                curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+                if curr == task_root:
+                    rootflag = True
+                    break
+            if rootflag == False:
+                if task_id == user_id:
+                    task_addr = str(curr['task_'].address)
+                else:
+                    while True:
+                        curr = curr['next'].cast(uBaseTaskDL_ptr_type)
+
+                        if (curr['task_']['name'].string() not in SysTask_Name):
+                            user_id += 1
+                            if curr == task_root:
+                                break
+                            if task_id == user_id:
+                                task_addr = str(curr['task_'].address)
+                                break
+
+                        if curr == task_root:
+                            break
+
+        if not task_addr:
+            print("Cannot find task ID: {}. Only have {} tasks".format(task_id,user_id))
+        else:
+            self.pushtask_by_address(task_addr)
+
+    def print_tasks_by_cluster_name(self, cluster_name):
+        """
+        Print out all the tasks available in the specified cluster
+        @cluster_name: str
+        """
+        cluster_address = lookup_cluster_by_name(cluster_name)
+        if cluster_address == 0x0:
+            return
+
+        self.print_tasks_by_cluster_all(cluster_address)
+
+    def invoke(self, arg, from_tty):
+        """
+        @arg: str
+        @from_tty: bool
+        """
+        argv = get_argv_list(arg)
+        if len(argv) == 0:
+            # print tasks
+            self.print_user_tasks() # only tasks and main
+        elif len(argv) == 1:
+            # push task
+            if argv[0].isdigit():
+                self.pushtask_by_id(argv[0], "userCluster") # by id, userCluster
+            elif argv[0].startswith('0x') or argv[0].startswith('0X'):
+                self.pushtask_by_address(argv[0]) # by address, any cluster
+            # print tasks
+            elif argv[0] == 'all':
+                self.print_all_tasks() # all tasks, all clusters
+            else:
+                self.print_tasks_by_cluster_name(argv[0]) # all tasks, specified cluster
+        elif len(argv) == 2:
+            # push task
+            self.pushtask_by_id(argv[0], argv[1]) # by id, specified cluster
+        else:
+            print('parse error')
+            print_usage(self.usage_msg)
+
+class PrevTask(gdb.Command):
+    """Switch back to previous task on the stack"""
+    usage_msg = 'prevtask <task_address>'
+
+    def __init__(self):
+        super(PrevTask, self).__init__('prevtask', gdb.COMMAND_USER)
+
+    def invoke(self, arg, from_tty):
+        """
+        @arg: str
+        @from_tty: bool
+        """
+        global STACK
+        if len(STACK) != 0:
+            # must be at frame 0 to set pc register
+            gdb.execute('select-frame 0')
+
+            # pop stack
+            stack_info = STACK.pop()
+            pc = get_addr(stack_info.pc)
+            sp = stack_info.sp
+            fp = stack_info.fp
+
+            # pop sp, fp, pc from global stack
+            gdb.execute('set $pc = {}'.format(pc))
+            gdb.execute('set $rbp = {}'.format(fp))
+            gdb.execute('set $sp = {}'.format(sp))
+
+            # must be at C++ frame to access C++ vars
+            gdb.execute('frame 1')
+        else:
+            print('empty stack')
+
+class ResetOriginFrame(gdb.Command):
+    """Reset to the origin frame prior to continue execution again"""
+    usage_msg = 'resetOriginFrame'
+    def __init__(self):
+        super(ResetOriginFrame, self).__init__('reset', gdb.COMMAND_USER)
+
+    def invoke(self, arg, from_tty):
+        """
+        @arg: str
+        @from_tty: bool
+        """
+        global STACK
+        if len(STACK) != 0:
+            stack_info = STACK.pop(0)
+            STACK.clear()
+            pc = get_addr(stack_info.pc)
+            sp = stack_info.sp
+            fp = stack_info.fp
+
+            # pop sp, fp, pc from global stack
+            gdb.execute('set $pc = {}'.format(pc))
+            gdb.execute('set $rbp = {}'.format(fp))
+            gdb.execute('set $sp = {}'.format(sp))
+
+            # must be at C++ frame to access C++ vars
+            gdb.execute('frame 1')
+        #else:
+            #print('reset: empty stack') #probably does not have to print msg
+
+Clusters()
+ClusterProcessors()
+PrevTask()
+ResetOriginFrame()
+Task()
Index: doc/theses/lynn_tran_SE499/SE499-master/utils.cpp
===================================================================
--- doc/theses/lynn_tran_SE499/SE499-master/utils.cpp	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/SE499-master/utils.cpp	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,38 @@
+#include <string>
+
+_Task T {
+    std::string name;
+    void a(int param) {
+        int x = 3;
+        std::string y = "example";
+        while(1);
+    }
+    void main() {
+        a(5);
+    }
+  public:
+    T( const int tid) {
+        name = "T" + std::to_string(tid);
+        setName( name.c_str() );
+    }
+};
+
+T* global_ptr_S;
+uCluster* global_cluster;
+
+int main() {
+    uProcessor p[3];
+    const int n = 10;
+    T* tasks[n];
+    uCluster fred( "fred"  );
+    global_cluster = &fred;
+
+    for (int i = 0; i < n; i += 1) {
+        tasks[i] = new T(i);
+        global_ptr_S = tasks[1];
+    }
+
+    for (int i = 0; i < n; i += 1) {
+        delete tasks[i];
+    }
+} // main
Index: doc/theses/lynn_tran_SE499/Thesis.cls
===================================================================
--- doc/theses/lynn_tran_SE499/Thesis.cls	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/Thesis.cls	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,419 @@
+%%
+%% This is file `Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn
+%% generated with the docstrip utility.
+%%
+%% Created by Steve R. Gunn, modified by Sunil Patel: www.sunilpatel.co.uk
+\NeedsTeXFormat{LaTeX2e}[1996/12/01]
+\ProvidesClass{Thesis}
+              [2007/22/02 v1.0
+   LaTeX document class]
+\def\baseclass{book}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
+\def\@checkoptions#1#2{
+  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
+  \@tempswafalse
+  \@tfor\@this:=#2\do{
+    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
+    \ifin@ \@tempswatrue \@break@tfor \fi}
+  \let\@this\@empty
+  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
+}
+\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
+\PassOptionsToClass{legalpaper}{\baseclass}
+\ProcessOptions\relax
+\LoadClass{\baseclass}
+\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}
+
+\newcommand\Declaration[1]{
+\btypeout{Declaration of Authorship}
+\addtotoc{Declaration of Authorship}
+\thispagestyle{plain}
+\null\vfil
+%\vskip 60\p@
+\begin{center}{\huge\bf Declaration of Authorship\par}\end{center}
+%\vskip 60\p@
+{\normalsize #1}
+\vfil\vfil\null
+%\cleardoublepage
+}
+\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
+\def\today{\ifcase\month\or
+  January\or February\or March\or April\or May\or June\or
+  July\or August\or September\or October\or November\or December\fi
+  \space \number\year}
+\usepackage{setspace}
+%\onehalfspacing
+% TODO: please turn this back on
+\doublespacing
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
+\iffalse
+\usepackage{vmargin}
+\setmarginsrb           { 1.5in}  % left margin
+                        { 0.6in}  % top margin
+                        { 1.0in}  % right margin
+                        { 0.8in}  % bottom margin
+                        {  20pt}  % head height
+                        {0.25in}  % head sep
+                        {   9pt}  % foot height
+                        { 0.3in}  % foot sep
+\fi
+\raggedbottom
+\setlength{\topskip}{1\topskip \@plus 5\p@}
+\doublehyphendemerits=10000       % No consecutive line hyphens.
+\brokenpenalty=10000              % No broken words across columns/pages.
+\widowpenalty=9999                % Almost no widows at bottom of page.
+\clubpenalty=9999                 % Almost no orphans at top of page.
+\interfootnotelinepenalty=9999    % Almost never break footnotes.
+\usepackage{geometry}
+\geometry{
+      letterpaper,
+        left=1.0in,top=0.5in,right=1.0in,bottom=0.5in,footskip=1cm,
+          headheight=20pt,headsep=0.25in,%footheight=9pt,
+            includeheadfoot
+}
+\usepackage{fancyhdr}
+\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
+\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
+\chead{}\lfoot{}\rfoot{}\cfoot{}
+\pagestyle{fancy}
+\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
+\renewcommand{\sectionmark}[1]{}
+\renewcommand{\subsectionmark}[1]{}
+\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
+\hbox{}
+\thispagestyle{empty}
+\newpage
+\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
+\theoremstyle{plain}
+\newtheorem{example}{Example}[chapter]
+\newtheorem{theorem}{Theorem}[chapter]
+\newtheorem{corollary}[theorem]{Corollary}
+\newtheorem{lemma}[theorem]{Lemma}
+\newtheorem{proposition}[theorem]{Proposition}
+\newtheorem{axiom}[theorem]{Axiom}
+\theoremstyle{definition}
+\newtheorem{definition}[theorem]{Definition}
+\theoremstyle{remark}
+\newtheorem{remark}[theorem]{Remark}
+\usepackage[centerlast,small,sc]{caption}
+\setlength{\captionmargin}{20pt}
+\newcommand{\fref}[1]{Figure~\ref{#1}}
+\newcommand{\tref}[1]{Table~\ref{#1}}
+\newcommand{\eref}[1]{Equation~\ref{#1}}
+\newcommand{\cref}[1]{Chapter~\ref{#1}}
+\newcommand{\sref}[1]{Section~\ref{#1}}
+\newcommand{\aref}[1]{Appendix~\ref{#1}}
+\renewcommand{\topfraction}{0.85}
+\renewcommand{\bottomfraction}{.85}
+\renewcommand{\textfraction}{0.1}
+\renewcommand{\dbltopfraction}{.85}
+\renewcommand{\floatpagefraction}{0.75}
+\renewcommand{\dblfloatpagefraction}{.75}
+\setcounter{topnumber}{9}
+\setcounter{bottomnumber}{9}
+\setcounter{totalnumber}{20}
+\setcounter{dbltopnumber}{9}
+\usepackage{graphicx}
+\usepackage{epstopdf}
+\usepackage[scriptsize]{subfigure}
+\usepackage{booktabs}
+\usepackage{rotating}
+\usepackage{listings}
+\usepackage{lstpatch}
+\lstset{captionpos=b,
+        frame=tb,
+        basicstyle=\scriptsize\ttfamily,
+        showstringspaces=false,
+        keepspaces=true}
+\lstset{escapeinside={<@}{@>}}
+\lstdefinestyle{matlab} {
+        language=Matlab,
+        keywordstyle=\color{blue},
+        commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
+        stringstyle=\color[rgb]{0.7,0,0} }
+\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
+   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
+   colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
+   pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
+\pdfstringdefDisableCommands{
+   \let\\\space
+}
+\lstdefinestyle{C++nokeyword} {
+        language=C++,
+        basicstyle=\linespread{1}\ttfamily,
+        %numbers=left,
+        stepnumber=1,
+        firstnumber=1,
+        %keywordstyle=\color{blue}\ttfamily,
+        stringstyle=\color{red}\ttfamily,
+        commentstyle=\color{ForestGreen}\ttfamily,
+}
+\lstdefinestyle{C++} {
+        language=C++,
+        basicstyle=\linespread{1}\ttfamily,
+        %numbers=left,
+        stepnumber=1,
+        firstnumber=1,
+        keywordstyle=\color{blue}\ttfamily,
+        stringstyle=\color{red}\ttfamily,
+        commentstyle=\color{ForestGreen}\ttfamily,
+}
+\lstdefinestyle{Python} {
+        language=Python,
+        basicstyle=\linespread{1}\ttfamily,
+        %numbers=left,
+        stepnumber=1,
+        firstnumber=1,
+        keywordstyle=\color{blue}\ttfamily,
+        stringstyle=\color{red}\ttfamily,
+        commentstyle=\color{ForestGreen}\ttfamily,
+}
+
+\newcommand*{\supervisor}[1]{\def\supname{#1}}
+\newcommand*{\emails}[1]{\def\supname{#1}}
+\newcommand*{\examiner}[1]{\def\examname{#1}}
+\newcommand*{\degree}[1]{\def\degreename{#1}}
+\newcommand*{\authors}[1]{\def\authornames{#1}}
+\newcommand*{\addresses}[1]{\def\addressnames{#1}}
+\newcommand*{\university}[1]{\def\univname{#1}}
+\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
+\newcommand*{\department}[1]{\def\deptname{#1}}
+\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
+\newcommand*{\group}[1]{\def\groupname{#1}}
+\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
+\newcommand*{\faculty}[1]{\def\facname{#1}}
+\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
+\newcommand*{\subject}[1]{\def\subjectname{#1}}
+\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
+\supervisor  {}
+\emails  {tmltran@uwaterloo.ca}
+\examiner    {}
+\degree      {}
+\authors     {}
+\university  {\texorpdfstring{\href{University Web Site URL Here (include http://)}
+                {University Name}}
+                {University Name}}
+\UNIVERSITY  {\texorpdfstring{\href{https://www.uwaterloo.ca}
+                {UNIVERSITY OF WATERLOO}}
+                {UNIVERSITY OF WATERLOO}}
+\department  {\texorpdfstring{\href{Department or School Web Site URL Here (include http://)}
+                {Software Engineering Department}}
+                {Software Engineering Department}}
+\DEPARTMENT  {\texorpdfstring{\href{Department or School Web Site URL Here (include http://)}
+                {SOFTWARE ENGINEERING DEPARTMENT}}
+                {SOFTWARE ENGINEERING DEPARTMENT}}
+\group       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
+                {Research Group Name}}
+                {Research Group Name}}
+\GROUP       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
+                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
+                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
+\faculty     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
+                {Faculty of Mathematics and Faculty of Engineering}}
+                {Faculty of Mathematics and Faculty of Engineering}}
+\FACULTY     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
+                {FACULTY NAME (IN BLOCK CAPITALS)}}
+                {FACULTY NAME (IN BLOCK CAPITALS)}}
+\addresses   {}
+\subject     {}
+\keywords    {}
+\renewcommand\maketitle{
+  \btypeout{Title page}
+  \hypersetup{pdftitle={\@title}}
+  \hypersetup{pdfsubject=\subjectname}
+  \hypersetup{pdfauthor=\authornames}
+  \hypersetup{pdfkeywords=\keywordnames}
+  \thispagestyle{empty}
+  \begin{titlepage}
+    \let\footnotesize\small
+    \let\footnoterule\relax
+    \let \footnote \thanks
+    \setcounter{footnote}{0}
+    \null\vfil
+    \vskip 60\p@
+    \begin{center}
+      \setlength{\parskip}{0pt}
+      {\large\textbf{\UNIVNAME}\par}
+      \vfill
+      {\huge \bf \@title \par}
+      \vfill
+      {\LARGE by \par}
+      \smallskip
+      {\LARGE \authornames \par}
+      \vfill
+      \bigskip
+      \bigskip
+      {\large in the \par}
+      {\large \facname \par}
+      {\large \deptname \par}
+      \bigskip
+      \bigskip
+      \bigskip
+      {\Large \@date \par}
+      \bigskip
+    \end{center}
+    \par
+    \@thanks
+    \vfil\null
+  \end{titlepage}
+  \setcounter{footnote}{0}%
+  \global\let\thanks\relax
+  \global\let\maketitle\relax
+  \global\let\@thanks\@empty
+  \global\let\@author\@empty
+  \global\let\@date\@empty
+  \global\let\@title\@empty
+  \global\let\title\relax
+  \global\let\author\relax
+  \global\let\date\relax
+  \global\let\and\relax
+  \cleardoublepage
+}
+\newenvironment{preface}
+{
+  \btypeout{Preface}
+  \thispagestyle{empty}
+  \null\vfil
+  \begin{center}
+    \setlength{\parskip}{0pt}
+    %{\normalsize \UNIVNAME \par}
+    %\bigskip
+    {\huge{\textit{Preface}} \par}
+    %\bigskip
+    %{\normalsize \facname \par}
+    %{\normalsize \deptname \par}
+    %\bigskip
+    %{\normalsize\bf \@title \par}
+    %\medskip
+    %{\normalsize by \authornames \par}
+    %\bigskip
+  \end{center}
+}
+{
+  \vfil\vfil\vfil\null
+  \cleardoublepage
+}
+\addtocounter{secnumdepth}{1}
+\setcounter{tocdepth}{6}
+\newcounter{dummy}
+\newcommand\addtotoc[1]{
+\refstepcounter{dummy}
+\addcontentsline{toc}{chapter}{#1}}
+\renewcommand\tableofcontents{
+\btypeout{Table of Contents}
+\begin{spacing}{1}{
+    \setlength{\parskip}{1pt}
+    \if@twocolumn
+      \@restonecoltrue\onecolumn
+    \else
+      \@restonecolfalse
+    \fi
+    \chapter*{\contentsname
+        \@mkboth{
+           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
+    \@starttoc{toc}
+    \if@restonecol\twocolumn\fi
+   \cleardoublepage
+}\end{spacing}
+}
+\renewcommand\listoffigures{
+\btypeout{List of Figures}
+\addtotoc{List of Figures}
+\begin{spacing}{1}{
+    \setlength{\parskip}{1pt}
+    \if@twocolumn
+      \@restonecoltrue\onecolumn
+    \else
+      \@restonecolfalse
+    \fi
+    \chapter*{\listfigurename
+      \@mkboth{\MakeUppercase\listfigurename}
+              {\MakeUppercase\listfigurename}}
+    \@starttoc{lof}
+    \if@restonecol\twocolumn\fi
+    \cleardoublepage
+}\end{spacing}
+}
+\renewcommand\listoftables{
+\btypeout{List of Tables}
+\addtotoc{List of Tables}
+\begin{spacing}{1}{
+    \setlength{\parskip}{1pt}
+    \if@twocolumn
+      \@restonecoltrue\onecolumn
+    \else
+      \@restonecolfalse
+    \fi
+    \chapter*{\listtablename
+      \@mkboth{
+          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
+    \@starttoc{lot}
+    \if@restonecol\twocolumn\fi
+    \cleardoublepage
+}\end{spacing}
+}
+\newcommand\listsymbolname{Abbreviations}
+\usepackage{longtable}
+\newcommand\listofsymbols[2]{
+\btypeout{\listsymbolname}
+\addtotoc{\listsymbolname}
+    \chapter*{\listsymbolname
+      \@mkboth{
+          \MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
+\begin{longtable}[c]{#1}#2\end{longtable}\par
+    \cleardoublepage
+}
+\newcommand\listconstants{Physical Constants}
+\usepackage{longtable}
+\newcommand\listofconstants[2]{
+\btypeout{\listconstants}
+\addtotoc{\listconstants}
+    \chapter*{\listconstants
+      \@mkboth{
+          \MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
+\begin{longtable}[c]{#1}#2\end{longtable}\par
+    \cleardoublepage
+}
+\newcommand\listnomenclature{Symbols}
+\usepackage{longtable}
+\newcommand\listofnomenclature[2]{
+\btypeout{\listnomenclature}
+\addtotoc{\listnomenclature}
+    \chapter*{\listnomenclature
+      \@mkboth{
+          \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
+\begin{longtable}[c]{#1}#2\end{longtable}\par
+    \cleardoublepage
+}
+\newcommand\acknowledgements[1]{
+\btypeout{Acknowledgements}
+\addtotoc{Acknowledgements}
+\thispagestyle{plain}
+\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
+{\normalsize #1}
+\vfil\vfil\null
+
+}
+\newcommand\dedicatory[1]{
+\btypeout{Dedicatory}
+\thispagestyle{plain}
+\null\vfil
+\vskip 60\p@
+\begin{center}{\Large \sl #1}\end{center}
+\vfil\null
+\cleardoublepage
+}
+\renewcommand\backmatter{
+  \if@openright
+    \cleardoublepage
+  \else
+    \clearpage
+  \fi
+  \addtotoc{\bibname}
+  \btypeout{\bibname}
+  \@mainmatterfalse}
+\endinput
+%%
+%% End of file `Thesis.cls'.
Index: doc/theses/lynn_tran_SE499/lstpatch.sty
===================================================================
--- doc/theses/lynn_tran_SE499/lstpatch.sty	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/lstpatch.sty	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,1 @@
+%%%% This is file `lstpatch.sty', generated manually.%%%% (w)(c) 2004 Carsten Heinz%%%% This file may be distributed under the terms of the LaTeX Project Public%% License from CTAN archives in directory  macros/latex/base/lppl.txt.%% Either version 1.0 or, at your option, any later version.%%%% Send comments and ideas on the package, error reports and additional%% programming languages to <cheinz@gmx.de>.%%%% This patch file will remove the following bugs from the listings package.%% Each item contains the bug finder with date of report and first bug fix%% version, a short description of the problem, and the reason for the bug%% in parenthesis.%%%%  1) Frank Atanassow, 2004/10/07, 1.3b%%%%     space after mathescape is not preserved%%     (\lst@newlines>0)%%%%  2) Benjamin Lings, 2004/10/15, 1.3b (2004/10/17)%%%%     \usepackage{xy,listings} yields:%%     "Forbidden control sequence found while scanning use of \lst@lExtend"%%     (xy-pic correctly resets catcode of ^^L (to active), which is \outer)%%%%%% The following features are added to the base package.%%%% 1.3a (2004/09/07)%%%%  a) H I G H L Y   E X P E R I M E N T A L%%%%     Use the options%%        rangeprefix=<prefix for begin and end of range>%%        rangesuffix=<suffix for begin and end of range>%%%%        rangebeginprefix=<prefix for begin of range>%%        rangebeginsuffix=<suffix for begin of range>%%%%        rangeendprefix=<prefix for end of range>%%        rangeendsuffix=<suffix for end of range>%%%%        includerangemarker=true|false%%     together with%%        firstline=<begin marker>%%        lastline=<end marker>%%     or%%        linerange={<begin marker 1>-<end marker 1>,%%                   <begin marker 2>-<end marker 2>, ...}%%     The according markers in the source code are%%           <prefix><marker><suffix>%%     for begin respectively end of range. Moreover, one can use%%        includerangemarker=true|false%%     to show or hide the range markers in the output.%%%% 1.3b (2004/10/17)%%%%  b) multicols=<number> (requires loaded multicol package)%%%%\lst@CheckVersion{1.3}{\typeout{^^J%    ***^^J%    *** This is a patch for listings 1.3, but you're using^^J%    *** version \lst@version.^^J%    ***^^J    *** Patch file not loaded.^^J%    ***^^J}%    \endinput}\def\fileversion{1.3b}\def\filedate{2004/10/17}\ProvidesFile{lstpatch.sty}[\filedate\space\fileversion\space (Carsten Heinz)]%% 0) Insert % after #1.\def\@@xbitor #1{\@tempcntb \count#1%   \ifnum \@tempcnta =\z@   \else     \divide\@tempcntb\@tempcnta     \ifodd\@tempcntb \@testtrue\fi   \fi}%% 1) Reset \lst@newlines at end of escape.\def\lstpatch@escape{%\gdef\lst@Escape##1##2##3##4{%    \lst@CArgX ##1\relax\lst@CDefX        {}%        {\lst@ifdropinput\else         \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken         \lst@InterruptModes         \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%         \ifx\^^M##2%             \lst@CArg ##2\relax\lst@ActiveCDefX                 {}%                 {\lst@escapeend ##4\lst@LeaveAllModes\lst@ReenterModes}%                 {\lst@MProcessListing}%         \else             \lst@CArg ##2\relax\lst@ActiveCDefX                 {}%                 {\lst@escapeend ##4\lst@LeaveAllModes\lst@ReenterModes                  \lst@newlines\z@ \lst@whitespacefalse}%                 {}%         \fi         ##3\lst@escapebegin         \fi}%        {}}%}%% 2) Deactivate \outer definition of ^^L temporarily (inside and outside%    of \lst@ScanChars) and restore \catcode at end of package.\begingroup \catcode12=\active\let^^L\@empty\gdef\lst@ScanChars{%  \let\lsts@ssL^^L%  \def^^L{\par}%    \lst@GetChars\lst@RestoreOrigCatcodes\@ne {128}%  \let^^L\lsts@ssL    \lst@GetChars\lst@RestoreOrigExtendedCatcodes{128}{256}}\endgroup\lst@lAddTo\lst@RestoreCatcodes{\catcode12\active}%% a) Let's start with the options:\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}%                            \def\lst@rangeendprefix{#1}}\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}%                            \def\lst@rangeendsuffix{#1}}\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}}\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}}\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}}\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}}\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker}%%    The key is a redefinition of \lst@GLI@ checking for numbers.\def\lst@GLI@#1-#2-#3\@nil{%    \lst@IfNumber{#1}%    {\ifx\@empty#1\@empty         \let\lst@firstline\@ne     \else         \def\lst@firstline{#1\relax}%     \fi     \ifx\@empty#3\@empty         \def\lst@lastline{9999999\relax}%     \else         \ifx\@empty#2\@empty             \let\lst@lastline\lst@firstline         \else             \def\lst@lastline{#2\relax}%         \fi     \fi}%%%    If we've found a general marker, we set firstline and lastline to 9999999.%    This prevents (almost) anything to be printed for now.    {\def\lst@firstline{9999999\relax}%     \let\lst@lastline\lst@firstline%%    We add the prefixes and suffixes to the markers.     \let\lst@rangebegin\lst@rangebeginprefix     \lst@AddTo\lst@rangebegin{#1}\lst@Extend\lst@rangebegin\lst@rangebeginsuffix     \ifx\@empty#3\@empty         \let\lst@rangeend\lst@rangeendprefix         \lst@AddTo\lst@rangeend{#1}\lst@Extend\lst@rangeend\lst@rangeendsuffix     \else         \ifx\@empty#2\@empty             \let\lst@rangeend\@empty         \else             \let\lst@rangeend\lst@rangeendprefix             \lst@AddTo\lst@rangeend{#2}\lst@Extend\lst@rangeend\lst@rangeendsuffix         \fi     \fi%    The following definition will be executed in the SelectCharTable hook%    and here right now if we are already processing a listing.     \global\def\lst@DefRange{\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}%     \ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi}}%    \lst@DefRange is not inserted via a hook anymore. Instead it is now called%    directly from \lst@SelectCharTable. This was necessary to get rid of an%    interference with the escape-to-LaTeX-feature. The bug was reported by%    \lsthelper{Michael~Bachmann}{2004/07/21}{Keine label-Referenzierung%    m\"oglich...}. Another chance is due to the same bug: \lst@DefRange is%    redefined globally when the begin of code is found, see below. The bug was%    reported by \lsthelper{Tobias~Rapp}{2004/04/06}{undetected end of range if%    listing crosses page break} \lsthelper{Markus~Luisser}{2004/08/13}{Bug mit%    'linerangemarker' in umgebrochenen listings}%\lst@AddToHook{SelectCharTable}{\lst@DefRange}\lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty}%%    Actually defining the marker (via \lst@GLI@, \lst@DefRange, \lst@CArgX as%    seen above) is similar to \lst@DefDelimB---except that we unfold the first%    parameter and use different <execute>, <pre>, and <post> statements.\def\lst@DefRangeB#1#2{\lst@DefRangeB@#1#2}\def\lst@DefRangeB@#1#2#3#4{%    \lst@CDef{#1{#2}{#3}}#4{}%    {\lst@ifincluderangemarker         \lst@LeaveMode         \let#1#4%         \lst@DefRangeEnd         \lst@InitLstNumber     \else         \@tempcnta\lst@lineno \advance\@tempcnta\@ne         \edef\lst@firstline{\the\@tempcnta\relax}%         \gdef\lst@OnceAtEOL{\let#1#4\lst@DefRangeEnd}%         \lst@InitLstNumber     \fi	 \global\let\lst@DefRange\lst@DefRangeEnd     \lst@CArgEmpty}%    \@empty}%% Modify labels and define |\lst@InitLstNumber| used above.% \lsthelper{Omair-Inam~Abdul-Matin}{2004/05/10}{experimental linerange% feature does not work with firstnumber}\def\lstpatch@labels{%\gdef\lst@SetFirstNumber{%    \ifx\lst@firstnumber\@undefined        \@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax        \ifnum\@tempcnta=\z@ \else            \lst@nololtrue            \advance\@tempcnta\lst@advancenumber            \edef\lst@firstnumber{\the\@tempcnta\relax}%        \fi    \fi}%}\lst@AddToAtTop\lsthk@PreInit    {\ifx\lst@firstnumber\@undefined         \def\lst@firstnumber{\lst@lineno}%     \fi}\def\lst@InitLstNumber{%     \global\c@lstnumber\lst@firstnumber     \global\advance\c@lstnumber\lst@advancenumber     \global\advance\c@lstnumber-\lst@advancelstnum     \ifx \lst@firstnumber\c@lstnumber         \global\advance\c@lstnumber-\lst@advancelstnum     \fi}%%    The end-marker is defined if and only if it's not empty. The definition is%    similar to \lst@DefDelimE---with the above exceptions and except that we%    define the re-entry point \lst@DefRangeE@@ as it is defined in the new%    version of \lst@MProcessListing above.\def\lst@DefRangeEnd{%    \ifx\lst@rangeend\@empty\else        \expandafter\lst@CArgX\lst@rangeend\relax\lst@DefRangeE    \fi}\def\lst@DefRangeE#1#2{\lst@DefRangeE@#1#2}\def\lst@DefRangeE@#1#2#3#4{%    \lst@CDef{#1#2{#3}}#4{}%    {\let#1#4%     \edef\lst@lastline{\the\lst@lineno\relax}%     \lst@DefRangeE@@}%    \@empty}\def\lst@DefRangeE@@#1\@empty{%    \lst@ifincluderangemarker        #1\lst@XPrintToken    \fi    \lst@LeaveModeToPmode    \lst@BeginDropInput{\lst@Pmode}}%\def\lst@LeaveModeToPmode{%    \ifnum\lst@mode=\lst@Pmode        \expandafter\lsthk@EndGroup    \else        \expandafter\egroup\expandafter\lst@LeaveModeToPmode    \fi}%%    Eventually we shouldn't forget to install \lst@OnceAtEOL, which must%    also be called in \lst@MSkipToFirst.\lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty}\gdef\lst@OnceAtEOL{}% Init\def\lst@MSkipToFirst{%    \global\advance\lst@lineno\@ne    \ifnum \lst@lineno=\lst@firstline        \def\lst@next{\lst@LeaveMode \global\lst@newlines\z@        \lst@OnceAtEOL \global\let\lst@OnceAtEOL\@empty        \lst@InitLstNumber % Added to work with modified \lsthk@PreInit.        \lsthk@InitVarsBOL        \lst@BOLGobble}%        \expandafter\lst@next    \fi}\def\lst@SkipToFirst{%    \ifnum \lst@lineno<\lst@firstline        \def\lst@next{\lst@BeginDropInput\lst@Pmode        \lst@Let{13}\lst@MSkipToFirst        \lst@Let{10}\lst@MSkipToFirst}%        \expandafter\lst@next    \else        \expandafter\lst@BOLGobble    \fi}%%    Finally the service macro \lst@IfNumber:\def\lst@IfNumber#1{%    \ifx\@empty#1\@empty        \let\lst@next\@firstoftwo    \else        \lst@IfNumber@#1\@nil    \fi    \lst@next}\def\lst@IfNumber@#1#2\@nil{%    \let\lst@next\@secondoftwo    \ifnum`#1>47\relax \ifnum`#1>57\relax\else        \let\lst@next\@firstoftwo    \fi\fi}%% b) The following is known to fail with some keys.\lst@Key{multicols}{}{\@tempcnta=0#1\relax\def\lst@multicols{#1}}\def\lst@Init#1{%    \begingroup    \ifx\lst@float\relax\else        \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}%        \expandafter\@tempa    \fi% chmod begin    \ifx\lst@multicols\@empty\else        \edef\lst@next{\noexpand\multicols{\lst@multicols}}        \expandafter\lst@next    \fi% chmod end    \ifhmode\ifinner \lst@boxtrue \fi\fi    \lst@ifbox        \lsthk@BoxUnsafe        \hbox to\z@\bgroup             $\if t\lst@boxpos \vtop        \else \if b\lst@boxpos \vbox        \else \vcenter \fi\fi        \bgroup \par\noindent    \else        \lst@ifdisplaystyle            \lst@EveryDisplay            \par\penalty-50\relax            \vspace\lst@aboveskip        \fi    \fi    \normalbaselines    \abovecaptionskip\lst@abovecaption\relax    \belowcaptionskip\lst@belowcaption\relax    \lst@MakeCaption t%    \lsthk@PreInit \lsthk@Init    \lst@ifdisplaystyle        \global\let\lst@ltxlabel\@empty        \if@inlabel            \lst@ifresetmargins                \leavevmode            \else                \xdef\lst@ltxlabel{\the\everypar}%                \lst@AddTo\lst@ltxlabel{%                    \global\let\lst@ltxlabel\@empty                    \everypar{\lsthk@EveryLine\lsthk@EveryPar}}%            \fi        \fi        \everypar\expandafter{\lst@ltxlabel                              \lsthk@EveryLine\lsthk@EveryPar}%    \else        \everypar{}\let\lst@NewLine\@empty    \fi    \lsthk@InitVars \lsthk@InitVarsBOL    \lst@Let{13}\lst@MProcessListing    \let\lst@Backslash#1%    \lst@EnterMode{\lst@Pmode}{\lst@SelectCharTable}%    \lst@InitFinalize}\def\lst@DeInit{%    \lst@XPrintToken \lst@EOLUpdate    \global\advance\lst@newlines\m@ne    \lst@ifshowlines        \lst@DoNewLines    \else        \setbox\@tempboxa\vbox{\lst@DoNewLines}%    \fi    \lst@ifdisplaystyle \par\removelastskip \fi    \lsthk@ExitVars\everypar{}\lsthk@DeInit\normalbaselines\normalcolor    \lst@MakeCaption b%    \lst@ifbox        \egroup $\hss \egroup        \vrule\@width\lst@maxwidth\@height\z@\@depth\z@    \else        \lst@ifdisplaystyle            \par\penalty-50\vspace\lst@belowskip        \fi    \fi% chmod begin    \ifx\lst@multicols\@empty\else        \def\lst@next{\global\let\@checkend\@gobble                      \endmulticols                      \global\let\@checkend\lst@@checkend}        \expandafter\lst@next    \fi% chmod end    \ifx\lst@float\relax\else        \expandafter\lst@endfloat    \fi    \endgroup}\let\lst@@checkend\@checkend%%\endinput%%%% End of file `lstpatch.sty'.
Index: doc/theses/lynn_tran_SE499/se499-report.tex
===================================================================
--- doc/theses/lynn_tran_SE499/se499-report.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/se499-report.tex	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,204 @@
+% https://github.com/lynnt/SE499-report
+
+%% ----------------------------------------------------------------
+%% Thesis.tex -- MAIN FILE (the one that you compile with LaTeX)
+%% ---------------------------------------------------------------- 
+
+% Set up the document
+\documentclass[legalpaper, 11pt, oneside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
+\graphicspath{Figures/}  % Location of the graphics files (set up for graphics to be in PDF format)
+
+% Include any extra LaTeX packages required
+\usepackage{times}
+\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
+\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
+\usepackage{vector}  % Allows "\bvec{}" and "\buvec{}" for "blackboard" style bold vectors in maths
+\usepackage[pagewise]{lineno}
+\usepackage{listings}
+
+\usepackage{etoolbox} % for robustify
+\usepackage[dvipsnames]{xcolor}
+\usepackage{listings}
+\lstset{moredelim=**[is][\color{red}]{`}{`}}
+\hypersetup{urlcolor=blue, colorlinks=true}  % Colours hyperlinks in blue, but this can be distracting if there are many links.
+%\urlstyle{sf}
+%% ----------------------------------------------------------------
+\newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
+\newcommand{\CFA}{\protect\CFAIcon}		% safe for section/caption
+\newcommand{\CC}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
+\newcommand{\uC}{$\mu$\CC}
+
+
+\begin{document}
+\frontmatter      % Begin Roman style (i, ii, iii, iv...) page numbering
+%\linenumbers    % TODO: remove this please
+% Set up the Title Page
+\title{GNU Debugger support for \uC and \CFA}
+\authors  {\texorpdfstring
+            {\href{tmltran@uwaterloo.ca}{Thi My Linh Tran}}
+            {Thi My Linh Tran}
+            }
+\emails{tmltran@uwaterloo.ca}
+\addresses  {\groupname\\\deptname\\\univname}  % Do not change this here, instead these must be set in the "Thesis.cls" file, please look through it instead
+\date       {\today}
+\subject    {}
+\keywords   {}
+\maketitle
+\setcounter{page}{2}
+%% ----------------------------------------------------------------
+
+\setstretch{1.3}  % It is better to have smaller font and larger line spacing than the other way round
+
+% Define the page headers using the FancyHdr package and set up for one-sided printing
+\fancyhead{}  % Clears all page headers and footers
+\rhead{\thepage}  % Sets the right side header to show the page number
+\lhead{}  % Clears the left side page header
+
+%  Reduce size of section titles
+\makeatletter
+\renewcommand\section{\@startsection{section}{1}{\z@}{-1.0ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\large\bfseries}}
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-1.0ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-1.0ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
+\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}}
+\makeatother
+
+\lstset{numberstyle=\scriptsize\sffamily}
+
+\pagestyle{fancy}  % Finally, use the "fancy" page style to implement the FancyHdr headers
+
+%% ----------------------------------------------------------------
+% The Abstract Page
+\addtotoc{Preface}  % Add the "Abstract" page entry to the Contents
+\preface{
+\addtocontents{toc}{\vspace{1em}}  % Add a gap in the Contents, for aesthetics
+
+The goal of this work is to add GNU Debugger support for the language \uC and \CFA. To
+achieve this goal for \uC, new extensions are written to provide additional
+support for high-level constructs that are unknown to the GNU Debugger. In addition to the work done for
+\uC, many hooks are added in the GNU Debugger to enable the addition of a \CFA
+demangler.
+
+This report assumes the reader has basic knowledge of compiler construction.
+Background knowledge about how the GNU Debugger works and specific features of \uC and
+\CFA
+are provided in the report.
+}
+
+\clearpage  % Abstract ended, start a new page
+%% ----------------------------------------------------------------
+
+\setstretch{1.3}  % Reset the line-spacing to 1.3 for body text (if it has changed)
+
+% The Acknowledgements page, for thanking everyone
+\acknowledgements{
+\addtocontents{toc}{\vspace{1em}}  % Add a gap in the Contents, for aesthetics
+
+I would like to thank Professor Peter Buhr and Thierry
+Delisle for their guidance throughout the development of this project. The
+GNU Debugger's internal manual \cite{Reference5} is used as a guide for the development of
+adding a demangler for \CFA, and \CFA's main page \cite{Reference13} for
+background knowledge and examples.
+}
+\clearpage  % End of the Acknowledgements
+%% ----------------------------------------------------------------
+
+\pagestyle{fancy}  %The page style headers have been "empty" all this time, now use the "fancy" headers as defined before to bring them back
+
+
+%% ----------------------------------------------------------------
+\lhead{\emph{Contents}}  % Set the left side page header to "Contents"
+\addcontentsline{toc}{chapter}{Listings}
+\tableofcontents  % Write out the Table of Contents
+
+%% ----------------------------------------------------------------
+%\lhead{\emph{List of Figures}}  % Set the left side page header to "List if Figures"
+%\listoffigures  % Write out the List of Figures
+
+%% ----------------------------------------------------------------
+%\lhead{\emph{List of Tables}}  % Set the left side page header to "List of Tables"
+%\listoftables  % Write out the List of Tables
+
+%% ----------------------------------------------------------------
+\lhead{\emph{List of Listings}}  % Set the left side page header to "List of Listings"
+\lstlistoflistings
+
+%% ----------------------------------------------------------------
+\setstretch{1.5}  % Set the line spacing to 1.5, this makes the following tables easier to read
+%\clearpage  % Start a new page
+%\lhead{\emph{Abbreviations}}  % Set the left side page header to "Abbreviations"
+%\listofsymbols{ll}  % Include a list of Abbreviations (a table of two columns)
+%{
+% \textbf{Acronym} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or \\
+%\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere \\
+%\textbf{GDB} & GNU Debugger \\
+%\textbf{API} & Application Programming Interface \\
+%}
+
+%% ----------------------------------------------------------------
+\clearpage  % Start a new page
+%% ----------------------------------------------------------------
+% End of the pre-able, contents and lists of things
+% Begin the Dedication page
+
+\setstretch{1.3}  % Return the line spacing back to 1.3
+
+\addtocontents{toc}{\vspace{2em}}  % Add a gap in the Contents, for aesthetics
+
+
+%% ----------------------------------------------------------------
+\mainmatter	  % Begin normal, numeric (1,2,3...) page numbering
+\pagestyle{fancy}  % Return the page headers back to the "fancy" style
+
+% Include the chapters of the thesis, as separate files
+% Just uncomment the lines as you write the chapters
+
+\lhead{\emph{Introduction}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/Introduction} % Introduction
+% Background
+\clearpage  % Start a new page
+\lhead{\emph{\uC}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/uCPP}
+\clearpage  %Start a new page
+\lhead{\emph{GNU Debugger}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/GDB}
+\clearpage  %Start a new page
+\lhead{\emph{\CFA}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/CFA}
+\clearpage  %Start a new page
+
+% Real work done
+
+\lhead{\emph{GNU Debugger Extensions for \uC}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/Extensions}
+\clearpage  %Start a new page
+\lhead{\emph{\CFA Demangler}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/Demangler}
+\clearpage  %Start a new page
+
+\lhead{\emph{Conclusion}}  % Set the left side page header to "Abbreviations"
+\input{Chapters/Conclusion} % Conclusion
+
+%% ----------------------------------------------------------------
+% Now begin the Appendices, including them as separate files
+
+\addtocontents{toc}{\vspace{2em}} % Add a gap in the Contents, for aesthetics
+
+\appendix % Cue to tell LaTeX that the following 'chapters' are Appendices
+
+%\input{Appendices/AppendixA}	% Appendix Title
+
+%\input{Appendices/AppendixB} % Appendix Title
+
+%\input{Appendices/AppendixC} % Appendix Title
+
+\addtocontents{toc}{\vspace{2em}}  % Add a gap in the Contents, for aesthetics
+\backmatter
+
+%% ----------------------------------------------------------------
+\label{Bibliography}
+\lhead{\emph{Bibliography}}  % Change the left side page header to "Bibliography"
+\bibliographystyle{unsrtnat}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
+\bibliography{Bibliography}  % The references (bibliography) information are stored in the file named "Bibliography.bib"
+
+\end{document}  % The End
+%% ----------------------------------------------------------------
Index: doc/theses/lynn_tran_SE499/vector.sty
===================================================================
--- doc/theses/lynn_tran_SE499/vector.sty	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
+++ doc/theses/lynn_tran_SE499/vector.sty	(revision 1b34b87a9432a5a2b3a787f7ef8ccb7e2dcc7c16)
@@ -0,0 +1,1 @@
+%%%% This is file `vector.sty',%% generated with the docstrip utility.%%%% The original source files were:%%%% vector.dtx  (with options: `package')%% %% Copyright (C) 1994 by Nick Efford%% %% This file is distributed in the hope that it will be useful,%% but WITHOUT ANY WARRANTY; without even the implied warranty of%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.%% \NeedsTeXFormat{LaTeX2e}\ProvidesPackage{vector}[1994/09/16 v1.0 vector macros for LaTeX2e (nde)]\RequirePackage{ifthen}\RequirePackage{calc}\newboolean{@wavy}\DeclareOption{wavy}{\setboolean{@wavy}{true}}\ProcessOptions\newcommand{\bvec}[1]{\ensuremath{\mathbf{#1}}}\newcommand{\buvec}[1]{\ensuremath{\mathbf{\hat{#1}}}}\newcommand{\svec}[1]{\ensuremath{\mathsf{#1}}}\newcommand{\suvec}[1]{\ensuremath{\mathsf{\hat{#1}}}}\ifthenelse{\boolean{@wavy}}{%  \PackageInfo{vector}{wavy underlining selected}  \newcommand{\undertilde}[1]{\mathord{\vtop{\ialign{##\crcr    $\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern1.5pt\nointerlineskip}    $\hfil\tilde{}\hfil$\crcr\noalign{\kern1.5pt}}}}}  \newcommand{\uvec}[1]{\ensuremath{\undertilde{#1}}}  \newcommand{\uuvec}[1]{\ensuremath{\hat{\undertilde{#1}}}}}{%  \newcommand{\uvec}[1]{\ensuremath{\underline{#1}}}  \newcommand{\uuvec}[1]{\ensuremath{\hat{\underline{#1}}}}}\def\first@element{1}\newcommand{\firstelement}[1]{\def\first@element{#1}}\newcommand{\irvec}[2][n]{\ensuremath{{#2}_{\first@element},\ldots,{#2}_{#1}}}\newcommand{\icvec}[2][n]{%  \begin{array}{c}    {#2}_{\first@element}\\ \vdots\\ {#2}_{#1}  \end{array}}\newcounter{vec@elem}\newcommand{\rvec}[3]{%  \ensuremath{%    \ifthenelse{#3 > #2}{%      \setcounter{vec@elem}{#2}      \whiledo{\value{vec@elem} < #3}%        {{#1}_{\thevec@elem}, \stepcounter{vec@elem}}%      {#1}_{#3}}{{#1}_{#2}}}}\newcommand{\cvec}[3]{%  \ifthenelse{#3 > #2}{%    \setcounter{vec@elem}{#2}    \begin{array}{c}      \whiledo{\value{vec@elem} < #3}%        {{#1}_{\thevec@elem} \\ \stepcounter{vec@elem}}%      {#1}_{#3}    \end{array}}{{#1}_{#2}}}\endinput%%%% End of file `vector.sty'.
