Add support for the DWARFv3 (circa 2005) DW_OP_form_tls_address
authorJason Molenda <jmolenda@apple.com>
Thu, 5 Mar 2015 02:42:06 +0000 (02:42 +0000)
committerJason Molenda <jmolenda@apple.com>
Thu, 5 Mar 2015 02:42:06 +0000 (02:42 +0000)
operator in addition to the vendor-extension DW_OP_GNU_push_tls_address.
clang on PS4 and Darwin will be emitting the standard opcode
as of r231286 via http://reviews.llvm.org/D8018

Behavior of this standard  opcode is the same as
DW_OP_GNU_push_tls_address.

<rdar://problem/20043195>

llvm-svn: 231342

lldb/source/Expression/DWARFExpression.cpp

index e1f2974..77a6f7d 100644 (file)
@@ -611,7 +611,6 @@ DWARFExpression::DumpLocation (Stream *s, lldb::offset_t offset, lldb::offset_t
         case DW_OP_call_ref:                                                // 0x9a DWARF3 1 4- or 8-byte offset of DIE
             s->Printf("DW_OP_call_ref(0x%8.8" PRIx64 ")", m_data.GetAddress(&offset));
             break;
-//      case DW_OP_form_tls_address: s << "form_tls_address"; break;        // 0x9b DWARF3
 //      case DW_OP_call_frame_cfa: s << "call_frame_cfa"; break;            // 0x9c DWARF3
 //      case DW_OP_bit_piece:                                               // 0x9d DWARF3 2
 //          s->Printf("DW_OP_bit_piece(0x%x, 0x%x)", m_data.GetULEB128(&offset), m_data.GetULEB128(&offset));
@@ -624,6 +623,9 @@ DWARFExpression::DumpLocation (Stream *s, lldb::offset_t offset, lldb::offset_t
 //        case DW_OP_APPLE_array_ref:
 //            s->PutCString("DW_OP_APPLE_array_ref");
 //            break;
+        case DW_OP_form_tls_address:
+            s->PutCString("DW_OP_form_tls_address");  // 0x9b
+            break;
         case DW_OP_GNU_push_tls_address:
             s->PutCString("DW_OP_GNU_push_tls_address");  // 0xe0
             break;
@@ -2897,17 +2899,24 @@ DWARFExpression::Evaluate
             break;
 
         //----------------------------------------------------------------------
-        // OPCODE: DW_OP_GNU_push_tls_address
+        // OPCODE: DW_OP_form_tls_address (or the old pre-DWARFv3 vendor extension opcode, DW_OP_GNU_push_tls_address)
         // OPERANDS: none
         // DESCRIPTION: Pops a TLS offset from the stack, converts it to
-        // an absolute value, and pushes it back on.
+        // an address in the current thread's thread-local storage block, 
+        // and pushes it on the stack.
         //----------------------------------------------------------------------
+        case DW_OP_form_tls_address:
         case DW_OP_GNU_push_tls_address:
             {
                 if (stack.size() < 1)
                 {
                     if (error_ptr)
-                        error_ptr->SetErrorString("DW_OP_GNU_push_tls_address needs an argument.");
+                    {
+                        if (op == DW_OP_form_tls_address)
+                            error_ptr->SetErrorString("DW_OP_form_tls_address needs an argument.");
+                        else
+                            error_ptr->SetErrorString("DW_OP_GNU_push_tls_address needs an argument.");
+                    }
                     return false;
                 }