core
Analyze core dump files generated by Go programs to diagnose crashes and debugging issues. Provide executable and core dump paths for detailed insights into program errors.
Instructions
Examine a core dump
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corePath | Yes | Path to the core dump file | |
| executable | Yes | Path to the executable that produced the core dump |
Implementation Reference
- src/handlers/debug.ts:67-76 (handler)The handler logic for the 'core' tool, which starts a debug session using startDebugSession with type 'core', the executable path, and core dump path as arguments. Returns a confirmation message.case "core": { const { executable, corePath } = args; const session = await startDebugSession("core", executable, [corePath]); return { content: [{ type: "text", text: `Started core dump analysis session ${session.id} for ${executable} with core ${corePath}` }] }; }
- src/server.ts:271-287 (schema)Input schema definition for the 'core' tool, specifying required parameters 'executable' and 'corePath'.name: "core", description: "Examine a core dump", inputSchema: { type: "object", properties: { executable: { type: "string", description: "Path to the executable that produced the core dump" }, corePath: { type: "string", description: "Path to the core dump file" } }, required: ["executable", "corePath"] } },
- src/server.ts:406-408 (registration)Tool dispatch registration: routes 'core' tool calls to the handleDebugCommands function.if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) { return handleDebugCommands(name, args); }
- src/session.ts:35-64 (helper)Helper function that spawns the Delve debugger process with the given type ('core'), target (executable), and args (corePath). Constructs dlv command as 'dlv core --headless --listen=:<port> ... executable corePath'.export async function startDebugSession(type: string, target: string, args: string[] = []): Promise<DebugSession> { const port = await getAvailablePort(); const id = Math.random().toString(36).substring(7); const dlvArgs = [ type, "--headless", `--listen=:${port}`, "--accept-multiclient", "--api-version=2", target, ...args ]; const process = spawn("dlv", dlvArgs, { stdio: ["pipe", "pipe", "pipe"] }); const session: DebugSession = { id, type, target, process, port, breakpoints: new Map() }; sessions.set(id, session); return session; }
- src/types.ts:18-18 (schema)Type definition for DebugSession.type including 'core'.type: string; // 'debug' | 'attach' | 'exec' | 'test' | 'core' | 'replay' | 'trace' | 'dap'