Skip to content

Commit

Permalink
Merge pull request #466 from flit/bugfix/gdbserver
Browse files Browse the repository at this point in the history
Fixed gdb server not being accessible via localhost
  • Loading branch information
flit authored Dec 8, 2018
2 parents 5ea0ff2 + 47b6e24 commit 061e90a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pyocd/gdbserver/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __init__(self, session, core=None, server_listening_callback=None):
self.flash = self.board.flash
self.abstract_socket = None
port_urlWSS = session.options.get('gdbserver_port', 3333)
if isinstance(port_urlWSS, str) == True:
if isinstance(port_urlWSS, str) is True:
self.port = 0
self.wss_server = port_urlWSS
else:
Expand Down Expand Up @@ -310,13 +310,13 @@ def __init__(self, session, core=None, server_listening_callback=None):
self.did_init_thread_providers = False
self.current_thread_id = 0
self.first_run_after_reset_or_flash = True
if self.wss_server == None:
if self.wss_server is None:
self.abstract_socket = GDBSocket(self.port, self.packet_size)
if self.serve_local_only:
self.abstract_socket.host = 'localhost'
self.abstract_socket.init()
# Read back bound port in case auto-assigned (port 0)
self.port = self.abstract_socket.port
if self.serve_local_only:
self.abstract_socket.host = 'localhost'
else:
self.abstract_socket = GDBWebSocket(self.wss_server)

Expand Down Expand Up @@ -584,7 +584,7 @@ def breakpoint(self, data):
# handle hardware breakpoint Z1/z1
if data[1:2] == b'1' or (self.soft_bkpt_as_hard and data[1:2] == b'0'):
if data[0:1] == b'Z':
if self.target.set_breakpoint(addr, Target.BREAKPOINT_HW) == False:
if self.target.set_breakpoint(addr, Target.BREAKPOINT_HW) is False:
return self.create_rsp_packet(b'E01') #EPERM
else:
self.target.remove_breakpoint(addr)
Expand All @@ -605,7 +605,7 @@ def breakpoint(self, data):

size = int(split[2], 16)
if data[0:1] == b'Z':
if self.target.set_watchpoint(addr, size, watchpoint_type) == False:
if self.target.set_watchpoint(addr, size, watchpoint_type) is False:
return self.create_rsp_packet(b'E01') #EPERM
else:
self.target.remove_watchpoint(addr, size, watchpoint_type)
Expand Down

0 comments on commit 061e90a

Please sign in to comment.