Topic: portable trace mechanism?
Author: "Bill Eidson" <bille@research.bell-labs.com>
Date: Fri, 3 May 2002 20:45:29 GMT Raw View
There was an article in CUJ a few months ago about an aspect oriented
approach to run time logging. The concept revolves around binary data
logging for speed with man readable output as a second step. Nice.
A Technique for Efficient Logging and Monitoring of Real-Time Systems by
Bill Pyritz
March 2002
"Ken Hagan" <K.Hagan@thermoteknix.co.uk> wrote in message
news:1020238108.23435.0.nnrp-14.3e31ffea@news.demon.co.uk...
> "Alex Rosenberg" <alexr@spies.com> wrote...
> >
> > Has anyone devised a portable C++ trace mechanism?
> >
> > Two of my typical desires for such a mechanism are providing a backtrace
> > when constructing an exception and for having nodes in a complex data
> > structure automatically track where they were last modified.
>
> Your two examples look a lot like debugging aids, though feel free to
> correct me if you are using them in production code.
>
> Unless the mechanism has a use in production code, I don't think we
> need a portable version of it. Any support can remain a QoI issue for
> your chosen compiler(s).
>
> Microsoft's offering lets you insert function calls at function entry
> and/or exit, lets you use inline assembly to discover the location of
> a function's caller, lets you track both throwing and unwinding of
> exceptions, and provides a library that can convert the compiler's debug
> information into stack traces with unmangled names. Perhaps it is an
> exceptionally good compiler, but presumably other vendors are similar.
>
>
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Alex Rosenberg <alexr@spies.com>
Date: Wed, 1 May 2002 00:49:03 GMT Raw View
Has anyone devised a portable C++ trace mechanism?
Two of my typical desires for such a mechanism are providing a backtrace
when constructing an exception and for having nodes in a complex data
structure automatically track where they were last modified.
The usual solutions require the preprocessor and the insertion of a
trace macro at the entry to each function.
The ideal solution should neither use the preprocessor, nor require lots
of typing. (Non-preprocessor versions of __FILE__ and __LINE__ should be
devised.)
I had considered that C99's __func__ would appear in a future standard,
so I thought perhaps making it a default argument somewhere might help
solve this problem, but 8.3.6,7 prevents local variables from being
passed as default arguments.
Another approach would be to abuse template conversion operators and
type_info::name(), but name() isn't guaranteed to provide a meaningful
result and this would require the explicit use of a conversion operator
at trace points. (Again, default args could help....)
It would be very desirable to find a specific solution to this common
problem for C++0x.
+------------------------------------------------------------+
| Alexander M. Rosenberg <mailto:alexr@_spies.com> |
| Nobody cares what I say. Remove the underscore to mail me. |
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: "Ken Hagan" <K.Hagan@thermoteknix.co.uk>
Date: Wed, 1 May 2002 21:07:36 GMT Raw View
"Alex Rosenberg" <alexr@spies.com> wrote...
>
> Has anyone devised a portable C++ trace mechanism?
>
> Two of my typical desires for such a mechanism are providing a backtrace
> when constructing an exception and for having nodes in a complex data
> structure automatically track where they were last modified.
Your two examples look a lot like debugging aids, though feel free to
correct me if you are using them in production code.
Unless the mechanism has a use in production code, I don't think we
need a portable version of it. Any support can remain a QoI issue for
your chosen compiler(s).
Microsoft's offering lets you insert function calls at function entry
and/or exit, lets you use inline assembly to discover the location of
a function's caller, lets you track both throwing and unwinding of
exceptions, and provides a library that can convert the compiler's debug
information into stack traces with unmangled names. Perhaps it is an
exceptionally good compiler, but presumably other vendors are similar.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]