Refactor "complex & slow"
This commit is contained in:
parent
2870f6a51d
commit
3b9768c76a
1 changed files with 56 additions and 6 deletions
60
slides.tex
60
slides.tex
|
@ -56,6 +56,10 @@
|
||||||
morekeywords={gdb},
|
morekeywords={gdb},
|
||||||
sensitive=false,
|
sensitive=false,
|
||||||
}
|
}
|
||||||
|
\lstdefinelanguage{cfiasm}{
|
||||||
|
morekeywords={cfi_startproc,cfi_def_cfa_offset,cfi_offset,cfi_def_cfa_register},
|
||||||
|
sensitive=false,
|
||||||
|
}
|
||||||
|
|
||||||
\setbeamertemplate{footline}
|
\setbeamertemplate{footline}
|
||||||
{
|
{
|
||||||
|
@ -237,14 +241,58 @@ Segmentation fault.
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
|
|
||||||
\pause{}
|
\pause{}
|
||||||
|
\vfill
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item[\textbf{$\longrightarrow$}] \textbf{\alert{constructed} on-demand
|
\item[\textbf{$\longrightarrow$}] \textbf{\alert{constructed} on-demand
|
||||||
by a \alert{Turing-complete stack machine}!}
|
by a \alert{Turing-complete stack machine}!}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{What does this imply?}
|
||||||
|
Your compiler actually generates codes for \alert{two machines}: your
|
||||||
|
processor and the DWARF VM\@.
|
||||||
|
|
||||||
|
\vfill{}
|
||||||
|
\begin{columns}
|
||||||
|
\begin{column}{0.5\textwidth}
|
||||||
|
\begin{center}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
||||||
|
\node (cmd) at (0, 2.5) {
|
||||||
|
\lstbash{\$ gcc -S foo.c}
|
||||||
|
};
|
||||||
|
\node (asm) at (0, 0) {
|
||||||
|
\lstinputlisting[numbers=none, language=cfiasm]{src/main_cfi.s}
|
||||||
|
};
|
||||||
|
\end{scope}
|
||||||
|
\begin{scope}[>={Stealth[black]},
|
||||||
|
every path/.style={draw=black,very thick}]
|
||||||
|
\path [->] (cmd) -- (asm);
|
||||||
|
\end{scope}
|
||||||
|
\end{tikzpicture}
|
||||||
|
\medskip{}
|
||||||
|
|
||||||
|
\textbf{The \lstc{.cfi_*} is inline DWARF!}
|
||||||
|
\end{center}
|
||||||
|
\end{column}
|
||||||
|
|
||||||
|
\begin{column}{0.5\textwidth}
|
||||||
|
\begin{center}
|
||||||
|
\bf
|
||||||
|
$\implies$ if you write inline asm, you must write inline DWARF!
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
In \prog{glibc}, \prog{lowlevellock.h}:
|
||||||
|
\alert{off by one error in unwinding data}. Result:
|
||||||
|
|
||||||
|
\lstinputlisting[language=gdb,numbers=none]{src/lowlevellock_backtrace}
|
||||||
|
\end{column}
|
||||||
|
\end{columns}
|
||||||
|
|
||||||
|
|
||||||
\only<2->{
|
\only<2->{
|
||||||
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.17\paperheight)%
|
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.10\paperheight)%
|
||||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||||
\bf \huge
|
\bf \huge
|
||||||
Complex \,\& \,slow
|
Complex \,\& \,slow
|
||||||
|
@ -253,13 +301,15 @@ Segmentation fault.
|
||||||
}
|
}
|
||||||
|
|
||||||
\only<3->{
|
\only<3->{
|
||||||
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.35\paperheight)%
|
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.30\paperheight)%
|
||||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||||
\huge
|
\huge
|
||||||
\textbf{Pervasive:}\\ relied upon by debuggers, profilers, C++
|
\textbf{Pervasive:}\\ relied upon by debuggers, profilers,
|
||||||
exceptions \\
|
aaand\ldots{}
|
||||||
|
\onslide<4->{
|
||||||
|
C++ exceptions. \\
|
||||||
\medskip{}
|
\medskip{}
|
||||||
\textbf{$\leadsto$ not only for debuggers!}
|
\textbf{$\leadsto$ not only for debuggers!}}
|
||||||
\end{tcolorbox}
|
\end{tcolorbox}
|
||||||
\end{textblock*}
|
\end{textblock*}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue