]>
git.saurik.com Git - apple/javascriptcore.git/blob - interpreter/VMInspector.h
   2  * Copyright (C) 2012 Apple Inc. All rights reserved. 
   4  * Redistribution and use in source and binary forms, with or without 
   5  * modification, are permitted provided that the following conditions 
   7  * 1. Redistributions of source code must retain the above copyright 
   8  *    notice, this list of conditions and the following disclaimer. 
   9  * 2. Redistributions in binary form must reproduce the above copyright 
  10  *    notice, this list of conditions and the following disclaimer in the 
  11  *    documentation and/or other materials provided with the distribution. 
  13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 
  14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
  15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR 
  17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
  18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
  19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
  21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
  22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  29 #define ENABLE_VMINSPECTOR 0 
  31 #include "CallFrame.h" 
  32 #include "JSCJSValue.h" 
  35 #include <wtf/text/WTFString.h> 
  39 #if ENABLE(VMINSPECTOR) 
  43     static JS_EXPORT_PRIVATE 
const char* getTypeName(JSValue
); 
  44     static JS_EXPORT_PRIVATE 
void dumpFrame0(CallFrame
*); 
  45     static JS_EXPORT_PRIVATE 
void dumpFrame(CallFrame
*, const char* prefix 
= 0, const char* funcName 
= 0, const char* file 
= 0, int line 
= -1); 
  46     static JS_EXPORT_PRIVATE 
int countFrames(CallFrame
*); 
  48     // Special family of ...printf() functions that support, in addition to the 
  49     // standard % formats (e.g. %d, %s, etc), the following extra JSC formatting 
  50     // options, %J<x>, where <x> consists of: 
  52     //   +    - verbose mode modifier. 
  53     //          Used in combination with other options. Must come after the %J. 
  58     //    WTF::String str("My WTF String"); 
  60     //    // Printing the string. Will print: 
  61     //    // The wtf string says: "My WTF String" and is NOT EMPTY. 
  63     //    VMInspector::printf("The wtf string says: \"%Js\" and is %s\n", 
  64     //        &str, str.isEmpty()?"EMPTY":"NOT EMPTY"); 
  66     //    // Printing the string with verbose mode. Will print: 
  67     //    // <WTF::String "My WTF String"> 
  69     //    VMInspector::printf("<%J+s>\n", &str); 
  71     // Also added some convenience non-JS formats: 
  73     //   %b    - boolean (va_args will look for an int). 
  74     //           Prints TRUE if non-zero, else prints FALSE. 
  76     // Caution: the user is expected to pass the correctly matched arguments 
  77     // to pair with the corresponding % fomatting. 
  79     static JS_EXPORT_PRIVATE 
void fprintf(FILE*, const char* format
, ...); 
  80     static JS_EXPORT_PRIVATE 
void printf(const char* format
, ...); 
  81     static JS_EXPORT_PRIVATE 
void sprintf(char*, const char* format
, ...); 
  82     static JS_EXPORT_PRIVATE 
void snprintf(char*, size_t, const char* format
, ...); 
  85 #endif // ENABLE(VMINSPECTOR) 
  89 #endif // VMInspector.h