Message ID | BANLkTimfcQbK-H99GvyUvd=qScs=vWTOcg@mail.gmail.com |
---|---|
State | New |
Headers | show |
Stefan Hajnoczi writes: >> + if (len > 1) { /* skip empty lines */ >> + line[len - 1] = '\0'; >> + if (!st_change_trace_event_state(line, true)) { > The build breaks when --enable-trace-backend != simple because this > code is outside an #ifdef CONFIG_SIMPLE_TRACE. Please add this: > diff --git a/simpletrace.h b/simpletrace.h > index 8d893bd..5d9d2ec 100644 > --- a/simpletrace.h > +++ b/simpletrace.h > @@ -43,6 +43,11 @@ static inline bool st_init(const char *file) > { > return true; > } > + > +static bool st_change_trace_event_state(const char *tname, bool tstate) > +{ > + return true; > +} > #endif /* !CONFIG_SIMPLE_TRACE */ > #endif /* SIMPLETRACE_H */ Hmmm... why don't simply conditionally call st_init (put it into an #ifdef) and remove the "#else" in simpletrace.h. I've looked at it and it's not called from anywhere else. This also reminds me that I didn't see any "-trace" option parsing in the OS-specific frontends (at least in linux-user). Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth
On Wed, Apr 6, 2011 at 3:15 PM, Lluís <xscript@gmx.net> wrote: > Stefan Hajnoczi writes: > >>> + if (len > 1) { /* skip empty lines */ >>> + line[len - 1] = '\0'; >>> + if (!st_change_trace_event_state(line, true)) { > >> The build breaks when --enable-trace-backend != simple because this >> code is outside an #ifdef CONFIG_SIMPLE_TRACE. Please add this: > >> diff --git a/simpletrace.h b/simpletrace.h >> index 8d893bd..5d9d2ec 100644 >> --- a/simpletrace.h >> +++ b/simpletrace.h >> @@ -43,6 +43,11 @@ static inline bool st_init(const char *file) >> { >> return true; >> } >> + >> +static bool st_change_trace_event_state(const char *tname, bool tstate) >> +{ >> + return true; >> +} >> #endif /* !CONFIG_SIMPLE_TRACE */ > >> #endif /* SIMPLETRACE_H */ > > Hmmm... why don't simply conditionally call st_init (put it into an > #ifdef) and remove the "#else" in simpletrace.h. > > I've looked at it and it's not called from anywhere else. The benefit to stubbing out these functions is that callers don't have #ifdefs. And caller code is always built (i.e. syntax checked by the parser) so it helps avoid bitrot. vl.c:main() is already a long and ugly function so it would be nice to avoid #ifdefs there. > This also reminds me that I didn't see any "-trace" option parsing in > the OS-specific frontends (at least in linux-user). User emulation does not have any way to control simpletrace today. Stefan
Stefan Hajnoczi writes: >> Hmmm... why don't simply conditionally call st_init (put it into an >> #ifdef) and remove the "#else" in simpletrace.h. >> >> I've looked at it and it's not called from anywhere else. > The benefit to stubbing out these functions is that callers don't have > #ifdefs. And caller code is always built (i.e. syntax checked by the > parser) so it helps avoid bitrot. vl.c:main() is already a long and > ugly function so it would be nice to avoid #ifdefs there. Aaah... well, I simply moved everything into ifdefs in v2, as the stderr additions also made use of the same function names but deleted the '#include "simpletrace.h"' in vl.c (as it's already in trace.h when such backend is enabled). Do you want it back? >> This also reminds me that I didn't see any "-trace" option parsing in >> the OS-specific frontends (at least in linux-user). > User emulation does not have any way to control simpletrace today. Well I was referring more to the lack of a common option parsing loop on all frontends, as I expected all of them to use hxtool. Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth
diff --git a/simpletrace.h b/simpletrace.h index 8d893bd..5d9d2ec 100644 --- a/simpletrace.h +++ b/simpletrace.h @@ -43,6 +43,11 @@ static inline bool st_init(const char *file) { return true; } + +static bool st_change_trace_event_state(const char *tname, bool tstate) +{ + return true; +} #endif /* !CONFIG_SIMPLE_TRACE */ #endif /* SIMPLETRACE_H */