Commit | Line | Data |
---|---|---|
c01dcd34 AB |
1 | debuginfo-data |
2 | ============== | |
3 | ||
4 | This directory contains pre-generated ELF and DWARF files used to test | |
ff570584 | 5 | the debug-info analysis feature, including lookup of DWARF debugging |
c01dcd34 AB |
6 | information via build ID and debug link methods, as well as the source |
7 | files used to generate them. | |
8 | ||
9 | The generated files are: | |
10 | ||
11 | * `libhello.so` (ELF and DWARF) | |
12 | * `libhello_elf.so` (ELF only) | |
13 | * `libhello_build_id.so` (ELF with separate DWARF via build ID) | |
14 | * `libhello_debug_link.so` (ELF with separate DWARF via debug link) | |
15 | * `libhello_debug_link.so.debug` (DWARF for debug link) | |
16 | * `.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug` (DWARF for build ID) | |
17 | ||
18 | All files are generated from the four (4) following source files: | |
19 | ||
20 | * libhello.c | |
21 | * libhello.h | |
22 | * tp.c | |
23 | * tp.h | |
24 | ||
25 | The generated executables were built using a GNU toolchain on an | |
26 | x86_64 machine. | |
27 | ||
28 | To regenerate them, you can use follow these steps: | |
29 | ||
30 | ## ELF and DWARF | |
31 | ||
32 | $ gcc -g -fPIC -c -I. tp.c libhello.c | |
33 | $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello.so -o libhello.so tp.o libhello.o | |
34 | ||
35 | ## ELF only | |
36 | ||
37 | $ gcc -fPIC -c -I. tp.c libhello.c | |
38 | $ gcc -shared -llttng-ust -ldl -Wl,-soname,libhello_elf.so -o libhello_elf.so tp.o libhello.o | |
39 | ||
40 | ## ELF and DWARF with Build ID | |
41 | ||
42 | $ gcc -g -fPIC -c -I. tp.c libhello.c | |
43 | $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_build_id.so -Wl,--build-id=sha1 -o libhello_build_id.so tp.o libhello.o | |
44 | $ mkdir -p .build-id/cd/ | |
45 | $ objcopy --only-keep-debug libhello_build_id.so .build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug | |
46 | $ strip -g libhello_build_id.so | |
47 | ||
48 | The build ID might not be the same once the executable is regenerated | |
49 | on your system, so adjust the values in the directory and file names | |
50 | accordingly. Refer to the GDB documentation for more information: | |
51 | https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html | |
52 | ||
53 | ## ELF and DWARF with Debug Link | |
54 | ||
55 | $ gcc -g -fPIC -c -I. tp.c libhello.c | |
56 | $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_debug_link.so -o libhello_debug_link.so tp.o libhello.o | |
57 | ||
58 | $ objcopy --only-keep-debug libhello_debug_link.so libhello_debug_link.so.debug | |
59 | $ strip -g libhello_debug_link.so | |
60 | $ objcopy --add-gnu-debuglink=libhello_debug_link.so.debug libhello_debug_link.so |