| Submitter | Fabien Chouteau |
|---|---|
| Date | Jan. 26, 2011, 11:34 a.m. |
| Message ID | <69207a7f790d1dca508166272a1fe2de4e4ea975.1296040658.git.chouteau@adacore.com> |
| Download | mbox | patch |
| Permalink | /patch/80501/ |
| State | New |
| Headers | show |
Comments
On Wed, Jan 26, 2011 at 11:34 AM, Fabien Chouteau <chouteau@adacore.com> wrote: > +linetoh_stderr() > +{ > + local name args argnamess argc fmt s/argnamess/argnames/ Stefan
On 26 January 2011 11:34, Fabien Chouteau <chouteau@adacore.com> wrote: > -echo " --enable-trace-backend=B Trace backend nop simple ust dtrace" > +echo " --enable-trace-backend=B Trace backend nop simple stderr ust dtrace" This is a bit cryptic, especially since there's no punctuation. Maybe it would be better to have something like the audio driver options: echo " --enable-trace-backend=B Set trace backend:" echo " Available backends: $trace_possible_backends" (and set trace_possible_backends earlier, perhaps even automatically by running tracetool?) -- PMM
On 01/26/2011 01:34 PM, Stefan Hajnoczi wrote: > On Wed, Jan 26, 2011 at 11:34 AM, Fabien Chouteau<chouteau@adacore.com> wrote: >> +linetoh_stderr() >> +{ >> + local name args argnamess argc fmt > > s/argnamess/argnames/ Fixed. Thanks,
On 01/26/2011 01:56 PM, Peter Maydell wrote: > On 26 January 2011 11:34, Fabien Chouteau<chouteau@adacore.com> wrote: >> -echo " --enable-trace-backend=B Trace backend nop simple ust dtrace" >> +echo " --enable-trace-backend=B Trace backend nop simple stderr ust dtrace" > > This is a bit cryptic, especially since there's no punctuation. > Maybe it would be better to have something like the audio > driver options: > echo " --enable-trace-backend=B Set trace backend:" > echo " Available backends: $trace_possible_backends" > > (and set trace_possible_backends earlier, perhaps even > automatically by running tracetool?) > > -- PMM I will add this in the next version of the patch.
Patch
diff --git a/configure b/configure index 210670c..560274e 100755 --- a/configure +++ b/configure @@ -907,7 +907,7 @@ echo " --enable-docs enable documentation build" echo " --disable-docs disable documentation build" echo " --disable-vhost-net disable vhost-net acceleration support" echo " --enable-vhost-net enable vhost-net acceleration support" -echo " --enable-trace-backend=B Trace backend nop simple ust dtrace" +echo " --enable-trace-backend=B Trace backend nop simple stderr ust dtrace" echo " --with-trace-file=NAME Full PATH,NAME of file to store traces" echo " Default:trace-<pid>" echo " --disable-spice disable spice" diff --git a/docs/tracing.txt b/docs/tracing.txt index 963c504..21183f9 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -133,6 +133,11 @@ source tree. It may not be as powerful as platform-specific or third-party trace backends but it is portable. This is the recommended trace backend unless you have specific needs for more advanced backends. +=== Stderr === + +The "stderr" backend sends trace events directly to standard error output +during emulation. + ==== Monitor commands ==== * info trace diff --git a/scripts/tracetool b/scripts/tracetool index fce491c..a686fe2 100755 --- a/scripts/tracetool +++ b/scripts/tracetool @@ -19,6 +19,7 @@ Generate tracing code for a file on stdin. Backends: --nop Tracing disabled --simple Simple built-in backend + --stderr Stderr built-in backend --ust LTTng User Space Tracing backend --dtrace DTrace/SystemTAP backend @@ -236,6 +237,56 @@ linetoc_end_simple() EOF } +#STDERR +linetoh_begin_stderr() +{ + cat <<EOF +#include <stdio.h> +EOF +} + +linetoh_stderr() +{ + local name args argnamess argc fmt + name=$(get_name "$1") + args=$(get_args "$1") + argnames=$(get_argnames "$1" ",") + argc=$(get_argc "$1") + fmt=$(get_fmt "$1") + + if [ "$argc" -gt 0 ]; then + argnames=", $argnames" + fi + + cat <<EOF +static inline void trace_$name($args) +{ + fprintf(stderr, "$name $fmt\n" $argnames); +} +EOF +} + +linetoh_end_stderr() +{ +return +} + +linetoc_begin_stderr() +{ +return +} + +linetoc_stderr() +{ +return +} + +linetoc_end_stderr() +{ +return +} +#END OF STDERR + # Clean up after UST headers which pollute the namespace ust_clean_namespace() { cat <<EOF @@ -546,7 +597,7 @@ targetarch= until [ -z "$1" ] do case "$1" in - "--nop" | "--simple" | "--ust" | "--dtrace") backend="${1#--}" ;; + "--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace") backend="${1#--}" ;; "--binary") shift ; binary="$1" ;; "--target-arch") shift ; targetarch="$1" ;;
This backend sends trace events to standard error output during the emulation. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> --- configure | 2 +- docs/tracing.txt | 5 +++++ scripts/tracetool | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-)