<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147446>147446</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ELF][debug_section][gdb vs lldb][readelf vs llvm-readelf][Does LLVM customize ELF's debug_section]
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xiaoqiang-wang
</td>
</tr>
</table>
<pre>
Hello,
I'm an **Android-Source-Code** and **ARM-GPU-DRIVER-Source-Code** user.
When I try to use default compile tool-chain **clang-18.0.1** (prebuilts/clang/host/linux-x86/clang-r522817/),
compile the **ARM-GPU-DRIVER-Source-Code**,
the **clang-18.0.1** can compile the **ARM-GPU-DRIVER-Source-Code** ,
and generate the ELF **malisc_host** file successfully.
But, **there is must something goes wrong**,
I can NOT use the **gdb** to debug the **clang-18.0.1** generated ELF file.
When I update from **clang-18.0.1** to **clang-19.0.1**(prebuilts/clang/host/linux-x86/clang-r536225/bin/clang), the problem still exist.
I sincerely want your can kindly help me about below **Question_1** and **Question_2**.
---
gdb vs lldb
---
1.1 When I try to use "**gdb malisc_host**" command to debug, It show below error message.
```
Android_15$ gdb ./malisc_host
BFD: malisc_host: unable to initialize decompress status for section .debug_loclists
malisc_host: not in executable format: file format not recognized
```
1.2 But the **malisc_host** can be debug by latest **lldb-21.0.0** tool.
```
Android_15$ lldb ./malisc_host //OK it works
```
1. 3 The the output binary file **malisc_host** can be debug by **lldb**, but can NOT be debug by **gdb**.
a. **But the lldb is not a powerful tool, It can NOT stop on my added breakpoints**.
b. **So, I strongly want to use the **gdb** to debug the **malisc_host** ELF**.
----
readelf vs llvm-readelf
----
2.1. And when I use the Unbuntu's **readelf** command, it output below warning message.
**Warning message .debug_str unsupported compress type: 2**
```
Android_15$ readelf -p .comment ./malisc_host
readelf: Warning: section '.debug_str' has unsupported compress type: 2
String dump of section '.comment':
[ 0] GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
[ 2a] GCC: (GNU) 4.8.3
[ 3c] Android (11967740, +pgo, +bolt, +lto, +mlgo, based on r522817) clang version 18.0.1
(https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)
[ f3] Linker: LLD 18.0.1
```
2.2. But when I try used the llvm tool-chain **llvm-readelf**, it not report any warning.
```
Android_15$ llvm-readelf -p .comment ./malisc_host
String dump of section '.comment':
[ 0] GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
[ 2a] GCC: (GNU) 4.8.3
[ 3c] Android (12701618, +pgo, +bolt, +lto, +mlgo, based on r536225) clang version 19.0.1
(https://android.googlesource.com/toolchain/llvm-project b3a530ec6537146650e42be89f1089e9a3588460)
[ f3] Linker: LLD 19.0.1
```
Above **readelf** command output the warning message, and **llvm-readelf** not output any warnings,
I think in the **clang** generated ELF 's file header,
there must be something's **version** or **format** UN-Match with **gdb**'s expectation.
that lead to **gdb** can not correctly recognize the **malisc_host**'s format.
---
Q1:Does this means LLVM customize the ELF's debug_section,
that lead to **gdb** can not correctly recognize the **malisc_host**?
Q2: How can I fix it? and make **gdb** can debug the ELF **malisc_host**?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0WF2Tm7jS_jXyTReUEGDMhS-YcZydeifZd5Od3cuUANnojEAcSYzH--tPSQjjj8lssnVOKhdGH61-Ws_T3RqqNd93jK1ReofSzYIOppFq_cqp_Den3T440G6_KGV9XP_ChJCI3CNcPCCStUA7QKRApCi6WkleB1_loCoW3MuajRNAu3pa8-VT8PH_n4LNl4c_Pnx5Y-mgmQoRLv5sWAcPYNQRjLSjULMdHYSBSrY9FwyMlCKoGsqn8ythPY1WIQ4jbw2RVa9YOXBhNCJbtwKRbSO1QWQreDe8Bq-r5TQVqJSQVZQhskUkH0GejmvYD2JA5B4A4WLe8YZnFe3g502DtY1wYQMKe9YxRc24_8Pj1ttoqeC6-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