Skip to content

Commit

Permalink
Merge pull request #209 from tearandfix/older-gdb-python2-support
Browse files Browse the repository at this point in the history
Support older GDB versions which use python2.7
  • Loading branch information
sakhnik authored Oct 7, 2024
2 parents e0c9609 + fe75712 commit 53c34af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/gdb_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def invoke(self, arg, from_tty):
self.thrd.daemon = True
self.thrd.start()

def _server(self, server_address: str):
def _server(self, server_address):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('127.0.0.1', 0))
sock.settimeout(0.25)
_, port = sock.getsockname()
with open(server_address, 'w') as f:
f.write(f"{port}")
f.write(str(port))
logger.info("Start listening for commands at port %d", port)
try:
while not self.quit:
Expand Down Expand Up @@ -129,7 +129,7 @@ def _get_current_frame_location(self):
line = symtab_and_line.line
return [filename, line]
except gdb.error:
...
pass
return []

def _get_breaks_provider(self):
Expand All @@ -139,7 +139,7 @@ def _get_breaks_provider(self):
return self._enum_breaks()
return self._enum_breaks_fallback()

def _get_breaks(self, fname: str):
def _get_breaks(self, fname):
"""Get list of enabled breakpoints for a given source file."""
breaks = {}

Expand Down Expand Up @@ -226,7 +226,7 @@ def _get_all_breaks(self):
breaks = []
try:
for path, line, bid in self._get_breaks_provider():
breaks.append(f"{path}:{line} breakpoint {bid}")
breaks.append(str(path) + ':' + str(line) + ' breakpoint ' + str(bid))
except AttributeError:
self.fallback_to_parsing = True
return self._get_all_breaks()
Expand Down

0 comments on commit 53c34af

Please sign in to comment.