[lldb-dev] [patch] segfault in ProcessPOSIX on destroy the object

Viktor Kutuzov vkutuzov at accesssoftek.com
Fri Mar 30 12:49:31 PDT 2012


Hi everyone,

here is a patch, which fixes a segmentation fault crash in lldb in the ProcessPOSIX class when the object gets destroyed. I can reproduce this problem on the FreeBSD platform and it should be reproducable for the other platforms also.

The steps to reproduce (log):

  freebsd1# ./lldb /bin/ls
  Current executable set to '/bin/ls' (x86_64).
  (lldb) platform select remote-freebsd
  Host: FreeBSD 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC<mailto:root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC>
  (lldb) process connect localhost
  error: remote connections are not supported
  (lldb) exit
  Segmentation fault (core dumped)
Stack trace:

Program received signal SIGSEGV, Segmentation fault.
ProcessMonitor::GetPID (this=0x0) at ProcessMonitor.h:67
67     GetPID() const { return m_pid; }
(gdb) bt
#0  ProcessMonitor::GetPID (this=0x0) at ProcessMonitor.h:67
#1  0x00000008023b6890 in ProcessPOSIX::DoDestroy (this=0x805f4b800) at /usr/home/projects/llvm-lldb/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp:295
#2  0x0000000801703ff6 in lldb_private::Process::Destroy (this=0x805f4b800) at /usr/home/projects/llvm-lldb/tools/lldb/source/Target/Process.cpp:2887
#3  0x0000000801729be4 in lldb_private::Target::DeleteCurrentProcess (this=0x808b8d600) at /usr/home/projects/llvm-lldb/tools/lldb/source/Target/Target.cpp:132
#4  0x00000008012fdf03 in CommandObjectProcessConnect::Execute (this=0x805c2fc00, command=@0x7fffffffbf00<mailto:command=@0x7fffffffbf00>, result=@0x805d48140<mailto:result=@0x805d48140>)
    at /usr/home/projects/llvm-lldb/tools/lldb/source/Commands/CommandObjectProcess.cpp:883
#5  0x00000008014bdf40 in lldb_private::CommandObject::ExecuteWithOptions (this=0x805c2fc00, args=@0x7fffffffbf00<mailto:args=@0x7fffffffbf00>, result=@0x805d48140<mailto:result=@0x805d48140>)
    at /usr/home/projects/llvm-lldb/tools/lldb/source/Interpreter/CommandObject.cpp:281
#6  0x00000008014b2283 in lldb_private::CommandInterpreter::HandleCommand (this=0x805ca4200, command_line=0x80a41f198 "process connect connect://localhost", add_to_history=true,
    result=@0x805d48140<mailto:result=@0x805d48140>, override_context=0x0, repeat_on_empty_command=true, no_context_switching=false) at /usr/home/projects/llvm-lldb/tools/lldb/source/Interpreter/CommandInterpreter.cpp:1540
#7  0x000000080124a7b5 in lldb::SBCommandInterpreter::HandleCommand (this=0x7fffffffc2e0, command_line=0x80a41f198 "process connect connect://localhost", result=@0x7fffffffc2e8<mailto:result=@0x7fffffffc2e8>,
    add_to_history=true) at /usr/home/projects/llvm-lldb/tools/lldb/source/API/SBCommandInterpreter.cpp:97
#8  0x000000000040b666 in Driver::HandleIOEvent (this=0x7fffffffd708, event=@0x7fffffffc550<mailto:event=@0x7fffffffc550>) at /usr/home/projects/llvm-lldb/tools/lldb/tools/driver/Driver.cpp:980
#9  0x000000000040cc3e in Driver::MainLoop (this=0x7fffffffd708) at /usr/home/projects/llvm-lldb/tools/lldb/tools/driver/Driver.cpp:1406
#10 0x000000000040d28b in main (argc=2, argv=0x7fffffffd878, envp=0x7fffffffd890) at /usr/home/projects/llvm-lldb/tools/lldb/tools/driver/Driver.cpp:1540

Would somebody review and apply this patch if it looks ok?
Thanks.
Viktor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20120330/7862e1bc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lldb-processposix-crash.patch
Type: application/octet-stream
Size: 559 bytes
Desc: lldb-processposix-crash.patch
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20120330/7862e1bc/attachment.obj>


More information about the lldb-dev mailing list