diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/qapi-commands.py | 14 | ||||
| -rw-r--r-- | scripts/qapi-types.py | 4 | ||||
| -rw-r--r-- | scripts/qapi-visit.py | 4 | ||||
| -rw-r--r-- | scripts/qapi.py | 5 | ||||
| -rw-r--r-- | scripts/qemu-gdb.py | 89 | ||||
| -rwxr-xr-x | scripts/texi2pod.pl | 9 |
6 files changed, 113 insertions, 12 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 3aabf61491..30a24d211b 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -42,7 +42,7 @@ def generate_command_decl(name, args, ret_type): return mcgen(''' %(ret_type)s qmp_%(name)s(%(args)sError **errp); ''', - ret_type=c_type(ret_type), name=c_var(name), args=arglist).strip() + ret_type=c_type(ret_type), name=c_fun(name), args=arglist).strip() def gen_sync_call(name, args, ret_type, indent=0): ret = "" @@ -59,7 +59,7 @@ def gen_sync_call(name, args, ret_type, indent=0): %(retval)sqmp_%(name)s(%(args)serrp); ''', - name=c_var(name), args=arglist, retval=retval).rstrip() + name=c_fun(name), args=arglist, retval=retval).rstrip() if ret_type: ret += "\n" + mcgen('''' if (!error_is_set(errp)) { @@ -74,7 +74,7 @@ if (!error_is_set(errp)) { def gen_marshal_output_call(name, ret_type): if not ret_type: return "" - return "qmp_marshal_output_%s(retval, ret, errp);" % c_var(name) + return "qmp_marshal_output_%s(retval, ret, errp);" % c_fun(name) def gen_visitor_output_containers_decl(ret_type): ret = "" @@ -198,16 +198,16 @@ static void qmp_marshal_output_%(c_name)s(%(c_ret_type)s ret_in, QObject **ret_o qapi_dealloc_visitor_cleanup(md); } ''', - c_ret_type=c_type(ret_type), c_name=c_var(name), + c_ret_type=c_type(ret_type), c_name=c_fun(name), visitor=type_visitor(ret_type)) return ret def gen_marshal_input_decl(name, args, ret_type, middle_mode): if middle_mode: - return 'int qmp_marshal_input_%s(Monitor *mon, const QDict *qdict, QObject **ret)' % c_var(name) + return 'int qmp_marshal_input_%s(Monitor *mon, const QDict *qdict, QObject **ret)' % c_fun(name) else: - return 'static void qmp_marshal_input_%s(QDict *args, QObject **ret, Error **errp)' % c_var(name) + return 'static void qmp_marshal_input_%s(QDict *args, QObject **ret, Error **errp)' % c_fun(name) @@ -298,7 +298,7 @@ def gen_registry(commands): registry += mcgen(''' qmp_register_command("%(name)s", qmp_marshal_input_%(c_name)s); ''', - name=cmd['command'], c_name=c_var(cmd['command'])) + name=cmd['command'], c_name=c_fun(cmd['command'])) pop_indent() ret = mcgen(''' static void qmp_init_marshal(void) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 727fb77266..4a734f58d5 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -100,7 +100,7 @@ typedef enum %(name)s %(abbrev)s_%(value)s = %(i)d, ''', abbrev=de_camel_case(name).upper(), - value=c_var(value).upper(), + value=c_fun(value).upper(), i=i) i += 1 @@ -126,7 +126,7 @@ struct %(name)s %(c_type)s %(c_name)s; ''', c_type=c_type(typeinfo[key]), - c_name=c_var(key)) + c_name=c_fun(key)) ret += mcgen(''' }; diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 54117d4d2b..78c947cd9c 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -129,9 +129,9 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error ** break; ''', abbrev = de_camel_case(name).upper(), - enum = de_camel_case(key).upper(), + enum = c_fun(de_camel_case(key)).upper(), c_type=members[key], - c_name=c_var(key)) + c_name=c_fun(key)) ret += mcgen(''' default: diff --git a/scripts/qapi.py b/scripts/qapi.py index 6e05469e6d..e06233666b 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -131,7 +131,10 @@ def camel_case(name): return new_name def c_var(name): - return '_'.join(name.split('-')).lstrip("*") + return name.replace('-', '_').lstrip("*") + +def c_fun(name): + return c_var(name).replace('.', '_') def c_list_type(name): return '%sList' % name diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py new file mode 100644 index 0000000000..8a0f30534f --- /dev/null +++ b/scripts/qemu-gdb.py @@ -0,0 +1,89 @@ +#!/usr/bin/python + +# GDB debugging support +# +# Copyright 2012 Red Hat, Inc. and/or its affiliates +# +# Authors: +# Avi Kivity <avi@redhat.com> +# +# This work is licensed under the terms of the GNU GPL, version 2. See +# the COPYING file in the top-level directory. +# +# Contributions after 2012-01-13 are licensed under the terms of the +# GNU GPL, version 2 or (at your option) any later version. + + +import gdb + +def isnull(ptr): + return ptr == gdb.Value(0).cast(ptr.type) + +def int128(p): + return long(p['lo']) + (long(p['hi']) << 64) + +class QemuCommand(gdb.Command): + '''Prefix for QEMU debug support commands''' + def __init__(self): + gdb.Command.__init__(self, 'qemu', gdb.COMMAND_DATA, + gdb.COMPLETE_NONE, True) + +class MtreeCommand(gdb.Command): + '''Display the memory tree hierarchy''' + def __init__(self): + gdb.Command.__init__(self, 'qemu mtree', gdb.COMMAND_DATA, + gdb.COMPLETE_NONE) + self.queue = [] + def invoke(self, arg, from_tty): + self.seen = set() + self.queue_root('address_space_memory') + self.queue_root('address_space_io') + self.process_queue() + def queue_root(self, varname): + ptr = gdb.parse_and_eval(varname)['root'] + self.queue.append(ptr) + def process_queue(self): + while self.queue: + ptr = self.queue.pop(0) + if long(ptr) in self.seen: + continue + self.print_item(ptr) + def print_item(self, ptr, offset = gdb.Value(0), level = 0): + self.seen.add(long(ptr)) + addr = ptr['addr'] + addr += offset + size = int128(ptr['size']) + alias = ptr['alias'] + klass = '' + if not isnull(alias): + klass = ' (alias)' + elif not isnull(ptr['ops']): + klass = ' (I/O)' + elif bool(ptr['ram']): + klass = ' (RAM)' + gdb.write('%s%016x-%016x %s%s (@ %s)\n' + % (' ' * level, + long(addr), + long(addr + (size - 1)), + ptr['name'].string(), + klass, + ptr, + ), + gdb.STDOUT) + if not isnull(alias): + gdb.write('%s alias: %s@%016x (@ %s)\n' % + (' ' * level, + alias['name'].string(), + ptr['alias_offset'], + alias, + ), + gdb.STDOUT) + self.queue.append(alias) + subregion = ptr['subregions']['tqh_first'] + level += 1 + while not isnull(subregion): + self.print_item(subregion, addr, level) + subregion = subregion['subregions_link']['tqe_next'] + +QemuCommand() +MtreeCommand() diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl index 9ed056ad1c..94097fb065 100755 --- a/scripts/texi2pod.pl +++ b/scripts/texi2pod.pl @@ -36,6 +36,7 @@ $fnno = 1; $inf = ""; $ibase = ""; @ipath = (); +$encoding = undef; while ($_ = shift) { if (/^-D(.*)$/) { @@ -97,6 +98,12 @@ while(<$inf>) { /^\@setfilename\s+([^.]+)/ and $fn = $1, next; /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; + # Look for document encoding + /^\@documentencoding\s+([^.]+)/ and do { + $encoding = $1 unless defined $encoding; + next; + }; + # Identify a man title but keep only the one we are interested in. /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { if (exists $defs{$1}) { @@ -336,6 +343,8 @@ $inf = pop @instack; die "No filename or title\n" unless defined $fn && defined $tl; +print "=encoding $encoding\n\n" if defined $encoding; + $sects{NAME} = "$fn \- $tl\n"; $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; |