Commit 077a1658 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[tracing] Fix test TraceWriter to expect uninitialized TraceObjects

The TraceObject passed to AppendTraceEvent can be completely
uninitialized (set to all 0s) in some situations where a flush happens
between creation and initialization of the TraceObject.

Fix the MockTraceWriter in test-tracing to expect nullptr strings for
the name of the object so that it does not try to construct an
std::string from a null char*.

Bug: v8:9214
Change-Id: Ib4f3b039ab98d5d786991134cb71ecc62f127179
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1598751
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61265}
parent 70678d53
......@@ -68,7 +68,9 @@ class ConvertableToTraceFormatMock : public v8::ConvertableToTraceFormat {
class MockTraceWriter : public TraceWriter {
public:
void AppendTraceEvent(TraceObject* trace_event) override {
events_.push_back(trace_event->name());
// TraceObject might not have been initialized.
const char* name = trace_event->name() ? trace_event->name() : "";
events_.push_back(name);
}
void Flush() override {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment