Issue 147446
Summary [ELF][debug_section][gdb vs lldb][readelf vs llvm-readelf][Does LLVM customize ELF's debug_section]
Labels new issue
Assignees
Reporter xiaoqiang-wang
    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**?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to