From 7d930046b77b519ff8a0394d01e9eb3b1cbbc99b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 5 Oct 2023 23:11:10 +0200 Subject: [PATCH] tools: remove genv8constants.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unused after commit aa3a572e6b ("build: remove dtrace & etw support") from last year. I had this vague notion that llnode also used it but that is another script. Fixes: https://github.com/nodejs/node/issues/49991 PR-URL: https://github.com/nodejs/node/pull/50023 Reviewed-By: Michaël Zasso Reviewed-By: Yagiz Nizipli Reviewed-By: Benjamin Gruenbaum Reviewed-By: Richard Lau Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- .github/label-pr-config.yml | 2 +- tools/genv8constants.py | 118 ------------------------------------ 2 files changed, 1 insertion(+), 119 deletions(-) delete mode 100755 tools/genv8constants.py diff --git a/.github/label-pr-config.yml b/.github/label-pr-config.yml index 622d3332899213..3961cda0e38724 100644 --- a/.github/label-pr-config.yml +++ b/.github/label-pr-config.yml @@ -47,7 +47,7 @@ subSystemLabels: /^\w+\.md$/: doc # Different variants of Makefile and build files /^(?:tools\/)?(?:Makefile|BSDmakefile|create_android_makefiles)$/: build, needs-ci - /^tools\/(?:install\.py|genv8constants\.py|getnodeversion\.py|js2c\.py|utils\.py|configure\.d\/.*)$/: build, python, needs-ci + /^tools\/(?:install\.py|getnodeversion\.py|js2c\.py|utils\.py|configure\.d\/.*)$/: build, python, needs-ci /^vcbuild\.bat$/: build, windows, needs-ci /^(?:android-)?configure|node\.gyp|common\.gypi$/: build, needs-ci # More specific tools diff --git a/tools/genv8constants.py b/tools/genv8constants.py deleted file mode 100755 index 01aa37cc715de0..00000000000000 --- a/tools/genv8constants.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python - -# -# genv8constants.py output_file libv8_base.a -# -# Emits v8dbg constants stored in libv8_base.a in a format suitable for the V8 -# ustack helper. -# - -from __future__ import print_function -import re -import subprocess -import sys -import errno - -if len(sys.argv) != 3: - print("Usage: genv8constants.py outfile libv8_base.a") - sys.exit(2) - -outfile = open(sys.argv[1], 'w') -try: - pipe = subprocess.Popen([ 'objdump', '-z', '-D', sys.argv[2] ], - bufsize=-1, stdout=subprocess.PIPE).stdout -except OSError as e: - if e.errno == errno.ENOENT: - print(''' - Node.js compile error: could not find objdump - - Check that GNU binutils are installed and included in PATH - ''') - else: - print('problem running objdump: ', e.strerror) - - sys.exit() - -pattern = re.compile('([0-9a-fA-F]{8}|[0-9a-fA-F]{16}) <(.*)>:') -v8dbg = re.compile('^v8dbg.*$') -numpattern = re.compile('^[0-9a-fA-F]{2} $') -octets = 4 - -outfile.write(""" -/* - * File automatically generated by genv8constants. Do not edit. - * - * The following offsets are dynamically from libv8_base.a. See src/v8ustack.d - * for details on how these values are used. - */ - -#ifndef V8_CONSTANTS_H -#define V8_CONSTANTS_H - -""") - -curr_sym = None -curr_val = 0 -curr_octet = 0 - -def out_reset(): - global curr_sym, curr_val, curr_octet - curr_sym = None - curr_val = 0 - curr_octet = 0 - -def out_define(): - global curr_sym, curr_val, curr_octet, outfile, octets - if curr_sym != None: - wrapped_val = curr_val & 0xffffffff - if curr_val & 0x80000000 != 0: - wrapped_val = 0x100000000 - wrapped_val - outfile.write("#define %s -0x%x\n" % (curr_sym.upper(), wrapped_val)) - else: - outfile.write("#define %s 0x%x\n" % (curr_sym.upper(), wrapped_val)) - out_reset() - -for line in pipe: - line = line.decode('utf-8') - if curr_sym != None: - # - # This bit of code has nasty knowledge of the objdump text output - # format, but this is the most obvious robust approach. We could almost - # rely on looking at numbered fields, but some instructions look very - # much like hex numbers (e.g., "adc"), and we don't want to risk picking - # those up by mistake, so we look at character-based columns instead. - # - for i in range(0, 3): - # 6-character margin, 2-characters + 1 space for each field - idx = 6 + i * 3 - octetstr = line[idx:idx+3] - if curr_octet > octets: - break - - if not numpattern.match(octetstr): - break - - curr_val += int('0x%s' % octetstr, 16) << (curr_octet * 8) - curr_octet += 1 - - match = pattern.match(line) - if match is None: - continue - - # Print previous symbol - out_define() - - v8match = v8dbg.match(match.group(2)) - if v8match != None: - out_reset() - curr_sym = match.group(2) - -# Print last symbol -out_define() - -outfile.write(""" - -#endif /* V8_CONSTANTS_H */ -""") - -outfile.close()