From e2189e88951e260d9fd04601a725e7c19eec098b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 1 Jul 2022 22:35:59 +0200 Subject: [PATCH] build: remove dtrace & etw support There are no clear indicators anyone is using the dtrace USDT probes. ETW support is very intertwined with the dtrace infrastructure. It's not clear if anyone uses ETW so to keep things simple it too is removed. Fixes: https://github.com/nodejs/node/issues/43649 --- common.gypi | 3 - configure.py | 44 -- doc/api/process.md | 1 - lib/_http_client.js | 7 - lib/_http_server.js | 6 - lib/internal/dtrace.js | 21 - lib/net.js | 6 - node.gyp | 245 --------- src/node.cc | 8 - src/node.d | 315 ----------- src/node_binding.cc | 7 - src/node_config.cc | 4 - src/node_dtrace.cc | 323 ----------- src/node_dtrace.h | 86 --- src/node_external_reference.h | 7 - src/node_provider.d | 80 --- src/node_win32_etw_provider-inl.h | 288 ---------- src/node_win32_etw_provider.cc | 213 -------- src/node_win32_etw_provider.h | 99 ---- src/res/node_etw_provider.man | 185 ------- src/v8ustack.d | 695 ------------------------ test/parallel/test-bootstrap-modules.js | 6 - test/parallel/test-internal-dtrace.js | 24 - tools/install.py | 2 - tools/msvs/msi/i18n/de-de.wxl | 3 - tools/msvs/msi/i18n/en-us.wxl | 3 - tools/msvs/msi/i18n/it-it.wxl | 3 - tools/msvs/msi/i18n/zh-cn.wxl | 3 - tools/msvs/msi/nodemsi.wixproj | 12 +- tools/msvs/msi/product.wxs | 16 - vcbuild.bat | 12 +- 31 files changed, 8 insertions(+), 2719 deletions(-) delete mode 100644 lib/internal/dtrace.js delete mode 100644 src/node.d delete mode 100644 src/node_dtrace.cc delete mode 100644 src/node_dtrace.h delete mode 100644 src/node_provider.d delete mode 100644 src/node_win32_etw_provider-inl.h delete mode 100644 src/node_win32_etw_provider.cc delete mode 100644 src/node_win32_etw_provider.h delete mode 100644 src/res/node_etw_provider.man delete mode 100644 src/v8ustack.d delete mode 100644 test/parallel/test-internal-dtrace.js diff --git a/common.gypi b/common.gypi index ecb5dd907f2b75..1b1dec3f28cb64 100644 --- a/common.gypi +++ b/common.gypi @@ -546,9 +546,6 @@ }], ], }], - ['OS=="freebsd" and node_use_dtrace=="true"', { - 'libraries': [ '-lelf' ], - }], ['OS=="freebsd"', { 'ldflags': [ '-Wl,--export-dynamic', diff --git a/configure.py b/configure.py index d6b92ea42ba7ae..5b4f950e2be2cc 100755 --- a/configure.py +++ b/configure.py @@ -508,18 +508,6 @@ help='MIPS floating-point ABI ({0}) [default: %(default)s]'.format( ', '.join(valid_mips_float_abi))) -parser.add_argument('--with-dtrace', - action='store_true', - dest='with_dtrace', - default=None, - help='build with DTrace (default is true on sunos and darwin)') - -parser.add_argument('--with-etw', - action='store_true', - dest='with_etw', - default=None, - help='build with ETW (default is true on Windows)') - parser.add_argument('--use-largepages', action='store_true', dest='node_use_large_pages', @@ -628,18 +616,6 @@ parser.add_argument_group(http2_optgroup) -parser.add_argument('--without-dtrace', - action='store_true', - dest='without_dtrace', - default=None, - help='build without DTrace') - -parser.add_argument('--without-etw', - action='store_true', - dest='without_etw', - default=None, - help='build without ETW') - parser.add_argument('--without-npm', action='store_true', dest='without_npm', @@ -1306,18 +1282,6 @@ def configure_node(o): o['variables']['enable_lto'] = b(options.enable_lto) - if flavor in ('solaris', 'mac', 'linux', 'freebsd'): - use_dtrace = not options.without_dtrace - # Don't enable by default on linux and freebsd - if flavor in ('linux', 'freebsd'): - use_dtrace = options.with_dtrace - o['variables']['node_use_dtrace'] = b(use_dtrace) - elif options.with_dtrace: - raise Exception( - 'DTrace is currently only supported on SunOS, MacOS or Linux systems.') - else: - o['variables']['node_use_dtrace'] = 'false' - if options.node_use_large_pages or options.node_use_large_pages_script_lld: warn('''The `--use-largepages` and `--use-largepages-script-lld` options have no effect during build time. Support for mapping to large pages is @@ -1328,14 +1292,6 @@ def configure_node(o): if options.no_ifaddrs: o['defines'] += ['SUNOS_NO_IFADDRS'] - # By default, enable ETW on Windows. - if flavor == 'win': - o['variables']['node_use_etw'] = b(not options.without_etw) - elif options.with_etw: - raise Exception('ETW is only supported on Windows.') - else: - o['variables']['node_use_etw'] = 'false' - o['variables']['node_with_ltcg'] = b(options.with_ltcg) if flavor != 'win' and options.with_ltcg: raise Exception('Link Time Code Generation is only supported on Windows.') diff --git a/doc/api/process.md b/doc/api/process.md index ecd53469ca4221..35dbca32d3d5ea 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1075,7 +1075,6 @@ An example of the possible output looks like: node_shared_http_parser: 'false', node_shared_libuv: 'false', node_shared_zlib: 'false', - node_use_dtrace: 'false', node_use_openssl: 'true', node_shared_openssl: 'false', strict_aliasing: 'true', diff --git a/lib/_http_client.js b/lib/_http_client.js index d14cdc343b6b29..7646d4c4a56d45 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -77,11 +77,6 @@ const { validateInteger, } = require('internal/validators'); const { getTimerDuration } = require('internal/timers'); -const { - DTRACE_HTTP_CLIENT_REQUEST, - DTRACE_HTTP_CLIENT_RESPONSE -} = require('internal/dtrace'); - const { hasObserver, startPerf, @@ -352,7 +347,6 @@ ObjectSetPrototypeOf(ClientRequest.prototype, OutgoingMessage.prototype); ObjectSetPrototypeOf(ClientRequest, OutgoingMessage); ClientRequest.prototype._finish = function _finish() { - DTRACE_HTTP_CLIENT_REQUEST(this, this.socket); FunctionPrototypeCall(OutgoingMessage.prototype._finish, this); if (hasObserver('http')) { startPerf(this, kClientRequestStatistics, { @@ -633,7 +627,6 @@ function parserOnIncomingClient(res, shouldKeepAlive) { req.shouldKeepAlive = false; } - DTRACE_HTTP_CLIENT_RESPONSE(socket, req); if (req[kClientRequestStatistics] && hasObserver('http')) { stopPerf(req, kClientRequestStatistics, { detail: { diff --git a/lib/_http_server.js b/lib/_http_server.js index 0eedace9ea443c..dbb9de4c13c6aa 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -79,10 +79,6 @@ const { validateBoolean } = require('internal/validators'); const Buffer = require('buffer').Buffer; -const { - DTRACE_HTTP_SERVER_REQUEST, - DTRACE_HTTP_SERVER_RESPONSE -} = require('internal/dtrace'); const { setInterval, clearInterval } = require('timers'); let debug = require('internal/util/debuglog').debuglog('http', (fn) => { debug = fn; @@ -215,7 +211,6 @@ ObjectSetPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype); ObjectSetPrototypeOf(ServerResponse, OutgoingMessage); ServerResponse.prototype._finish = function _finish() { - DTRACE_HTTP_SERVER_RESPONSE(this.socket); if (this[kServerResponseStatistics] && hasObserver('http')) { stopPerf(this, kServerResponseStatistics, { detail: { @@ -944,7 +939,6 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { res.shouldKeepAlive = keepAlive; res[kUniqueHeaders] = server[kUniqueHeaders]; - DTRACE_HTTP_SERVER_REQUEST(req, socket); if (onRequestStartChannel.hasSubscribers) { onRequestStartChannel.publish({ diff --git a/lib/internal/dtrace.js b/lib/internal/dtrace.js deleted file mode 100644 index 8eb1df7807fbcd..00000000000000 --- a/lib/internal/dtrace.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const config = internalBinding('config'); - -const { - DTRACE_HTTP_CLIENT_REQUEST = () => {}, - DTRACE_HTTP_CLIENT_RESPONSE = () => {}, - DTRACE_HTTP_SERVER_REQUEST = () => {}, - DTRACE_HTTP_SERVER_RESPONSE = () => {}, - DTRACE_NET_SERVER_CONNECTION = () => {}, - DTRACE_NET_STREAM_END = () => {} -} = (config.hasDtrace ? internalBinding('dtrace') : {}); - -module.exports = { - DTRACE_HTTP_CLIENT_REQUEST, - DTRACE_HTTP_CLIENT_RESPONSE, - DTRACE_HTTP_SERVER_REQUEST, - DTRACE_HTTP_SERVER_RESPONSE, - DTRACE_NET_SERVER_CONNECTION, - DTRACE_NET_STREAM_END -}; diff --git a/lib/net.js b/lib/net.js index c7f932c736584c..b08bfc378c796e 100644 --- a/lib/net.js +++ b/lib/net.js @@ -110,10 +110,6 @@ const { validateString } = require('internal/validators'); const kLastWriteQueueSize = Symbol('lastWriteQueueSize'); -const { - DTRACE_NET_SERVER_CONNECTION, - DTRACE_NET_STREAM_END -} = require('internal/dtrace'); // Lazy loaded to improve startup performance. let cluster; @@ -653,7 +649,6 @@ Socket.prototype._read = function(n) { Socket.prototype.end = function(data, encoding, callback) { stream.Duplex.prototype.end.call(this, data, encoding, callback); - DTRACE_NET_STREAM_END(this); return this; }; @@ -1682,7 +1677,6 @@ function onconnection(err, clientHandle) { socket.server = self; socket._server = self; - DTRACE_NET_SERVER_CONNECTION(socket); self.emit('connection', socket); } diff --git a/node.gyp b/node.gyp index d063a6408072ac..cc367145eeb812 100644 --- a/node.gyp +++ b/node.gyp @@ -4,8 +4,6 @@ 'v8_trace_maps%': 0, 'v8_enable_pointer_compression%': 0, 'v8_enable_31bit_smis_on_64bit_arch%': 0, - 'node_use_dtrace%': 'false', - 'node_use_etw%': 'false', 'node_no_browser_globals%': 'false', 'node_snapshot_main%': '', 'node_use_node_snapshot%': 'false', @@ -230,16 +228,6 @@ '-Wl,--no-whole-archive', ], }], - [ 'OS=="win"', { - 'sources': [ 'src/res/node.rc' ], - 'conditions': [ - [ 'node_use_etw=="true"', { - 'sources': [ - 'tools/msvs/genfiles/node_etw_provider.rc' - ], - }], - ], - }], ], }], [ 'node_shared=="true"', { @@ -748,72 +736,6 @@ 'Ws2_32', ], }], - [ 'node_use_etw=="true"', { - 'defines': [ 'HAVE_ETW=1' ], - 'dependencies': [ 'node_etw' ], - 'include_dirs': [ - 'src', - 'tools/msvs/genfiles', - '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h - ], - 'sources': [ - 'src/node_win32_etw_provider.h', - 'src/node_win32_etw_provider-inl.h', - 'src/node_win32_etw_provider.cc', - 'src/node_dtrace.h', - 'src/node_dtrace.cc', - 'tools/msvs/genfiles/node_etw_provider.h', - ], - 'conditions': [ - ['node_intermediate_lib_type != "static_library"', { - 'sources': [ - 'tools/msvs/genfiles/node_etw_provider.rc', - ], - }], - ], - }], - [ 'node_use_dtrace=="true"', { - 'defines': [ 'HAVE_DTRACE=1' ], - 'dependencies': [ - 'node_dtrace_header', - 'specialize_node_d', - ], - 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], - # - # DTrace is supported on linux, solaris, mac, and bsd. There are - # three object files associated with DTrace support, but they're - # not all used all the time: - # - # node_dtrace.o all configurations - # node_dtrace_ustack.o not supported on mac and linux - # node_dtrace_provider.o All except OS X. "dtrace -G" is not - # used on OS X. - # - # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not - # actually exist. They're listed here to trick GYP into linking the - # corresponding object files into the final "node" executable. These - # object files are generated by "dtrace -G" using custom actions - # below, and the GYP-generated Makefiles will properly build them when - # needed. - # - 'sources': [ - 'src/node_dtrace.h', - 'src/node_dtrace.cc', - ], - 'conditions': [ - [ 'OS=="linux"', { - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o' - ], - }], - [ 'OS!="mac" and OS!="linux"', { - 'sources': [ - 'src/node_dtrace_ustack.cc', - 'src/node_dtrace_provider.cc', - ] - } - ] ] - } ], [ 'node_use_openssl=="true"', { 'sources': [ 'src/crypto/crypto_aes.cc', @@ -948,164 +870,6 @@ }, ], }, # node_lib_target_name - { - # generate ETW header and resource files - 'target_name': 'node_etw', - 'type': 'none', - 'conditions': [ - [ 'node_use_etw=="true"', { - 'actions': [ - { - 'action_name': 'node_etw', - 'inputs': [ 'src/res/node_etw_provider.man' ], - 'outputs': [ - 'tools/msvs/genfiles/node_etw_provider.rc', - 'tools/msvs/genfiles/node_etw_provider.h', - 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', - ], - 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] - } - ] - } ] - ] - }, # node_etw - { - 'target_name': 'node_dtrace_header', - 'type': 'none', - 'conditions': [ - [ 'node_use_dtrace=="true" and OS!="linux"', { - 'actions': [ - { - 'action_name': 'node_dtrace_header', - 'inputs': [ 'src/node_provider.d' ], - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ], - 'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)', - '-o', '<@(_outputs)' ] - } - ] - } ], - [ 'node_use_dtrace=="true" and OS=="linux"', { - 'actions': [ - { - 'action_name': 'node_dtrace_header', - 'inputs': [ 'src/node_provider.d' ], - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ], - 'action': [ 'dtrace', '-h', '-s', '<@(_inputs)', - '-o', '<@(_outputs)' ] - } - ] - } ], - ] - }, # node_dtrace_header - { - 'target_name': 'node_dtrace_provider', - 'type': 'none', - 'conditions': [ - [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', { - 'actions': [ - { - 'action_name': 'node_dtrace_provider_o', - 'inputs': [ - '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o', - ], - 'outputs': [ - '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o' - ], - 'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d', - '<@(_inputs)', '-o', '<@(_outputs)' ] - } - ] - }], - [ 'node_use_dtrace=="true" and OS=="linux"', { - 'actions': [ - { - 'action_name': 'node_dtrace_provider_o', - 'inputs': [ 'src/node_provider.d' ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o' - ], - 'action': [ - 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)' - ], - } - ], - }], - ] - }, # node_dtrace_provider - { - 'target_name': 'node_dtrace_ustack', - 'type': 'none', - 'conditions': [ - [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', { - 'actions': [ - { - 'action_name': 'node_dtrace_ustack_constants', - 'inputs': [ - '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)' - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/v8constants.h' - ], - 'action': [ - 'tools/genv8constants.py', - '<@(_outputs)', - '<@(_inputs)' - ] - }, - { - 'action_name': 'node_dtrace_ustack', - 'inputs': [ - 'src/v8ustack.d', - '<(SHARED_INTERMEDIATE_DIR)/v8constants.h' - ], - 'outputs': [ - '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o' - ], - 'conditions': [ - [ 'target_arch=="ia32" or target_arch=="arm"', { - 'action': [ - 'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc', - '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)', - ] - } ], - [ 'target_arch=="x64"', { - 'action': [ - 'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc', - '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)', - ] - } ], - ] - }, - ] - } ], - ] - }, # node_dtrace_ustack - { - 'target_name': 'specialize_node_d', - 'type': 'none', - 'conditions': [ - [ 'node_use_dtrace=="true"', { - 'actions': [ - { - 'action_name': 'specialize_node_d', - 'inputs': [ - 'src/node.d' - ], - 'outputs': [ - '<(PRODUCT_DIR)/node.d', - ], - 'action': [ - 'tools/specialize_node_d.py', - '<@(_outputs)', - '<@(_inputs)', - '<@(OS)', - '<@(target_arch)', - ], - }, - ], - } ], - ] - }, # specialize_node_d { # fuzz_url 'target_name': 'fuzz_url', 'type': 'executable', @@ -1144,9 +908,6 @@ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', 'deps/uvwasi/uvwasi.gyp:uvwasi', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', ], 'includes': [ 'node.gypi' @@ -1189,9 +950,6 @@ 'deps/googletest/googletest.gyp:gtest_main', 'deps/histogram/histogram.gyp:histogram', 'deps/uvwasi/uvwasi.gyp:uvwasi', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', ], 'includes': [ @@ -1287,9 +1045,6 @@ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', 'deps/uvwasi/uvwasi.gyp:uvwasi', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', ], 'includes': [ diff --git a/src/node.cc b/src/node.cc index 78e93c74d3c3c4..fb04f4935a00d9 100644 --- a/src/node.cc +++ b/src/node.cc @@ -55,10 +55,6 @@ #include "inspector_io.h" #endif -#if defined HAVE_DTRACE || defined HAVE_ETW -#include "node_dtrace.h" -#endif - #if NODE_USE_V8_PLATFORM #include "libplatform/libplatform.h" #endif // NODE_USE_V8_PLATFORM @@ -292,10 +288,6 @@ void Environment::InitializeDiagnostics() { env->isolate()->SetAtomicsWaitCallback(nullptr, nullptr); }, this); } - -#if defined HAVE_DTRACE || defined HAVE_ETW - InitDTrace(this); -#endif } MaybeLocal Environment::BootstrapInternalLoaders() { diff --git a/src/node.d b/src/node.d deleted file mode 100644 index fae2378437ead9..00000000000000 --- a/src/node.d +++ /dev/null @@ -1,315 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to permit - * persons to whom the Software is furnished to do so, subject to the - * following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * This is the DTrace library file for the node provider, which includes - * the necessary translators to get from the args[] to something useful. - * Be warned: the mechanics here are seriously ugly -- and one must always - * keep in mind that clean abstractions often require filthy systems. - */ -#pragma D depends_on library procfs.d - -typedef struct { - int32_t fd; - int32_t port; - uint32_t remote; - uint32_t buffered; -} node_dtrace_connection_t; - -typedef struct { - int32_t fd; - int32_t port; - uint64_t remote; - uint32_t buffered; -} node_dtrace_connection64_t; - -typedef struct { - int fd; - string remoteAddress; - int remotePort; - int bufferSize; -} node_connection_t; - -translator node_connection_t { - fd = *(int32_t *)copyin((uintptr_t)&nc->fd, sizeof (int32_t)); - remotePort = - *(int32_t *)copyin((uintptr_t)&nc->port, sizeof (int32_t)); - remoteAddress = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)&nc->remote, - sizeof (int32_t))) : - copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_connection64_t *)nc)->remote, sizeof (int64_t))); - bufferSize = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - *(uint32_t *)copyin((uintptr_t)&nc->buffered, sizeof (int32_t)) : - *(uint32_t *)copyin((uintptr_t) - &((node_dtrace_connection64_t *)nc)->buffered, sizeof (int32_t)); -}; - -/* - * 32-bit and 64-bit structures received from node for HTTP client request - * probe. - */ -typedef struct { - uint32_t url; - uint32_t method; -} node_dtrace_http_client_request_t; - -typedef struct { - uint64_t url; - uint64_t method; -} node_dtrace_http_client_request64_t; - -/* - * The following structures are never used directly, but must exist to bind the - * types specified in the provider to the translators defined here. - * Ultimately, they always get cast to a more specific type inside the - * translator. To add to the confusion, the DTrace compiler does not allow - * declaring two translators with the same destination type if the source types - * are structures with the same size (because libctf says they're compatible, - * so dtrace considers them equivalent). Since we must define translators from - * node_dtrace_http_client_request_t (above), node_dtrace_http_request_t, and - * node_dtrace_http_server_request_t (both below), each of these three structs - * must be declared with a different size. - */ -typedef struct { - uint32_t version; - uint64_t dummy1; -} node_dtrace_http_request_t; - -typedef struct { - uint32_t version; - uint64_t dummy2; - uint64_t dummy3; -} node_dtrace_http_server_request_t; - -/* - * Actual 32-bit and 64-bit, v0 and v1 structures received from node for the - * HTTP server request probe. - */ -typedef struct { - uint32_t url; - uint32_t method; -} node_dtrace_http_server_request_v0_t; - -typedef struct { - uint32_t version; - uint32_t url; - uint32_t method; - uint32_t forwardedFor; -} node_dtrace_http_server_request_v1_t; - -typedef struct { - uint64_t url; - uint64_t method; -} node_dtrace_http_server_request64_v0_t; - -typedef struct { - uint32_t version; - uint32_t pad; - uint64_t url; - uint64_t method; - uint64_t forwardedFor; -} node_dtrace_http_server_request64_v1_t; - -/* - * In the end, both client and server request probes from both old and new - * binaries translate their arguments to node_http_request_t, which is what the - * user's D script ultimately sees. - */ -typedef struct { - string url; - string method; - string forwardedFor; -} node_http_request_t; - -/* - * The following translators are particularly filthy for reasons of backwards - * compatibility. Stable versions of node prior to 0.6 used a single - * http_request struct with fields for "url" and "method" for both client and - * server probes. 0.6 added a "forwardedFor" field intended for the server - * probe only, and the http_request struct passed by the application was split - * first into client_http_request and server_http_request and the latter was - * again split for v0 (the old struct) and v1. - * - * To distinguish the binary representations of the two versions of these - * structs, the new version prepends a "version" member (where the old one has - * a "url" pointer). Each field that we're translating below first switches on - * the value of this "version" field: if it's larger than 4096, we know we must - * be looking at the "url" pointer of the older structure version. Otherwise, - * we must be looking at the new version. Besides this, we have the usual - * switch based on the userland process data model. This would all be simpler - * with macros, but those aren't available in D library files since we cannot - * rely on cpp being present at runtime. - * - * In retrospect, the versioning bit might have been unnecessary since the type - * of the object passed in should allow DTrace to select which translator to - * use. However, DTrace does sometimes use translators whose source types - * don't quite match, and since we know this versioning logic works, we just - * leave it alone. Each of the translators below is functionally identical - * (except that the client -> client translator doesn't bother translating - * forwardedFor) and should actually work with any version of any of the client - * or server structs transmitted by the application up to this point. - */ - -/* - * Translate from node_dtrace_http_server_request_t (received from node 0.6 and - * later versions) to node_http_request_t. - */ -translator node_http_request_t { - url = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->url, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->url, - sizeof (uint64_t)))); - - method = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->method, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->method, - sizeof (uint64_t)))); - - forwardedFor = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? "" : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->forwardedFor, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)-> - forwardedFor, sizeof (uint64_t)))); -}; - -/* - * Translate from node_dtrace_http_client_request_t (received from node 0.6 and - * later versions) to node_http_request_t. - */ -translator node_http_request_t { - url = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->url, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->url, - sizeof (uint64_t)))); - - method = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->method, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->method, - sizeof (uint64_t)))); - - forwardedFor = ""; -}; - -/* - * Translate from node_dtrace_http_request_t (received from versions of node - * prior to 0.6) to node_http_request_t. This is used for both the server and - * client probes since these versions of node didn't distinguish between the - * types used in these probes. - */ -translator node_http_request_t { - url = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->url, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->url, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->url, - sizeof (uint64_t)))); - - method = (*(uint32_t *)copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v0_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v0_t *)nd)->method, - sizeof (uint64_t)))) : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->method, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)->method, - sizeof (uint64_t)))); - - forwardedFor = (*(uint32_t *) copyin((uintptr_t)(uint32_t *)nd, - sizeof (uint32_t))) >= 4096 ? "" : - (curpsinfo->pr_dmodel == PR_MODEL_ILP32 ? - copyinstr(*(uint32_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request_v1_t *)nd)->forwardedFor, - sizeof (uint32_t))) : - copyinstr(*(uint64_t *)copyin((uintptr_t) - &((node_dtrace_http_server_request64_v1_t *)nd)-> - forwardedFor, sizeof (uint64_t)))); -}; diff --git a/src/node_binding.cc b/src/node_binding.cc index 2991ee34746e0f..48a50d23d9504c 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -26,12 +26,6 @@ #define NODE_BUILTIN_PROFILER_MODULES(V) #endif -#if HAVE_DTRACE || HAVE_ETW -#define NODE_BUILTIN_DTRACE_MODULES(V) V(dtrace) -#else -#define NODE_BUILTIN_DTRACE_MODULES(V) -#endif - // A list of built-in modules. In order to do module registration // in node::Init(), need to add built-in modules in the following list. // Then in binding::RegisterBuiltinModules(), it calls modules' registration @@ -97,7 +91,6 @@ NODE_BUILTIN_OPENSSL_MODULES(V) \ NODE_BUILTIN_ICU_MODULES(V) \ NODE_BUILTIN_PROFILER_MODULES(V) \ - NODE_BUILTIN_DTRACE_MODULES(V) // This is used to load built-in modules. Instead of using // __attribute__((constructor)), we call the _register_ diff --git a/src/node_config.cc b/src/node_config.cc index 176daa88b0fab1..1e6436d552f6ce 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -78,10 +78,6 @@ static void Initialize(Local target, READONLY_PROPERTY(target, "bits", Number::New(isolate, 8 * sizeof(intptr_t))); - -#if defined HAVE_DTRACE || defined HAVE_ETW - READONLY_TRUE_PROPERTY(target, "hasDtrace"); -#endif } // InitConfig } // namespace node diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc deleted file mode 100644 index 52e63992833c38..00000000000000 --- a/src/node_dtrace.cc +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#include "node_dtrace.h" - -#ifdef HAVE_DTRACE -#include "node_provider.h" -#elif HAVE_ETW -#include "node_win32_etw_provider-inl.h" -#else -#define NODE_HTTP_SERVER_REQUEST(arg0, arg1) -#define NODE_HTTP_SERVER_REQUEST_ENABLED() (0) -#define NODE_HTTP_SERVER_RESPONSE(arg0) -#define NODE_HTTP_SERVER_RESPONSE_ENABLED() (0) -#define NODE_HTTP_CLIENT_REQUEST(arg0, arg1) -#define NODE_HTTP_CLIENT_REQUEST_ENABLED() (0) -#define NODE_HTTP_CLIENT_RESPONSE(arg0) -#define NODE_HTTP_CLIENT_RESPONSE_ENABLED() (0) -#define NODE_NET_SERVER_CONNECTION(arg0) -#define NODE_NET_SERVER_CONNECTION_ENABLED() (0) -#define NODE_NET_STREAM_END(arg0) -#define NODE_NET_STREAM_END_ENABLED() (0) -#define NODE_GC_START(arg0, arg1, arg2) -#define NODE_GC_DONE(arg0, arg1, arg2) -#endif - -#include "env-inl.h" -#include "node_errors.h" -#include "node_external_reference.h" - -#include - -namespace node { - -using v8::Context; -using v8::FunctionCallbackInfo; -using v8::GCCallbackFlags; -using v8::GCType; -using v8::HandleScope; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::Value; - -#define SLURP_STRING(obj, member, valp) \ - if (!(obj)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected object for " #obj " to contain string member " #member); \ - } \ - node::Utf8Value _##member(env->isolate(), \ - obj->Get(env->context(), \ - OneByteString(env->isolate(), #member)).ToLocalChecked()); \ - if ((*(const char **)valp = *_##member) == nullptr) \ - *(const char **)valp = ""; - -#define SLURP_INT(obj, member, valp) \ - if (!(obj)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE( \ - env, \ - "expected object for " #obj " to contain integer member " #member); \ - } \ - *valp = obj->Get(env->context(), \ - OneByteString(env->isolate(), #member)).ToLocalChecked() \ - ->Int32Value(env->context()) \ - .FromJust(); - -#define SLURP_OBJECT(obj, member, valp) \ - if (!(obj)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected object for " #obj " to contain object member " #member); \ - } \ - *valp = obj->Get(env->context(), \ - OneByteString(env->isolate(), #member)).ToLocalChecked().As(); - -#define SLURP_CONNECTION(arg, conn) \ - if (!(arg)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected argument " #arg " to be a connection object"); \ - } \ - node_dtrace_connection_t conn; \ - Local _##conn = arg.As(); \ - Local _handle = \ - (_##conn)->Get(env->context(), \ - FIXED_ONE_BYTE_STRING(env->isolate(), "_handle")) \ - .ToLocalChecked(); \ - if (_handle->IsObject()) { \ - SLURP_INT(_handle.As(), fd, &conn.fd); \ - } else { \ - conn.fd = -1; \ - } \ - SLURP_STRING(_##conn, remoteAddress, &conn.remote); \ - SLURP_INT(_##conn, remotePort, &conn.port); \ - SLURP_INT(_##conn, bufferSize, &conn.buffered); - -#define SLURP_CONNECTION_HTTP_CLIENT(arg, conn) \ - if (!(arg)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected argument " #arg " to be a connection object"); \ - } \ - node_dtrace_connection_t conn; \ - Local _##conn = arg.As(); \ - SLURP_INT(_##conn, fd, &conn.fd); \ - SLURP_STRING(_##conn, host, &conn.remote); \ - SLURP_INT(_##conn, port, &conn.port); \ - SLURP_INT(_##conn, bufferSize, &conn.buffered); - -#define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(arg0, arg1, conn) \ - if (!(arg0)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected argument " #arg0 " to be a connection object"); \ - } \ - if (!(arg1)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected argument " #arg1 " to be a connection object"); \ - } \ - node_dtrace_connection_t conn; \ - Local _##conn = arg0.As(); \ - SLURP_INT(_##conn, fd, &conn.fd); \ - SLURP_INT(_##conn, bufferSize, &conn.buffered); \ - _##conn = arg1.As(); \ - SLURP_STRING(_##conn, host, &conn.remote); \ - SLURP_INT(_##conn, port, &conn.port); - - -void DTRACE_NET_SERVER_CONNECTION(const FunctionCallbackInfo& args) { - if (!NODE_NET_SERVER_CONNECTION_ENABLED()) - return; - Environment* env = Environment::GetCurrent(args); - SLURP_CONNECTION(args[0], conn); - NODE_NET_SERVER_CONNECTION(&conn, conn.remote, conn.port, conn.fd); -} - - -void DTRACE_NET_STREAM_END(const FunctionCallbackInfo& args) { - if (!NODE_NET_STREAM_END_ENABLED()) - return; - Environment* env = Environment::GetCurrent(args); - SLURP_CONNECTION(args[0], conn); - NODE_NET_STREAM_END(&conn, conn.remote, conn.port, conn.fd); -} - -void DTRACE_HTTP_SERVER_REQUEST(const FunctionCallbackInfo& args) { - node_dtrace_http_server_request_t req; - - if (!NODE_HTTP_SERVER_REQUEST_ENABLED()) - return; - - Environment* env = Environment::GetCurrent(args); - HandleScope scope(env->isolate()); - Local arg0 = args[0].As(); - Local headers; - - memset(&req, 0, sizeof(req)); - req._un.version = 1; - SLURP_STRING(arg0, url, &req.url); - SLURP_STRING(arg0, method, &req.method); - SLURP_OBJECT(arg0, headers, &headers); - - if (!(headers)->IsObject()) { - return node::THROW_ERR_INVALID_ARG_TYPE(env, - "expected object for request to contain string member headers"); - } - - Local strfwdfor = headers->Get( - env->context(), env->x_forwarded_string()).ToLocalChecked(); - node::Utf8Value fwdfor(env->isolate(), strfwdfor); - - if (!strfwdfor->IsString() || (req.forwardedFor = *fwdfor) == nullptr) - req.forwardedFor = const_cast(""); - - SLURP_CONNECTION(args[1], conn); - NODE_HTTP_SERVER_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \ - req.url, conn.fd); -} - - -void DTRACE_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo& args) { - if (!NODE_HTTP_SERVER_RESPONSE_ENABLED()) - return; - Environment* env = Environment::GetCurrent(args); - SLURP_CONNECTION(args[0], conn); - NODE_HTTP_SERVER_RESPONSE(&conn, conn.remote, conn.port, conn.fd); -} - - -void DTRACE_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo& args) { - node_dtrace_http_client_request_t req; - char* header; - - if (!NODE_HTTP_CLIENT_REQUEST_ENABLED()) - return; - - Environment* env = Environment::GetCurrent(args); - HandleScope scope(env->isolate()); - - /* - * For the method and URL, we're going to dig them out of the header. This - * is not as efficient as it could be, but we would rather not force the - * caller here to retain their method and URL until the time at which - * DTRACE_HTTP_CLIENT_REQUEST can be called. - */ - Local arg0 = args[0].As(); - SLURP_STRING(arg0, _header, &header); - - req.method = header; - - while (*header != '\0' && *header != ' ') - header++; - - if (*header != '\0') - *header++ = '\0'; - - req.url = header; - - while (*header != '\0' && *header != ' ') - header++; - - *header = '\0'; - - SLURP_CONNECTION_HTTP_CLIENT(args[1], conn); - NODE_HTTP_CLIENT_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \ - req.url, conn.fd); -} - - -void DTRACE_HTTP_CLIENT_RESPONSE(const FunctionCallbackInfo& args) { - if (!NODE_HTTP_CLIENT_RESPONSE_ENABLED()) - return; - Environment* env = Environment::GetCurrent(args); - SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(args[0], args[1], conn); - NODE_HTTP_CLIENT_RESPONSE(&conn, conn.remote, conn.port, conn.fd); -} - -void dtrace_gc_start(Isolate* isolate, - GCType type, - GCCallbackFlags flags, - void* data) { - // Previous versions of this probe point only logged type and flags. - // That's why for reasons of backwards compatibility the isolate goes last. - NODE_GC_START(type, flags, isolate); -} - -void dtrace_gc_done(Isolate* isolate, - GCType type, - GCCallbackFlags flags, - void* data) { - // Previous versions of this probe point only logged type and flags. - // That's why for reasons of backwards compatibility the isolate goes last. - NODE_GC_DONE(type, flags, isolate); -} - - -void InitDTrace(Environment* env) { -#ifdef HAVE_ETW - // ETW is neither thread-safe nor does it clean up resources on exit, - // so we can use it only on the main thread. - if (env->is_main_thread()) { - init_etw(); - } -#endif - - // We need to use the variant of GC callbacks that takes data to - // avoid running into DCHECKs when multiple Environments try to add - // the same callback to the same isolate multiple times. - env->isolate()->AddGCPrologueCallback(dtrace_gc_start, env); - env->isolate()->AddGCEpilogueCallback(dtrace_gc_done, env); - env->AddCleanupHook([](void* data) { - Environment* env = static_cast(data); - env->isolate()->RemoveGCPrologueCallback(dtrace_gc_start, env); - env->isolate()->RemoveGCEpilogueCallback(dtrace_gc_done, env); - }, env); -} - -#define NODE_PROBES(V) \ - V(DTRACE_NET_SERVER_CONNECTION) \ - V(DTRACE_NET_STREAM_END) \ - V(DTRACE_HTTP_SERVER_REQUEST) \ - V(DTRACE_HTTP_SERVER_RESPONSE) \ - V(DTRACE_HTTP_CLIENT_REQUEST) \ - V(DTRACE_HTTP_CLIENT_RESPONSE) - -void InitializeDTrace(Local target, - Local unused, - Local context, - void* priv) { - Environment* env = Environment::GetCurrent(context); - -#if defined HAVE_DTRACE || defined HAVE_ETW -#define V(name) env->SetMethod(target, #name, name); - NODE_PROBES(V) -#undef V -#endif // defined HAVE_DTRACE || defined HAVE_ETW -} - -void RegisterDtraceExternalReferences(ExternalReferenceRegistry* registry) { -#if defined HAVE_DTRACE || defined HAVE_ETW -#define V(name) registry->Register(name); - NODE_PROBES(V) -#undef V -#endif // defined HAVE_DTRACE || defined HAVE_ETW -} - -} // namespace node -NODE_MODULE_CONTEXT_AWARE_INTERNAL(dtrace, node::InitializeDTrace) -NODE_MODULE_EXTERNAL_REFERENCE(dtrace, node::RegisterDtraceExternalReferences) diff --git a/src/node_dtrace.h b/src/node_dtrace.h deleted file mode 100644 index b887542abfc9cf..00000000000000 --- a/src/node_dtrace.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_DTRACE_H_ -#define SRC_NODE_DTRACE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "v8.h" - -extern "C" { -/* - * The following structures are passed directly to DTrace when probes are fired. - * Translators in node.d translate these structures into the corresponding D - * structures, taking care of dealing with the user process data model (32-bit - * or 64-bit) and structure versions (see node_dtrace_http_server_request_t - * below). - */ - -typedef struct { - int32_t fd; - int32_t port; - char* remote; - int32_t buffered; -} node_dtrace_connection_t; - -typedef struct { - char* url; - char* method; -} node_dtrace_http_client_request_t; - -/* - * The original version of this structure contained only a url and method, just - * like the client request above. To add the new forwardedFor field, the - * structure layout was changed to begin with an integer version. The - * translator knows whether it's looking at an old- or new-version structure - * based on whether the version field's value is a reasonable pointer (i.e. - * address greater than 4K). No doubt this is filthy, but there's not much else - * we can do, and it works reliably. - * - * This version of the structure also contains padding that should be zeroed out - * by the consumer so that future versions of the translator can simply check if - * a field is present by checking it against nullptr. - */ -typedef struct { - union { - uint32_t version; - uintptr_t unused; /* for compat. with old 64-bit struct */ - } _un; - char* url; - char* method; - char* forwardedFor; - char* _pad[8]; -} node_dtrace_http_server_request_t; - -} // extern "C" - -namespace node { - -class Environment; - -void InitDTrace(Environment* env); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_DTRACE_H_ diff --git a/src/node_external_reference.h b/src/node_external_reference.h index 58b8f4bed2fcfd..0a90220c763dbe 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -107,12 +107,6 @@ class ExternalReferenceRegistry { #define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) #endif // HAVE_INSPECTOR -#if HAVE_DTRACE || HAVE_ETW -#define EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) V(dtrace) -#else -#define EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) -#endif - #if HAVE_OPENSSL #define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) V(crypto) V(tls_wrap) #else @@ -123,7 +117,6 @@ class ExternalReferenceRegistry { EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \ EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \ EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) \ EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) } // namespace node diff --git a/src/node_provider.d b/src/node_provider.d deleted file mode 100644 index 90be45e730fd40..00000000000000 --- a/src/node_provider.d +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to permit - * persons to whom the Software is furnished to do so, subject to the - * following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * DTrace provider for node.js. - */ - -/* - * In order to have the information we need here to create the provider, - * we must declare bogus definitions for our depended-upon structures. And - * yes, the fact that we need to do this represents a shortcoming in DTrace, - * one that would be resolved by that elusive El Dorado: dynamic translators. - */ - -typedef struct { - int dummy; -} node_dtrace_connection_t; - -typedef struct { - int dummy; -} node_connection_t; - -typedef struct { - int dummy; -} node_dtrace_http_server_request_t; - -typedef struct { - int dummy; -} node_dtrace_http_client_request_t; - -typedef struct { - int dummy; -} node_http_request_t; - -provider node { - probe net__server__connection(node_dtrace_connection_t *c, - const char *a, int p, int fd) : (node_connection_t *c, string a, int p, - int fd); - probe net__stream__end(node_dtrace_connection_t *c, const char *a, - int p, int fd) : (node_connection_t *c, string a, int p, int fd); - probe http__server__request(node_dtrace_http_server_request_t *h, - node_dtrace_connection_t *c, const char *a, int p, const char *m, - const char *u, int fd) : (node_http_request_t *h, node_connection_t *c, - string a, int p, string m, string u, int fd); - probe http__server__response(node_dtrace_connection_t *c, const char *a, - int p, int fd) : (node_connection_t *c, string a, int p, int fd); - probe http__client__request(node_dtrace_http_client_request_t *h, - node_dtrace_connection_t *c, const char *a, int p, const char *m, - const char *u, int fd) : (node_http_request_t *h, node_connection_t *c, - string a, int p, string m, string u, int fd); - probe http__client__response(node_dtrace_connection_t *c, const char *a, - int p, int fd) : (node_connection_t *c, string a, int p, int fd); - probe gc__start(int t, int f, void *isolate); - probe gc__done(int t, int f, void *isolate); -}; - -#pragma D attributes Evolving/Evolving/ISA provider node provider -#pragma D attributes Private/Private/Unknown provider node module -#pragma D attributes Private/Private/Unknown provider node function -#pragma D attributes Private/Private/ISA provider node name -#pragma D attributes Evolving/Evolving/ISA provider node args diff --git a/src/node_win32_etw_provider-inl.h b/src/node_win32_etw_provider-inl.h deleted file mode 100644 index 9238ea22a3a179..00000000000000 --- a/src/node_win32_etw_provider-inl.h +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ -#define SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_win32_etw_provider.h" -#include "node_etw_provider.h" - -namespace node { - -// From node_win32_etw_provider.cc -extern REGHANDLE node_provider; -extern EventWriteFunc event_write; -extern int events_enabled; - -#define ETW_WRITE_STRING_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, \ - data, \ - (strlen(data) + 1) * sizeof(*data)); - -#define ETW_WRITE_INT32_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int32_t)); - -#define ETW_WRITE_INT64_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int64_t)); - -#define ETW_WRITE_ADDRESS_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(intptr_t)); - -#define ETW_WRITE_INT16_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int16_t)); - -#define ETW_WRITE_WSTRING_DATA_LENGTH(data_descriptor, data, data_len_bytes) \ - EventDataDescCreate(data_descriptor, \ - data, \ - data_len_bytes); - -#define ETW_WRITE_NET_CONNECTION(descriptors, conn) \ - ETW_WRITE_INT32_DATA(descriptors, &conn->fd); \ - ETW_WRITE_INT32_DATA(descriptors + 1, &conn->port); \ - ETW_WRITE_STRING_DATA(descriptors + 2, conn->remote); \ - ETW_WRITE_INT32_DATA(descriptors + 3, &conn->buffered); - -#define ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req) \ - ETW_WRITE_STRING_DATA(descriptors, req->url); \ - ETW_WRITE_STRING_DATA(descriptors + 1, req->method); \ - ETW_WRITE_STRING_DATA(descriptors + 2, req->forwardedFor); - -#define ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req) \ - ETW_WRITE_STRING_DATA(descriptors, req->url); \ - ETW_WRITE_STRING_DATA(descriptors + 1, req->method); - -#define ETW_WRITE_GC(descriptors, type, flags) \ - ETW_WRITE_INT32_DATA(descriptors, &type); \ - ETW_WRITE_INT32_DATA(descriptors + 1, &flags); - -#define ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2) \ - ETW_WRITE_ADDRESS_DATA(descriptors, &addr1); \ - ETW_WRITE_ADDRESS_DATA(descriptors + 1, &addr2); - -#define ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, \ - context, \ - startAddr, \ - size, \ - id, \ - flags, \ - rangeId, \ - sourceId, \ - line, \ - col, \ - name, \ - name_len_bytes) \ - ETW_WRITE_ADDRESS_DATA(descriptors, &context); \ - ETW_WRITE_ADDRESS_DATA(descriptors + 1, &startAddr); \ - ETW_WRITE_INT64_DATA(descriptors + 2, &size); \ - ETW_WRITE_INT32_DATA(descriptors + 3, &id); \ - ETW_WRITE_INT16_DATA(descriptors + 4, &flags); \ - ETW_WRITE_INT16_DATA(descriptors + 5, &rangeId); \ - ETW_WRITE_INT64_DATA(descriptors + 6, &sourceId); \ - ETW_WRITE_INT32_DATA(descriptors + 7, &line); \ - ETW_WRITE_INT32_DATA(descriptors + 8, &col); \ - ETW_WRITE_WSTRING_DATA_LENGTH(descriptors + 9, name, name_len_bytes); - - -#define ETW_WRITE_EVENT(eventDescriptor, dataDescriptors) \ - DWORD status = event_write(node_provider, \ - &eventDescriptor, \ - sizeof(dataDescriptors) / \ - sizeof(*dataDescriptors), \ - dataDescriptors); \ - CHECK_EQ(status, ERROR_SUCCESS); - -// NOLINTNEXTLINE (readability/null_usage) -#define NULL_NOLINT NULL - -#define ETW_WRITE_EMPTY_EVENT(eventDescriptor) \ - DWORD status = event_write(node_provider, &eventDescriptor, 0, NULL_NOLINT); \ - CHECK_EQ(status, ERROR_SUCCESS); - -void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[7]; - ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req); - ETW_WRITE_NET_CONNECTION(descriptors + 3, conn); - ETW_WRITE_EVENT(NODE_HTTP_SERVER_REQUEST_EVENT, descriptors); -} - - -void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_HTTP_SERVER_RESPONSE_EVENT, descriptors); -} - - -void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[6]; - ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req); - ETW_WRITE_NET_CONNECTION(descriptors + 2, conn); - ETW_WRITE_EVENT(NODE_HTTP_CLIENT_REQUEST_EVENT, descriptors); -} - - -void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_HTTP_CLIENT_RESPONSE_EVENT, descriptors); -} - - -void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_NET_SERVER_CONNECTION_EVENT, descriptors); -} - - -void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_NET_STREAM_END_EVENT, descriptors); -} - - -void NODE_GC_START(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_GC(descriptors, type, flags); - ETW_WRITE_EVENT(NODE_GC_START_EVENT, descriptors); - } -} - - -void NODE_GC_DONE(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_GC(descriptors, type, flags); - ETW_WRITE_EVENT(NODE_GC_DONE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); - ETW_WRITE_EVENT(NODE_V8SYMBOL_REMOVE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); - ETW_WRITE_EVENT(NODE_V8SYMBOL_MOVE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_RESET() { - if (events_enabled > 0) { - ETW_WRITE_EMPTY_EVENT(NODE_V8SYMBOL_RESET_EVENT); - } -} - -#define SETSYMBUF(s) \ - wcscpy(symbuf, s); \ - symbol_len = arraysize(s) - 1; - -void NODE_V8SYMBOL_ADD(LPCSTR symbol, - int symbol_len, - const void* addr1, - int len) { - if (events_enabled > 0) { - wchar_t symbuf[128]; - if (symbol == nullptr) { - SETSYMBUF(L"nullptr"); - } else { - symbol_len = MultiByteToWideChar(CP_ACP, - 0, - symbol, - symbol_len, - symbuf, - 128); - if (symbol_len == 0) { - SETSYMBUF(L"Invalid"); - } else { - if (symbol_len > 127) { - symbol_len = 127; - } - symbuf[symbol_len] = L'\0'; - } - } - void* context = nullptr; - INT64 size = (INT64)len; - INT32 id = (INT32)addr1; - INT16 flags = 0; - INT16 rangeid = 1; - INT32 col = 1; - INT32 line = 1; - INT64 sourceid = 0; - EVENT_DATA_DESCRIPTOR descriptors[10]; - ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, - context, - addr1, - size, - id, - flags, - rangeid, - sourceid, - line, - col, - symbuf, - (symbol_len + 1) * sizeof(symbuf[0])); - ETW_WRITE_EVENT(MethodLoad, descriptors); - } -} -#undef SETSYMBUF - -#undef NULL_NOLINT - - -bool NODE_HTTP_SERVER_REQUEST_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_SERVER_RESPONSE_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_CLIENT_REQUEST_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_CLIENT_RESPONSE_ENABLED() { return events_enabled > 0; } -bool NODE_NET_SERVER_CONNECTION_ENABLED() { return events_enabled > 0; } -bool NODE_NET_STREAM_END_ENABLED() { return events_enabled > 0; } -bool NODE_V8SYMBOL_ENABLED() { return events_enabled > 0; } - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ diff --git a/src/node_win32_etw_provider.cc b/src/node_win32_etw_provider.cc deleted file mode 100644 index 7b0c696a9c8882..00000000000000 --- a/src/node_win32_etw_provider.cc +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#include "node_win32_etw_provider.h" // NOLINT(build/include_inline) -#include "node_win32_etw_provider-inl.h" - -#include "node_etw_provider.h" - -namespace node { - -using v8::Isolate; -using v8::JitCodeEvent; -using v8::V8; - -HMODULE advapi; -REGHANDLE node_provider; -EventRegisterFunc event_register; -EventUnregisterFunc event_unregister; -EventWriteFunc event_write; -int events_enabled; -static uv_async_t dispatch_etw_events_change_async; - -struct v8tags { - char prefix[32 - sizeof(size_t)]; - size_t prelen; -}; - -// The v8 CODE_ADDED event name has a prefix indicating the type of event. -// Many of these are internal to v8. -// The trace_codes array specifies which types are written. -struct v8tags trace_codes[] = { -#define MAKE_V8TAG(s) { s, sizeof(s) - 1 } - MAKE_V8TAG("LazyCompile:"), - MAKE_V8TAG("Script:"), - MAKE_V8TAG("Function:"), - MAKE_V8TAG("RegExp:"), - MAKE_V8TAG("Eval:") -#undef MAKE_V8TAG -}; - -/* Below are some code prefixes which are not being written. - * "Builtin:" - * "Stub:" - * "CallIC:" - * "LoadIC:" - * "KeyedLoadIC:" - * "StoreIC:" - * "KeyedStoreIC:" - * "CallPreMonomorphic:" - * "CallInitialize:" - * "CallMiss:" - * "CallMegamorphic:" - */ - -// v8 sometimes puts a '*' or '~' in front of the name. -#define V8_MARKER1 '*' -#define V8_MARKER2 '~' - - -// If prefix is not in filtered list return -1, -// else return length of prefix and marker. -int FilterCodeEvents(const char* name, size_t len) { - for (size_t i = 0; i < arraysize(trace_codes); i++) { - size_t prelen = trace_codes[i].prelen; - if (prelen < len) { - if (strncmp(name, trace_codes[i].prefix, prelen) == 0) { - if (name[prelen] == V8_MARKER1 || name[prelen] == V8_MARKER2) - prelen++; - return prelen; - } - } - } - return -1; -} - - -// callback from V8 module passes symbol and address info for stack walk -void CodeAddressNotification(const JitCodeEvent* jevent) { - int pre_offset = 0; - if (NODE_V8SYMBOL_ENABLED()) { - switch (jevent->type) { - case JitCodeEvent::CODE_ADDED: - pre_offset = FilterCodeEvents(jevent->name.str, jevent->name.len); - if (pre_offset >= 0) { - // skip over prefix and marker - NODE_V8SYMBOL_ADD(jevent->name.str + pre_offset, - jevent->name.len - pre_offset, - jevent->code_start, - jevent->code_len); - } - break; - case JitCodeEvent::CODE_REMOVED: - NODE_V8SYMBOL_REMOVE(jevent->code_start, nullptr); - break; - case JitCodeEvent::CODE_MOVED: - NODE_V8SYMBOL_MOVE(jevent->code_start, jevent->new_code_start); - break; - default: - break; - } - } -} - - -// Call v8 to enable or disable code event callbacks. -// Must be on default thread to do this. -// Note: It is possible to call v8 from ETW thread, but then -// event callbacks are received in the same thread. Attempts -// to write ETW events in this thread will fail. -void etw_events_change_async(uv_async_t* handle) { - if (events_enabled > 0) { - NODE_V8SYMBOL_RESET(); - Isolate::GetCurrent()->SetJitCodeEventHandler( - v8::kJitCodeEventEnumExisting, - CodeAddressNotification); - } else { - Isolate::GetCurrent()->SetJitCodeEventHandler( - v8::kJitCodeEventDefault, - nullptr); - } -} - - -// This callback is called by ETW when consumers of our provider -// are enabled or disabled. -// The callback is dispatched on ETW thread. -// Before calling into V8 to enable code events, switch to default thread. -void NTAPI etw_events_enable_callback( - LPCGUID SourceId, - ULONG IsEnabled, - UCHAR Level, - ULONGLONG MatchAnyKeyword, - ULONGLONG MatchAllKeywords, - PEVENT_FILTER_DESCRIPTOR FilterData, - PVOID CallbackContext) { - if (IsEnabled) { - events_enabled++; - if (events_enabled == 1) { - uv_async_send(&dispatch_etw_events_change_async); - } - } else { - events_enabled--; - if (events_enabled == 0) { - uv_async_send(&dispatch_etw_events_change_async); - } - } -} - - -void init_etw() { - events_enabled = 0; - - advapi = LoadLibraryW(L"advapi32.dll"); - if (advapi) { - event_register = (EventRegisterFunc) - GetProcAddress(advapi, "EventRegister"); - event_unregister = (EventUnregisterFunc) - GetProcAddress(advapi, "EventUnregister"); - event_write = (EventWriteFunc)GetProcAddress(advapi, "EventWrite"); - - // create async object used to invoke main thread from callback - CHECK_EQ(0, uv_async_init(uv_default_loop(), - &dispatch_etw_events_change_async, - etw_events_change_async)); - uv_unref(reinterpret_cast(&dispatch_etw_events_change_async)); - - if (event_register) { - DWORD status = event_register(&NODE_ETW_PROVIDER, - etw_events_enable_callback, - nullptr, - &node_provider); - CHECK_EQ(status, ERROR_SUCCESS); - } - } -} - - -void shutdown_etw() { - if (advapi && event_unregister && node_provider) { - event_unregister(node_provider); - node_provider = 0; - } - - events_enabled = 0; - Isolate::GetCurrent()->SetJitCodeEventHandler( - v8::kJitCodeEventDefault, - nullptr); - - if (advapi) { - FreeLibrary(advapi); - advapi = nullptr; - } -} - -} // namespace node diff --git a/src/node_win32_etw_provider.h b/src/node_win32_etw_provider.h deleted file mode 100644 index 0f84a86f0ac3fc..00000000000000 --- a/src/node_win32_etw_provider.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_WIN32_ETW_PROVIDER_H_ -#define SRC_NODE_WIN32_ETW_PROVIDER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_dtrace.h" -#include - -namespace node { - -#if defined(_MSC_VER) -# define INLINE __forceinline -#else -# define INLINE inline -#endif - -typedef ULONG (NTAPI* EventRegisterFunc)( - LPCGUID ProviderId, - PENABLECALLBACK EnableCallback, - PVOID CallbackContext, - PREGHANDLE RegHandle -); - -typedef ULONG (NTAPI* EventUnregisterFunc)( - REGHANDLE RegHandle -); - -typedef ULONG (NTAPI* EventWriteFunc)( - REGHANDLE RegHandle, - PCEVENT_DESCRIPTOR EventDescriptor, - ULONG UserDataCount, - PEVENT_DATA_DESCRIPTOR UserData -); - -void init_etw(); -void shutdown_etw(); - -INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd); -INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd); -INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_GC_START(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate); -INLINE void NODE_GC_DONE(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate); -INLINE void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2); -INLINE void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2); -INLINE void NODE_V8SYMBOL_RESET(); -INLINE void NODE_V8SYMBOL_ADD(LPCSTR symbol, - int symbol_len, - const void* addr1, - int len); - -INLINE bool NODE_HTTP_SERVER_REQUEST_ENABLED(); -INLINE bool NODE_HTTP_SERVER_RESPONSE_ENABLED(); -INLINE bool NODE_HTTP_CLIENT_REQUEST_ENABLED(); -INLINE bool NODE_HTTP_CLIENT_RESPONSE_ENABLED(); -INLINE bool NODE_NET_SERVER_CONNECTION_ENABLED(); -INLINE bool NODE_NET_STREAM_END_ENABLED(); -INLINE bool NODE_V8SYMBOL_ENABLED(); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WIN32_ETW_PROVIDER_H_ diff --git a/src/res/node_etw_provider.man b/src/res/node_etw_provider.man deleted file mode 100644 index 46ad2e38fccad7..00000000000000 --- a/src/res/node_etw_provider.man +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/v8ustack.d b/src/v8ustack.d deleted file mode 100644 index 2fe40714c094e8..00000000000000 --- a/src/v8ustack.d +++ /dev/null @@ -1,695 +0,0 @@ -/* - * V8 DTrace ustack helper for annotating native stack traces with JavaScript - * function names. We start with a frame pointer (arg1) and emit a string - * describing the current function. We do this by chasing pointers to extract - * the function's name (if any) and the filename and line number where the - * function is defined. - * - * To use the helper, run node, then use the jstack() DTrace action to capture - * a JavaScript stacktrace. You may need to tune the dtrace_helper_actions_max - * kernel variable to 128. - */ - -#include -#include - -/* - * V8 represents small integers (SMI) using the upper 31 bits of a 32/64-bit - * value. To extract the actual integer value, we must shift it over. - */ -#define IS_SMI(value) \ - ((value & V8_SmiTagMask) == V8_SmiTag) -#define SMI_VALUE(value) \ - ((uint32_t) ((value) >> V8_SmiValueShift)) -#define NO_SHARED_FUNCTION_NAME_SENTINEL NULL - -/* - * Heap objects usually start off with a Map pointer, itself another heap - * object. However, during garbage collection, the low order bits of the - * pointer (which are normally 01) are used to record GC state. Of course, we - * have no idea if we're in GC or not, so we must always normalize the pointer. - */ -#define V8_MAP_PTR(ptr) \ - ((ptr & ~V8_HeapObjectTagMask) | V8_HeapObjectTag) - -#define V8_TYPE_SCRIPT(type) \ - ((type) == V8_IT_SCRIPT) - -/* - * Determine the encoding and representation of a V8 string. - */ -#define V8_TYPE_STRING(type) \ - (((type) & V8_IsNotStringMask) == V8_StringTag) - -#define V8_STRENC_ASCII(type) \ - (((type) & V8_StringEncodingMask) == V8_AsciiStringTag) - -#define V8_STRREP_SEQ(type) \ - (((type) & V8_StringRepresentationMask) == V8_SeqStringTag) -#define V8_STRREP_CONS(type) \ - (((type) & V8_StringRepresentationMask) == V8_ConsStringTag) -#define V8_STRREP_EXT(type) \ - (((type) & V8_StringRepresentationMask) == V8_ExternalStringTag) - -/* - * String type predicates - */ -#define ASCII_SEQSTR(value) \ - (V8_TYPE_STRING(value) && V8_STRENC_ASCII(value) && V8_STRREP_SEQ(value)) - -#define TWOBYTE_SEQSTR(value) \ - (V8_TYPE_STRING(value) && !V8_STRENC_ASCII(value) && V8_STRREP_SEQ(value)) - -#define IS_CONSSTR(value) \ - (V8_TYPE_STRING(value) && V8_STRREP_CONS(value)) - -#define ASCII_EXTSTR(value) \ - (V8_TYPE_STRING(value) && V8_STRENC_ASCII(value) && V8_STRREP_EXT(value)) - -/* - * General helper macros - */ -#define COPYIN_UINT8(addr) (*(uint8_t*) copyin((addr), sizeof(uint8_t))) -#define COPYIN_UINT32(addr) (*(uint32_t*) copyin((addr), sizeof(uint32_t))) -#define COPYIN_UINT64(addr) (*(uint64_t*) copyin((addr), sizeof(uint64_t))) - -#if defined(__i386) -# define COPYIN_PTR(addr) COPYIN_UINT32(addr) -# define off_t uint32_t -# define APPEND_PTR(p) APPEND_PTR_32(p) -#else -# define COPYIN_PTR(addr) COPYIN_UINT64(addr) -# define off_t uint64_t -# define APPEND_PTR(p) APPEND_PTR_64(p) -#endif - -#define APPEND_CHR(c) (this->buf[this->off++] = (c)) -#define APPEND_CHR4(s0, s1, s2, s3) \ - APPEND_CHR(s0); \ - APPEND_CHR(s1); \ - APPEND_CHR(s2); \ - APPEND_CHR(s3); -#define APPEND_CHR8(s0, s1, s2, s3, s4, s5, s6, s7) \ - APPEND_CHR4(s0, s1, s2, s3) \ - APPEND_CHR4(s4, s5, s6, s7) - -#define APPEND_DGT(i, d) \ - (((i) / (d)) ? APPEND_CHR('0' + ((i)/(d) % 10)) : 0) - -#define APPEND_NUM(i) \ - APPEND_DGT((i), 100000); \ - APPEND_DGT((i), 10000); \ - APPEND_DGT((i), 1000); \ - APPEND_DGT((i), 100); \ - APPEND_DGT((i), 10); \ - APPEND_DGT((i), 1); - -#define APPEND_HEX(d) \ - APPEND_CHR((d) < 10 ? '0' + (d) : 'a' - 10 + (d)) - -#define APPEND_PTR_32(p) \ - APPEND_HEX((p >> 28) & 0xf); \ - APPEND_HEX((p >> 24) & 0xf); \ - APPEND_HEX((p >> 20) & 0xf); \ - APPEND_HEX((p >> 16) & 0xf); \ - APPEND_HEX((p >> 12) & 0xf); \ - APPEND_HEX((p >> 8) & 0xf); \ - APPEND_HEX((p >> 4) & 0xf); \ - APPEND_HEX((p) & 0xf); - -#define APPEND_PTR_64(p) \ - APPEND_PTR_32(p >> 32) \ - APPEND_PTR_32(p) - -/* - * The following macros are used to output ASCII SeqStrings, ConsStrings, and - * Node.js ExternalStrings. To represent each string, we use three fields: - * - * "str": a pointer to the string itself - * - * "len": the string length - * - * "attrs": the type identifier for the string, which indicates the - * encoding and representation. We're only interested in strings - * whose representation is one of: - * - * SeqOneByteString stored directly as a char array inside the object - * - * SeqTwoByteString stored as a UTF-16 char array inside the object - * - * ConsString pointer to two strings that should be concatenated - * - * ExternalString pointer to a char* outside the V8 heap - */ - -/* - * Load "len" and "attrs" for the given "str". - */ -#define LOAD_STRFIELDS(str, len, attrs) \ - len = SMI_VALUE(COPYIN_PTR(str + V8_OFF_STR_LENGTH)); \ - this->map = V8_MAP_PTR(COPYIN_PTR(str + V8_OFF_HEAPOBJ_MAP)); \ - attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS); - -#define APPEND_SEQSTR(str, len, attrs) \ - APPEND_SEQONEBYTESTR(str, len, attrs) \ - APPEND_SEQTWOBYTESTR(str, len, attrs) - -/* - * Print out the given SeqOneByteString, or do nothing if the string is not an ASCII - * SeqOneByteString. - */ -#define APPEND_SEQONEBYTESTR(str, len, attrs) \ - dtrace:helper:ustack: \ - /!this->done && len > 0 && ASCII_SEQSTR(attrs)/ \ - { \ - copyinto(str + V8_OFF_STR_CHARS, len, this->buf + this->off); \ - this->off += len; \ - } - -/* - * LOOP_ITER: macro to paste "block" while "ivar" is less than "dynmax" and - * "statmax". The subsequent LOOP_{4,8} macros facilitate pasting the same - * thing 4 and 8 times, respectively. Like much of the rest of the code in this - * file, this is regrettably necessary given the constraints under which we're - * expected to run. - */ -#define LOOP_ITER(ivar, dynmax, statmax, block) \ - ((ivar) < (dynmax)) && ((ivar) < (statmax)) && (block); (ivar)++; - -#define LOOP_4(block) \ - block \ - block \ - block \ - block \ - -#define LOOP_8(block) \ - LOOP_4(block) \ - LOOP_4(block) - -/* - * Print out the given SeqTwoByteString, or do nothing if the string is not an ASCII - * SeqTwoByteString. NOTE: if you bump MAX_TWOBYTESTR_CHARS, you'll also need - * to modify the LOOP_* macro calls below to match. - */ -#define MAX_TWOBYTESTR_CHARS 128 -#define MAX_TWOBYTESTR_BYTES (2 * MAX_TWOBYTESTR_CHARS) -#define TO_ASCII(c) ((c) < 128 ? (c) : '?') - -#define APPEND_SEQTWOBYTESTR(str, len, attrs) \ - dtrace:helper:ustack: \ - /!this->done && len > 0 && TWOBYTE_SEQSTR(attrs)/ \ - { \ - this->i = 0; \ - this->stbuf = (uint16_t *)alloca(MAX_TWOBYTESTR_BYTES + 2); \ - copyinto(str + V8_OFF_TWOBYTESTR_CHARS, \ - MAX_TWOBYTESTR_BYTES, this->stbuf); \ - this->stbuf[MAX_TWOBYTESTR_BYTES - 1] = '\0'; \ - this->stbuf[MAX_TWOBYTESTR_BYTES] = '\0'; \ - \ - LOOP_8(LOOP_8(LOOP_4(LOOP_ITER(this->i, len, \ - MAX_TWOBYTESTR_CHARS, \ - APPEND_CHR(TO_ASCII(this->stbuf[this->i])))))) \ - \ - this->i = 0; \ - this->stbuf = 0; \ - } - -/* - * Print out the given Node.js ExternalString, or do nothing if the string is - * not an ASCII ExternalString. - */ -#define APPEND_NODESTR(str, len, attrs) \ - dtrace:helper:ustack: \ - /!this->done && len > 0 && ASCII_EXTSTR(attrs)/ \ - { \ - this->resource = COPYIN_PTR(str + V8_OFF_EXTSTR_RSRC); \ - this->dataptr = COPYIN_PTR(this->resource + NODE_OFF_EXTSTR_DATA); \ - copyinto(this->dataptr, len, this->buf + this->off); \ - this->off += len; \ - } - -/* - * Recall that each ConsString points to two other strings which are - * semantically concatenated. Of course, these strings may themselves by - * ConsStrings, but in D we can only expand this recursion to a finite level. - * Thankfully, function and script names are generally not more than a few - * levels deep, so we unroll the expansion up to three levels. Even this is - * pretty hairy: we use strings "s0", ..., "s13", (each with "str", "len", and - * "attr" fields -- see above) to store the expanded strings. We expand the - * original string into s0 and s7, then s0 into s1 and s4, etc: - * - * - * +---- str ----+ - * / \ <-- 1st expansion - * / \ - * s0 s7 - * / \ / \ - * / \ / \ <-- 2nd expansion - * / \ / \ - * s1 s4 s8 s11 - * / \ / \ / \ / \ <-- 3rd expansion - * s2 s3 s5 s6 s9 s10 s12 s13 - * - * Of course, for a given string, any of these expansions may not be needed. - * For example, we may expand str and find that s0 is already a SeqString, - * while s7 requires further expansion. So when we expand a ConsString, we - * zero the length of the string itself, and then at the end we print out - * all non-zero-length strings in order (including both internal nodes and - * leafs in the tree above) to get the final output. - */ -#define EXPAND_START() \ - dtrace:helper:ustack: \ - /!this->done/ \ - { \ - this->s0str = this->s1str = this->s2str = (off_t) 0; \ - this->s3str = this->s4str = this->s5str = (off_t) 0; \ - this->s6str = this->s7str = this->s8str = (off_t) 0; \ - this->s9str = this->s10str = this->s11str = (off_t) 0; \ - this->s12str = this->s13str = (off_t) 0; \ - \ - this->s0len = this->s1len = this->s2len = (off_t) 0; \ - this->s3len = this->s4len = this->s5len = (off_t) 0; \ - this->s6len = this->s7len = this->s8len = (off_t) 0; \ - this->s9len = this->s10len = this->s11len = (off_t) 0; \ - this->s12len = this->s13len = (off_t) 0; \ - \ - this->s0attrs = this->s1attrs = this->s2attrs = 0; \ - this->s3attrs = this->s4attrs = this->s5attrs = 0; \ - this->s6attrs = this->s7attrs = this->s8attrs = 0; \ - this->s9attrs = this->s10attrs = this->s11attrs = 0; \ - this->s12attrs = this->s13attrs = 0; \ - } - -/* - * Expand the ConsString "str" (represented by "str", "len", and "attrs") into - * strings "s1" (represented by "s1s", "s1l", and "s1a") and "s2" (represented - * by "s2s", "s2l", "s2a"). If "str" is not a ConsString, do nothing. - */ -#define EXPAND_STR(str, len, attrs, s1s, s1l, s1a, s2s, s2l, s2a) \ - dtrace:helper:ustack: \ - /!this->done && len > 0 && IS_CONSSTR(attrs)/ \ - { \ - len = 0; \ - \ - s1s = COPYIN_PTR(str + V8_OFF_CONSSTR_CAR); \ - LOAD_STRFIELDS(s1s, s1l, s1a) \ - \ - s2s = COPYIN_PTR(str + V8_OFF_CONSSTR_CDR); \ - LOAD_STRFIELDS(s2s, s2l, s2a) \ - } - -/* - * Print out a ConsString by expanding it up to three levels and printing out - * the resulting SeqStrings. - */ -#define APPEND_CONSSTR(str, len, attrs) \ - EXPAND_START() \ - EXPAND_STR(str, len, attrs, \ - this->s0str, this->s0len, this->s0attrs, \ - this->s7str, this->s7len, this->s7attrs) \ - EXPAND_STR(this->s0str, this->s0len, this->s0attrs, \ - this->s1str, this->s1len, this->s1attrs, \ - this->s4str, this->s4len, this->s4attrs) \ - EXPAND_STR(this->s1str, this->s1len, this->s1attrs, \ - this->s2str, this->s2len, this->s2attrs, \ - this->s3str, this->s3len, this->s3attrs) \ - EXPAND_STR(this->s4str, this->s4len, this->s4attrs, \ - this->s5str, this->s5len, this->s5attrs, \ - this->s6str, this->s6len, this->s6attrs) \ - EXPAND_STR(this->s7str, this->s7len, this->s7attrs, \ - this->s8str, this->s8len, this->s8attrs, \ - this->s11str, this->s11len, this->s11attrs) \ - EXPAND_STR(this->s8str, this->s8len, this->s8attrs, \ - this->s9str, this->s9len, this->s9attrs, \ - this->s10str, this->s10len, this->s10attrs) \ - EXPAND_STR(this->s11str, this->s11len, this->s11attrs, \ - this->s12str, this->s12len, this->s12attrs, \ - this->s13str, this->s13len, this->s13attrs) \ - \ - APPEND_SEQSTR(str, len, attrs) \ - APPEND_SEQSTR(this->s0str, this->s0len, this->s0attrs) \ - APPEND_SEQSTR(this->s1str, this->s1len, this->s1attrs) \ - APPEND_SEQSTR(this->s2str, this->s2len, this->s2attrs) \ - APPEND_SEQSTR(this->s3str, this->s3len, this->s3attrs) \ - APPEND_SEQSTR(this->s4str, this->s4len, this->s4attrs) \ - APPEND_SEQSTR(this->s5str, this->s5len, this->s5attrs) \ - APPEND_SEQSTR(this->s6str, this->s6len, this->s6attrs) \ - APPEND_SEQSTR(this->s7str, this->s7len, this->s7attrs) \ - APPEND_SEQSTR(this->s8str, this->s8len, this->s8attrs) \ - APPEND_SEQSTR(this->s9str, this->s9len, this->s9attrs) \ - APPEND_SEQSTR(this->s10str, this->s10len, this->s10attrs) \ - APPEND_SEQSTR(this->s11str, this->s11len, this->s11attrs) \ - APPEND_SEQSTR(this->s12str, this->s12len, this->s12attrs) \ - APPEND_SEQSTR(this->s13str, this->s13len, this->s13attrs) \ - - -/* - * Print out the given SeqString, ConsString, or ExternalString. - * APPEND_CONSSTR implicitly handles SeqStrings as the degenerate case of an - * expanded ConsString. - */ -#define APPEND_V8STR(str, len, attrs) \ - APPEND_CONSSTR(str, len, attrs) \ - APPEND_NODESTR(str, len, attrs) - -/* - * In this first clause we initialize all variables. We must explicitly clear - * them because they may contain values left over from previous iterations. - */ -dtrace:helper:ustack: -{ - /* input */ - this->fp = arg1; - - /* output/flow control */ - this->buf = (char*) alloca(128); - this->off = 0; - this->done = 0; - - /* program state */ - this->ctx = (off_t) 0; - this->marker = (off_t) 0; - this->func = (off_t) 0; - this->shared = (off_t) 0; - this->map = (off_t) 0; - this->attrs = 0; - this->funcrawnamestr = (off_t) 0; - this->hassharedname = 0; - this->funcnamelen = 0; - this->funcnameattrs = 0; - this->script = (off_t) 0; - this->scriptattrs = 0; - this->scriptnamestr = (off_t) 0; - this->scriptnamelen = 0; - this->scriptnameattrs = 0; - this->position = 0; - this->line_ends = (off_t) 0; - this->le_attrs = 0; - - /* binary search fields */ - this->bsearch_min = 0; - this->bsearch_max = 0; - this->ii = 0; -} - -/* - * Check for other common frame types for which we also have nothing to add. - */ -dtrace:helper:ustack: -/!this->done/ -{ - this->marker = COPYIN_PTR(this->fp + V8_OFF_FP_CONTEXT); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_ENTRY/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','e','n','t','r','y'); - APPEND_CHR4(' ','>','>','\0'); - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_ENTRYCONSTRUCT/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','e','n','t','r','y'); - APPEND_CHR8('_','c','o','n','s','t','r','u'); - APPEND_CHR4('t',' ','>','>'); - APPEND_CHR('\0'); - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_EXIT/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','e','x','i','t',' '); - APPEND_CHR4('>','>','\0','\0'); - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_INTERNAL/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','i','n','t','e','r'); - APPEND_CHR8('n','a','l',' ','>','>','\0','\0'); - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_CONSTRUCT/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','c','o','n','s','t'); - APPEND_CHR8('r','u','c','t','o','r',' ','>'); - APPEND_CHR4('>','\0','\0','\0'); - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && IS_SMI(this->marker) && - SMI_VALUE(this->marker) == V8_FT_STUB/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','s','t','u','b',' '); - APPEND_CHR4('>','>','\0','\0'); - stringof(this->buf); -} - -/* - * Now check for internal frames that we can only identify by seeing that - * there's a Code object where there would be a JSFunction object for a - * JavaScriptFrame. - */ -dtrace:helper:ustack: -/!this->done/ -{ - this->func = COPYIN_PTR(this->fp + V8_OFF_FP_FUNC); - this->map = V8_MAP_PTR(COPYIN_PTR(this->func + V8_OFF_HEAPOBJ_MAP)); - this->attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS); -} - -dtrace:helper:ustack: -/!this->done && this->attrs == V8_IT_CODE/ -{ - this->done = 1; - APPEND_CHR8('<','<',' ','i','n','t','e','r'); - APPEND_CHR8('n','a','l',' ','c','o','d','e'); - APPEND_CHR4(' ','>','>','\0'); - stringof(this->buf); -} - -/* - * At this point, we're either looking at a JavaScriptFrame or an - * OptimizedFrame. For now, we assume JavaScript and start by grabbing the - * function name. - */ -dtrace:helper:ustack: -/!this->done/ -{ - this->map = 0; - this->attrs = 0; - - this->shared = COPYIN_PTR(this->func + V8_OFF_FUNC_SHARED); - this->funcrawnamestr = COPYIN_PTR(this->shared + V8_OFF_RAW_NAME); - this->hassharedname = this->funcrawnamestr != - NO_SHARED_FUNCTION_NAME_SENTINEL; -} - -dtrace:helper:ustack: -/!this->done && this->hassharedname/ -{ - LOAD_STRFIELDS(this->funcrawnamestr, this->funcnamelen, - this->funcnameattrs); -} - -dtrace:helper:ustack: -/!this->done && this->funcnamelen == 0/ -{ - /* - * This is an anonymous function, but if it was invoked as a method of - * some object then V8 will have computed an inferred name that we can - * include in the stack trace. - */ - APPEND_CHR8('(','a','n','o','n',')',' ','a'); - APPEND_CHR('s'); - APPEND_CHR(' '); - - this->funcrawnamestr = COPYIN_PTR(this->shared + V8_OFF_SHARED_IDENT); - LOAD_STRFIELDS(this->funcrawnamestr, this->funcnamelen, - this->funcnameattrs); -} - -dtrace:helper:ustack: -/!this->done && this->funcnamelen == 0/ -{ - APPEND_CHR('('); - APPEND_CHR4('a','n','o','n'); - APPEND_CHR(')'); -} - -APPEND_V8STR(this->funcrawnamestr, this->funcnamelen, this->funcnameattrs) - -/* - * Now look for the name of the script where the function was defined. The - * "script" itself may be undefined for special functions like "RegExp". - */ -dtrace:helper:ustack: -/!this->done/ -{ - this->script = COPYIN_PTR(this->shared + V8_OFF_SHARED_SCRIPT); - this->map = V8_MAP_PTR(COPYIN_PTR(this->script + V8_OFF_HEAPOBJ_MAP)); - this->scriptattrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS); -} - -dtrace:helper:ustack: -/!this->done && !V8_TYPE_SCRIPT(this->scriptattrs)/ -{ - APPEND_CHR('\0'); - this->done = 1; - stringof(this->buf); -} - - -dtrace:helper:ustack: -/!this->done/ -{ - this->scriptnamestr = COPYIN_PTR(this->script + V8_OFF_SCRIPT_NAME); - LOAD_STRFIELDS(this->scriptnamestr, this->scriptnamelen, - this->scriptnameattrs); -} - -dtrace:helper:ustack: -/!this->done && this->scriptnamelen != 0/ -{ - APPEND_CHR4(' ','a','t',' '); -} - -APPEND_V8STR(this->scriptnamestr, this->scriptnamelen, this->scriptnameattrs) - -/* - * Now look for file position and line number information. - */ -dtrace:helper:ustack: -/!this->done/ -{ - this->position = COPYIN_UINT32(this->shared + V8_OFF_SHARED_FUNIDENT); - this->line_ends = COPYIN_PTR(this->script + V8_OFF_SCRIPT_LENDS); - this->map = V8_MAP_PTR(COPYIN_PTR(this->line_ends + V8_OFF_HEAPOBJ_MAP)); - this->le_attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS); -} - -dtrace:helper:ustack: -/!this->done && this->le_attrs != V8_IT_FIXEDARRAY && this->position == 0/ -{ - APPEND_CHR('\0'); - this->done = 1; - stringof(this->buf); -} - -dtrace:helper:ustack: -/!this->done && this->le_attrs != V8_IT_FIXEDARRAY/ -{ - /* - * If the line number array was not a valid FixedArray, it's probably - * undefined because V8 has not had to compute it yet. In this case we - * just show the raw position and call it a day. - */ - APPEND_CHR4(' ','p','o','s'); - APPEND_CHR(' '); - APPEND_NUM(SMI_VALUE(this->position)); - APPEND_CHR('\0'); - this->done = 1; - stringof(this->buf); -} - -/* - * At this point, we've got both a position in the script and an array - * describing where each line of the file ends. We can use this to compute the - * line number by binary searching the array. (This is also what V8 does when - * computing stack traces.) - */ -dtrace:helper:ustack: -/!this->done/ -{ - /* initialize binary search */ - this->bsearch_line = this->position < - SMI_VALUE(COPYIN_PTR(this->line_ends + V8_OFF_FA_DATA)) ? 1 : 0; - this->bsearch_min = 0; - this->bsearch_max = this->bsearch_line != 0 ? 0 : - SMI_VALUE(COPYIN_PTR(this->line_ends + V8_OFF_FA_SIZE)) - 1; -} - -/* - * Of course, we can't iterate the binary search indefinitely, so we hardcode 15 - * iterations. That's enough to precisely identify the line number in files up - * to 32768 lines of code. - */ -#define BSEARCH_LOOP \ - dtrace:helper:ustack: \ - /!this->done && this->bsearch_max >= 1/ \ - { \ - this->ii = (this->bsearch_min + this->bsearch_max) >> 1; \ - } \ - \ - dtrace:helper:ustack: \ - /!this->done && this->bsearch_max >= 1 && \ - this->position > SMI_VALUE( \ - COPYIN_PTR(this->line_ends + V8_OFF_FA_DATA + \ - this->ii * sizeof (uint32_t)))/ \ - { \ - this->bsearch_min = this->ii + 1; \ - } \ - \ - dtrace:helper:ustack: \ - /!this->done && this->bsearch_max >= 1 && \ - this->position <= SMI_VALUE( \ - COPYIN_PTR(this->line_ends + V8_OFF_FA_DATA + \ - (this->ii - 1) * sizeof (uint32_t)))/ \ - { \ - this->bsearch_max = this->ii - 1; \ - } - -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP -BSEARCH_LOOP - -dtrace:helper:ustack: -/!this->done && !this->bsearch_line/ -{ - this->bsearch_line = this->ii + 1; -} - -dtrace:helper:ustack: -/!this->done/ -{ - APPEND_CHR(' '); - APPEND_CHR4('l','i','n','e'); - APPEND_CHR(' '); - APPEND_NUM(this->bsearch_line); - APPEND_CHR('\0'); - this->done = 1; - stringof(this->buf); -} - -/* vim: set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 495f08f716f573..bd7221529ca8fc 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -57,7 +57,6 @@ const expectedModules = new Set([ 'NativeModule internal/console/constructor', 'NativeModule internal/console/global', 'NativeModule internal/constants', - 'NativeModule internal/dtrace', 'NativeModule internal/encoding', 'NativeModule internal/errors', 'NativeModule internal/event_target', @@ -235,11 +234,6 @@ if (common.hasCrypto) { expectedModules.add('NativeModule internal/streams/lazy_transform'); } -const { internalBinding } = require('internal/test/binding'); -if (internalBinding('config').hasDtrace) { - expectedModules.add('Internal Binding dtrace'); -} - const difference = (setA, setB) => { return new Set([...setA].filter((x) => !setB.has(x))); }; diff --git a/test/parallel/test-internal-dtrace.js b/test/parallel/test-internal-dtrace.js deleted file mode 100644 index 68991d739a8bf4..00000000000000 --- a/test/parallel/test-internal-dtrace.js +++ /dev/null @@ -1,24 +0,0 @@ -// Flags: --expose-internals -'use strict'; - -require('../common'); -const assert = require('assert'); - -const { - DTRACE_HTTP_CLIENT_REQUEST, - DTRACE_HTTP_CLIENT_RESPONSE, - DTRACE_HTTP_SERVER_REQUEST, - DTRACE_HTTP_SERVER_RESPONSE, - DTRACE_NET_SERVER_CONNECTION, - DTRACE_NET_STREAM_END -} = require('internal/dtrace'); - -// We're just testing to make sure these are always defined and -// callable. We don't actually test their function here. - -assert.strictEqual(typeof DTRACE_HTTP_CLIENT_REQUEST, 'function'); -assert.strictEqual(typeof DTRACE_HTTP_CLIENT_RESPONSE, 'function'); -assert.strictEqual(typeof DTRACE_HTTP_SERVER_REQUEST, 'function'); -assert.strictEqual(typeof DTRACE_HTTP_SERVER_RESPONSE, 'function'); -assert.strictEqual(typeof DTRACE_NET_SERVER_CONNECTION, 'function'); -assert.strictEqual(typeof DTRACE_NET_STREAM_END, 'function'); diff --git a/tools/install.py b/tools/install.py index 2a41a286f4e162..bf8f5673faf16c 100755 --- a/tools/install.py +++ b/tools/install.py @@ -144,8 +144,6 @@ def files(action): else: output_lib = 'libnode.' + variables.get('shlib_suffix') action([output_prefix + output_lib], 'lib/' + output_lib) - if 'true' == variables.get('node_use_dtrace'): - action(['out/Release/node.d'], 'lib/dtrace/node.d') action(['deps/v8/tools/gdbinit'], 'share/doc/node/') action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/') diff --git a/tools/msvs/msi/i18n/de-de.wxl b/tools/msvs/msi/i18n/de-de.wxl index 8ce814b2db3237..646d9c55640503 100644 --- a/tools/msvs/msi/i18n/de-de.wxl +++ b/tools/msvs/msi/i18n/de-de.wxl @@ -12,9 +12,6 @@ Node.js-Laufzeitumgebung Installation der [ProductName]-Laufzeitumgebung (node.exe). - Event Tracing (ETW) - Installiert Unterstützung für Event Tracing (ETW)-Events, generiert von [ProductName]. - npm-Paketmanager Installiert npm, den empfohlenen Paketmanager für [ProductName]. diff --git a/tools/msvs/msi/i18n/en-us.wxl b/tools/msvs/msi/i18n/en-us.wxl index c47dabf1dadf30..dc69f218240149 100644 --- a/tools/msvs/msi/i18n/en-us.wxl +++ b/tools/msvs/msi/i18n/en-us.wxl @@ -20,9 +20,6 @@ Node.js runtime Install the core [ProductName] runtime (node.exe). - Event tracing (ETW) - Installs support for event tracing (ETW) events generated by [ProductName]. - npm package manager Install npm, the recommended package manager for [ProductName]. diff --git a/tools/msvs/msi/i18n/it-it.wxl b/tools/msvs/msi/i18n/it-it.wxl index 369074c642cf1f..26c02be0db31b5 100644 --- a/tools/msvs/msi/i18n/it-it.wxl +++ b/tools/msvs/msi/i18n/it-it.wxl @@ -12,9 +12,6 @@ Node.js runtime Installa [ProductName] runtime (node.exe). - Event tracing (ETW) - Installa il supporto per gli eventi "event tracing" (ETW) generati da [ProductName]. - npm package manager Installa npm, il package manager raccomandato per [ProductName]. diff --git a/tools/msvs/msi/i18n/zh-cn.wxl b/tools/msvs/msi/i18n/zh-cn.wxl index c2c1f51262e789..b0f6b195f3ae62 100644 --- a/tools/msvs/msi/i18n/zh-cn.wxl +++ b/tools/msvs/msi/i18n/zh-cn.wxl @@ -12,9 +12,6 @@ Node.js 运行时 安装核心 [ProductName] 运行时(node.exe)。 - 事件追踪(ETW) - 为 [ProductName] 生成的事件安装事件追踪(ETW)的支持。 - npm 包管理器 安装 npm, [ProductName] 的推荐包管理器。 diff --git a/tools/msvs/msi/nodemsi.wixproj b/tools/msvs/msi/nodemsi.wixproj index f01ca4d7722e64..41ee3b3c0bed55 100644 --- a/tools/msvs/msi/nodemsi.wixproj +++ b/tools/msvs/msi/nodemsi.wixproj @@ -16,33 +16,33 @@ ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFilesFolder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFilesFolder ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFilesFolder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFilesFolder ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder en-US ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder ..\..\..\ obj\$(Configuration)\ - Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder + Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NpmSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\npm\;CorepackSourceDir=..\..\..\Release\node-v$(FullVersion)-win-$(Platform)\node_modules\corepack\;ProgramFilesFolderId=ProgramFiles64Folder True diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs index 0c9c09e5b07010..1f065fa6f3ed93 100755 --- a/tools/msvs/msi/product.wxs +++ b/tools/msvs/msi/product.wxs @@ -81,14 +81,6 @@ - - - - - - - - - - - - - diff --git a/vcbuild.bat b/vcbuild.bat index 1f200a6818eb6a..0ac45d92ad0ced 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -48,8 +48,6 @@ set lint_js= set lint_cpp= set lint_md= set lint_md_build= -set noetw= -set noetw_msi_arg= set i18n_arg= set download_arg= set build_release= @@ -93,7 +91,6 @@ if /i "%1"=="sign" set sign=1&goto arg-ok if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok if /i "%1"=="nonpm" set nonpm=1&goto arg-ok if /i "%1"=="nocorepack" set nocorepack=1&goto arg-ok -if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="ltcg" set ltcg=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok if /i "%1"=="test" set test_args=%test_args% %common_test_suites%&set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok @@ -190,7 +187,6 @@ if "%config%"=="Debug" set configure_flags=%configure_flags% --debug if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot if defined nonpm set configure_flags=%configure_flags% --without-npm if defined nocorepack set configure_flags=%configure_flags% --without-corepack -if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1 if defined ltcg set configure_flags=%configure_flags% --with-ltcg if defined release_urlbase set configure_flags=%configure_flags% --release-urlbase=%release_urlbase% if defined download_arg set configure_flags=%configure_flags% %download_arg% @@ -477,10 +473,6 @@ copy /Y ..\tools\msvs\nodevars.bat %TARGET_NAME%\ > nul if errorlevel 1 echo Cannot copy nodevars.bat && goto package_error copy /Y ..\tools\msvs\install_tools\*.* %TARGET_NAME%\ > nul if errorlevel 1 echo Cannot copy install_tools scripts && goto package_error -if not defined noetw ( - copy /Y ..\src\res\node_etw_provider.man %TARGET_NAME%\ > nul - if errorlevel 1 echo Cannot copy node_etw_provider.man && goto package_error -) if defined dll ( copy /Y libnode.dll %TARGET_NAME%\ > nul if errorlevel 1 echo Cannot copy libnode.dll && goto package_error @@ -533,7 +525,7 @@ if not defined msi goto install-doctools echo Building node-v%FULLVERSION%-%target_arch%.msi set "msbsdk=" if defined WindowsSDKVersion set "msbsdk=/p:WindowsTargetPlatformVersion=%WindowsSDKVersion:~0,-1%" -msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build %msbsdk% /p:PlatformToolset=%PLATFORM_TOOLSET% /p:WixSdkDir="%WIXSDKDIR%" /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build %msbsdk% /p:PlatformToolset=%PLATFORM_TOOLSET% /p:WixSdkDir="%WIXSDKDIR%" /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit if not defined sign goto upload @@ -772,7 +764,7 @@ set exit_code=1 goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-doc/test-js-native-api/test-node-api/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [nonpm] [nocorepack] [noetw] [ltcg] [licensetf] [sign] [ia32/x86/x64/arm64] [vs2019/vs2022] [download-all] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-doc/test-js-native-api/test-node-api/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [nonpm] [nocorepack] [ltcg] [licensetf] [sign] [ia32/x86/x64/arm64] [vs2019/vs2022] [download-all] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build