From a2e32673b589449c440dd220ca822d63449bb036 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 5 Feb 2020 15:24:14 +0100 Subject: [PATCH] build: add configure option to debug only Node.js part of the binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building Node.js with `--debug` takes a long time and generates binaries that can be hard to work with due to their size, in particular because debug builds of V8 are large. Sometimes, it’s sufficient to build the Node.js parts with native debugging options enabled. Add an option for that. PR-URL: https://github.com/nodejs/node/pull/31644 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Santiago Gimeno Reviewed-By: Gus Caplan Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott --- configure.py | 6 ++++++ node.gypi | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/configure.py b/configure.py index 14f5665e0299a2..1e1ede32bc685c 100755 --- a/configure.py +++ b/configure.py @@ -88,6 +88,11 @@ dest='debug', help='also build debug build') +parser.add_option('--debug-node', + action='store_true', + dest='debug_node', + help='build the Node.js part of the binary with debugging symbols') + parser.add_option('--dest-cpu', action='store', dest='dest_cpu', @@ -964,6 +969,7 @@ def configure_node(o): o['variables']['node_prefix'] = options.prefix o['variables']['node_install_npm'] = b(not options.without_npm) o['variables']['node_report'] = b(not options.without_report) + o['variables']['debug_node'] = b(options.debug_node) o['default_configuration'] = 'Debug' if options.debug else 'Release' host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc() diff --git a/node.gypi b/node.gypi index 144544214316a3..ff6c36c4b82ea9 100644 --- a/node.gypi +++ b/node.gypi @@ -272,6 +272,16 @@ ], }, }], + [ 'debug_node=="true"', { + 'cflags!': [ '-O3' ], + 'cflags': [ '-g', '-O0' ], + 'defines': [ 'DEBUG' ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-g', '-O0' + ], + }, + }], [ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', { 'cflags!': [ '-O3' ], 'ldflags': [ '--coverage',