本文整理汇总了Python中gdb.string_to_argv方法的典型用法代码示例。如果您正苦于以下问题:Python gdb.string_to_argv方法的具体用法?Python gdb.string_to_argv怎么用?Python gdb.string_to_argv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdb
的用法示例。
在下文中一共展示了gdb.string_to_argv方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self,args,from_tty):
self.dont_repeat()
# Don't eval expression in PwngdbCmd commands
#expressions = gdb.string_to_argv(args)
#arg = self.eval_argv(expressions)
arg = args.split()
if len(arg) > 0 :
cmd = arg[0]
if cmd in pwncmd.commands :
func = getattr(pwncmd,cmd)
func(*arg[1:])
else :
print("Unknown command")
else :
print("Unknown command")
return
示例2: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self,args,from_tty):
global angelheap_cmd
self.dont_repeat()
expressions = gdb.string_to_argv(args)
arg = self.eval_argv(expressions)
if len(arg) > 0 :
cmd = arg[0]
if cmd in angelheap_cmd.commands :
func = getattr(angelheap_cmd,cmd)
func(*arg[1:])
else :
print("Unknown command")
else :
print("Unknow command")
return
示例3: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, args, from_tty):
argv = gdb.string_to_argv(args)
result = []
if len(argv) != 1:
raise gdb.GdbError('vmmap -f takes 1 arg')
try:
mapping = Strongdb.run_cmd('info proc mapping')
mapping = mapping[mapping.find('0x'):].split('\n')
for item in mapping:
item_list = item.split(None)
if len(item_list) == 5 and item_list[4].find(argv[0]) != -1:
result.append('\t\t'.join(item_list))
Strongdb.display('\n'.join(result) + '\n\n')
except Exception, e:
print e
return
示例4: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, arg, from_tty):
global _ctx
self.dont_repeat()
argv = gdb.string_to_argv(_prepare_args(arg))
if len(argv) == 0:
raise AngrGDBError("angrdbg find: at least a parameter is needed")
_ctx.find = []
for a in argv:
addr = _to_int(a)
if addr is None:
raise AngrGDBError(
"angrdbg find: failed to convert '%s' to int" %
a)
_ctx.find.append(addr)
示例5: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, arg, from_tty):
argv = gdb.string_to_argv(arg)
CastTypeStr = None
if ( len(argv) > 0):
symbolArg = argv[0]
if ( len(argv) > 1 ):
CastTypeStr = argv[1]
listVal = ListInspector(symbolArg)
elems = listVal.GetElements( CastTypeStr )
for elem in elems :
print("Elem: %s" % str(elem))
示例6: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, args, isatty):
if not self.repeat:
self.dont_repeat()
self.parser.set_defaults(isatty=isatty)
# Not sure we trust gdb to split the line as we want it, but
# until there are problems we'll let him give it a shot.
args = gdb.string_to_argv(args)
try:
args = self.parser.parse_args(args)
self.run(args)
except KeyboardInterrupt as e:
pass
except SystemExit as e:
if isinstance(e.code, int):
raise gdb.GdbError("command exited with status %s." % e.code)
elif e.code:
raise gdb.GdbError(str(e))
except gdb.GdbError:
# This type of error can be used to report failure to gdb.
# We let is pass through so that applications can print errors.
# Still, the prefered way for an extension to do this
# would be to simply use exit().
raise
except BaseException as e:
# This is a bug or unexpected circumstance.
if getattr(args, "isatty", True):
gxf.errors.show_error(e)
else:
raise
示例7: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, arg, from_tty):
def parse_global(a):
pargs = self.parser.parse_args(a)
for c in self.cmds:
if hasattr(pargs, c) and (getattr(pargs, c) is True):
getattr(self, c)(pargs)
return True
return False
argv = gdb.string_to_argv(arg)
parser_name = argv[0]
argv = argv[1:]
if parser_name == self.name:
if parse_global(argv):
return
else:
if parser_name in self.subcommand_parsers.iterkeys():
sub = self.subcommand_parsers[parser_name]
if argv[0] in sub.cmds:
pargs = sub.parser.parse_args(argv)
for subc in sub.cmds:
if hasattr(pargs, subc) and (getattr(pargs, subc) is True):
getattr(sub.plugin, subc)(pargs)
return
if parse_global(argv):
return
self.gdb_print("unknown command %s\n" % arg)
示例8: invoke
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def invoke(self, args, from_tty):
argv = gdb.string_to_argv(args)
if len(argv) != 2:
raise gdb.GdbError('输入参数数目不对,help mv以获得用法')
gdb.execute('delete ' + argv[0])
gdb.execute('break ' + argv[1])
示例9: parse_printer_regexps
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import string_to_argv [as 别名]
def parse_printer_regexps(arg):
"""Internal utility to parse a pretty-printer command argv.
Arguments:
arg: The arguments to the command. The format is:
[object-regexp [name-regexp]].
Individual printers in a collection are named as
printer-name;subprinter-name.
Returns:
The result is a 3-tuple of compiled regular expressions, except that
the resulting compiled subprinter regexp is None if not provided.
Raises:
SyntaxError: an error processing ARG
"""
argv = gdb.string_to_argv(arg);
argc = len(argv)
object_regexp = "" # match everything
name_regexp = "" # match everything
subname_regexp = None
if argc > 3:
raise SyntaxError("too many arguments")
if argc >= 1:
object_regexp = argv[0]
if argc >= 2:
name_subname = argv[1].split(";", 1)
name_regexp = name_subname[0]
if len(name_subname) == 2:
subname_regexp = name_subname[1]
# That re.compile raises SyntaxError was determined empirically.
# We catch it and reraise it to provide a slightly more useful
# error message for the user.
try:
object_re = re.compile(object_regexp)
except SyntaxError:
raise SyntaxError("invalid object regexp: %s" % object_regexp)
try:
name_re = re.compile (name_regexp)
except SyntaxError:
raise SyntaxError("invalid name regexp: %s" % name_regexp)
if subname_regexp is not None:
try:
subname_re = re.compile(subname_regexp)
except SyntaxError:
raise SyntaxError("invalid subname regexp: %s" % subname_regexp)
else:
subname_re = None
return(object_re, name_re, subname_re)