Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LLDB crash with a simple help commond #1590

Closed
zte-majiang opened this issue Sep 26, 2021 · 8 comments
Closed

[BUG] LLDB crash with a simple help commond #1590

zte-majiang opened this issue Sep 26, 2021 · 8 comments

Comments

@zte-majiang
Copy link

Description

/mnt/d/opensource/android_ndk/android-ndk-r23$ ./toolchains/llvm/prebuilt/linux-x86_64/bin/lldb.sh
Cannot read termcap database;
using dumb terminal settings.
(lldb) help x
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace.
Stack dump:
0. Program arguments: /mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb
#0 0x0000000000231665 (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb+0x231665)
#1 0x0000000000231bb0 (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb+0x231bb0)
#2 0x0000000000231b1a (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb+0x231b1a)
#3 0x00007f5ea9c003c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007f5ea9012395 lldb_private::Options::GenerateOptionUsage(lldb_private::Stream&, lldb_private::CommandObject*, unsigned int) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x442e395)
#5 0x00007f5ea8ffd6e1 lldb_private::CommandObject::GenerateHelpText(lldb_private::Stream&) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x44196e1)
#6 0x00007f5ea94cd5cb lldb_private::CommandObjectHelp::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x48e95cb)
#7 0x00007f5ea8ffe38f lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x441a38f)
#8 0x00007f5ea8ff18ac lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, lldb_private::ExecutionContext*, bool, bool) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x440d8ac)
#9 0x00007f5ea8ff6240 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x4412240)
#10 0x00007f5ea8f4f346 lldb_private::IOHandlerEditline::Run() (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x436b346)
#11 0x00007f5ea8f325ed lldb_private::Debugger::RunIOHandlers() (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x434e5ed)
#12 0x00007f5ea8ff78bc lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInterpreterRunOptions&) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x44138bc)
#13 0x00007f5ea8a9db8d lldb::SBDebugger::RunCommandInterpreter(bool, bool) (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/liblldb.so.12git+0x3eb9b8d)
#14 0x00000000002388b1 main (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb+0x2388b1)
#15 0x00007f5ea47570b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#16 0x0000000000231d95 _start (/mnt/d/opensource/android_ndk/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb+0x231d95)
./toolchains/llvm/prebuilt/linux-x86_64/bin/lldb.sh: line 5: 3618 Segmentation fault (core dumped) "$CURDIR/lldb" "$@"

Environment Details

Windows10 WSL Ubuntu20.04

:/mnt/d/opensource/android_ndk/android-ndk-r23$ uname -a
Linux P80299346 4.4.0-17763-Microsoft #1432-Microsoft Mon Aug 18 18:18:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
:/mnt/d/opensource/android_ndk/android-ndk-r23$ cat source.properties
Pkg.Desc = Android NDK
Pkg.Revision = 23.0.7599858

@DanAlbert
Copy link
Member

Repros on debian as well, so it's at least not a WSL issue. It looks like it is specifically a crash that happens when you run help with an unrecognized argument (help is fine, help list is fine, help x is not). Still present in the r24 canary.

@DanAlbert DanAlbert added this to Triaged in r24 via automation Sep 27, 2021
@DanAlbert DanAlbert added this to Awaiting triage in LLVM via automation Sep 27, 2021
@rprichard
Copy link
Collaborator

It looks like it is specifically a crash that happens when you run help with an unrecognized argument

help asdfasdfasdf prints error: 'asdfasdfasdf' is not a known command. The x command is supposed to be short for memory read, and help memory read also segfaults. They don't segfault in the upstream clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04 binary.

It looks broken in r416183{b,c,c1} and fixed in r428724 and r433403.

@DanAlbert DanAlbert moved this from Awaiting triage to Awaiting update in LLVM Sep 27, 2021
@DanAlbert DanAlbert moved this from Awaiting update to Prebuilts submitted in LLVM Sep 27, 2021
@DanAlbert
Copy link
Member

Thanks for checking that. Nothing for us to do then other than update to the newer build, unless we think this is worth cherry-picking to r23c?

@pirama-arumuga-nainar
Copy link
Collaborator

FWIW, it was easy to find the fix by looking for memory read in git log lldb: https://reviews.llvm.org/D94917 (9a7672ac4980bca8829814e1e49e1c201a5bf9b6).

I don't think we should respin toolchain specifically for this issue though.

@DanAlbert DanAlbert added this to Triaged in r23c via automation Sep 27, 2021
@DanAlbert
Copy link
Member

I don't think we should respin toolchain specifically for this issue though.

Agreed. We should pick it up if (and realistically, when) we need to respin the toolchain for other issues. Triaged to r23c but will punt to r23d if we somehow manage to make it through a minor release without otherwise updating the toolchain.

@DanAlbert DanAlbert moved this from Triaged to Merged in r24 Sep 29, 2021
@DanAlbert DanAlbert moved this from Prebuilts submitted to Awaiting prebuilt drop in LLVM Dec 14, 2021
@stephenhines
Copy link
Collaborator

https://android-review.googlesource.com/c/toolchain/llvm_android/+/1965517 has the cherry-pick for r416183b (but needs prebuilts once merged).

@DanAlbert DanAlbert moved this from Triaged to Needs prebuilt update in r23c Apr 21, 2022
@DanAlbert DanAlbert moved this from Needs prebuilt update to Needs cherry-pick in r23c Apr 22, 2022
@DanAlbert DanAlbert moved this from Needs cherry-pick to Merged in r23c Apr 22, 2022
@DanAlbert DanAlbert moved this from Awaiting prebuilt drop to Prebuilts submitted in LLVM Apr 22, 2022
@DanAlbert
Copy link
Member

Should be fixed in build 8486889.

cyberknight777 pushed a commit to Neutron-Toolchains/aosp_llvm_android that referenced this issue May 30, 2022
Bug: android/ndk#1590

9a7672ac498 [lldb] Fix crash in "help memory read"

Test: N/A
Change-Id: Ie8dc7c8dd742a21c337318a67e780637aafac79f
MaoHan001 pushed a commit to riscv-android-src/platform-ndk that referenced this issue Jun 22, 2022
Changelog updates are in a separate commit to make cherry-picking to
master easier.

Bug: android/ndk#1590
Bug: android/ndk#1608
Bug: android/ndk#1619
Bug: android/ndk#1645
Bug: android/ndk#1672
Test: ./checkbuild.py && ./run_tests.py
Change-Id: Ie5571ed436cb0a3fe9ad675ed15f62fff4e978d6
(cherry picked from commit 59e8e507c2a2147c2bc806087c953dd36f6b1c41)
Merged-In: Ie5571ed436cb0a3fe9ad675ed15f62fff4e978d6
MaoHan001 pushed a commit to riscv-android-src/platform-ndk that referenced this issue Jun 22, 2022
Separate from the toolchain update to avoid merge conflicts.

Bug: android/ndk#1590
Bug: android/ndk#1608
Bug: android/ndk#1619
Bug: android/ndk#1645
Bug: android/ndk#1672
Test: None
Change-Id: I6e24e582dc0c300db173083009da9a1494360137
(cherry picked from commit 25ab62f84177b8f57782048a01a755c5730d6e6b)
Merged-In: I6e24e582dc0c300db173083009da9a1494360137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 participants