forked from OSchip/llvm-project
Fix adb forward in gdbremote_testcase to support multiple devices.
Summary: Update to D9510. Reviewers: chying, tberghammer, ovyalov Reviewed By: ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9542 llvm-svn: 236688
This commit is contained in:
parent
3514f27456
commit
28b8ea1d55
|
@ -62,7 +62,12 @@ class GdbRemoteTestCaseBase(TestBase):
|
||||||
self.stub_sends_two_stop_notifications_on_kill = False
|
self.stub_sends_two_stop_notifications_on_kill = False
|
||||||
if lldb.platform_url:
|
if lldb.platform_url:
|
||||||
scheme, host = re.match('(.+)://(.+):\d+', lldb.platform_url).groups()
|
scheme, host = re.match('(.+)://(.+):\d+', lldb.platform_url).groups()
|
||||||
self.stub_hostname = 'localhost' if scheme == 'adb' else host
|
if scheme == 'adb':
|
||||||
|
self.stub_device = host
|
||||||
|
self.stub_hostname = 'localhost'
|
||||||
|
else:
|
||||||
|
self.stub_device = None
|
||||||
|
self.stub_hostname = host
|
||||||
else:
|
else:
|
||||||
self.stub_hostname = "localhost"
|
self.stub_hostname = "localhost"
|
||||||
|
|
||||||
|
@ -177,11 +182,12 @@ class GdbRemoteTestCaseBase(TestBase):
|
||||||
# when the process truly dies.
|
# when the process truly dies.
|
||||||
self.stub_sends_two_stop_notifications_on_kill = True
|
self.stub_sends_two_stop_notifications_on_kill = True
|
||||||
|
|
||||||
def forward_adb_port(self, source, target, direction):
|
def forward_adb_port(self, source, target, direction, device):
|
||||||
|
adb = [ 'adb' ] + ([ '-s', device ] if device else []) + [ direction ]
|
||||||
def remove_port_forward():
|
def remove_port_forward():
|
||||||
subprocess.call(["adb", direction, "--remove", "tcp:%d" % source])
|
subprocess.call(adb + [ "--remove", "tcp:%d" % source])
|
||||||
|
|
||||||
subprocess.call(["adb", direction, "tcp:%d" % source, "tcp:%d" % target])
|
subprocess.call(adb + [ "tcp:%d" % source, "tcp:%d" % target])
|
||||||
self.addTearDownHook(remove_port_forward)
|
self.addTearDownHook(remove_port_forward)
|
||||||
|
|
||||||
def create_socket(self):
|
def create_socket(self):
|
||||||
|
@ -190,7 +196,7 @@ class GdbRemoteTestCaseBase(TestBase):
|
||||||
|
|
||||||
triple = self.dbg.GetSelectedPlatform().GetTriple()
|
triple = self.dbg.GetSelectedPlatform().GetTriple()
|
||||||
if re.match(".*-.*-.*-android", triple):
|
if re.match(".*-.*-.*-android", triple):
|
||||||
self.forward_adb_port(self.port, self.port, "forward")
|
self.forward_adb_port(self.port, self.port, "forward", self.stub_device)
|
||||||
|
|
||||||
connect_info = (self.stub_hostname, self.port)
|
connect_info = (self.stub_hostname, self.port)
|
||||||
sock.connect(connect_info)
|
sock.connect(connect_info)
|
||||||
|
|
Loading…
Reference in New Issue