[lldb-dev] lldb crashes on Linux

Tobias Platen tobias at platen-software.de
Sat Jul 2 10:40:47 PDT 2011


Hello,
I finally managed to compile LLDB on Linux but the programm debugged seems to crash in the first instruction with a SIGSEGV.

The Output of the compiler is:
si_code = 128
lldb: ProcessMonitor.cpp:1123: static ProcessMessage::CrashReason ProcessMonitor::GetCrashReasonForSIGSEGV(const siginfo*): Assertion `false && "unexpected si_code for SIGSEGV"' failed.

First of all I had to apply a small patch to lldb

--- source/Expression/ASTDumper.cpp	(revision 134085)
+++ source/Expression/ASTDumper.cpp	(working copy)
@@ -406,7 +406,7 @@
     m_stream.Indent();  m_stream.Printf("isCanonicalUnqualified() : %s\n", SfB(type->isCanonicalUnqualified()));
     m_stream.Indent();  m_stream.Printf("isIncompleteType() : %s\n", SfB(type->isIncompleteType()));
     m_stream.Indent();  m_stream.Printf("isObjectType() : %s\n", SfB(type->isObjectType()));
-    m_stream.Indent();  m_stream.Printf("isPODType() : %s\n", SfB(type->isPODType()));
+    //m_stream.Indent();  m_stream.Printf("isPODType() : %s\n", SfB(type->isPODType()));
     m_stream.Indent();  m_stream.Printf("isLiteralType() : %s\n", SfB(type->isLiteralType()));
     m_stream.Indent();  m_stream.Printf("isBuiltinType() : %s\n", SfB(type->isBuiltinType()));
     m_stream.Indent();  m_stream.Printf("isPlaceholderType() : %s\n", SfB(type->isPlaceholderType()));
Index: source/Plugins/Process/Linux/ProcessMonitor.cpp
===================================================================
--- source/Plugins/Process/Linux/ProcessMonitor.cpp	(revision 134085)
+++ source/Plugins/Process/Linux/ProcessMonitor.cpp	(working copy)
@@ -31,7 +31,10 @@
 #include "ProcessLinux.h"
 #include "ProcessMonitor.h"
 
+//for debugging the debugger
+#include <iostream>
 
+
 using namespace lldb_private;
 
 //------------------------------------------------------------------------------
@@ -241,7 +244,7 @@
 
     // Set errno to zero so that we can detect a failed peek.
     errno = 0;
-    unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL);
+    uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL);
 
     if (data == -1UL && errno)
         m_result = false;
@@ -1074,8 +1077,10 @@
             return ProcessMessage::Signal(pid, signo);
     }
 
+	
     if (signo == SIGSEGV) {
         lldb::addr_t fault_addr = reinterpret_cast<lldb::addr_t>(info->si_addr);
+	std::cerr << "SIGSEGV on Linux at \n";
         ProcessMessage::CrashReason reason = GetCrashReasonForSIGSEGV(info);
         return ProcessMessage::Crash(pid, reason, signo, fault_addr);
     }
@@ -1114,6 +1119,7 @@
     switch (info->si_code) 
     {
     default:
+        std::cerr << "si_code" << info->si_code;
         assert(false && "unexpected si_code for SIGSEGV");
         break;
     case SEGV_MAPERR:
@@ -1285,7 +1291,8 @@
 
             assert(status == sizeof(op));
             op->Execute(monitor);
-            write(fdset.fd, &op, sizeof(op));
+            int wr=write(fdset.fd, &op, sizeof(op));
+	    if(wr<0) return;//FIXME error check
         }
     }
 }
@@ -1298,7 +1305,8 @@
     Mutex::Locker lock(m_server_mutex);
 
     // FIXME: Do proper error checking here.
-    write(m_client_fd, &op, sizeof(op));
+    int wr=write(m_client_fd, &op, sizeof(op));
+    if(wr<0) return;	
 
 READ_AGAIN:
     if ((status = read(m_client_fd, &ack, sizeof(ack))) < 0)
Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp	(revision 134085)
+++ source/Symbol/ClangASTContext.cpp	(working copy)
@@ -6,7 +6,6 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-
 #include "lldb/Symbol/ClangASTContext.h"
 
 // C Includes
@@ -1591,6 +1590,7 @@
                 APInt bitfield_bit_size_apint(ast->getTypeSize(ast->IntTy), bitfield_bit_size);
                 bit_width = new (*ast)IntegerLiteral (*ast, bitfield_bit_size_apint, ast->IntTy, SourceLocation());
             }
+	#if 0	//BAD style
             FieldDecl *field = FieldDecl::Create (*ast,
                                                   record_decl,
                                                   SourceLocation(),
@@ -1607,6 +1607,8 @@
             {
                 record_decl->addDecl(field);
             }
+	#endif
+		FieldDecl *field = NULL;
         }
         else
         {
@@ -3123,6 +3125,7 @@
                     }
                 }
 
+#if 0
                 if (cxx_record_decl)
                 {
                     const RecordDecl *parent_record_decl = cxx_record_decl;
@@ -3181,6 +3184,7 @@
                         return child_indexes.size();
                     }
                 }
+		#endif
 
             }
             break;

Tobias



More information about the lldb-dev mailing list