Author: labath
Date: Mon Mar 26 04:45:32 2018
New Revision: 328485

URL: http://llvm.org/viewvc/llvm-project?rev=328485&view=rev
Log:
Add a test for setting the load address of a module with differing 
physical/virtual addresses

Summary:
First attempt at landing D42145 was reverted because it caused test
failures on some android devices. It turned out this was because these
devices had vdso modules with differing physical and virtual addresses.
This was not caught earlier because all of the modules in our tests
either lack physical addresses or have them identical to virtual ones.

In the discussion on the patch, we came to the conclusion that in the
scenario where we are merely setting a load address of a module (for
example from a dynamic loader plugin), we should always use virtual
addresses (i.e., preserve status quo). This patch adds a test to make
sure we don't regress in that direction.

Reviewers: owenpshaw

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D44738

Modified:
    
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py?rev=328485&r1=328484&r2=328485&view=diff
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
 Mon Mar 26 04:45:32 2018
@@ -6,6 +6,25 @@ from gdbclientutils import *
 
 class TestGDBRemoteLoad(GDBRemoteTestBase):
 
+    def setUp(self):
+        super(TestGDBRemoteLoad, self).setUp()
+        self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def tearDown(self):
+        lldb.DBG.SetSelectedPlatform(self._initial_platform)
+        super(TestGDBRemoteLoad, self).tearDown()
+
+    def test_module_load_address(self):
+        """Test that setting the load address of a module uses virtual 
addresses"""
+        target = self.createTarget("a.yaml")
+        process = self.connect(target)
+        module = target.GetModuleAtIndex(0)
+        self.assertTrue(module.IsValid())
+        self.assertTrue(target.SetModuleLoadAddress(module, 0).Success())
+        address = target.ResolveLoadAddress(0x2001)
+        self.assertTrue(address.IsValid())
+        self.assertEqual(".data", address.GetSection().GetName())
+
     def test_ram_load(self):
         """Test loading an object file to a target's ram"""
         target = self.createTarget("a.yaml")


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to