-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmds
executable file
·30 lines (24 loc) · 825 Bytes
/
cmds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
# https://stackoverflow.com/questions/1262639/multiple-commands-in-gdb-separated-by-some-sort-of-delimiter
# multiple commands
from __future__ import print_function
import gdb
class Cmds(gdb.Command):
"""run multiple commands separated by ';'"""
def __init__(self):
gdb.Command.__init__(
self,
"cmds",
gdb.COMMAND_DATA,
gdb.COMPLETE_SYMBOL,
True,
)
def invoke(self, arg, from_tty):
for fragment in arg.split(';'):
# from_tty is passed in from invoke.
# These commands should be considered interactive if the command
# that invoked them is interactive.
# to_string is false. We just want to write the output of the commands, not capture it.
gdb.execute(fragment, from_tty=from_tty, to_string=False)
print()
Cmds()