String to ascii char array converter for debug mode.
Review URL: http://codereview.chromium.org/7523052 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8763 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6637fa2835
commit
15b13fac8e
@ -560,6 +560,21 @@ void String::StringPrint(FILE* out) {
|
||||
}
|
||||
|
||||
|
||||
// This method is only meant to be called from gdb for debugging purposes.
|
||||
// Since the string can also be in two-byte encoding, non-ascii characters
|
||||
// will be ignored in the output.
|
||||
char* String::ToAsciiArray() {
|
||||
// Static so that subsequent calls frees previously allocated space.
|
||||
// This also means that previous results will be overwritten.
|
||||
static char* buffer = NULL;
|
||||
if (buffer != NULL) free(buffer);
|
||||
buffer = new char[length()+1];
|
||||
WriteToFlat(this, buffer, 0, length());
|
||||
buffer[length()] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
void JSProxy::JSProxyPrint(FILE* out) {
|
||||
HeapObject::PrintHeader(out, "JSProxy");
|
||||
PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
|
||||
|
@ -5927,6 +5927,8 @@ class String: public HeapObject {
|
||||
StringPrint(stdout);
|
||||
}
|
||||
void StringPrint(FILE* out);
|
||||
|
||||
char* ToAsciiArray();
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void StringVerify();
|
||||
|
Loading…
Reference in New Issue
Block a user