[Lldb-commits] [lldb] r246608 - Remove ABIMacOSX_i386::PrepareNormalCall().

Bruce Mitchener via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 1 16:51:30 PDT 2015


Author: brucem
Date: Tue Sep  1 18:51:30 2015
New Revision: 246608

URL: http://llvm.org/viewvc/llvm-project?rev=246608&view=rev
Log:
Remove ABIMacOSX_i386::PrepareNormalCall().

Summary:
This was removed from the other ABI plugins long ago. This removes
a warning that was happening in this unused code as a result of
adding 2 new types to Scalar.h (e_uint128 and e_sint128).

Reviewers: clayborg

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12514

Modified:
    lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=246608&r1=246607&r2=246608&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Tue Sep  1 18:51:30 2015
@@ -316,184 +316,6 @@ ABIMacOSX_i386::PrepareTrivialCall (Thre
     return true;
 }
 
-bool
-ABIMacOSX_i386::PrepareNormalCall (Thread &thread,
-                                   addr_t sp,
-                                   addr_t func_addr,
-                                   addr_t return_addr,
-                                   ValueList &args) const
-{
-    ExecutionContext exe_ctx (thread.shared_from_this());
-    RegisterContext *reg_ctx = thread.GetRegisterContext().get();
-    if (!reg_ctx)
-        return false;
-    
-    Process *process = exe_ctx.GetProcessPtr();
-    Error error;
-    uint32_t fp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP);
-    uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
-    uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
-    
-    // Do the argument layout
-    
-    std::vector <uint32_t> argLayout;   // 4-byte chunks, as discussed in the ABI Function Call Guide
-    
-    size_t numArgs = args.GetSize();
-    size_t index;
-    
-    for (index = 0; index < numArgs; ++index)
-    {
-        Value *val = args.GetValueAtIndex(index);
-        
-        if (!val)
-            return false;
-        
-        switch (val->GetValueType())
-        {
-        case Value::eValueTypeScalar:
-            {
-                Scalar &scalar = val->GetScalar();
-                switch (scalar.GetType())
-                {
-                case Scalar::e_void:
-                    return false;
-                case Scalar::e_sint: 
-                case Scalar::e_uint:
-                case Scalar::e_slong:
-                case Scalar::e_ulong:
-                case Scalar::e_slonglong:
-                case Scalar::e_ulonglong:
-                    {
-                        uint64_t data = scalar.ULongLong();
-                        
-                        switch (scalar.GetByteSize())
-                        {
-                        default:
-                            return false;
-                        case 1:
-                            argLayout.push_back((uint32_t)(data & 0xffull));
-                            break;
-                        case 2:
-                            argLayout.push_back((uint32_t)(data & 0xffffull));
-                            break;
-                        case 4:
-                            argLayout.push_back((uint32_t)(data & 0xffffffffull));
-                            break;
-                        case 8:
-                            argLayout.push_back((uint32_t)(data & 0xffffffffull));
-                            argLayout.push_back((uint32_t)(data >> 32));
-                            break;
-                        }
-                    }
-                    break;
-                case Scalar::e_float:
-                    {
-                        float data = scalar.Float();
-                        uint32_t dataRaw = *((uint32_t*)(&data));
-                        argLayout.push_back(dataRaw);
-                    }
-                    break;
-                case Scalar::e_double:
-                    {
-                        double data = scalar.Double();
-                        uint32_t *dataRaw = ((uint32_t*)(&data));
-                        argLayout.push_back(dataRaw[0]);
-                        argLayout.push_back(dataRaw[1]);
-                    }
-                    break;
-                case Scalar::e_long_double:
-                    {
-                        long double data = scalar.Double();
-                        uint32_t *dataRaw = ((uint32_t*)(&data));
-                        while ((argLayout.size() * 4) & 0xf)
-                            argLayout.push_back(0);
-                        argLayout.push_back(dataRaw[0]);
-                        argLayout.push_back(dataRaw[1]);
-                        argLayout.push_back(dataRaw[2]);
-                        argLayout.push_back(dataRaw[3]);
-                    }
-                    break;
-                }
-            }
-            break;
-        case Value::eValueTypeHostAddress:
-            {
-                CompilerType clang_type (val->GetCompilerType());
-                if (clang_type)
-                {
-                    uint32_t cstr_length = 0;
-                    if (clang_type.IsCStringType (cstr_length))
-                    {
-                        const char *cstr = (const char*)val->GetScalar().ULongLong();
-                        cstr_length = strlen(cstr);
-                        
-                        // Push the string onto the stack immediately.
-                        
-                        sp -= (cstr_length + 1);
-                        
-                        if (process->WriteMemory(sp, cstr, cstr_length + 1, error) != (cstr_length + 1))
-                            return false;
-                        
-                        // Put the address of the string into the argument array.
-                        
-                        argLayout.push_back((uint32_t)(sp & 0xffffffff));
-                    }
-                    else
-                    {
-                        return false;
-                    }
-                }
-                break;
-            }
-            break;
-        case Value::eValueTypeFileAddress:
-        case Value::eValueTypeLoadAddress:
-        default:
-            return false;
-        }
-    }
-    
-    // Make room for the arguments on the stack
-    
-    sp -= 4 * argLayout.size();
-    
-    // Align the SP
-    
-    sp &= ~(16ull-1ull); // 16-byte alignment
-    
-    // Write the arguments on the stack
-    
-    size_t numChunks = argLayout.size();
-
-    for (index = 0; index < numChunks; ++index)
-        if (process->WriteMemory(sp + (index * 4), &argLayout[index], sizeof(uint32_t), error) != sizeof(uint32_t))
-            return false;
-    
-    // The return address is pushed onto the stack.
-    
-    sp -= 4;
-    uint32_t returnAddressU32 = return_addr;
-    if (process->WriteMemory (sp, &returnAddressU32, sizeof(returnAddressU32), error) != sizeof(returnAddressU32))
-        return false;
-    
-    // %esp is set to the actual stack value.
-    
-    if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_num, sp))
-        return false;
-    
-    // %ebp is set to a fake value, in our case 0x0x00000000
-    
-    if (!reg_ctx->WriteRegisterFromUnsigned(fp_reg_num, 0x00000000))
-        return false;
-    
-    // %eip is set to the address of the called function.
-    
-    if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, func_addr))
-        return false;
-    
-    return true;    
-}
-
 static bool 
 ReadIntegerArgument (Scalar           &scalar,
                      unsigned int     bit_width,

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h?rev=246608&r1=246607&r2=246608&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h Tue Sep  1 18:51:30 2015
@@ -36,13 +36,6 @@ public:
                         llvm::ArrayRef<lldb::addr_t> args) const;
     
     virtual bool
-    PrepareNormalCall (lldb_private::Thread &thread,
-                       lldb::addr_t sp,
-                       lldb::addr_t func_addr,
-                       lldb::addr_t return_addr,
-                       lldb_private::ValueList &args) const;
-    
-    virtual bool
     GetArgumentValues (lldb_private::Thread &thread,
                        lldb_private::ValueList &values) const;
     




More information about the lldb-commits mailing list