mirror of https://github.com/pwndbg/pwndbg.git
Improve behavior without IDA Pro (#442)
* Improve behavior without IDA Pro * Fix import order * Improved IDA Pro behaviour more * Added only_after_first_prompt decorator * Removed newline after import * Added documentation * Improved docstringpull/448/head
parent
0736dbd1c7
commit
399eb3137c
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import functools
|
||||
|
||||
first_prompt = False
|
||||
|
||||
|
||||
def only_after_first_prompt(value_before=None):
|
||||
"""
|
||||
Decorator to prevent a function from running before the first prompt was displayed.
|
||||
The 'value_before' parameter can be used to specify the value that is
|
||||
returned if the function is called before the first prompt was displayed.
|
||||
"""
|
||||
def decorator(func):
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
if first_prompt:
|
||||
return func(*args, **kwargs)
|
||||
else:
|
||||
return value_before
|
||||
return wrapper
|
||||
return decorator
|
||||
Loading…
Reference in new issue