What does this imply: enhance
This commit is contained in:
parent
660852ce0d
commit
24f53aa0de
3 changed files with 54 additions and 14 deletions
39
slides.tex
39
slides.tex
|
@ -283,16 +283,16 @@ Segmentation fault.
|
|||
\end{frame}
|
||||
|
||||
\begin{frame}{What does this imply?}
|
||||
Your compiler actually generates codes for \alert{two machines}: your
|
||||
processor and the DWARF VM\@.
|
||||
Your compiler actually generates codes for \alert{two machines}:\\
|
||||
your processor and the DWARF VM\@.
|
||||
|
||||
\vfill{}
|
||||
\begin{columns}
|
||||
\begin{column}{0.5\textwidth}
|
||||
\begin{column}{0.45\textwidth}
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
||||
\node (cmd) at (0, 2.5) {
|
||||
\node (cmd) at (0, 3.0) {
|
||||
\lstbash{\$ gcc -S foo.c}
|
||||
};
|
||||
\node (asm) at (0, 0) {
|
||||
|
@ -304,25 +304,36 @@ Segmentation fault.
|
|||
\path [->] (cmd) -- (asm);
|
||||
\end{scope}
|
||||
\end{tikzpicture}
|
||||
\medskip{}
|
||||
%\vspace{0.2em}
|
||||
|
||||
\textbf{The \lstc{.cfi_*} is inline DWARF!}
|
||||
\textbf{\lstc{.cfi_*}: \alert{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}
|
||||
\begin{column}{0.55\textwidth}
|
||||
\begin{itemize}
|
||||
\item[$\implies$] \alert{Cumbersome} to generate for the
|
||||
\alert{compiler}
|
||||
\begin{itemize}
|
||||
\item[$\leadsto$] might do it wrong
|
||||
\item[$\leadsto$] might not do it at all
|
||||
\end{itemize}
|
||||
|
||||
In \prog{glibc}, \prog{lowlevellock.h}:
|
||||
\alert{off by one error in unwinding data}.
|
||||
\item[$\implies$] If you write \alert{inline asm}, \alert{you} must write
|
||||
inline DWARF\@!
|
||||
\end{itemize}
|
||||
|
||||
\lstinputlisting[language=gdb,numbers=none]{src/lowlevellock_backtrace}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}
|
||||
\todo{Actually add lowlevellock code}
|
||||
|
||||
In \prog{glibc}, \prog{lowlevellock.h}:
|
||||
\alert{off by one error in unwinding data}.
|
||||
|
||||
\lstinputlisting[language=gdb,numbers=none]{src/lowlevellock_backtrace}
|
||||
|
||||
\only<2->{
|
||||
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.10\paperheight)%
|
||||
|
|
|
@ -6,3 +6,5 @@ pushq %rbp
|
|||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $32, %rsp
|
||||
movl %edi, -20(%rbp)
|
||||
movq %rsi, -32(%rbp)
|
||||
|
|
27
src/main_cfi_full.s
Normal file
27
src/main_cfi_full.s
Normal file
|
@ -0,0 +1,27 @@
|
|||
main:
|
||||
.LFB6:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $32, %rsp
|
||||
movl %edi, -20(%rbp)
|
||||
movq %rsi, -32(%rbp)
|
||||
movq -32(%rbp), %rax
|
||||
addq $8, %rax
|
||||
movq (%rax), %rax
|
||||
movq %rax, %rdi
|
||||
call atoi@PLT
|
||||
movl %eax, -4(%rbp)
|
||||
movl -4(%rbp), %eax
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE6:
|
||||
.size main, .-main
|
||||
.ident "GCC: (GNU) 9.2.0"
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
|
Loading…
Reference in a new issue