#
d4cfbbda |
|
13-Apr-2018 |
Jeff Brown <jeffbrown@google.com> |
[trace] Prevent use-after-free when trace arg is a temporary. This fixes an issue with temporary strings passed as arguments to the trace macros. When writing a record which has a string argument, the string's data pointer is placed in a table of trace_arg_t values which are then passed to the function which actually does the writing. That function will copy the contents of the string as required. However, if the string was a temporary, it may have already been destroyed by the time that happens. This change first assigns the trace arguments to local variables to ensure they remain in scope for the whole block. TRACE_DURATION_BEGIN("foo", "name", "key", fbl::String("string")); Tested using ASAN that the problem has been fixed. Change-Id: I97cb382242d7736bb9f0fa6e5c9f2ae64009ba38
|
#
76e6ccd5 |
|
29-Aug-2017 |
Jeff Brown <jeffbrown@google.com> |
[trace] Port Fuchsia tracing system to Magenta. The Fuchsia tracing system supports instrumentation of userspace programs to collect trace records. This implementation consists of... - libtrace: a static library providing C and C++ instrumentation macros and functions designed to be linked into client programs - libtrace-engine: a shared library with a C ABI which manages global tracing state in the process and provides functions to write trace records - libtrace-provider: a static library which implements the TraceProvider FIDL interface and registers an instrumented program with the trace manager - libtrace-reader: a static library which provides a C++ API for reading binary trace data - unit tests - benchmarks - documentation This is almost a complete rewrite of the code formerly in //apps/tracing but it remains compatible with the trace format and preserves most of the structure of the trace event API. The main differences are... - The <trace/event.h> API uses identical syntax for C and C++ with a few extra goodies for C++ type inference. - The trace engine is factored out as a shared library with a C ABI instead of being written as a C++ static library, this makes it more suitable for instrumentation of libraries and device drivers. - The API is extensively documented. - We actually have benchmarks to measure instrumentation overhead. There are still a few pieces left in //apps/tracing, such as the trace manager and command-line tools, which will be moved over later. Change-Id: I2d2986be0e63e5aa21fe56dd03024490b0334214
|