[Lldb-commits] [lldb] r134461 - in /lldb/trunk: include/lldb/Core/RegisterValue.h include/lldb/Target/StackFrame.h source/API/SBFrame.cpp source/Core/Debugger.cpp source/Core/Disassembler.cpp source/Core/RegisterValue.cpp source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp source/Plugins/Instruction/ARM/EmulateInstructionARM.h source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h source/Target/StackFrame.cpp source/Target/UnixSignals.cpp

Greg Clayton gclayton at apple.com
Tue Jul 5 21:07:21 PDT 2011


Author: gclayton
Date: Tue Jul  5 23:07:21 2011
New Revision: 134461

URL: http://llvm.org/viewvc/llvm-project?rev=134461&view=rev
Log:
Fixed some issues with ARM backtraces by not processing any push/pop 
instructions if they are conditional. Also fixed issues where the PC wasn't
getting bit zero stripped for ARM targets when a stack frame was thumb. We
now properly call through the GetOpcodeLoadAddress() functions to make sure
the addresses are properly stripped for any targets that may decorate up
their addresses.

We now don't pass the SIGSTOP signals along. We can revisit this soon, but
currently this was interfering with debugging some older ARM targets that
don't have vCont support in the GDB server.



Modified:
    lldb/trunk/include/lldb/Core/RegisterValue.h
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/RegisterValue.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/UnixSignals.cpp

Modified: lldb/trunk/include/lldb/Core/RegisterValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegisterValue.h?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RegisterValue.h (original)
+++ lldb/trunk/include/lldb/Core/RegisterValue.h Tue Jul  5 23:07:21 2011
@@ -204,6 +204,12 @@
         }
 
         bool
+        ClearBit (uint32_t bit);
+
+        bool
+        SetBit (uint32_t bit);
+
+        bool
         operator == (const RegisterValue &rhs) const;
 
         bool

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Tue Jul  5 23:07:21 2011
@@ -74,7 +74,7 @@
     StackID&
     GetStackID();
 
-    Address&
+    const Address&
     GetFrameCodeAddress();
     
     void

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Jul  5 23:07:21 2011
@@ -258,7 +258,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
-        addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
+        addr = m_opaque_sp->GetFrameCodeAddress().GetOpcodeLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
     }
 
     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Jul  5 23:07:21 2011
@@ -715,7 +715,7 @@
                      ValueObject::ValueObjectRepresentationStyle* val_obj_display)
 {
     *percent_position = ::strchr(var_name_begin,'%');
-    if(!*percent_position || *percent_position > var_name_end)
+    if (!*percent_position || *percent_position > var_name_end)
         *var_name_final = var_name_end;
     else
     {
@@ -727,10 +727,10 @@
                                                   *custom_format) )
         {
             // if this is an @ sign, print ObjC description
-            if(*format_name == '@')
+            if (*format_name == '@')
                 *val_obj_display = ValueObject::eDisplayLanguageSpecific;
             // if this is a V, print the value using the default format
-            if(*format_name == 'V')
+            if (*format_name == 'V')
                 *val_obj_display = ValueObject::eDisplayValue;
         }
         // a good custom format tells us to print the value using it
@@ -753,14 +753,14 @@
                    int64_t* index_higher)
 {
     *open_bracket_position = ::strchr(var_name_begin,'[');
-    if(*open_bracket_position && *open_bracket_position < var_name_final)
+    if (*open_bracket_position && *open_bracket_position < var_name_final)
     {
         *separator_position = ::strchr(*open_bracket_position,'-'); // might be NULL if this is a simple var[N] bitfield
         *close_bracket_position = ::strchr(*open_bracket_position,']');
         // as usual, we assume that [] will come before %
         //printf("trying to expand a []\n");
         *var_name_final_if_array_range = *open_bracket_position;
-        if(*close_bracket_position - *open_bracket_position == 1)
+        if (*close_bracket_position - *open_bracket_position == 1)
         {
             *index_lower = 0;
         }
@@ -771,7 +771,7 @@
             *index_higher = *index_lower;
             //printf("got to read low=%d high same\n",bitfield_lower);
         }
-        else if(*close_bracket_position && *close_bracket_position < var_name_end)
+        else if (*close_bracket_position && *close_bracket_position < var_name_end)
         {
             char *end = NULL;
             *index_lower = ::strtoul (*open_bracket_position+1, &end, 0);
@@ -803,9 +803,9 @@
     StreamString sstring;
     VariableSP var_sp;
     
-    if(*do_deref_pointer)
+    if (*do_deref_pointer)
         sstring.PutChar('*');
-    else if(vobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(vobj->GetParent()->GetClangType()) && !vobj->IsArrayItemForPointer())
+    else if (vobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(vobj->GetParent()->GetClangType()) && !vobj->IsArrayItemForPointer())
     {
         sstring.PutChar('*');
         *do_deref_pointer = true;
@@ -837,7 +837,7 @@
     ValueObjectSP item;
     bool is_array = ClangASTContext::IsArrayType(vobj->GetClangType());
 
-    if(is_array)
+    if (is_array)
         return vobj->GetChildAtIndex(index, true);
     else
     {
@@ -881,7 +881,7 @@
     const char *p;
     for (p = format; *p != '\0'; ++p)
     {
-        if(realvobj)
+        if (realvobj)
         {
             vobj = realvobj;
             realvobj = NULL;
@@ -961,165 +961,169 @@
                         {
                         case '*':
                             {
-                                if (!vobj) break;
+                                if (!vobj) 
+                                    break;
                                 do_deref_pointer = true;
                                 var_name_begin++;
                             }
+                            // Fall through...
+
                         case 'v':
                             {
-                            ValueObject::ValueObjectRepresentationStyle val_obj_display = ValueObject::eDisplaySummary;
-                            ValueObject* target;
-                            lldb::Format custom_format = eFormatInvalid;
-                            const char* var_name_final;
-                            const char* var_name_final_if_array_range = NULL;
-                            const char* close_bracket_position;
-                            int64_t index_lower = -1, index_higher = -1;
-                            bool is_array_range = false;
-                            if (!vobj) break;
-                            // simplest case ${var}, just print vobj's value
-                            if (::strncmp (var_name_begin, "var}", strlen("var}")) == 0)
-                            {
-                                target = vobj;
-                                val_obj_display = ValueObject::eDisplayValue;
-                            }
-                            else if (::strncmp(var_name_begin,"var%",strlen("var%")) == 0)
-                            {
-                                // this is a variable with some custom format applied to it
-                                const char* percent_position;
-                                target = vobj;
-                                val_obj_display = ValueObject::eDisplayValue;
-                                ScanFormatDescriptor(var_name_begin,
-                                                     var_name_end,
-                                                     &var_name_final,
-                                                     &percent_position,
-                                                     &custom_format,
-                                                     &val_obj_display);
-                            }
-                                // this is ${var.something} or multiple .something nested
-                            else if (::strncmp (var_name_begin, "var", strlen("var")) == 0)
-                            {
+                                ValueObject::ValueObjectRepresentationStyle val_obj_display = ValueObject::eDisplaySummary;
+                                ValueObject* target = NULL;
+                                lldb::Format custom_format = eFormatInvalid;
+                                const char* var_name_final = NULL;
+                                const char* var_name_final_if_array_range = NULL;
+                                const char* close_bracket_position = NULL;
+                                int64_t index_lower = -1;
+                                int64_t index_higher = -1;
+                                bool is_array_range = false;
+                                if (!vobj) break;
+                                // simplest case ${var}, just print vobj's value
+                                if (::strncmp (var_name_begin, "var}", strlen("var}")) == 0)
+                                {
+                                    target = vobj;
+                                    val_obj_display = ValueObject::eDisplayValue;
+                                }
+                                else if (::strncmp(var_name_begin,"var%",strlen("var%")) == 0)
+                                {
+                                    // this is a variable with some custom format applied to it
+                                    const char* percent_position;
+                                    target = vobj;
+                                    val_obj_display = ValueObject::eDisplayValue;
+                                    ScanFormatDescriptor (var_name_begin,
+                                                          var_name_end,
+                                                          &var_name_final,
+                                                          &percent_position,
+                                                          &custom_format,
+                                                          &val_obj_display);
+                                }
+                                    // this is ${var.something} or multiple .something nested
+                                else if (::strncmp (var_name_begin, "var", strlen("var")) == 0)
+                                {
 
-                                const char* percent_position;
-                                ScanFormatDescriptor(var_name_begin,
-                                                     var_name_end,
-                                                     &var_name_final,
-                                                     &percent_position,
-                                                     &custom_format,
-                                                     &val_obj_display);
-                                
-                                const char* open_bracket_position;
-                                const char* separator_position;
-                                ScanBracketedRange(var_name_begin,
-                                                   var_name_end,
-                                                   var_name_final,
-                                                   &open_bracket_position,
-                                                   &separator_position,
-                                                   &close_bracket_position,
-                                                   &var_name_final_if_array_range,
-                                                   &index_lower,
-                                                   &index_higher);
-                                                                
-                                Error error;
-                                target = ExpandExpressionPath(vobj,
-                                                     exe_ctx->frame,
-                                                     &do_deref_pointer,
-                                                     var_name_begin,
-                                                     var_name_final,
-                                                     error).get();
+                                    const char* percent_position;
+                                    ScanFormatDescriptor (var_name_begin,
+                                                          var_name_end,
+                                                          &var_name_final,
+                                                          &percent_position,
+                                                          &custom_format,
+                                                          &val_obj_display);
+                                    
+                                    const char* open_bracket_position;
+                                    const char* separator_position;
+                                    ScanBracketedRange (var_name_begin,
+                                                        var_name_end,
+                                                        var_name_final,
+                                                        &open_bracket_position,
+                                                        &separator_position,
+                                                        &close_bracket_position,
+                                                        &var_name_final_if_array_range,
+                                                        &index_lower,
+                                                        &index_higher);
+                                                                    
+                                    Error error;
+                                    target = ExpandExpressionPath (vobj,
+                                                                   exe_ctx->frame,
+                                                                   &do_deref_pointer,
+                                                                   var_name_begin,
+                                                                   var_name_final,
+                                                                   error).get();
 
-                                if (error.Fail() || !target)
-                                {
+                                    if (error.Fail() || !target)
+                                    {
 #ifdef VERBOSE_FORMATPROMPT_OUTPUT                                
-                                    printf("ERROR: %s\n",error.AsCString("unknown"));
+                                        printf("ERROR: %s\n",error.AsCString("unknown"));
 #endif //VERBOSE_FORMATPROMPT_OUTPUT
-                                    if (var_name_final_if_array_range)
-                                    {
-                                        target = ExpandExpressionPath(vobj,
-                                                                      exe_ctx->frame,
-                                                                      &do_deref_pointer,
-                                                                      var_name_begin,
-                                                                      var_name_final_if_array_range,
-                                                                      error).get();
+                                        if (var_name_final_if_array_range)
+                                        {
+                                            target = ExpandExpressionPath(vobj,
+                                                                          exe_ctx->frame,
+                                                                          &do_deref_pointer,
+                                                                          var_name_begin,
+                                                                          var_name_final_if_array_range,
+                                                                          error).get();
+                                        }
+                                        
+                                        IFERROR_PRINT_IT
+                                        else
+                                            is_array_range = true;
                                     }
                                     
-                                    IFERROR_PRINT_IT
-                                    else
-                                        is_array_range = true;
-                                }
-                                
-                                do_deref_pointer = false; // I have honored the request to deref                               
+                                    do_deref_pointer = false; // I have honored the request to deref                               
 
-                            }
-                            else
-                                break;
-
-                            if(do_deref_pointer)
-                            {
-                                // I have not deref-ed yet, let's do it
-                                // this happens when we are not going through GetValueForVariableExpressionPath
-                                // to get to the target ValueObject
-                                Error error;
-                                target = target->Dereference(error).get();
-                                IFERROR_PRINT_IT
-                                do_deref_pointer = false;
-                            }
-                                                            
-                            if(!is_array_range)
-                                var_success = target->DumpPrintableRepresentation(s,val_obj_display, custom_format);
-                            else
-                            {
-                                bool is_array = ClangASTContext::IsArrayType(vobj->GetClangType());
-                                bool is_pointer = ClangASTContext::IsPointerType(vobj->GetClangType());
-                                
-                                if(!is_array && !is_pointer)
+                                }
+                                else
                                     break;
-                                
-                                char* special_directions = NULL;
-                                if (close_bracket_position && (var_name_end-close_bracket_position > 1))
+
+                                if (do_deref_pointer)
                                 {
-                                    int base_len = var_name_end-close_bracket_position;
-                                    special_directions = new char[8+base_len];
-                                    special_directions[0] = '$';
-                                    special_directions[1] = '{';                                        
-                                    special_directions[2] = 'v';
-                                    special_directions[3] = 'a';
-                                    special_directions[4] = 'r';
-                                    memcpy(special_directions+5, close_bracket_position+1, base_len);
-                                    special_directions[base_len+7] = '\0';
-#ifdef VERBOSE_FORMATPROMPT_OUTPUT
-                                    printf("%s\n",special_directions);
-#endif //VERBOSE_FORMATPROMPT_OUTPUT
+                                    // I have not deref-ed yet, let's do it
+                                    // this happens when we are not going through GetValueForVariableExpressionPath
+                                    // to get to the target ValueObject
+                                    Error error;
+                                    target = target->Dereference(error).get();
+                                    IFERROR_PRINT_IT
+                                    do_deref_pointer = false;
                                 }
-                                
-                                // let us display items index_lower thru index_higher of this array
-                                s.PutChar('[');
-                                var_success = true;
-
-                                if(index_higher < 0)
-                                    index_higher = vobj->GetNumChildren() - 1;
-                                
-                                for(;index_lower<=index_higher;index_lower++)
+                                                                
+                                if (!is_array_range)
+                                    var_success = target->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+                                else
                                 {
-                                    Error error;
-                                    ValueObject* item = ExpandIndexedExpression(vobj,
-                                                                                index_lower,
-                                                                                exe_ctx->frame,
-                                                                                error).get();
-
+                                    bool is_array = ClangASTContext::IsArrayType(vobj->GetClangType());
+                                    bool is_pointer = ClangASTContext::IsPointerType(vobj->GetClangType());
                                     
-                                    IFERROR_PRINT_IT
-                                    if (!special_directions)
-                                        var_success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
-                                    else
-                                        var_success &= FormatPrompt(special_directions, sc, exe_ctx, addr, s, NULL, item);
+                                    if (!is_array && !is_pointer)
+                                        break;
                                     
-                                    if(index_lower < index_higher)
-                                        s.PutChar(',');
+                                    char* special_directions = NULL;
+                                    if (close_bracket_position && (var_name_end-close_bracket_position > 1))
+                                    {
+                                        int base_len = var_name_end-close_bracket_position;
+                                        special_directions = new char[8+base_len];
+                                        special_directions[0] = '$';
+                                        special_directions[1] = '{';                                        
+                                        special_directions[2] = 'v';
+                                        special_directions[3] = 'a';
+                                        special_directions[4] = 'r';
+                                        memcpy(special_directions+5, close_bracket_position+1, base_len);
+                                        special_directions[base_len+7] = '\0';
+#ifdef VERBOSE_FORMATPROMPT_OUTPUT
+                                        printf("%s\n",special_directions);
+#endif //VERBOSE_FORMATPROMPT_OUTPUT
+                                    }
+                                    
+                                    // let us display items index_lower thru index_higher of this array
+                                    s.PutChar('[');
+                                    var_success = true;
+
+                                    if (index_higher < 0)
+                                        index_higher = vobj->GetNumChildren() - 1;
+                                    
+                                    for (;index_lower<=index_higher;index_lower++)
+                                    {
+                                        Error error;
+                                        ValueObject* item = ExpandIndexedExpression(vobj,
+                                                                                    index_lower,
+                                                                                    exe_ctx->frame,
+                                                                                    error).get();
+
+                                        
+                                        IFERROR_PRINT_IT
+                                        if (!special_directions)
+                                            var_success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+                                        else
+                                            var_success &= FormatPrompt(special_directions, sc, exe_ctx, addr, s, NULL, item);
+                                        
+                                        if (index_lower < index_higher)
+                                            s.PutChar(',');
+                                    }
+                                    s.PutChar(']');
                                 }
-                                s.PutChar(']');
                             }
                             break;
-                            }
                         case 'a':
                             if (::strncmp (var_name_begin, "addr}", strlen("addr}")) == 0)
                             {

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Jul  5 23:07:21 2011
@@ -331,7 +331,7 @@
     SymbolContext sc;
     SymbolContext prev_sc;
     AddressRange sc_range;
-    Address *pc_addr_ptr = NULL;
+    const Address *pc_addr_ptr = NULL;
     ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
     if (exe_ctx.frame)
         pc_addr_ptr = &exe_ctx.frame->GetFrameCodeAddress();

Modified: lldb/trunk/source/Core/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Core/RegisterValue.cpp (original)
+++ lldb/trunk/source/Core/RegisterValue.cpp Tue Jul  5 23:07:21 2011
@@ -1000,3 +1000,150 @@
     return true;
 }
 
+bool
+RegisterValue::ClearBit (uint32_t bit)
+{
+    switch (m_type)
+    {
+        case eTypeInvalid:
+            break;
+
+        case eTypeUInt8:        
+            if (bit < 8)
+            {
+                m_data.uint8 &= ~(1u << bit);
+                return true;
+            }
+            break;
+            
+        case eTypeUInt16:
+            if (bit < 16)
+            {
+                m_data.uint16 &= ~(1u << bit);
+                return true;
+            }
+            break;
+
+        case eTypeUInt32:
+            if (bit < 32)
+            {
+                m_data.uint32 &= ~(1u << bit);
+                return true;
+            }
+            break;
+            
+        case eTypeUInt64:
+            if (bit < 64)
+            {
+                m_data.uint64 &= ~(1ull << (uint64_t)bit);
+                return true;
+            }
+            break;
+#if defined (ENABLE_128_BIT_SUPPORT)
+        case eTypeUInt128:
+            if (bit < 64)
+            {
+                m_data.uint128 &= ~((__uint128_t)1ull << (__uint128_t)bit);
+                return true;
+            }
+#endif
+        case eTypeFloat:
+        case eTypeDouble:
+        case eTypeLongDouble:
+            break;
+
+        case eTypeBytes:
+            if (m_data.buffer.byte_order == eByteOrderBig || m_data.buffer.byte_order == eByteOrderLittle)
+            {
+                uint32_t byte_idx;
+                if (m_data.buffer.byte_order == eByteOrderBig)
+                    byte_idx = m_data.buffer.length - (bit / 8) - 1;
+                else
+                    byte_idx = bit / 8;
+
+                const uint32_t byte_bit = bit % 8;
+                if (byte_idx < m_data.buffer.length)
+                {
+                    m_data.buffer.bytes[byte_idx] &= ~(1u << byte_bit);
+                    return true;
+                }
+            }
+            break;
+    }
+    return false;
+}
+
+
+bool
+RegisterValue::SetBit (uint32_t bit)
+{
+    switch (m_type)
+    {
+        case eTypeInvalid:
+            break;
+            
+        case eTypeUInt8:        
+            if (bit < 8)
+            {
+                m_data.uint8 |= (1u << bit);
+                return true;
+            }
+            break;
+            
+        case eTypeUInt16:
+            if (bit < 16)
+            {
+                m_data.uint16 |= (1u << bit);
+                return true;
+            }
+            break;
+            
+        case eTypeUInt32:
+            if (bit < 32)
+            {
+                m_data.uint32 |= (1u << bit);
+                return true;
+            }
+            break;
+            
+        case eTypeUInt64:
+            if (bit < 64)
+            {
+                m_data.uint64 |= (1ull << (uint64_t)bit);
+                return true;
+            }
+            break;
+#if defined (ENABLE_128_BIT_SUPPORT)
+        case eTypeUInt128:
+            if (bit < 64)
+            {
+                m_data.uint128 |= ((__uint128_t)1ull << (__uint128_t)bit);
+                return true;
+            }
+#endif
+        case eTypeFloat:
+        case eTypeDouble:
+        case eTypeLongDouble:
+            break;
+            
+        case eTypeBytes:
+            if (m_data.buffer.byte_order == eByteOrderBig || m_data.buffer.byte_order == eByteOrderLittle)
+            {
+                uint32_t byte_idx;
+                if (m_data.buffer.byte_order == eByteOrderBig)
+                    byte_idx = m_data.buffer.length - (bit / 8) - 1;
+                else
+                    byte_idx = bit / 8;
+                
+                const uint32_t byte_bit = bit % 8;
+                if (byte_idx < m_data.buffer.length)
+                {
+                    m_data.buffer.bytes[byte_idx] |= (1u << byte_bit);
+                    return true;
+                }
+            }
+            break;
+    }
+    return false;
+}
+

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Tue Jul  5 23:07:21 2011
@@ -327,8 +327,9 @@
     }
 #endif
 
+    bool conditional = false;
     bool success = false;
-    if (ConditionPassed(opcode))
+    if (ConditionPassed(opcode, &conditional))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -381,7 +382,10 @@
         uint32_t i;
         
         EmulateInstruction::Context context;
-        context.type = EmulateInstruction::eContextPushRegisterOnStack;
+        if (conditional)
+            context.type = EmulateInstruction::eContextRegisterStore;
+        else
+            context.type = EmulateInstruction::eContextPushRegisterOnStack;
         RegisterInfo reg_info;
         RegisterInfo sp_reg;
         GetRegisterInfo (eRegisterKindDWARF, dwarf_sp, sp_reg);
@@ -447,7 +451,9 @@
 
     bool success = false;
 
-    if (ConditionPassed(opcode))    {
+    bool conditional = false;
+    if (ConditionPassed(opcode, &conditional))
+    {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -508,7 +514,10 @@
         uint32_t i, data;
         
         EmulateInstruction::Context context;
-        context.type = EmulateInstruction::eContextPopRegisterOffStack;
+        if (conditional)
+            context.type = EmulateInstruction::eContextRegisterLoad;
+        else
+            context.type = EmulateInstruction::eContextPopRegisterOffStack;
         
         RegisterInfo sp_reg;
         GetRegisterInfo (eRegisterKindDWARF, dwarf_sp, sp_reg);
@@ -1847,9 +1856,9 @@
     }
 #endif
 
+    bool conditional = false;
     bool success = false;
-
-    if (ConditionPassed(opcode))
+    if (ConditionPassed(opcode, &conditional))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -1894,7 +1903,10 @@
             addr = sp;
         
         EmulateInstruction::Context context;
-        context.type = EmulateInstruction::eContextPushRegisterOnStack;
+        if (conditional)
+            context.type = EmulateInstruction::eContextRegisterStore;
+        else
+            context.type = EmulateInstruction::eContextPushRegisterOnStack;
         RegisterInfo sp_reg;
         RegisterInfo dwarf_reg;
 
@@ -1955,8 +1967,8 @@
 #endif
 
     bool success = false;
-
-    if (ConditionPassed(opcode))
+    bool conditional = false;
+    if (ConditionPassed(opcode, &conditional))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -1998,7 +2010,10 @@
         uint32_t i;
         
         EmulateInstruction::Context context;
-        context.type = EmulateInstruction::eContextPushRegisterOnStack;
+        if (conditional)
+            context.type = EmulateInstruction::eContextRegisterStore;
+        else
+            context.type = EmulateInstruction::eContextPushRegisterOnStack;
         RegisterInfo dwarf_reg;
         RegisterInfo sp_reg;
         GetRegisterInfo (eRegisterKindDWARF, dwarf_sp, sp_reg);
@@ -2048,8 +2063,8 @@
 #endif
 
     bool success = false;
-
-    if (ConditionPassed(opcode))
+    bool conditional = false;
+    if (ConditionPassed(opcode, &conditional))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -2092,7 +2107,10 @@
         uint64_t data; // uint64_t to accomodate 64-bit registers.
         
         EmulateInstruction::Context context;
-        context.type = EmulateInstruction::eContextPopRegisterOffStack;
+        if (conditional)
+            context.type = EmulateInstruction::eContextRegisterLoad;
+        else
+            context.type = EmulateInstruction::eContextPopRegisterOffStack;
         RegisterInfo dwarf_reg;
         RegisterInfo sp_reg;
         GetRegisterInfo (eRegisterKindDWARF, dwarf_sp, sp_reg);
@@ -3303,8 +3321,8 @@
 #endif
             
     bool success = false;
-            
-    if (ConditionPassed(opcode))
+    bool conditional = false;
+    if (ConditionPassed(opcode, &conditional))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -3376,7 +3394,12 @@
                 context.type = EmulateInstruction::eContextRegisterPlusOffset;
                 context.SetRegisterPlusOffset (dwarf_reg, offset);
                 if (wback && (n == 13)) // Pop Instruction
-                    context.type = EmulateInstruction::eContextPopRegisterOffStack;
+                {
+                    if (conditional)
+                        context.type = EmulateInstruction::eContextRegisterLoad;
+                    else
+                        context.type = EmulateInstruction::eContextPopRegisterOffStack;
+                }
 
                 // R[i] = MemA [address, 4]; address = address + 4;
                 uint32_t data = MemARead (context, base_address + offset, addr_byte_size, 0, &success);
@@ -12849,7 +12872,7 @@
 }
 
 bool
-EmulateInstructionARM::ConditionPassed (const uint32_t opcode)
+EmulateInstructionARM::ConditionPassed (const uint32_t opcode, bool *is_conditional)
 {
    // If we are ignoring conditions, then always return true.
    // this allows us to iterate over disassembly code and still
@@ -12857,6 +12880,9 @@
    // bits set in the CPSR register...
     if (m_ignore_conditions)
         return true;
+    
+    if (is_conditional)
+        *is_conditional = true;
 
     const uint32_t cond = CurrentCond (opcode);
     
@@ -12868,33 +12894,38 @@
     {
     case 0: 
 		if (m_opcode_cpsr == 0)
-			return true;
-		result = (m_opcode_cpsr & MASK_CPSR_Z) != 0; 
+			result = true;
+        else
+            result = (m_opcode_cpsr & MASK_CPSR_Z) != 0; 
 		break;
     case 1:
- 		if (m_opcode_cpsr == 0)
-			return true;
-		result = (m_opcode_cpsr & MASK_CPSR_C) != 0; 
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
+            result = (m_opcode_cpsr & MASK_CPSR_C) != 0; 
 		break;
     case 2:
- 		if (m_opcode_cpsr == 0)
-			return true;
-		result = (m_opcode_cpsr & MASK_CPSR_N) != 0; 
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
+            result = (m_opcode_cpsr & MASK_CPSR_N) != 0; 
 		break;
     case 3:
- 		if (m_opcode_cpsr == 0)
-			return true;
-		result = (m_opcode_cpsr & MASK_CPSR_V) != 0; 
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
+            result = (m_opcode_cpsr & MASK_CPSR_V) != 0; 
 		break;
     case 4:
- 		if (m_opcode_cpsr == 0)
-			return true;
-		result = ((m_opcode_cpsr & MASK_CPSR_C) != 0) && ((m_opcode_cpsr & MASK_CPSR_Z) == 0); 
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
+            result = ((m_opcode_cpsr & MASK_CPSR_C) != 0) && ((m_opcode_cpsr & MASK_CPSR_Z) == 0); 
 		break;
     case 5: 
-  		if (m_opcode_cpsr == 0)
-			return true;
-       	else
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
 		{
             bool n = (m_opcode_cpsr & MASK_CPSR_N);
             bool v = (m_opcode_cpsr & MASK_CPSR_V);
@@ -12902,9 +12933,9 @@
         }
         break;
     case 6: 
-  		if (m_opcode_cpsr == 0)
-			return true;
-       	else
+        if (m_opcode_cpsr == 0)
+            result = true;
+        else
 		{
             bool n = (m_opcode_cpsr & MASK_CPSR_N);
             bool v = (m_opcode_cpsr & MASK_CPSR_V);
@@ -12912,6 +12943,10 @@
         }
         break;
     case 7: 
+        // Always execute (cond == 0b1110, or the special 0b1111 which gives
+        // opcodes different meanings, but always means execution happpens.
+        if (is_conditional)
+            *is_conditional = false;
         result = true; 
         break;
     }

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h Tue Jul  5 23:07:21 2011
@@ -189,7 +189,9 @@
     ArchVersion();
 
     bool
-    ConditionPassed (const uint32_t opcode);
+    ConditionPassed (const uint32_t opcode, 
+                     bool *is_conditional = NULL);  // Filled in with true if the opcode is a conditional opcode
+                                                    // Filled in with false if the opcode is always executed
 
     uint32_t
     CurrentCond (const uint32_t opcode);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Tue Jul  5 23:07:21 2011
@@ -119,7 +119,7 @@
 GDBRemoteRegisterContext::ReadRegister (const RegisterInfo *reg_info, RegisterValue &value)
 {
     // Read the register
-    if (ReadRegisterBytes (reg_info, value, m_reg_data))
+    if (ReadRegisterBytes (reg_info, m_reg_data))
     {
         const bool partial_data_ok = false;
         Error error (value.SetValueFromData(reg_info, m_reg_data, reg_info->byte_offset, partial_data_ok));
@@ -156,7 +156,7 @@
 
 
 bool
-GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, RegisterValue &value, DataExtractor &data)
+GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataExtractor &data)
 {
     GDBRemoteCommunicationClient &gdb_comm (GetGDBProcess().GetGDBRemote());
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h Tue Jul  5 23:07:21 2011
@@ -227,7 +227,6 @@
 
     bool
     ReadRegisterBytes (const lldb_private::RegisterInfo *reg_info,
-                       lldb_private::RegisterValue &value, 
                        lldb_private::DataExtractor &data);
 
     bool

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Tue Jul  5 23:07:21 2011
@@ -209,7 +209,7 @@
     m_id.SetSymbolContextScope (symbol_scope);
 }
 
-Address&
+const Address&
 StackFrame::GetFrameCodeAddress()
 {
     if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) && !m_frame_code_addr.IsSectionOffset())
@@ -218,10 +218,9 @@
 
         // Resolve the PC into a temporary address because if ResolveLoadAddress
         // fails to resolve the address, it will clear the address object...
-        Address resolved_pc;
-        if (m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress(m_frame_code_addr.GetOffset(), resolved_pc))
+        
+        if (m_frame_code_addr.SetOpcodeLoadAddress (m_frame_code_addr.GetOffset(), &m_thread.GetProcess().GetTarget()))
         {
-            m_frame_code_addr = resolved_pc;
             const Section *section = m_frame_code_addr.GetSection();
             if (section)
             {

Modified: lldb/trunk/source/Target/UnixSignals.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnixSignals.cpp?rev=134461&r1=134460&r2=134461&view=diff
==============================================================================
--- lldb/trunk/source/Target/UnixSignals.cpp (original)
+++ lldb/trunk/source/Target/UnixSignals.cpp Tue Jul  5 23:07:21 2011
@@ -59,39 +59,39 @@
     // order, you can either subclass this class, and use Add & Remove to change them
     // or you can subclass and build them afresh in your constructor;
     m_signals.clear();
-    //        SIGNO  NAME         SHORT NAME SUPPRESS   STOP   NOTIFY DESCRIPTION
-    //        ====== ============ ========== =========  ====== ====== ===================================================
-    AddSignal (1,    "SIGHUP",    "HUP",     false,     true,  true,  "hangup");
-    AddSignal (2,    "SIGINT",    "INT",     true,      true,  true,  "interrupt");
-    AddSignal (3,    "SIGQUIT",   "QUIT",    false,     true,  true,  "quit");
-    AddSignal (4,    "SIGILL",    "ILL",     false,     true,  true,  "illegal instruction");
-    AddSignal (5,    "SIGTRAP",   "TRAP",    true,      true,  true,  "trace trap (not reset when caught)");
-    AddSignal (6,    "SIGABRT",   "ABRT",    false,      true,  true,  "abort()");
-    AddSignal (7,    "SIGEMT",    "EMT",     false,     true,  true,  "pollable event");
-    AddSignal (8,    "SIGFPE",    "FPE",     false,     true,  true,  "floating point exception");
-    AddSignal (9,    "SIGKILL",   "KILL",    false,     true,  true,  "kill");
-    AddSignal (10,   "SIGBUS",    "BUS",     false,     true,  true,  "bus error");
-    AddSignal (11,   "SIGSEGV",   "SEGV",    false,     true,  true,  "segmentation violation");
-    AddSignal (12,   "SIGSYS",    "SYS",     false,     true,  true,  "bad argument to system call");
-    AddSignal (13,   "SIGPIPE",   "PIPE",    false,     true,  true,  "write on a pipe with no one to read it");
-    AddSignal (14,   "SIGALRM",   "ALRM",    false,     false, true,  "alarm clock");
-    AddSignal (15,   "SIGTERM",   "TERM",    false,     true,  true,  "software termination signal from kill");
-    AddSignal (16,   "SIGURG",    "URG",     false,     false, false, "urgent condition on IO channel");
-    AddSignal (17,   "SIGSTOP",   "STOP",    false,     true,  true,  "sendable stop signal not from tty");
-    AddSignal (18,   "SIGTSTP",   "TSTP",    false,     true,  true,  "stop signal from tty");
-    AddSignal (19,   "SIGCONT",   "CONT",    false,     true,  true,  "continue a stopped process");
-    AddSignal (20,   "SIGCHLD",   "CHLD",    false,     false, true,  "to parent on child stop or exit");
-    AddSignal (21,   "SIGTTIN",   "TTIN",    false,     true,  true,  "to readers process group upon background tty read");
-    AddSignal (22,   "SIGTTOU",   "TTOU",    false,     true,  true,  "to readers process group upon background tty write");
-    AddSignal (23,   "SIGIO",     "IO",      false,     false, false, "input/output possible signal");
-    AddSignal (24,   "SIGXCPU",   "XCPU",    false,     true,  true,  "exceeded CPU time limit");
-    AddSignal (25,   "SIGXFSZ",   "XFSZ",    false,     true,  true,  "exceeded file size limit");
-    AddSignal (26,   "SIGVTALRM", "VTALRM",  false,     false, false, "virtual time alarm");
-    AddSignal (27,   "SIGPROF",   "PROF",    false,     false, false, "profiling time alarm");
-    AddSignal (28,   "SIGWINCH",  "WINCH",   false,     false, false, "window size changes");
-    AddSignal (29,   "SIGINFO",   "INFO",    false,     true,  true,  "information request");
-    AddSignal (30,   "SIGUSR1",   "USR1",    false,     true,  true,  "user defined signal 1");
-    AddSignal (31,   "SIGUSR2",   "USR2",    false,     true,  true,  "user defined signal 2");
+    //        SIGNO  NAME         SHORT NAME SUPPRESS STOP   NOTIFY DESCRIPTION
+    //        ====== ============ ========== ======== ====== ====== ===================================================
+    AddSignal (1,    "SIGHUP",    "HUP",     false,   true , true , "hangup");
+    AddSignal (2,    "SIGINT",    "INT",     true ,   true , true , "interrupt");
+    AddSignal (3,    "SIGQUIT",   "QUIT",    false,   true , true , "quit");
+    AddSignal (4,    "SIGILL",    "ILL",     false,   true , true , "illegal instruction");
+    AddSignal (5,    "SIGTRAP",   "TRAP",    true ,   true , true , "trace trap (not reset when caught)");
+    AddSignal (6,    "SIGABRT",   "ABRT",    false,   true , true , "abort()");
+    AddSignal (7,    "SIGEMT",    "EMT",     false,   true , true , "pollable event");
+    AddSignal (8,    "SIGFPE",    "FPE",     false,   true , true , "floating point exception");
+    AddSignal (9,    "SIGKILL",   "KILL",    false,   true , true , "kill");
+    AddSignal (10,   "SIGBUS",    "BUS",     false,   true , true , "bus error");
+    AddSignal (11,   "SIGSEGV",   "SEGV",    false,   true , true , "segmentation violation");
+    AddSignal (12,   "SIGSYS",    "SYS",     false,   true , true , "bad argument to system call");
+    AddSignal (13,   "SIGPIPE",   "PIPE",    false,   true , true , "write on a pipe with no one to read it");
+    AddSignal (14,   "SIGALRM",   "ALRM",    false,   false, true , "alarm clock");
+    AddSignal (15,   "SIGTERM",   "TERM",    false,   true , true , "software termination signal from kill");
+    AddSignal (16,   "SIGURG",    "URG",     false,   false, false, "urgent condition on IO channel");
+    AddSignal (17,   "SIGSTOP",   "STOP",    true ,   true , true , "sendable stop signal not from tty");
+    AddSignal (18,   "SIGTSTP",   "TSTP",    false,   true , true , "stop signal from tty");
+    AddSignal (19,   "SIGCONT",   "CONT",    false,   true , true , "continue a stopped process");
+    AddSignal (20,   "SIGCHLD",   "CHLD",    false,   false, true , "to parent on child stop or exit");
+    AddSignal (21,   "SIGTTIN",   "TTIN",    false,   true , true , "to readers process group upon background tty read");
+    AddSignal (22,   "SIGTTOU",   "TTOU",    false,   true , true , "to readers process group upon background tty write");
+    AddSignal (23,   "SIGIO",     "IO",      false,   false, false, "input/output possible signal");
+    AddSignal (24,   "SIGXCPU",   "XCPU",    false,   true , true , "exceeded CPU time limit");
+    AddSignal (25,   "SIGXFSZ",   "XFSZ",    false,   true , true , "exceeded file size limit");
+    AddSignal (26,   "SIGVTALRM", "VTALRM",  false,   false, false, "virtual time alarm");
+    AddSignal (27,   "SIGPROF",   "PROF",    false,   false, false, "profiling time alarm");
+    AddSignal (28,   "SIGWINCH",  "WINCH",   false,   false, false, "window size changes");
+    AddSignal (29,   "SIGINFO",   "INFO",    false,   true , true , "information request");
+    AddSignal (30,   "SIGUSR1",   "USR1",    false,   true , true , "user defined signal 1");
+    AddSignal (31,   "SIGUSR2",   "USR2",    false,   true , true , "user defined signal 2");
 }
 
 void





More information about the lldb-commits mailing list