aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
blob: 629361c6ae5b8d3d3fd41beaffb675e01cacef38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test.gdbclientutils import *
from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase


class TestqOffsets(GDBRemoteTestBase):
    class Responder(MockGDBServerResponder):
        def qOffsets(self):
            return "Text=470000;Data=470000"

    def test(self):
        self.server.responder = TestqOffsets.Responder()
        # This ensures that we do not pick up any binaries on the host.
        self.runCmd("platform select remote-linux")
        target = self.createTarget("qOffsets.yaml")
        text = target.modules[0].FindSection(".text")
        self.assertEqual(text.GetLoadAddress(target), lldb.LLDB_INVALID_ADDRESS)

        process = self.connect(target)
        self.assertEqual(text.GetLoadAddress(target), 0x471000)