[Lldb-commits] [lldb] r202887 - Get Linux i386 running.

Todd Fiala tfiala at google.com
Tue Mar 4 12:46:32 PST 2014


Author: tfiala
Date: Tue Mar  4 14:46:32 2014
New Revision: 202887

URL: http://llvm.org/viewvc/llvm-project?rev=202887&view=rev
Log:
Get Linux i386 running.

This change uses a fixed known offset for the Linux i386 DR0 register.
This change also undoes the 32-bit wordsize change from r169645 that
revolved around being 32-bit/64-bit friendly in
WriteRegOperation::Execute within the Linux ProcessMonitor.cpp. I ran
all the tests on x86_64 Linux with no failures. I also ran some simple
tests with 32-bit Linux exe on x86_64 host and 32-bit linux exe on
i686 32-bit host and these worked fine.

Note (from Todd): the UserData struct in the Linux i386 register
context (only used by Linux i386 host running Linux 32-bit inferior)
is out of sync with what shows up in the sys/user.h for an 32-bit
Linux build (per an earlier change of mine to make it look more like
x86_64 host running x86 exe). I think we should (1) make i386 Linux
targets run using the same register context (and correct ones) on i386
and x86_64 linux hosts if that is possible, and (2) we could use some
tests around the register handling, particularly to verify things like
DR0 registers are in the right spots on host/target combos that we can
verify vs. known correct values.

Change by Matthew Gardiner.

Modified:
    lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=202887&r1=202886&r2=202887&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue Mar  4 14:46:32 2014
@@ -532,11 +532,7 @@ WriteRegOperation::Execute(ProcessMonito
     void* buf;
     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
 
-#if __WORDSIZE == 32
-    buf = (void*) m_value.GetAsUInt32();
-#else
     buf = (void*) m_value.GetAsUInt64();
-#endif
 
     if (log)
         log->Printf ("ProcessMonitor::%s() reg %s: %p", __FUNCTION__, m_reg_name, buf);

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp?rev=202887&r1=202886&r2=202887&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp Tue Mar  4 14:46:32 2014
@@ -83,8 +83,9 @@ struct UserArea
 };
 
 #define DR_SIZE sizeof(UserArea::u_debugreg[0])
+#define DR_0_OFFSET 0xFC
 #define DR_OFFSET(reg_index) \
-    (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
+    (DR_0_OFFSET + (reg_index * 4))
 #define FPR_SIZE(reg) sizeof(((FPR_i386*)NULL)->reg)
 
 //---------------------------------------------------------------------------





More information about the lldb-commits mailing list