diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 81ad3ac..4f26331 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -18,7 +18,7 @@ jobs: {os: "macos-latest", arch: "x64"}, {os: "ubuntu-latest", arch: "x64"}, ] - node-version: [ 12, 14, 16, 18 ] + node-version: [ 12, 14, 16, 18, 19 ] steps: - name: Checkout Git Source uses: actions/checkout@master diff --git a/README.md b/README.md index 45ab8e1..78489fa 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ xprofiler 插件支持三大主流操作系统: - v16.x - v17.x - v18.x +v v19.x 更低的版本因为在此项目创建时已经不在官方 LTS 计划中,故正常情况下不再支持。 diff --git a/binding.gyp b/binding.gyp index 149af60..42c491c 100644 --- a/binding.gyp +++ b/binding.gyp @@ -56,7 +56,7 @@ ["OS == 'linux'", { "cflags": [ "-O3", - "-std=c++14", + "-std=c++17", "-Wno-sign-compare", "-Wno-cast-function-type", ], @@ -80,7 +80,7 @@ "GCC_ENABLE_CPP_EXCEPTIONS": "YES", "GCC_OPTIMIZATION_LEVEL": "3", "OTHER_CFLAGS": [ - "-std=c++14", + "-std=c++17", "-Wconversion", "-Wno-sign-conversion", ] diff --git a/package.json b/package.json index 0a58509..060d586 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "dependencies": { "@xprofiler/node-pre-gyp": "^1.0.9", "moment": "^2.29.4", - "nan": "^2.16.0", + "nan": "^2.17.0", "uuid": "^9.0.0", "yargs": "^17.5.1" }, diff --git a/src/hooks/fatal_error.cc b/src/hooks/fatal_error.cc index 431fa59..5d0e17d 100644 --- a/src/hooks/fatal_error.cc +++ b/src/hooks/fatal_error.cc @@ -56,10 +56,19 @@ void DumpBeforeAbort(const char* location, const char* message) { } } +#if (NODE_MODULE_VERSION > NODE_18_0_MODULE_VERSION) +[[noreturn]] void OnOOMError(const char* location, + const v8::OOMDetails& details) { + const char* message = + details.detail != nullptr ? details.detail + : details.is_heap_oom +#else [[noreturn]] void OnOOMError(const char* location, bool is_heap_oom) { const char* message = - is_heap_oom ? "Allocation failed - JavaScript heap out of memory" - : "Allocation failed - process out of memory"; + is_heap_oom +#endif + ? "Allocation failed - JavaScript heap out of memory" + : "Allocation failed - process out of memory"; DumpBeforeAbort(location, message); Abort(); } diff --git a/src/platform/unix/core/linux/elfcore.cc b/src/platform/unix/core/linux/elfcore.cc index 7f59077..363f07a 100644 --- a/src/platform/unix/core/linux/elfcore.cc +++ b/src/platform/unix/core/linux/elfcore.cc @@ -947,8 +947,8 @@ static int CreateElfCore(void* handle, /* We could save the first page of ELF to record the BuildId, * let the debugger later find the corresponding binary it used. */ - if (!dontdump && mappings[i].write_size == 0 && - (mappings[i].flags & PF_X) != 0) { + if (!dontdump && mappings[i].write_size == 0 && + (mappings[i].flags & PF_X) != 0) { mappings[i].write_size = pagesize; }