Use six module for types

pull/49/head
Zach Riggle 10 years ago
parent d97847b872
commit 42ab6eb6b3

@ -17,26 +17,32 @@ module, for example:
>>> int(pwndbg.config.example_value)
7
"""
from __future__ import unicode_literals
import sys
import types
import six
import gdb
TYPES = {
# The value is an integer.
# This is like PARAM_INTEGER, except 0 is interpreted as itself.
int: gdb.PARAM_ZINTEGER,
# The value is a string.
# When the user modifies the string, any escape sequences,
# such as \t, \f, and octal escapes, are translated into
# corresponding characters and encoded into the current host charset.
str: gdb.PARAM_STRING,
# The value is a plain boolean.
# The Python boolean values, True and False are the only valid values.
bool: gdb.PARAM_BOOLEAN
}
TYPES = {}
# The value is an integer.
# This is like PARAM_INTEGER, except 0 is interpreted as itself.
for type in six.integer_types:
TYPES[type] = gdb.PARAM_ZINTEGER
# The value is a string.
# When the user modifies the string, any escape sequences,
# such as \t, \f, and octal escapes, are translated into
# corresponding characters and encoded into the current host charset.
for type in six.string_types:
TYPES[type] = gdb.PARAM_STRING
# The value is a plain boolean.
# The Python boolean values, True and False are the only valid values.
TYPES[bool] = gdb.PARAM_BOOLEAN
def getParam(value):
for k,v in TYPES.items():

@ -4,3 +4,4 @@ psutil>=3.1.0
python-ptrace>=0.8
pyelftools
isort
six

Loading…
Cancel
Save