llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.61k stars 11.82k forks source link

segfault hitting breakpoint on a VMware VM #18176

Closed llvmbot closed 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 17802
Resolution FIXED
Resolved on Feb 27, 2014 14:51
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

Archlinux i686 running on a hardware version 7 VMware VM. lldb (svnversion 193157) built with gcc 4.8.2 and cmake.

The following gdb session is run with lldb built in 'Debug' built type and '-O2' removed from CMAKE_CXX_FLAGS in CMakeCache.txt:

$ gdb /usr/bin/lldb GNU gdb (GDB) 7.6.1 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/bin/lldb...(no debugging symbols found)...done. (gdb) set args foobar (gdb) run Starting program: /usr/bin/lldb foobar warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0xb293eb40 (LWP 7612)] [New Thread 0xb213db40 (LWP 7613)] [New Thread 0xb15ffb40 (LWP 7614)] [New Thread 0xb0dfeb40 (LWP 7615)] Current executable set to 'foobar' (i386). (lldb) beakpoint set --name main Breakpoint 1: where = foobarmain + 26 at foobar.c:10, address = 0x080484da (lldb) run [New Thread 0xb05fdb40 (LWP 7616)] [New Thread 0xafdfcb40 (LWP 7618)] [New Thread 0xaf5fbb40 (LWP 7619)] warning: failed to set breakpoint site at 0x80483c0 for breakpoint -1.1: Unable to read memory at breakpoint address. warning: failed to set breakpoint site at 0x80484da for breakpoint 1.1: Unable to read memory at breakpoint address. lldb: /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp:503: void POSIXThread::WatchNotify(const ProcessMessage&): Assertionwp_sp.get() && "No watchpoint found"' failed.

Program received signal SIGABRT, Aborted. 0xb7fdd424 in __kernel_vsyscall () (gdb) bt

​0 0xb7fdd424 in __kernel_vsyscall ()

​1 0xb2be04c6 in raise () from /usr/lib/libc.so.6

​2 0xb2be1c53 in abort () from /usr/lib/libc.so.6

​3 0xb2bd9767 in __assert_fail_base () from /usr/lib/libc.so.6

​4 0xb2bd9817 in __assert_fail () from /usr/lib/libc.so.6

​5 0xb420825d in POSIXThread::WatchNotify (this=0xb18004e0, message=...)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp:503

​6 0xb4206b33 in LinuxThread::TraceNotify (this=0xb18004e0, message=...)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/Linux/LinuxThread.cpp:56

​7 0xb4207ae7 in POSIXThread::Notify (this=0xb18004e0, message=...)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp:345

​8 0xb420bc03 in ProcessPOSIX::RefreshStateAfterStop (this=0x80d9738)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp:550

​9 0xb4091016 in lldb_private::Process::ShouldBroadcastEvent (this=0x80d9738,

event_ptr=0xb18008a8)
at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Target/Process.cpp:3720

​10 0xb4091928 in lldb_private::Process::HandlePrivateEvent (this=0x80d9738, event_sp=

std::shared_ptr (count 1, weak 0) 0xb18008a8)
at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Target/Process.cpp:3968

​11 0xb408f00a in lldb_private::Process::Launch (this=0x80d9738, launch_info=...)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Target/Process.cpp:2951

​12 0xb4247317 in CommandObjectProcessLaunch::DoExecute (this=0x8077900, launch_args=...,

result=...)
at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp:286

​13 0xb3fcab9b in lldb_private::CommandObjectParsed::Execute (this=0x8077900,

args_string=0x80d550c "-c/bin/sh --", result=...)
at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Interpreter/CommandObject.cpp:1037

​14 0xb3fbf76a in lldb_private::CommandInterpreter::HandleCommand (this=0x806caf0,

command_line=0xb1600c04 "run", lazy_add_to_history=lldb_private::eLazyBoolYes, result=..., 
override_context=0x0, repeat_on_empty_command=true, no_context_switching=false)
at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp:18---Type <return> to continue, or q <return> to quit---q

Quit (gdb) frame 5

​5 0xb420825d in POSIXThread::WatchNotify (this=0xb18004e0, message=...)

at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp:503

503 assert(wp_sp.get() && "No watchpoint found"); (gdb) p wp_list Python Exception <type 'exceptions.ValueError'> Cannot find type lldb_private::WatchpointList::wp_collection::_Node: $1 = (const lldb_private::WatchpointList &) @​0x80b5e4c: {m_watchpoints = empty std::list, m_mutex = {m_mutex = {data = {lock = 0, count = 0, owner = 0, kind = 1, nusers = 0, { d = {espins = 0, elision = 0}, list = {next = 0x0}}}, size = '\000' <repeats 12 times>, "\001\000\000\000\000\000\000\000\000\000\000", align = 0}}, m_next_wp_id = 0} (gdb) p wp_sp $2 = std::shared_ptr (empty) 0x0 (gdb) p wp_sp.get() $3 = (lldb_private::Watchpoint *) 0x0 (gdb) p wp_sp->GetID()

Program received signal SIGSEGV, Segmentation fault. 0xb3ddb24e in lldb_private::StoppointLocation::GetID (this=0x0) at /home/xavier/builds/lldb-svn/src/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h:113 113 return m_loc_id; The program being debugged was signaled while in a function called from GDB. GDB remains in the frame where the signal was received. To change this behavior use "set unwindonsignal on". Evaluation of the expression containing the function (lldb_private::StoppointLocation::GetID() const) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) continue Continuing. [Thread 0xaf5fbb40 (LWP 7619) exited] [Thread 0xafdfcb40 (LWP 7618) exited] [Thread 0xb05fdb40 (LWP 7616) exited] [Thread 0xb0dfeb40 (LWP 7615) exited] [Thread 0xb213db40 (LWP 7613) exited] [Thread 0xb293eb40 (LWP 7612) exited] [Thread 0xb294d700 (LWP 7608) exited]

Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb) quit

llvmbot commented 10 years ago

Fixed in lldb SVN r202428.

llvmbot commented 10 years ago

Compiling with optimizations enabled and assertions enabled allowed me to make it through a 'make -j8'.

Running the tests with 'make -C tools/lldb/test' is failing, the build of test executables are failing with messages like this:

FAIL: LLDB (gcc-i686) :: test_display_source_python (TestSourceManager.SourceManagerTestCase) FAIL: LLDB (gcc-i686) :: test_modify_source_file_while_debugging (TestSourceManager.SourceManagerTestCase) FAIL: LLDB (gcc-i686) :: test_move_and_then_display_source (TestSourceManager.SourceManagerTestCase)

ERROR: test_display_source_python (TestSourceManager.SourceManagerTestCase) Test display of source using the SBSourceManager API.

Traceback (most recent call last): File "/home/tfiala/lldb/work/llvm/tools/lldb/test/lldbtest.py", line 319, in wrapper return func(self, *args, **kwargs) File "/home/tfiala/lldb/work/llvm/tools/lldb/test/source-manager/TestSourceManager.py", line 31, in test_display_source_python self.buildDefault() File "/home/tfiala/lldb/work/llvm/tools/lldb/test/lldbtest.py", line 1471, in buildDefault if not module.buildDefault(self, architecture, compiler, dictionary, clean): File "/home/tfiala/lldb/work/llvm/tools/lldb/test/plugins/builder_base.py", line 96, in buildDefault sender=sender) File "/home/tfiala/lldb/work/llvm/tools/lldb/test/lldbtest.py", line 284, in system raise CalledProcessError(retcode, cmd) CalledProcessError: Command '['/bin/sh', '-c', 'make clean;make ARCH=i686 CC=gcc']' returned non-zero exit status 2 Config=i686-gcc

I'll look at that next.

llvmbot commented 10 years ago

I set up an Ubuntu 13.10 32-bit environment.

I added these packages: sudo apt-get install build-essential swig libedit-dev ncurses-dev python-dev git

I grabbed the source via the llvm.org git mirrors.

The first issue I'm hitting is running out of memory on the build, using configure-based make:

Assume this structure: ~/lldb/work/llvm <= source ~/lldb/work/build <= build tree

cd ~/lldb/work/build ../llvm/configure --enable-cxx11 --prefix=pwd/../install make -j16

The first issue I hit is that I run out of memory quickly on a 32-bit machine. I ended up going with more like -j8 (I have allocated 8 cores to the VM). This got me most of the way there. I ran out of memory two more times.

And, I cannot make it through linking liblldb.so - ld keeps core dumping and looks like it is running out of memory.

Are we getting too fat for 32-bit toolchains? I'm going to try again without debug, and turn on optimized. Maybe that'll make enough headroom for me to replicate the issue.

llvmbot commented 10 years ago

I'll have a look at this on an Ubuntu 13.10 32-bit VM.

llvmbot commented 10 years ago

I think this is actually a general problem with 32-bit Linux builds as I'm getting the same issue here in a non-VM. Built with gcc 4.8.1 and this configure line:

./configure --enable-optimized --enable-assertions --enable-cxx11

Running gives:

lldb /usr/bin/python Current executable set to '/usr/bin/python' (i386). (lldb) r lldb: POSIXThread.cpp:505: void POSIXThread::WatchNotify(const ProcessMessage&): Assertion `wp_sp.get() && "No watchpoint found"' failed. Aborted (core dumped)

With this issue and #​18311 it seems that it's not currently possible to use lldb under 32-bit Linux.