* strace.cc (strace::vprntf): Move prntf functionality to this function
adding an va_list interface to strace. (strace::printf): Calls strace::vprntf now. (strace_printf): New function providing an extern "C" interface to trace output. * include/sys/strace.h: Make plain C clean. (class strace): Add `vprntf' method.
This commit is contained in:
parent
6626ebfef7
commit
88429768bb
|
@ -1,3 +1,13 @@
|
||||||
|
Mon Feb 26 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* strace.cc (strace::vprntf): Move prntf functionality to this function
|
||||||
|
adding an va_list interface to strace.
|
||||||
|
(strace::printf): Calls strace::vprntf now.
|
||||||
|
(strace_printf): New function providing an extern "C" interface to
|
||||||
|
trace output.
|
||||||
|
* include/sys/strace.h: Make plain C clean.
|
||||||
|
(class strace): Add `vprntf' method.
|
||||||
|
|
||||||
Mon Feb 26 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
Mon Feb 26 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* shortcut.c: Remove #include <sys/strace.h>.
|
* shortcut.c: Remove #include <sys/strace.h>.
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
class strace
|
class strace
|
||||||
{
|
{
|
||||||
int vsprntf (char *buf, const char *func, const char *infmt, va_list ap);
|
int vsprntf (char *buf, const char *func, const char *infmt, va_list ap);
|
||||||
|
@ -33,11 +35,14 @@ public:
|
||||||
int execing;
|
int execing;
|
||||||
strace() : version(1) {}
|
strace() : version(1) {}
|
||||||
void prntf (unsigned, const char *func, const char *, ...);
|
void prntf (unsigned, const char *func, const char *, ...);
|
||||||
|
void vprntf (unsigned, const char *func, const char *, va_list ap);
|
||||||
void wm (int message, int word, int lon);
|
void wm (int message, int word, int lon);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern strace strace;
|
extern strace strace;
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#define _STRACE_INTERFACE_ACTIVATE_ADDR -1
|
#define _STRACE_INTERFACE_ACTIVATE_ADDR -1
|
||||||
#define _STRACE_INTERFACE_ACTIVATE_ADDR1 -2
|
#define _STRACE_INTERFACE_ACTIVATE_ADDR1 -2
|
||||||
|
|
||||||
|
@ -63,7 +68,18 @@ extern strace strace;
|
||||||
#define _STRACE_THREAD 0x40000 // thread-locking calls
|
#define _STRACE_THREAD 0x40000 // thread-locking calls
|
||||||
#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL
|
#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL
|
||||||
|
|
||||||
extern "C" void small_printf (const char *, ...);
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void small_printf (const char *, ...);
|
||||||
|
void strace_printf (unsigned, const char *func, const char *, ...);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#ifdef NOSTRACE
|
#ifdef NOSTRACE
|
||||||
#define define_strace(c, f)
|
#define define_strace(c, f)
|
||||||
|
@ -120,4 +136,5 @@ extern "C" void small_printf (const char *, ...);
|
||||||
#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args)
|
#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args)
|
||||||
#endif /*NEW_MACRO_VARARGS*/
|
#endif /*NEW_MACRO_VARARGS*/
|
||||||
#endif /*NOSTRACE*/
|
#endif /*NOSTRACE*/
|
||||||
|
#endif /* __cplusplus */
|
||||||
#endif /* _SYS_STRACE_H */
|
#endif /* _SYS_STRACE_H */
|
||||||
|
|
|
@ -183,17 +183,15 @@ strace::write (unsigned category, const char *buf, int count)
|
||||||
Warning: DO NOT SET ERRNO HERE! */
|
Warning: DO NOT SET ERRNO HERE! */
|
||||||
|
|
||||||
void
|
void
|
||||||
strace::prntf (unsigned category, const char *func, const char *fmt, ...)
|
strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
DWORD err = GetLastError ();
|
DWORD err = GetLastError ();
|
||||||
int count;
|
int count;
|
||||||
char buf[10000];
|
char buf[10000];
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
PROTECT(buf);
|
PROTECT(buf);
|
||||||
SetLastError (err);
|
SetLastError (err);
|
||||||
|
|
||||||
va_start (ap, fmt);
|
|
||||||
count = this->vsprntf (buf, func, fmt, ap);
|
count = this->vsprntf (buf, func, fmt, ap);
|
||||||
CHECK(buf);
|
CHECK(buf);
|
||||||
if (category & _STRACE_SYSTEM)
|
if (category & _STRACE_SYSTEM)
|
||||||
|
@ -210,6 +208,27 @@ strace::prntf (unsigned category, const char *func, const char *fmt, ...)
|
||||||
SetLastError (err);
|
SetLastError (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
strace::prntf (unsigned category, const char *func, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start (ap, fmt);
|
||||||
|
this->vprntf (category, func, fmt, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
strace_printf (unsigned category, const char *func, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
if ((category & _STRACE_SYSTEM) || strace.active)
|
||||||
|
{
|
||||||
|
va_start (ap, fmt);
|
||||||
|
strace.vprntf (category, func, fmt, ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static NO_COPY const struct tab
|
static NO_COPY const struct tab
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
Loading…
Reference in New Issue