<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147445>147445</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ELF format][GDB][debug_section][Does LLVM customize the 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/eJy0WF1zo7jS_jXyTZcpIcCYC1-QeDybejOz785sdi-nBAijE4E4kojj_fWnJITxRyY7s3VOKhe2Plr9tJ6nu2WqNd93jG1QcoeS7YIOppFq88qp_Den3X55oN1-UcjquAH4hQkhEblHOH9AJG2BdoBIjkied5WSvFp-lYMq2fJeVmycANpV05ovn5Yf__9puf3y8MeHL28sHTRTAcL5nw3r4AGMOoKRdhQqVtNBGChl23PBwEgplmVD-XR-Kayv4TrAQeitIbLuFSsGLoxGZOdWILJrpDaI7ATvhtfl63o1TS1VQsg6TBHZIZKNIE_HNewHMSByD4BwPu94w7OSdvDzpsHaRji3AYU965iiZtz_4XHnbbRUcF1-GzG6TbU9RA9lybSuByGONsAI53eDc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