From 4507f06aaa1fa372b0b0fe62ad2fb4b70574e9e2 Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 27 Feb 2014 20:46:12 +0000 Subject: Fix linux x86 debugging on a linux x86 host (32-bit on 32-bit). This change fixes up issues with specifying the size of the i386 register infos for FPU registers. The bug was that for the i386 register context, the size of the FPU registers were still being computed based on the x86_64 FXSAVE structure. This change permits the FPR_SIZE macro to optionally be defined outside of RegisterInfos_i386.h, which RegisterContextLinux_i386.cpp does properly. It redefines the FPR_i386 structure with all the accessible parts that RegisterInfos_i386.h wants to see, which we had not done before when we made the overall size of the structure properly sized a recently. This change also modifies POSIXThread to create a RegisterContextLinux_i386 only when the host is 32-bit; otherwise, it uses the RegisterContextLinux_x86_64, which works properly for 32-bit and 64-bit inferiors on a 64-bit host. I tested this debugging a Linux x86 exe on an x86 host (Ubuntu 13.10 x86), and debugging a Linux x86 exe and a Linux x86-64 exe on an x86-64 host (Ubuntu 12.04 LTS). Those cases all worked. Thanks to Matthew Gardiner who discoverd may key insights into tracking down the issue. The motivation for this change and some of the code originates from him via this thread: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140224/010554.html llvm-svn: 202428 --- lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp') diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index 0591a0d5755..36795e584cf 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -168,9 +168,9 @@ PtraceWrapper(int req, lldb::pid_t pid, void *addr, void *data, size_t data_size errno = 0; if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET) - result = ptrace(static_cast<__ptrace_request>(req), pid, *(unsigned int *)addr, data); + result = ptrace(static_cast<__ptrace_request>(req), static_cast(pid), *(unsigned int *)addr, data); else - result = ptrace(static_cast<__ptrace_request>(req), pid, addr, data); + result = ptrace(static_cast<__ptrace_request>(req), static_cast(pid), addr, data); if (log) log->Printf("ptrace(%s, %" PRIu64 ", %p, %p, %zu)=%lX called from file %s line %d", -- cgit v1.2.3