3 Copyright 1999, 2001, 2013 Red Hat Inc.
5 Written by Egor Duda <deo@logos-m.ru>
7 This file is part of Cygwin.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License (file COPYING.dumper) for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
47 enum process_entity_type
54 typedef struct _process_entity
56 process_entity_type type
;
59 process_thread thread
;
60 process_mem_region memory
;
61 process_module module
;
64 struct _process_entity
* next
;
73 process_mem_region
* region
;
75 exclusion ( size_t step
) { last
= size
= 0;
78 ~exclusion () { free ( region
); }
79 int add ( LPBYTE mem_base
, SIZE_T mem_size
);
80 int sort_and_check ();
83 #define PAGE_BUFFER_SIZE 4096
88 DWORD tid
; /* thread id of active thread */
97 asection
* status_section
;
104 void dumper_abort ();
106 process_entity
* add_process_entity_to_list ( process_entity_type type
);
107 int add_thread ( DWORD tid
, HANDLE hThread
);
108 int add_mem_region ( LPBYTE base
, SIZE_T size
);
110 /* break mem_region by excl_list and add add all subregions */
111 int split_add_mem_region ( LPBYTE base
, SIZE_T size
);
113 int add_module ( LPVOID base_address
);
115 int collect_memory_sections ();
116 int dump_memory_region ( asection
* to
, process_mem_region
* memory
);
117 int dump_thread ( asection
* to
, process_thread
* thread
);
118 int dump_module ( asection
* to
, process_module
* module
);
123 int collect_process_information ();
124 void print_core_section_list ();
126 dumper ( DWORD pid
, DWORD tid
, const char* name
);
129 int init_core_dump ();
130 int prepare_core_dump ();
131 int write_core_dump ();
134 extern int deb_printf ( const char* format
, ... );
136 extern char* psapi_get_module_name ( HANDLE hProcess
, LPVOID BaseAddress
);
138 extern int parse_pe ( const char* file_name
, exclusion
* excl_list
);