Remove gdb special handling for vespa/ci
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.coredump;
-import com.yahoo.config.provision.DockerImage;
import com.yahoo.vespa.hosted.dockerapi.ProcessResult;
import com.yahoo.vespa.hosted.node.admin.docker.DockerOperations;
import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext;
@@ -12,7 +11,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
@@ -37,7 +35,7 @@ public class CoreCollector {
}
Path readBinPathFallback(NodeAgentContext context, Path coredumpPath) {
- String command = GDBPath(context).toString()
+ String command = GDBPath().toString()
+ " -n -batch -core " + coredumpPath + " | grep \'^Core was generated by\'";
String[] wrappedCommand = {"/bin/sh", "-c", command};
ProcessResult result = docker.executeCommandInContainerAsRoot(context, wrappedCommand);
@@ -50,16 +48,9 @@ public class CoreCollector {
return Paths.get(matcher.group("path").split(" ")[0]);
}
- Path GDBPath(NodeAgentContext context) {
- Optional<DockerImage> image = context.node().currentDockerImage();
-
- if (image.isPresent() && image.get().repository().endsWith("vespa/ci")) {
- return context.pathInNodeUnderVespaHome("bin64/gdb");
- }
- else {
+ Path GDBPath() {
return Paths.get("/opt/rh/devtoolset-9/root/bin/gdb");
}
- }
Path readBinPath(NodeAgentContext context, Path coredumpPath) {
String[] command = {"file", coredumpPath.toString()};
@@ -88,7 +79,7 @@ public class CoreCollector {
List<String> readBacktrace(NodeAgentContext context, Path coredumpPath, Path binPath, boolean allThreads) {
String threads = allThreads ? "thread apply all bt" : "bt";
- String[] command = {GDBPath(context).toString(), "-n", "-ex", threads, "-batch", binPath.toString(), coredumpPath.toString()};
+ String[] command = {GDBPath().toString(), "-n", "-ex", threads, "-batch", binPath.toString(), coredumpPath.toString()};
ProcessResult result = docker.executeCommandInContainerAsRoot(context, command);
if (result.getExitStatus() != 0)
