Skip to content

Commit a2e860f

Browse files
addaleaxcodebytere
authored andcommitted
build: add configure option to debug only Node.js part of the binary
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: #31644 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 64973e9 commit a2e860f

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

configure.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
dest='debug',
8989
help='also build debug build')
9090

91+
parser.add_option('--debug-node',
92+
action='store_true',
93+
dest='debug_node',
94+
help='build the Node.js part of the binary with debugging symbols')
95+
9196
parser.add_option('--dest-cpu',
9297
action='store',
9398
dest='dest_cpu',
@@ -964,6 +969,7 @@ def configure_node(o):
964969
o['variables']['node_prefix'] = options.prefix
965970
o['variables']['node_install_npm'] = b(not options.without_npm)
966971
o['variables']['node_report'] = b(not options.without_report)
972+
o['variables']['debug_node'] = b(options.debug_node)
967973
o['default_configuration'] = 'Debug' if options.debug else 'Release'
968974

969975
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()

node.gypi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,16 @@
272272
],
273273
},
274274
}],
275+
[ 'debug_node=="true"', {
276+
'cflags!': [ '-O3' ],
277+
'cflags': [ '-g', '-O0' ],
278+
'defines': [ 'DEBUG' ],
279+
'xcode_settings': {
280+
'OTHER_CFLAGS': [
281+
'-g', '-O0'
282+
],
283+
},
284+
}],
275285
[ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
276286
'cflags!': [ '-O3' ],
277287
'ldflags': [ '--coverage',

0 commit comments

Comments
 (0)