2 # SPDX-License-Identifier: GPL-2.0-or-later
6 def writeliteral(indent, bytes):
7 sys.stdout.write(' ' * indent)
13 sys.stdout.write('\n')
14 sys.stdout.write(' ' * indent)
19 sys.stdout.write('\\"')
21 sys.stdout.write('\\\\')
23 sys.stdout.write('\\n"')
25 elif c >= 32 and c < 127:
26 sys.stdout.write(c.to_bytes(1, 'big').decode())
28 sys.stdout.write(f'\{c:03o}')
33 sys.stdout.write('#include "qemu/osdep.h"\n' \
34 '#include "exec/gdbstub.h"\n' \
36 'const GDBFeature gdb_static_features[] = {\n')
38 for input in sys.argv[1:]:
39 with open(input, 'rb') as file:
42 sys.stdout.write(' {\n')
43 writeliteral(8, bytes(os.path.basename(input), 'utf-8'))
44 sys.stdout.write(',\n')
46 sys.stdout.write('\n },\n')
48 sys.stdout.write(' { NULL }\n};\n')