Compare commits
6 commits
2635a3190a
...
5ecaeca632
Author | SHA1 | Date | |
---|---|---|---|
Théophile Bastian | 5ecaeca632 | ||
Théophile Bastian | fe242b9ac6 | ||
Théophile Bastian | bb80c3be9a | ||
Théophile Bastian | 7a443bba1b | ||
Théophile Bastian | f21ad366e7 | ||
Théophile Bastian | a1cc44cfd8 |
BIN
demo.old/demo.bin
Executable file
BIN
demo.old/demo.bin
Executable file
Binary file not shown.
BIN
demo.old/demo.bin.synth
Executable file
BIN
demo.old/demo.bin.synth
Executable file
Binary file not shown.
14
demo.old/demo.c
Normal file
14
demo.old/demo.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int bar(int x) {
|
||||
printf("'I’m %d; how many? %n\n", x, &x);
|
||||
return x;
|
||||
}
|
||||
|
||||
int foo() {
|
||||
return bar(3);
|
||||
}
|
||||
|
||||
int main() {
|
||||
return foo();
|
||||
}
|
12
demo.old/synth.sh
Executable file
12
demo.old/synth.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
SYNTHESIS_SCRIPT="../../../src/dwarf-synthesis/synthesize_dwarf.sh"
|
||||
|
||||
if [ "$#" -lt 1 ] ; then
|
||||
>&2 echo -e "Missing argument: object file.\nUsage: $0 object.o"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
objfile="$1"
|
||||
|
||||
$SYNTHESIS_SCRIPT "$objfile" "$objfile.synth"
|
2
demo/.gitignore
vendored
Normal file
2
demo/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
dwarf-synthesis
|
||||
tests/data*
|
9
demo/Makefile
Normal file
9
demo/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
all:
|
||||
@>&2 echo "Please provide an explicit target"
|
||||
@exit 1
|
||||
|
||||
tests/data:
|
||||
dd if=/dev/urandom of="$@" bs=512K count=4
|
||||
|
||||
clean:
|
||||
rm -f tests/data.gz tests/gzip.synth
|
BIN
demo/tests/gzip
Executable file
BIN
demo/tests/gzip
Executable file
Binary file not shown.
120
slides.tex
120
slides.tex
|
@ -17,6 +17,7 @@
|
|||
\usepackage{multirow}
|
||||
\usepackage[many]{tcolorbox}
|
||||
\usepackage[absolute,overlay]{textpos}
|
||||
\usetikzlibrary{arrows.meta}
|
||||
|
||||
\usepackage{texlib/my_listings}
|
||||
\usepackage{texlib/specific}
|
||||
|
@ -129,7 +130,7 @@
|
|||
\begin{frame}[fragile]{}
|
||||
\begin{columns}[c]
|
||||
\begin{column}{0.65\textwidth}
|
||||
\begin{lstlisting}[language=gdb, numbers=none, escapechar=|]
|
||||
\begin{lstlisting}[basicstyle=\tt,language=gdb, numbers=none, escapechar=|]
|
||||
$ ./a.out
|
||||
Segmentation fault.
|
||||
|
||||
|
@ -240,22 +241,26 @@ Segmentation fault.
|
|||
by a \alert{Turing-complete stack machine}!}
|
||||
\end{itemize}
|
||||
|
||||
\pause{}
|
||||
\only<2->{
|
||||
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.17\paperheight)%
|
||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||
\bf \huge
|
||||
Complex \,\& \,slow
|
||||
\end{tcolorbox}
|
||||
\end{textblock*}
|
||||
}
|
||||
|
||||
\vspace{-5cm}
|
||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||
\bf \huge
|
||||
Complex \,\& \,slow
|
||||
\end{tcolorbox}
|
||||
|
||||
\pause{}
|
||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||
\huge
|
||||
\textbf{Pervasive:}\\ relied upon by debuggers, profilers, C++
|
||||
exceptions \\
|
||||
\medskip{}
|
||||
\textbf{$\leadsto$ not only for debuggers!}
|
||||
\end{tcolorbox}
|
||||
\only<3->{
|
||||
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.35\paperheight)%
|
||||
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
||||
\huge
|
||||
\textbf{Pervasive:}\\ relied upon by debuggers, profilers, C++
|
||||
exceptions \\
|
||||
\medskip{}
|
||||
\textbf{$\leadsto$ not only for debuggers!}
|
||||
\end{tcolorbox}
|
||||
\end{textblock*}
|
||||
}
|
||||
\end{frame}
|
||||
|
||||
\newcommand{\LinusMailOne}{
|
||||
|
@ -403,7 +408,7 @@ Segmentation fault.
|
|||
|
||||
\begin{frame}{How do we actually synthesize?}
|
||||
\begin{itemize}
|
||||
\item Upon entering a function, we know (ABI)
|
||||
\item Upon entering a function, we know
|
||||
\[ \cfa = \reg{rsp} - 8
|
||||
\qquad \ra = \cfa + 8 \]
|
||||
\item The semantics of each instruction specifies \alert{how it changes \cfa}.
|
||||
|
@ -435,31 +440,52 @@ Segmentation fault.
|
|||
|
||||
\subsection{Compilation ahead-of-time}
|
||||
|
||||
\begin{frame}
|
||||
\begin{itemize}
|
||||
\item Compiled to \alert{C code}
|
||||
\item C code then \alert{compiled to native binary} (gcc)
|
||||
\begin{itemize}
|
||||
\item[$\leadsto$] gcc optimisations for free
|
||||
\end{itemize}
|
||||
\item Compiled as \alert{separate \texttt{.so} files}, called \ehelfs{}
|
||||
\bigskip{}
|
||||
\item Morally a \alert{monolithic switch} on IPs
|
||||
\item Each case contains assembly that computes a \alert{row of the
|
||||
table}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\begin{frame}[shrink]
|
||||
\lstinputlisting[language=C]{src/fib7/fib7.eh_elf_basic.c}
|
||||
\vspace{0.5cm}
|
||||
\begin{tikzpicture}
|
||||
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
||||
\node (dwarf) at (0, 0) {
|
||||
\lstinputlisting[basicstyle=\tiny\tt,numbers=none,language=]{src/dw_plt_abbr}
|
||||
};
|
||||
|
||||
\pause{}
|
||||
\vspace{1em}
|
||||
\begin{center}
|
||||
The real code is optimised, but boils down to this.
|
||||
\end{center}
|
||||
\only<2->{
|
||||
\node (table) at (0.5\textwidth, -0.23\textheight) {
|
||||
\tiny\tt
|
||||
\begin{tabular}{
|
||||
>{\columncolor{YellowGreen}}l
|
||||
>{\columncolor{Thistle}}l
|
||||
l l
|
||||
>{\columncolor{Apricot}}l}
|
||||
LOC & CFA & rbx & rbp & ra \\
|
||||
0084950 & rsp+8 & u & u & c-8 \\
|
||||
0084952 & rsp+16 & u & u & c-8 \\
|
||||
0084954 & rsp+24 & u & u & c-8 \\
|
||||
0084956 & rsp+32 & u & u & c-8 \\
|
||||
\end{tabular}
|
||||
};
|
||||
}
|
||||
\only<3->{
|
||||
\node (csrc) at (0, -0.6\textheight) {
|
||||
\lstinputlisting[basicstyle=\tiny,numbers=none,language=C]{src/fib7/fib7.eh_elf_basic.c}
|
||||
};
|
||||
\node (ehelf) at (0.55\textwidth, -0.75\textheight) {
|
||||
ELF file:
|
||||
``\ehelf{}''
|
||||
};
|
||||
}
|
||||
\end{scope}
|
||||
|
||||
\begin{scope}[>={Stealth[black]},
|
||||
every node/.style={fill=white,rectangle},
|
||||
every path/.style={draw=black,very thick}]
|
||||
\only<2->{\path [->] (dwarf) -| node {runtime} (table);}
|
||||
\only<3->{
|
||||
\path [->] (dwarf) edge node {ahead of time} (csrc);
|
||||
\path [->] (csrc) -| node {gcc, AoT} (ehelf);
|
||||
}
|
||||
\end{scope}
|
||||
\end{tikzpicture}
|
||||
\end{frame}
|
||||
|
||||
|
||||
|
@ -505,16 +531,14 @@ Segmentation fault.
|
|||
\section*{Conclusion}
|
||||
\setcounter{section}{0}
|
||||
|
||||
\begin{frame}
|
||||
The original article \textbf{Reliable and Fast DWARF-based Stack Unwinding}
|
||||
contains
|
||||
|
||||
\vspace{1em}
|
||||
|
||||
\begin{frame}{A lot of things remain to be done!}
|
||||
\begin{itemize}
|
||||
\item{} DWARF unwinding tables validation;
|
||||
\item{} DWARF unwinding tables synthesis;
|
||||
\item{} DWARF-based unwinding speedup.
|
||||
\item{} Synthesis + compare = verification of unwinding data!
|
||||
\item{} Synthesis could be integrated in compilers: support for inline
|
||||
assembly, fallback, \ldots
|
||||
\item{} Speedup could be implemented in profilers, debuggers,
|
||||
\ldots{}
|
||||
\item{} Probably many more cool things to do!
|
||||
\end{itemize}
|
||||
|
||||
\vspace{1em}
|
||||
|
|
7
src/dw_plt
Normal file
7
src/dw_plt
Normal file
|
@ -0,0 +1,7 @@
|
|||
30 24 34 FDE pc=004020..004040
|
||||
DW_CFA_def_cfa_offset: 16
|
||||
DW_CFA_advance_loc: 6 to 0000000000004026
|
||||
DW_CFA_def_cfa_offset: 24
|
||||
DW_CFA_advance_loc: 10 to 0000000000004030
|
||||
DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit11; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus)
|
||||
[...]
|
7
src/dw_plt_abbr
Normal file
7
src/dw_plt_abbr
Normal file
|
@ -0,0 +1,7 @@
|
|||
30 24 34 FDE pc=004020..004040
|
||||
DW_CFA_def_cfa_offset: 16
|
||||
DW_CFA_advance_loc: 6 to 0000000000004026
|
||||
DW_CFA_def_cfa_offset: 24
|
||||
DW_CFA_advance_loc: 10 to 0000000000004030
|
||||
DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8;
|
||||
DW_OP_breg16 (rip): 0; ...)
|
Loading…
Reference in a new issue