diff options
author | Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> | 2023-05-17 15:24:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 15:24:01 -0400 |
commit | 3eaa2749041d0ba1e048fe269a5455e17a3eb3d7 (patch) | |
tree | 8e58dc518126fa7e124056feb7280dab42011546 | |
parent | 33c05780c9aac3804cbf633cd417eb874a8a0fbd (diff) | |
download | compiler-explorer-3eaa2749041d0ba1e048fe269a5455e17a3eb3d7.tar.gz compiler-explorer-3eaa2749041d0ba1e048fe269a5455e17a3eb3d7.zip |
Add nm (#5058)gh-7421
Changes on top of #5057
-rw-r--r-- | etc/config/c++.amazon.properties | 9 | ||||
-rw-r--r-- | etc/config/c++.defaults.properties | 9 | ||||
-rw-r--r-- | etc/config/c.amazon.properties | 9 | ||||
-rw-r--r-- | etc/config/c.defaults.properties | 9 | ||||
-rw-r--r-- | lib/tooling/_all.ts | 1 | ||||
-rw-r--r-- | lib/tooling/nm-tool.ts | 45 | ||||
-rw-r--r-- | lib/tooling/pahole-tool.ts | 4 | ||||
-rw-r--r-- | lib/tooling/readelf-tool.ts | 4 | ||||
-rw-r--r-- | lib/tooling/strings-tool.ts | 2 |
9 files changed, 81 insertions, 11 deletions
diff --git a/etc/config/c++.amazon.properties b/etc/config/c++.amazon.properties index 5bf1a6c97..68de6736d 100644 --- a/etc/config/c++.amazon.properties +++ b/etc/config/c++.amazon.properties @@ -3730,7 +3730,7 @@ libs.copperspice.versions.180.libpath=/opt/compiler-explorer/libs/copperspice/1. ################################# ################################# # Installed tools -tools=PVS-Studio:clangformattrunk:clangquerytrunk:clangtidytrunk:iwyu:ldd:llvm-covtrunk:llvm-mcatrunk:osacatrunk:pahole:readelf:Sonar:strings:x86to6502 +tools=PVS-Studio:clangformattrunk:clangquerytrunk:clangtidytrunk:iwyu:ldd:llvm-covtrunk:llvm-mcatrunk:osacatrunk:pahole:readelf:nm:Sonar:strings:x86to6502 tools.PVS-Studio.name=PVS-Studio tools.PVS-Studio.exe=/opt/compiler-explorer/pvs-studio-latest/bin/pvs-studio-analyzer @@ -3809,6 +3809,13 @@ tools.readelf.class=readelf-tool tools.readelf.exclude=djggp tools.readelf.stdinHint=disabled +tools.nm.name=nm (trunk) +tools.nm.exe=/opt/compiler-explorer/gcc-snapshot/bin/nm +tools.nm.type=postcompilation +tools.nm.class=nm-tool +tools.nm.exclude=djggp +tools.nm.stdinHint=disabled + tools.strings.exe=/opt/compiler-explorer/gcc-snapshot/bin/strings tools.strings.name=strings tools.strings.type=postcompilation diff --git a/etc/config/c++.defaults.properties b/etc/config/c++.defaults.properties index 14b6c0695..187dd8735 100644 --- a/etc/config/c++.defaults.properties +++ b/etc/config/c++.defaults.properties @@ -50,7 +50,7 @@ compiler.clang12.name=clang 12 compiler.clangdefault.exe=/usr/bin/clang++ compiler.clangdefault.name=clang default -tools=clangquerydefault:clangtidydefault:clangquery7:clangquery8:clangquery9:clangquery10:clangquery11:clangquery12:strings:ldd:readelf +tools=clangquerydefault:clangtidydefault:clangquery7:clangquery8:clangquery9:clangquery10:clangquery11:clangquery12:strings:ldd:readelf:nm tools.clangquerydefault.exe=/usr/bin/clang-query tools.clangquerydefault.name=clang-query (default) @@ -115,6 +115,13 @@ tools.readelf.class=readelf-tool tools.readelf.exclude=djggp tools.readelf.stdinHint=disabled +tools.nm.name=nm (default) +tools.nm.exe=/usr/bin/nm +tools.nm.type=postcompilation +tools.nm.class=nm-tool +tools.nm.exclude=djggp +tools.nm.stdinHint=disabled + tools.strings.exe=/usr/bin/strings tools.strings.name=strings tools.strings.type=postcompilation diff --git a/etc/config/c.amazon.properties b/etc/config/c.amazon.properties index 703735bc8..f8cd44109 100644 --- a/etc/config/c.amazon.properties +++ b/etc/config/c.amazon.properties @@ -2443,7 +2443,7 @@ libs.sqlite.versions.3400.path=/opt/compiler-explorer/libs/sqlite/3.40.0 ################################# ################################# # Installed tools -tools=PVS-Studio:clangformattrunk:clangquerytrunk:clangtidytrunk:ldd:llvm-mcatrunk:osacatrunk:pahole:readelf:Sonar:strings +tools=PVS-Studio:clangformattrunk:clangquerytrunk:clangtidytrunk:ldd:llvm-mcatrunk:osacatrunk:pahole:readelf:nm:Sonar:strings tools.PVS-Studio.name=PVS-Studio tools.PVS-Studio.exe=/opt/compiler-explorer/pvs-studio-latest/bin/pvs-studio-analyzer @@ -2507,6 +2507,13 @@ tools.readelf.class=readelf-tool tools.readelf.exclude= tools.readelf.stdinHint=disabled +tools.nm.name=nm (trunk) +tools.nm.exe=/opt/compiler-explorer/gcc-snapshot/bin/nm +tools.nm.type=postcompilation +tools.nm.class=nm-tool +tools.nm.exclude=djggp +tools.nm.stdinHint=disabled + tools.Sonar.name=Sonar tools.Sonar.exe=/opt/compiler-explorer/sonar/sonar.sh tools.Sonar.icon=./Sonar.svg diff --git a/etc/config/c.defaults.properties b/etc/config/c.defaults.properties index 839860b23..b837db412 100644 --- a/etc/config/c.defaults.properties +++ b/etc/config/c.defaults.properties @@ -59,7 +59,7 @@ compiler.cclangdefault.name=clang default compiler.cclangccdefault.exe=/usr/bin/clangcc compiler.cclangccdefault.name=clang default -tools=clangquerydefault:clangtidydefault:readelf +tools=clangquerydefault:clangtidydefault:readelf:nm tools.clangquerydefault.exe=/usr/bin/clang-query tools.clangquerydefault.name=clang-query (default) @@ -80,3 +80,10 @@ tools.readelf.type=postcompilation tools.readelf.class=readelf-tool tools.readelf.exclude=djggp tools.readelf.stdinHint=disabled + +tools.nm.name=nm (default) +tools.nm.exe=/usr/bin/nm +tools.nm.type=postcompilation +tools.nm.class=nm-tool +tools.nm.exclude=djggp +tools.nm.stdinHint=disabled diff --git a/lib/tooling/_all.ts b/lib/tooling/_all.ts index 8df57a672..63b50e30f 100644 --- a/lib/tooling/_all.ts +++ b/lib/tooling/_all.ts @@ -29,6 +29,7 @@ export {CompilerDropinTool} from './compiler-dropin-tool.js'; export {LLVMMcaTool} from './llvm-mca-tool.js'; export {LLVMCovTool} from './llvm-cov-tool.js'; export {MicrosoftAnalysisTool} from './microsoft-analysis-tool.js'; +export {NmTool} from './nm-tool.js'; export {OSACATool} from './osaca-tool.js'; export {PaholeTool} from './pahole-tool.js'; export {PvsStudioTool} from './pvs-studio-tool.js'; diff --git a/lib/tooling/nm-tool.ts b/lib/tooling/nm-tool.ts new file mode 100644 index 000000000..e77cb6fdb --- /dev/null +++ b/lib/tooling/nm-tool.ts @@ -0,0 +1,45 @@ +// Copyright (c) 2023, Compiler Explorer Authors +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import {fileExists} from '../utils.js'; + +import {BaseTool} from './base-tool.js'; + +export class NmTool extends BaseTool { + static get key() { + return 'nm-tool'; + } + + override async runTool(compilationInfo: Record<any, any>, inputFilepath?: string, args?: string[]) { + if (!compilationInfo.filters.binary && !compilationInfo.filters.binaryObject) { + return this.createErrorResponse(`${this.tool.name ?? 'nm'} requires an executable or binary object`); + } + + if (await fileExists(compilationInfo.executableFilename)) { + return super.runTool(compilationInfo, compilationInfo.executableFilename, args); + } else { + return super.runTool(compilationInfo, compilationInfo.outputFilename, args); + } + } +} diff --git a/lib/tooling/pahole-tool.ts b/lib/tooling/pahole-tool.ts index c5d931816..7392b1874 100644 --- a/lib/tooling/pahole-tool.ts +++ b/lib/tooling/pahole-tool.ts @@ -33,9 +33,7 @@ export class PaholeTool extends BaseTool { override async runTool(compilationInfo: Record<any, any>, inputFilepath?: string, args?: string[]) { if (!compilationInfo.filters.binary && !compilationInfo.filters.binaryObject) { - return this.createErrorResponse( - `${this.tool.name ? this.tool.name : 'Pahole'} requires an executable or binary object`, - ); + return this.createErrorResponse(`${this.tool.name ?? 'Pahole'} requires an executable or binary object`); } if (await fs.pathExists(compilationInfo.executableFilename)) { diff --git a/lib/tooling/readelf-tool.ts b/lib/tooling/readelf-tool.ts index 28b301a4a..336966a85 100644 --- a/lib/tooling/readelf-tool.ts +++ b/lib/tooling/readelf-tool.ts @@ -33,9 +33,7 @@ export class ReadElfTool extends BaseTool { override async runTool(compilationInfo: Record<any, any>, inputFilepath?: string, args?: string[]) { if (!compilationInfo.filters.binary && !compilationInfo.filters.binaryObject) { - return this.createErrorResponse( - `${this.tool.name ? this.tool.name : 'readelf'} requires an executable or binary object`, - ); + return this.createErrorResponse(`${this.tool.name ?? 'readelf'} requires an executable or binary object`); } if (await fileExists(compilationInfo.executableFilename)) { diff --git a/lib/tooling/strings-tool.ts b/lib/tooling/strings-tool.ts index 9d1eed72a..343073605 100644 --- a/lib/tooling/strings-tool.ts +++ b/lib/tooling/strings-tool.ts @@ -33,7 +33,7 @@ export class StringsTool extends BaseTool { override async runTool(compilationInfo: Record<any, any>, inputFilepath?: string, args?: string[]) { if (!compilationInfo.filters.binary) { - return this.createErrorResponse(`${this.tool.name ? this.tool.name : 'Strings'} requires an executable`); + return this.createErrorResponse(`${this.tool.name ?? 'Strings'} requires an executable`); } if (await fileExists(compilationInfo.executableFilename)) { return super.runTool(compilationInfo, compilationInfo.executableFilename, args); |