build: add --debug-symbols to build with -g without enabling DCHECKs

This is useful when debugging release builds on Linux without
enabling DCHECKs.

PR-URL: https://github.com/nodejs/node/pull/61100
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Joyee Cheung 2025-12-23 15:45:21 +01:00 committed by GitHub
parent a385bb1d70
commit c837811baf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,6 +107,12 @@ parser.add_argument('--debug-node',
default=None,
help='build the Node.js part of the binary with debugging symbols')
parser.add_argument('--debug-symbols',
action='store_true',
dest='debug_symbols',
default=None,
help='add debugging symbols to release builds (adds -g without enabling DCHECKs)')
parser.add_argument('--dest-cpu',
action='store',
dest='dest_cpu',
@ -1560,6 +1566,9 @@ def configure_node(o):
o['variables']['control_flow_guard'] = b(options.enable_cfg)
o['variables']['node_use_amaro'] = b(not options.without_amaro)
o['variables']['debug_node'] = b(options.debug_node)
o['variables']['debug_symbols'] = b(options.debug_symbols)
if options.debug_symbols:
o['cflags'] += ['-g']
o['variables']['build_type%'] = 'Debug' if options.debug else 'Release'
o['default_configuration'] = 'Debug' if options.debug else 'Release'
if options.error_on_warn and options.suppress_all_error_on_warn: