2 * Wine debugger - minidump handling
4 * Copyright 2005 Eric Pouech
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #define NONAMELESSUNION
22 #define NONAMELESSSTRUCT
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
39 void minidump_write(const char* file, const EXCEPTION_RECORD* rec)
42 MINIDUMP_EXCEPTION_INFORMATION mei;
43 EXCEPTION_POINTERS ep;
46 hFile = CreateFile(file, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
47 FILE_ATTRIBUTE_NORMAL, NULL);
49 if (hFile == INVALID_HANDLE_VALUE) return;
53 mei.ThreadId = dbg_curr_thread->tid;
54 mei.ExceptionPointers = &ep;
55 ep.ExceptionRecord = (EXCEPTION_RECORD*)rec;
56 ep.ContextRecord = &dbg_context;
57 mei.ClientPointers = FALSE;
59 /* this is a wine specific options to return also ELF modules in the
62 SymSetOptions((wine_opt = SymGetOptions()) | 0x40000000);
63 MiniDumpWriteDump(dbg_curr_process->handle, dbg_curr_process->pid,
64 hFile, MiniDumpNormal/*|MiniDumpWithDataSegs*/,
65 rec ? &mei : NULL, NULL, NULL);
66 SymSetOptions(wine_opt);