Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index e9ef382152362b1140aa5f48e06b4916dd671946..94385373c2ee309e5f5392bd922b8333d610508f 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -644,7 +644,17 @@ void Logger::ApiNamedSecurityCheck(Object* key) { |
String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
ApiEvent("api,check-security,\"%s\"\n", *str); |
} else if (key->IsSymbol()) { |
- ApiEvent("api,check-security,symbol(hash %x)\n", Symbol::cast(key)->Hash()); |
+ Symbol* symbol = Symbol::cast(key); |
+ if (symbol->name()->IsUndefined()) { |
+ ApiEvent("api,check-security,symbol(hash %x)\n", |
+ Symbol::cast(key)->Hash()); |
+ } else { |
+ SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( |
+ DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
+ ApiEvent("api,check-security,symbol(\"%s\" hash %x)\n", |
+ *str, |
+ Symbol::cast(key)->Hash()); |
+ } |
} else if (key->IsUndefined()) { |
ApiEvent("api,check-security,undefined\n"); |
} else { |
@@ -833,8 +843,16 @@ void Logger::ApiNamedPropertyAccess(const char* tag, |
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name); |
} else { |
- uint32_t hash = Symbol::cast(name)->Hash(); |
- ApiEvent("api,%s,\"%s\",symbol(hash %x)\n", tag, *class_name, hash); |
+ Symbol* symbol = Symbol::cast(name); |
+ uint32_t hash = symbol->Hash(); |
+ if (symbol->name()->IsUndefined()) { |
+ ApiEvent("api,%s,\"%s\",symbol(hash %x)\n", tag, *class_name, hash); |
+ } else { |
+ SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( |
+ DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
+ ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)\n", |
+ tag, *class_name, *str, hash); |
+ } |
} |
} |
@@ -902,7 +920,14 @@ void Logger::CallbackEventInternal(const char* prefix, Name* name, |
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
msg.Append(",1,\"%s%s\"", prefix, *str); |
} else { |
- msg.Append(",1,symbol(hash %x)", prefix, Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ if (symbol->name()->IsUndefined()) { |
+ msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash()); |
+ } else { |
+ SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( |
+ DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
+ msg.Append(",1,symbol(\"%s\" hash %x)", prefix, *str, symbol->Hash()); |
+ } |
} |
msg.Append('\n'); |
msg.WriteToLogFile(); |
@@ -978,8 +1003,15 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
if (name->IsString()) { |
name_buffer_->AppendString(String::cast(name)); |
} else { |
- name_buffer_->AppendBytes("symbol(hash "); |
- name_buffer_->AppendHex(Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ name_buffer_->AppendBytes("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ name_buffer_->AppendBytes("\""); |
+ name_buffer_->AppendString(String::cast(symbol->name())); |
+ name_buffer_->AppendBytes("\" "); |
+ } |
+ name_buffer_->AppendBytes("hash "); |
+ name_buffer_->AppendHex(symbol->Hash()); |
name_buffer_->AppendByte(')'); |
} |
} |
@@ -1006,7 +1038,14 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
msg.AppendDetailed(String::cast(name), false); |
msg.Append('"'); |
} else { |
- msg.Append("symbol(hash %x)", Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ msg.Append("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ msg.Append("\""); |
+ msg.AppendDetailed(String::cast(symbol->name()), false); |
+ msg.Append("\" "); |
+ } |
+ msg.Append("hash %x)", symbol->Hash()); |
} |
msg.Append('\n'); |
msg.WriteToLogFile(); |
@@ -1036,8 +1075,15 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
if (name->IsString()) { |
name_buffer_->AppendString(String::cast(name)); |
} else { |
- name_buffer_->AppendBytes("symbol(hash "); |
- name_buffer_->AppendHex(Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ name_buffer_->AppendBytes("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ name_buffer_->AppendBytes("\""); |
+ name_buffer_->AppendString(String::cast(symbol->name())); |
+ name_buffer_->AppendBytes("\" "); |
+ } |
+ name_buffer_->AppendBytes("hash "); |
+ name_buffer_->AppendHex(symbol->Hash()); |
name_buffer_->AppendByte(')'); |
} |
} |
@@ -1073,7 +1119,14 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
msg.Append("\"%s\"", *str); |
} else { |
- msg.Append("symbol(hash %x)", Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ msg.Append("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ msg.Append("\""); |
+ msg.AppendDetailed(String::cast(symbol->name()), false); |
+ msg.Append("\" "); |
+ } |
+ msg.Append("hash %x)", symbol->Hash()); |
} |
msg.Append(','); |
msg.AppendAddress(shared->address()); |
@@ -1138,7 +1191,14 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
msg.Append("%s", *sourcestr); |
} else { |
- msg.Append("symbol(hash %x)", Name::cast(source)->Hash()); |
+ Symbol* symbol = Symbol::cast(source); |
+ msg.Append("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ msg.Append("\""); |
+ msg.AppendDetailed(String::cast(symbol->name()), false); |
+ msg.Append("\" "); |
+ } |
+ msg.Append("hash %x)", symbol->Hash()); |
} |
msg.Append(":%d\",", line); |
msg.AppendAddress(shared->address()); |
@@ -1358,7 +1418,14 @@ void Logger::SuspectReadEvent(Name* name, Object* obj) { |
msg.Append(String::cast(name)); |
msg.Append('"'); |
} else { |
- msg.Append("symbol(hash %x)", Name::cast(name)->Hash()); |
+ Symbol* symbol = Symbol::cast(name); |
+ msg.Append("symbol("); |
+ if (!symbol->name()->IsUndefined()) { |
+ msg.Append("\""); |
+ msg.AppendDetailed(String::cast(symbol->name()), false); |
+ msg.Append("\" "); |
+ } |
+ msg.Append("hash %x)", symbol->Hash()); |
} |
msg.Append('\n'); |
msg.WriteToLogFile(); |