Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: gdb logging enable/disable command #1095

Merged
merged 4 commits into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading