qemu-patch-raspberry4/scripts/tracetool/format
Daniel P. Berrange ea1ff54f7d trace: ensure unique function / variable names per .stp file
The simpletrace compatibility code for systemtap creates a
function and some global variables for mapping to event ID
numbers. We generate multiple -simpletrace.stp files though,
one per target and systemtap considers functions & variables
to be globally scoped, not per file. So if trying to use the
simpletrace compat probes, systemtap will complain:

 # stap -e 'probe qemu.system.arm.simpletrace.visit_type_str { print( "hello")}'
 semantic error: conflicting global variables: identifier 'event_name_to_id_map' at /usr/share/systemtap/tapset/qemu-aarch64-simpletrace.stp:3:8
        source: global event_name_to_id_map
                       ^
 identifier 'event_name_to_id_map' at /usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:3:8
        source: global event_name_to_id_map
                       ^

 WARNING: cross-file global variable reference to identifier 'event_name_to_id_map' at /usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:3:8 from: identifier 'event_name_to_id_map' at /usr/share/systemtap/tapset/qemu-aarch64-simpletrace.stp:8:21
 source:     if (!([name] in event_name_to_id_map)) {
                             ^
 WARNING: cross-file global variable reference to identifier 'event_next_id' at /usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:4:8 from: identifier 'event_next_id' at :9:38
 source:         event_name_to_id_map[name] = event_next_id
                                              ^

We already have a string used to prefix probe names, so just
replace '.' with '_' to get a function / variable name prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170728133657.5525-1-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-01 10:36:30 +01:00
..
__init__.py trace: introduce a formal group name for trace events 2016-10-12 09:54:53 +02:00
c.py trace: switch to modular code generation for sub-directories 2017-01-31 17:11:18 +00:00
d.py trace: introduce a formal group name for trace events 2016-10-12 09:54:53 +02:00
h.py trace: [tcg] Do not generate TCG code to trace dynamically-disabled events 2017-07-17 13:11:12 +01:00
simpletrace_stap.py trace: ensure unique function / variable names per .stp file 2017-08-01 10:36:30 +01:00
stap.py trace: introduce a formal group name for trace events 2016-10-12 09:54:53 +02:00
tcg_h.py trace: [tcg] Do not generate TCG code to trace dynamically-disabled events 2017-07-17 13:11:12 +01:00
tcg_helper_c.py trace: [tcg] Do not generate TCG code to trace dynamically-disabled events 2017-07-17 13:11:12 +01:00
tcg_helper_h.py trace: introduce a formal group name for trace events 2016-10-12 09:54:53 +02:00
tcg_helper_wrapper_h.py trace: introduce a formal group name for trace events 2016-10-12 09:54:53 +02:00
ust_events_c.py trace: switch to modular code generation for sub-directories 2017-01-31 17:11:18 +00:00
ust_events_h.py trace: switch to modular code generation for sub-directories 2017-01-31 17:11:18 +00:00