-
Notifications
You must be signed in to change notification settings - Fork 1.2k
xplat: Debugger Support #2056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xplat: Debugger Support #2056
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env python | ||
| #------------------------------------------------------------------------------------------------------- | ||
| # Copyright (C) Microsoft. All rights reserved. | ||
| # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
| #------------------------------------------------------------------------------------------------------- | ||
|
|
||
| from __future__ import with_statement # py 2.5 | ||
| import sys | ||
| import os | ||
|
|
||
| def print_usage(): | ||
| print "jstoc tool" | ||
| print "creates a (const char array) from a javascript file." | ||
| print "" | ||
| print "usage: jstoc.py <js file path> <variable name>" | ||
| sys.exit(1) | ||
|
|
||
| def convert(): | ||
| if len(sys.argv) < 3: | ||
| print_usage() | ||
|
|
||
| js_file_name = sys.argv[1] | ||
| if os.path.isfile(js_file_name) == False: | ||
| print_usage() | ||
|
|
||
| h_file_name = js_file_name + '.h' | ||
|
|
||
| js_file_time = os.path.getmtime(js_file_name) | ||
| h_file_time = 0 | ||
| if os.path.isfile(h_file_name): | ||
| h_file_time = os.path.getmtime(h_file_name) | ||
|
|
||
| str_header = "static const char " + sys.argv[2] + "[] = {\n" | ||
|
|
||
| # if header file is up to date and no update to jstoc.py since, skip.. | ||
| if h_file_time < js_file_time or h_file_time < os.path.getmtime(sys.argv[0]): | ||
| with open(js_file_name, "rb") as js_file: | ||
| last_break = len(str_header) # skip first line | ||
| byte = js_file.read(1) | ||
| while byte: | ||
| str_header += str(ord(byte)) | ||
| str_header += "," | ||
| # beautify a bit. limit column to ~80 | ||
| column_check = (len(str_header) + 1) - last_break | ||
| if column_check > 5 and column_check % 80 < 5: | ||
| last_break = len(str_header) + 1 | ||
| str_header += "\n" | ||
| else: | ||
| str_header += " " | ||
| byte = js_file.read(1) | ||
| str_header += "0\n};" | ||
|
|
||
| h_file = open(h_file_name, "w") | ||
| h_file.write(str_header) | ||
| h_file.close() | ||
| print "-- " + h_file_name + " is created" | ||
| else: | ||
| print "-- " + h_file_name + " is up to date. skipping." | ||
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(convert()) | ||
| else: | ||
| print("try without python") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
| #define ProfileEntryThunk Js::ScriptContext::DebugProfileProbeThunk | ||
|
|
||
| #define DefaultDeferredParsingThunk Js::JavascriptFunction::DeferredParsingThunk | ||
| #ifdef ENABLE_SCRIPT_PROFILING | ||
| #if defined(ENABLE_SCRIPT_PROFILING) || defined(ENABLE_SCRIPT_DEBUGGING) | ||
| #define ProfileDeferredParsingThunk Js::ScriptContext::ProfileModeDeferredParsingThunk | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we use ProfileDeferredParsingThunk in debugging.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, the method itself doesn't receive any call but I've fixed it's impl. for xplat instead of adding even more ifdef checks etc. |
||
| #endif | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| //------------------------------------------------------------------------------------------------------- | ||
| // Copyright (C) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
| //------------------------------------------------------------------------------------------------------- | ||
|
|
||
| #ifndef RUNTIME_PLATFORM_AGNOSTIC_DEBUGGER | ||
| #define RUNTIME_PLATFORM_AGNOSTIC_DEBUGGER | ||
|
|
||
| #ifndef _WIN32 | ||
|
|
||
| #define ACTIVPROF_E_PROFILER_PRESENT 0x0200 | ||
| #define ACTIVPROF_E_PROFILER_ABSENT 0x0201 | ||
| #define ACTIVPROF_E_UNABLE_TO_APPLY_ACTION 0x0202 | ||
| #define PROFILER_TOKEN uint | ||
|
|
||
| typedef enum { | ||
| PROFILER_SCRIPT_TYPE_USER, | ||
| PROFILER_SCRIPT_TYPE_DYNAMIC, | ||
| PROFILER_SCRIPT_TYPE_NATIVE, | ||
| PROFILER_SCRIPT_TYPE_DOM | ||
| } PROFILER_SCRIPT_TYPE; | ||
|
|
||
| typedef enum { | ||
| PROFILER_EVENT_MASK_TRACE_SCRIPT_FUNCTION_CALL = 0x00000001, | ||
| PROFILER_EVENT_MASK_TRACE_NATIVE_FUNCTION_CALL = 0x00000002, | ||
| PROFILER_EVENT_MASK_TRACE_DOM_FUNCTION_CALL = 0x00000004, | ||
| PROFILER_EVENT_MASK_TRACE_ALL = | ||
| PROFILER_EVENT_MASK_TRACE_SCRIPT_FUNCTION_CALL | | ||
| PROFILER_EVENT_MASK_TRACE_NATIVE_FUNCTION_CALL, | ||
| PROFILER_EVENT_MASK_TRACE_ALL_WITH_DOM = PROFILER_EVENT_MASK_TRACE_ALL | | ||
| PROFILER_EVENT_MASK_TRACE_DOM_FUNCTION_CALL | ||
| } PROFILER_EVENT_MASK; | ||
|
|
||
| interface IEnumDebugCodeContexts : IUnknown | ||
| { | ||
| // HRESULT Next( .. | ||
|
|
||
| // HRESULT Skip( .. | ||
|
|
||
| // HRESULT Reset(); | ||
|
|
||
| // HRESULT Clone( .. | ||
| }; | ||
|
|
||
| interface IDebugDocumentInfo : IUnknown | ||
| { | ||
| HRESULT GetName(char* dn, BSTR *name); | ||
|
|
||
| HRESULT GetDocumentClassId(CLSID *dclsid); | ||
| }; | ||
|
|
||
| interface IDebugDocument : IDebugDocumentInfo | ||
| { | ||
| }; | ||
|
|
||
| interface IDebugDocumentContext : IUnknown | ||
| { | ||
| HRESULT GetDocument(IDebugDocument **doc); | ||
|
|
||
| HRESULT EnumCodeContexts(IEnumDebugCodeContexts **dctx); | ||
| }; | ||
|
|
||
| class IActiveScriptProfilerCallback | ||
| { | ||
| public: | ||
| HRESULT Initialize(DWORD ctx) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT Shutdown(HRESULT _) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT Release() | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT QueryInterface(IActiveScriptProfilerCallback **_) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT ScriptCompiled(PROFILER_TOKEN scriptId, PROFILER_SCRIPT_TYPE type, IUnknown *ctx) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT FunctionCompiled(PROFILER_TOKEN functionId, PROFILER_TOKEN scriptId, | ||
| const WCHAR* pwszFunctionName, const WCHAR* pwszFunctionNameHint, IUnknown *ctx) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT OnFunctionEnter(PROFILER_TOKEN scriptId, PROFILER_TOKEN functionId) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT OnFunctionExit(PROFILER_TOKEN scriptId, PROFILER_TOKEN functionId) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| // IActiveScriptProfilerCallback2 | ||
| HRESULT OnFunctionEnterByName(const WCHAR *functionName, PROFILER_SCRIPT_TYPE _) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT OnFunctionExitByName(const WCHAR *functionName, PROFILER_SCRIPT_TYPE _) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| // IActiveScriptProfilerCallback3 | ||
| HRESULT AddRef() | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| HRESULT SetWebWorkerId(PROFILER_TOKEN _) | ||
| { | ||
| return S_OK; | ||
| } | ||
| }; | ||
|
|
||
| #define IActiveScriptProfilerCallback2 IActiveScriptProfilerCallback | ||
| #define IActiveScriptProfilerCallback3 IActiveScriptProfilerCallback | ||
|
|
||
| #endif // !_WIN32 | ||
|
|
||
| #endif // RUNTIME_PLATFORM_AGNOSTIC_DEBUGGER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output some more help message about what this script does?