Skip to content

Commit

Permalink
update: gdb logging enable/disable command (#1095)
Browse files Browse the repository at this point in the history
'set logging on/off' is deprecated and replaced with 'set logging enabled on/off'.
  • Loading branch information
mtwoz committed May 19, 2024
1 parent 13d1de2 commit 220611a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -1978,12 +1978,19 @@ def __enter__(self) -> None:
gdb.execute("set logging overwrite")
gdb.execute(f"set logging file {self.redirection_target_file}")
gdb.execute("set logging redirect on")
gdb.execute("set logging on")

if GDB_VERSION >= (12, 0):
gdb.execute("set logging enabled on")
else:
gdb.execute("set logging on")
return

def __exit__(self, *exc: Any) -> None:
"""Disable the output redirection, if any."""
gdb.execute("set logging off")
if GDB_VERSION >= (12, 0):
gdb.execute("set logging enabled off")
else:
gdb.execute("set logging off")
gdb.execute("set logging redirect off")
return

Expand All @@ -1994,13 +2001,20 @@ def enable_redirect_output(to_file: str = "/dev/null") -> None:
gdb.execute("set logging overwrite")
gdb.execute(f"set logging file {to_file}")
gdb.execute("set logging redirect on")
gdb.execute("set logging on")

if GDB_VERSION >= (12, 0):
gdb.execute("set logging enabled on")
else:
gdb.execute("set logging on")
return


def disable_redirect_output() -> None:
"""Disable the output redirection, if any."""
gdb.execute("set logging off")
if GDB_VERSION >= (12, 0):
gdb.execute("set logging enabled off")
else:
gdb.execute("set logging off")
gdb.execute("set logging redirect off")
return

Expand Down

0 comments on commit 220611a

Please sign in to comment.