[bootlin/training-materials updates] master: training: slides: debugging-application-tracing: fix LD_PRELOAD example (6d5bc75c)

Luca Ceresoli luca.ceresoli at bootlin.com
Wed Aug 23 14:32:12 CEST 2023


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/6d5bc75c767dfb2ab3298e6b53d9bb098bdef11a

>---------------------------------------------------------------

commit 6d5bc75c767dfb2ab3298e6b53d9bb098bdef11a
Author: Luca Ceresoli <luca.ceresoli at bootlin.com>
Date:   Wed Aug 23 12:46:18 2023 +0200

    training: slides: debugging-application-tracing: fix LD_PRELOAD example
    
    Fix the example so it is usable out of the box (tested on Ubuntu 22.04).
    
    Fixes build error:
    
      my_lib.c:3:1: error: unknown type name ‘ssize_t’; did you mean ‘size_t’?
    
    and runtime error:
    
      ERROR: ld.so: object 'my_lib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
    
    Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>


>---------------------------------------------------------------

6d5bc75c767dfb2ab3298e6b53d9bb098bdef11a
 slides/debugging-application-tracing/debugging-application-tracing.tex | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/slides/debugging-application-tracing/debugging-application-tracing.tex b/slides/debugging-application-tracing/debugging-application-tracing.tex
index cf493c23..99a04f7c 100644
--- a/slides/debugging-application-tracing/debugging-application-tracing.tex
+++ b/slides/debugging-application-tracing/debugging-application-tracing.tex
@@ -30,6 +30,7 @@
   \begin{block}{}
     \begin{minted}[fontsize=\small]{c}
 #include <string.h>
+#include <unistd.h>
 
 ssize_t read(int fd, void *data, size_t size) {
   memset(data, 0x42, size);
@@ -51,7 +52,7 @@ $ gcc -shared -fPIC -o my_lib.so my_lib.c
   \end{itemize}
   \begin{block}{}
     \begin{minted}[fontsize=\small]{console}
-$ LD_PRELOAD=my_lib.so ./exe
+$ LD_PRELOAD=./my_lib.so ./exe
     \end{minted}
   \end{block}
 \end{frame}




More information about the training-materials-updates mailing list