@Test public void collectsPartialIfBacktraceFailsTest() { mockExec(new String[]{"file", TEST_CORE_PATH.toString()}, "/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from " + "'/usr/bin/program'"); mockExec(new String[]{GDB_PATH + " -n -ex bt -batch /usr/bin/program /tmp/core.1234"}, "", "Failure"); Map<String, Object> expectedData = Map.of("bin_path", TEST_BIN_PATH.toString()); assertEquals(expectedData, coreCollector.collect(context, TEST_CORE_PATH)); }
Map<String, Object> collect(NodeAgentContext context, Path coredumpPath) { Map<String, Object> data = new HashMap<>(); try { Path binPath = readBinPath(context, coredumpPath); data.put("bin_path", binPath.toString()); if (binPath.getFileName().toString().equals("java")) { data.put("backtrace_all_threads", readJstack(context, coredumpPath, binPath)); } else { data.put("backtrace", readBacktrace(context, coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(context, coredumpPath, binPath, true)); } } catch (RuntimeException e) { context.log(logger, Level.WARNING, "Failed to extract backtrace", e); } return data; }
CoreCollector { Map<String, Object> collect(NodeAgentContext context, Path coredumpPath) { Map<String, Object> data = new HashMap<>(); try { Path binPath = readBinPath(context, coredumpPath); data.put("bin_path", binPath.toString()); if (binPath.getFileName().toString().equals("java")) { data.put("backtrace_all_threads", readJstack(context, coredumpPath, binPath)); } else { data.put("backtrace", readBacktrace(context, coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(context, coredumpPath, binPath, true)); } } catch (RuntimeException e) { context.log(logger, Level.WARNING, "Failed to extract backtrace", e); } return data; } }
CoreCollector { Map<String, Object> collect(NodeAgentContext context, Path coredumpPath) { Map<String, Object> data = new HashMap<>(); try { Path binPath = readBinPath(context, coredumpPath); data.put("bin_path", binPath.toString()); if (binPath.getFileName().toString().equals("java")) { data.put("backtrace_all_threads", readJstack(context, coredumpPath, binPath)); } else { data.put("backtrace", readBacktrace(context, coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(context, coredumpPath, binPath, true)); } } catch (RuntimeException e) { context.log(logger, Level.WARNING, "Failed to extract backtrace", e); } return data; } CoreCollector(ContainerOperations docker); }
CoreCollector { Map<String, Object> collect(NodeAgentContext context, Path coredumpPath) { Map<String, Object> data = new HashMap<>(); try { Path binPath = readBinPath(context, coredumpPath); data.put("bin_path", binPath.toString()); if (binPath.getFileName().toString().equals("java")) { data.put("backtrace_all_threads", readJstack(context, coredumpPath, binPath)); } else { data.put("backtrace", readBacktrace(context, coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(context, coredumpPath, binPath, true)); } } catch (RuntimeException e) { context.log(logger, Level.WARNING, "Failed to extract backtrace", e); } return data; } CoreCollector(ContainerOperations docker);  }
CoreCollector { Map<String, Object> collect(NodeAgentContext context, Path coredumpPath) { Map<String, Object> data = new HashMap<>(); try { Path binPath = readBinPath(context, coredumpPath); data.put("bin_path", binPath.toString()); if (binPath.getFileName().toString().equals("java")) { data.put("backtrace_all_threads", readJstack(context, coredumpPath, binPath)); } else { data.put("backtrace", readBacktrace(context, coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(context, coredumpPath, binPath, true)); } } catch (RuntimeException e) { context.log(logger, Level.WARNING, "Failed to extract backtrace", e); } return data; } CoreCollector(ContainerOperations docker);   }