OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 * Passes on the value set by the embedder when it fed the script from which | 1150 * Passes on the value set by the embedder when it fed the script from which |
1151 * this Message was generated to V8. | 1151 * this Message was generated to V8. |
1152 */ | 1152 */ |
1153 bool IsSharedCrossOrigin() const; | 1153 bool IsSharedCrossOrigin() const; |
1154 | 1154 |
1155 // TODO(1245381): Print to a string instead of on a FILE. | 1155 // TODO(1245381): Print to a string instead of on a FILE. |
1156 static void PrintCurrentStackTrace(FILE* out); | 1156 static void PrintCurrentStackTrace(FILE* out); |
1157 | 1157 |
1158 static const int kNoLineNumberInfo = 0; | 1158 static const int kNoLineNumberInfo = 0; |
1159 static const int kNoColumnInfo = 0; | 1159 static const int kNoColumnInfo = 0; |
| 1160 static const int kNoScriptIdInfo = 0; |
1160 }; | 1161 }; |
1161 | 1162 |
1162 | 1163 |
1163 /** | 1164 /** |
1164 * Representation of a JavaScript stack trace. The information collected is a | 1165 * Representation of a JavaScript stack trace. The information collected is a |
1165 * snapshot of the execution stack and the information remains valid after | 1166 * snapshot of the execution stack and the information remains valid after |
1166 * execution continues. | 1167 * execution continues. |
1167 */ | 1168 */ |
1168 class V8_EXPORT StackTrace { | 1169 class V8_EXPORT StackTrace { |
1169 public: | 1170 public: |
1170 /** | 1171 /** |
1171 * Flags that determine what information is placed captured for each | 1172 * Flags that determine what information is placed captured for each |
1172 * StackFrame when grabbing the current stack trace. | 1173 * StackFrame when grabbing the current stack trace. |
1173 */ | 1174 */ |
1174 enum StackTraceOptions { | 1175 enum StackTraceOptions { |
1175 kLineNumber = 1, | 1176 kLineNumber = 1, |
1176 kColumnOffset = 1 << 1 | kLineNumber, | 1177 kColumnOffset = 1 << 1 | kLineNumber, |
1177 kScriptName = 1 << 2, | 1178 kScriptName = 1 << 2, |
1178 kFunctionName = 1 << 3, | 1179 kFunctionName = 1 << 3, |
1179 kIsEval = 1 << 4, | 1180 kIsEval = 1 << 4, |
1180 kIsConstructor = 1 << 5, | 1181 kIsConstructor = 1 << 5, |
1181 kScriptNameOrSourceURL = 1 << 6, | 1182 kScriptNameOrSourceURL = 1 << 6, |
| 1183 kScriptId = 1 << 7, |
1182 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName, | 1184 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName, |
1183 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL | 1185 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL |
1184 }; | 1186 }; |
1185 | 1187 |
1186 /** | 1188 /** |
1187 * Returns a StackFrame at a particular index. | 1189 * Returns a StackFrame at a particular index. |
1188 */ | 1190 */ |
1189 Local<StackFrame> GetFrame(uint32_t index) const; | 1191 Local<StackFrame> GetFrame(uint32_t index) const; |
1190 | 1192 |
1191 /** | 1193 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 /** | 1229 /** |
1228 * Returns the 1-based column offset on the line for the associated function | 1230 * Returns the 1-based column offset on the line for the associated function |
1229 * call. | 1231 * call. |
1230 * This method will return Message::kNoColumnInfo if it is unable to retrieve | 1232 * This method will return Message::kNoColumnInfo if it is unable to retrieve |
1231 * the column number, or if kColumnOffset was not passed as an option when | 1233 * the column number, or if kColumnOffset was not passed as an option when |
1232 * capturing the StackTrace. | 1234 * capturing the StackTrace. |
1233 */ | 1235 */ |
1234 int GetColumn() const; | 1236 int GetColumn() const; |
1235 | 1237 |
1236 /** | 1238 /** |
| 1239 * Returns the id of the script for the function for this StackFrame. |
| 1240 * This method will return Message::kNoScriptIdInfo if it is unable to |
| 1241 * retrieve the script id, or if kScriptId was not passed as an option when |
| 1242 * capturing the StackTrace. |
| 1243 */ |
| 1244 int GetScriptId() const; |
| 1245 |
| 1246 /** |
1237 * Returns the name of the resource that contains the script for the | 1247 * Returns the name of the resource that contains the script for the |
1238 * function for this StackFrame. | 1248 * function for this StackFrame. |
1239 */ | 1249 */ |
1240 Local<String> GetScriptName() const; | 1250 Local<String> GetScriptName() const; |
1241 | 1251 |
1242 /** | 1252 /** |
1243 * Returns the name of the resource that contains the script for the | 1253 * Returns the name of the resource that contains the script for the |
1244 * function for this StackFrame or sourceURL value if the script name | 1254 * function for this StackFrame or sourceURL value if the script name |
1245 * is undefined and its source ends with //# sourceURL=... string or | 1255 * is undefined and its source ends with //# sourceURL=... string or |
1246 * deprecated //@ sourceURL=... string. | 1256 * deprecated //@ sourceURL=... string. |
(...skipping 5242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6489 */ | 6499 */ |
6490 | 6500 |
6491 | 6501 |
6492 } // namespace v8 | 6502 } // namespace v8 |
6493 | 6503 |
6494 | 6504 |
6495 #undef TYPE_CHECK | 6505 #undef TYPE_CHECK |
6496 | 6506 |
6497 | 6507 |
6498 #endif // V8_H_ | 6508 #endif // V8_H_ |
OLD | NEW |