user32: Add a heuristic for Unicode mappings of DDE data on the server side.
[wine/hramrach.git] / tools / winedump / pdb.c
blob5098d85a1705938fcc2248882e2eca7ce490a37a
1 /*
2 * PDB dumping utility
4 * Copyright 2006 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <stdio.h>
27 #ifdef HAVE_UNISTD_H
28 # include <unistd.h>
29 #endif
30 #include <time.h>
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
33 #endif
34 #ifdef HAVE_SYS_STAT_H
35 # include <sys/stat.h>
36 #endif
37 #ifdef HAVE_SYS_MMAN_H
38 #include <sys/mman.h>
39 #endif
40 #include <fcntl.h>
42 #define NONAMELESSUNION
43 #define NONAMELESSSTRUCT
44 #include "windef.h"
45 #include "winbase.h"
46 #include "winedump.h"
47 #include "wine/mscvpdb.h"
49 struct pdb_reader
51 union
53 struct
55 const struct PDB_JG_HEADER* header;
56 const struct PDB_JG_TOC* toc;
57 } jg;
58 struct
60 const struct PDB_DS_HEADER* header;
61 const struct PDB_DS_TOC* toc;
62 } ds;
63 } u;
64 void* (*read_file)(struct pdb_reader*, DWORD);
65 DWORD file_used[1024];
68 static void* pdb_jg_read(const struct PDB_JG_HEADER* pdb, const WORD* block_list, int size)
70 int i, nBlocks;
71 BYTE* buffer;
73 if (!size) return NULL;
75 nBlocks = (size + pdb->block_size - 1) / pdb->block_size;
76 buffer = malloc(nBlocks * pdb->block_size);
78 for (i = 0; i < nBlocks; i++)
79 memcpy(buffer + i * pdb->block_size,
80 (const char*)pdb + block_list[i] * pdb->block_size, pdb->block_size);
82 return buffer;
85 static void* pdb_jg_read_file(struct pdb_reader* reader, DWORD file_nr)
87 const WORD* block_list;
88 DWORD i;
90 if (!reader->u.jg.toc || file_nr >= reader->u.jg.toc->num_files) return NULL;
92 reader->file_used[file_nr / 32] |= 1 << (file_nr % 32);
93 if (reader->u.jg.toc->file[file_nr].size == 0 ||
94 reader->u.jg.toc->file[file_nr].size == 0xFFFFFFFF)
95 return NULL;
96 block_list = (const WORD*) &reader->u.jg.toc->file[reader->u.jg.toc->num_files];
97 for (i = 0; i < file_nr; i++)
98 block_list += (reader->u.jg.toc->file[i].size +
99 reader->u.jg.header->block_size - 1) / reader->u.jg.header->block_size;
101 return pdb_jg_read(reader->u.jg.header, block_list,
102 reader->u.jg.toc->file[file_nr].size);
105 static void pdb_jg_init(struct pdb_reader* reader)
107 reader->u.jg.header = PRD(0, sizeof(struct PDB_JG_HEADER));
108 reader->read_file = pdb_jg_read_file;
109 reader->u.jg.toc = pdb_jg_read(reader->u.jg.header,
110 reader->u.jg.header->toc_block,
111 reader->u.jg.header->toc.size);
112 memset(reader->file_used, 0, sizeof(reader->file_used));
115 static DWORD pdb_get_num_files(const struct pdb_reader* reader)
117 if (reader->read_file == pdb_jg_read_file)
118 return reader->u.jg.toc->num_files;
119 else
120 return reader->u.ds.toc->num_files;
123 static DWORD pdb_get_file_size(const struct pdb_reader* reader, unsigned idx)
125 if (reader->read_file == pdb_jg_read_file)
126 return reader->u.jg.toc->file[idx].size;
127 else
128 return reader->u.ds.toc->file_size[idx];
131 static void pdb_exit(struct pdb_reader* reader)
133 #if 1
134 unsigned i;
135 unsigned char* file;
136 DWORD size;
138 for (i = 0; i < pdb_get_num_files(reader); i++)
140 if (reader->file_used[i / 32] & (1 << (i % 32))) continue;
142 file = reader->read_file(reader, i);
143 if (!file) continue;
145 size = pdb_get_file_size(reader, i);
147 printf("File --unused-- #%d (%x)\n", i, size);
148 dump_data(file, size, " ");
149 free(file);
151 #endif
152 if (reader->read_file == pdb_jg_read_file)
153 free((char*)reader->u.jg.toc);
154 else
155 free((char*)reader->u.ds.toc);
158 static void pdb_dump_symbols(struct pdb_reader* reader)
160 PDB_SYMBOLS* symbols;
161 unsigned char* modimage;
162 const char* file;
163 char* filesimage;
164 DWORD filessize = 0;
166 symbols = reader->read_file(reader, 3);
168 if (!symbols) return;
170 switch (symbols->version)
172 case 0: /* VC 4.0 */
173 case 19960307: /* VC 5.0 */
174 case 19970606: /* VC 6.0 */
175 case 19990903: /* VC 7.0 */
176 break;
177 default:
178 printf("-Unknown symbol info version %d\n", symbols->version);
180 printf("Symbols:\n"
181 "\tsignature: %08x\n"
182 "\tversion: %u\n"
183 "\tunknown: %08x\n"
184 "\thash1_file: %08x\n"
185 "\thash2_file: %08x\n"
186 "\tgsym_file: %04x\n"
187 "\tunknown1: %04x\n"
188 "\tmodule_size: %08x\n"
189 "\toffset_size: %08x\n"
190 "\thash_size: %08x\n"
191 "\tsrc_module_size %08x\n"
192 "\tpdbimport_size %08x\n"
193 "\tresvd[0] %08x\n"
194 "\tresvd[1] %08x\n"
195 "\tresvd[2] %08x\n"
196 "\tresvd[3] %08x\n"
197 "\tresvd[4] %08x\n",
198 symbols->signature,
199 symbols->version,
200 symbols->unknown,
201 symbols->hash1_file,
202 symbols->hash2_file,
203 symbols->gsym_file,
204 symbols->unknown1,
205 symbols->module_size,
206 symbols->offset_size,
207 symbols->hash_size,
208 symbols->srcmodule_size,
209 symbols->pdbimport_size,
210 symbols->resvd[0],
211 symbols->resvd[1],
212 symbols->resvd[2],
213 symbols->resvd[3],
214 symbols->resvd[4]);
216 if (symbols->offset_size)
218 const BYTE* src;
220 printf("\t----------offsets------------\n");
221 src = (const BYTE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size);
222 dump_data(src, symbols->offset_size, " ");
225 filesimage = reader->read_file(reader, 12); /* FIXME: really fixed ??? */
226 if (filesimage)
228 if (*(const DWORD*)filesimage == 0xeffeeffe)
230 filessize = *(const DWORD*)(filesimage + 8);
232 else
234 printf("wrong header %x expecting 0xeffeeffe\n", *(const DWORD*)filesimage);
235 free(filesimage);
236 filesimage = NULL;
240 if (symbols->srcmodule_size)
242 const PDB_SYMBOL_SOURCE*src;
243 int i, j, cfile;
244 const WORD* indx;
245 const DWORD* offset;
246 const char* start_cstr;
247 const char* cstr;
249 printf("\t----------src module------------\n");
250 src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) +
251 symbols->module_size + symbols->offset_size + symbols->hash_size);
252 printf("\tSource Modules\n"
253 "\t\tnModules: %u\n"
254 "\t\tnSrcFiles: %u\n",
255 src->nModules, src->nSrcFiles);
257 /* usage of table seems to be as follows:
258 * two arrays of WORD (src->nModules as size)
259 * - first array contains index into files for "module" compilation
260 * (module = compilation unit ??)
261 * - second array contains the number of source files in module
262 * an array of DWORD (src->nSrcFiles as size)
263 * - contains offset (in following string table) of the source file name
264 * a string table
265 * - each string is a pascal string (ie. with its length as first BYTE) or
266 * 0-terminated string (depending on version)
268 indx = &src->table[src->nModules];
269 offset = (const DWORD*)&src->table[2 * src->nModules];
270 cstr = (const char*)&src->table[2 * (src->nModules + src->nSrcFiles)];
271 start_cstr = cstr;
273 for (i = cfile = 0; i < src->nModules; i++)
275 printf("\t\tModule[%2d]:\n", i);
276 for (j = 0; j < indx[i]; j++, cfile++)
278 /* FIXME: in some cases, it's a p_string but WHEN ? */
279 if (src->table[cfile] < src->nSrcFiles &&
280 cstr + offset[src->table[cfile]] >= (const char*)start_cstr /* wrap around */ &&
281 cstr + offset[src->table[cfile]] < (const char*)src + symbols->srcmodule_size)
282 printf("\t\t\tSource file: %s\n", cstr + offset[src->table[cfile]]);
283 else
284 printf("\t\t\tSource file: <<out of bounds>>\n");
288 if (symbols->pdbimport_size)
290 const PDB_SYMBOL_IMPORT* imp;
291 const char* first;
292 const char* last;
293 const char* ptr;
295 printf("\t------------import--------------\n");
296 imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) +
297 symbols->module_size + symbols->offset_size +
298 symbols->hash_size + symbols->srcmodule_size);
299 first = (const char*)imp;
300 last = (const char*)imp + symbols->pdbimport_size;
301 while (imp < (const PDB_SYMBOL_IMPORT*)last)
303 ptr = (const char*)imp + sizeof(*imp) + strlen(imp->filename);
304 printf("\tImport: %lx\n"
305 "\t\tUnknown1: %08x\n"
306 "\t\tUnknown2: %08x\n"
307 "\t\tTimeDateStamp: %08x\n"
308 "\t\tAge: %08u\n"
309 "\t\tfile1: %s\n"
310 "\t\tfile2: %s\n",
311 (ULONG_PTR)((const char*)imp - (const char*)first),
312 imp->unknown1,
313 imp->unknown2,
314 imp->TimeDateStamp,
315 imp->Age,
316 imp->filename,
317 ptr);
318 imp = (const PDB_SYMBOL_IMPORT*)(first + ((ptr - first + strlen(ptr) + 1 + 3) & ~3));
322 /* Read global symbol table */
323 modimage = reader->read_file(reader, symbols->gsym_file);
324 if (modimage)
326 printf("\t------------globals-------------\n");
327 codeview_dump_symbols(modimage, pdb_get_file_size(reader, symbols->gsym_file));
328 free(modimage);
331 /* Read per-module symbol / linenumber tables */
332 file = (const char*)symbols + sizeof(PDB_SYMBOLS);
333 while (file - (const char*)symbols < sizeof(PDB_SYMBOLS) + symbols->module_size)
335 int file_nr, symbol_size, lineno_size;
336 const char* file_name;
338 if (symbols->version < 19970000)
340 const PDB_SYMBOL_FILE* sym_file = (const PDB_SYMBOL_FILE*) file;
341 file_nr = sym_file->file;
342 file_name = sym_file->filename;
343 symbol_size = sym_file->symbol_size;
344 lineno_size = sym_file->lineno_size;
345 printf("\t--------symbol file----------- %s\n", file_name);
346 printf("\tgot symbol_file\n"
347 "\t\tunknown1: %08x\n"
348 "\t\trange\n"
349 "\t\t\tsegment: %04x\n"
350 "\t\t\tpad1: %04x\n"
351 "\t\t\toffset: %08x\n"
352 "\t\t\tsize: %08x\n"
353 "\t\t\tcharacteristics: %08x\n"
354 "\t\t\tindex: %04x\n"
355 "\t\t\tpad2: %04x\n"
356 "\t\tflag: %04x\n"
357 "\t\tfile: %04x\n"
358 "\t\tsymb size: %08x\n"
359 "\t\tline size: %08x\n"
360 "\t\tunknown2: %08x\n"
361 "\t\tnSrcFiles: %08x\n"
362 "\t\tattribute: %08x\n",
363 sym_file->unknown1,
364 sym_file->range.segment,
365 sym_file->range.pad1,
366 sym_file->range.offset,
367 sym_file->range.size,
368 sym_file->range.characteristics,
369 sym_file->range.index,
370 sym_file->range.pad2,
371 sym_file->flag,
372 sym_file->file,
373 sym_file->symbol_size,
374 sym_file->lineno_size,
375 sym_file->unknown2,
376 sym_file->nSrcFiles,
377 sym_file->attribute);
379 else
381 const PDB_SYMBOL_FILE_EX* sym_file = (const PDB_SYMBOL_FILE_EX*) file;
382 file_nr = sym_file->file;
383 file_name = sym_file->filename;
384 symbol_size = sym_file->symbol_size;
385 lineno_size = sym_file->lineno_size;
386 printf("\t--------symbol file----------- %s\n", file_name);
387 printf("\t\tunknown1: %08x\n"
388 "\t\trange\n"
389 "\t\t\tsegment: %04x\n"
390 "\t\t\tpad1: %04x\n"
391 "\t\t\toffset: %08x\n"
392 "\t\t\tsize: %08x\n"
393 "\t\t\tcharacteristics: %08x\n"
394 "\t\t\tindex: %04x\n"
395 "\t\t\tpad2: %04x\n"
396 "\t\t\ttimestamp: %08x\n"
397 "\t\t\tunknown: %08x\n"
398 "\t\tflag: %04x\n"
399 "\t\tfile: %04x\n"
400 "\t\tsymb size: %08x\n"
401 "\t\tline size: %08x\n"
402 "\t\tunknown2: %08x\n"
403 "\t\tnSrcFiles: %08x\n"
404 "\t\tattribute: %08x\n"
405 "\t\treserved/0: %08x\n"
406 "\t\treserved/1: %08x\n",
407 sym_file->unknown1,
408 sym_file->range.segment,
409 sym_file->range.pad1,
410 sym_file->range.offset,
411 sym_file->range.size,
412 sym_file->range.characteristics,
413 sym_file->range.index,
414 sym_file->range.pad2,
415 sym_file->range.timestamp,
416 sym_file->range.unknown,
417 sym_file->flag,
418 sym_file->file,
419 sym_file->symbol_size,
420 sym_file->lineno_size,
421 sym_file->unknown2,
422 sym_file->nSrcFiles,
423 sym_file->attribute,
424 sym_file->reserved[0],
425 sym_file->reserved[1]);
427 modimage = reader->read_file(reader, file_nr);
428 if (modimage)
430 int total_size = pdb_get_file_size(reader, file_nr);
432 if (symbol_size)
433 codeview_dump_symbols((const char*)modimage + sizeof(DWORD), symbol_size);
435 /* line number info */
436 if (lineno_size)
437 codeview_dump_linetab((const char*)modimage + symbol_size, lineno_size, TRUE, " ");
438 /* anyway, lineno_size doesn't see to really be the size of the line number information, and
439 * it's not clear yet when to call for linetab2...
441 codeview_dump_linetab2((const char*)modimage + symbol_size + lineno_size,
442 total_size - (symbol_size + lineno_size),
443 filesimage + 12, filessize, " ");
444 /* what's that part ??? */
445 if (0)
446 dump_data(modimage + symbol_size + lineno_size, total_size - (symbol_size + lineno_size), " ");
447 free(modimage);
450 file_name += strlen(file_name) + 1;
451 file = (char*)((DWORD_PTR)(file_name + strlen(file_name) + 1 + 3) & ~3);
453 free(symbols);
454 free(filesimage);
457 static void pdb_dump_types(struct pdb_reader* reader)
459 PDB_TYPES* types = NULL;
461 types = reader->read_file(reader, 2);
463 switch (types->version)
465 case 19950410: /* VC 4.0 */
466 case 19951122:
467 case 19961031: /* VC 5.0 / 6.0 */
468 case 19990903: /* VC 7.0 */
469 case 20040203: /* VC 8.0 */
470 break;
471 default:
472 printf("-Unknown type info version %d\n", types->version);
475 /* Read type table */
476 printf("Types:\n"
477 "\tversion: %u\n"
478 "\ttype_offset: %08x\n"
479 "\tfirst_index: %x\n"
480 "\tlast_index: %x\n"
481 "\ttype_size: %x\n"
482 "\tfile: %x\n"
483 "\tpad: %x\n"
484 "\thash_size: %x\n"
485 "\thash_base: %x\n"
486 "\thash_offset: %x\n"
487 "\thash_len: %x\n"
488 "\tsearch_offset: %x\n"
489 "\tsearch_len: %x\n"
490 "\tunknown_offset: %x\n"
491 "\tunknown_len: %x\n",
492 types->version,
493 types->type_offset,
494 types->first_index,
495 types->last_index,
496 types->type_size,
497 types->file,
498 types->pad,
499 types->hash_size,
500 types->hash_base,
501 types->hash_offset,
502 types->hash_len,
503 types->search_offset,
504 types->search_len,
505 types->unknown_offset,
506 types->unknown_len);
507 codeview_dump_types_from_block((const char*)types + types->type_offset, types->type_size);
508 free(types);
511 static const char pdb2[] = "Microsoft C/C++ program database 2.00";
513 static void pdb_jg_dump(void)
515 struct pdb_reader reader;
516 struct PDB_JG_ROOT* root = NULL;
519 * Read in TOC and well-known files
521 pdb_jg_init(&reader);
522 printf("Header (JG):\n"
523 "\tident: %.*s\n"
524 "\tsignature: %08x\n"
525 "\tblock_size: %08x\n"
526 "\tfree_list: %04x\n"
527 "\ttotal_alloc:%04x\n",
528 (int)sizeof(pdb2) - 1, reader.u.jg.header->ident,
529 reader.u.jg.header->signature,
530 reader.u.jg.header->block_size,
531 reader.u.jg.header->free_list,
532 reader.u.jg.header->total_alloc);
534 root = reader.read_file(&reader, 1);
536 if (root)
538 printf("Root:\n"
539 "\tVersion: %u\n"
540 "\tTimeDateStamp: %08x\n"
541 "\tAge: %08x\n"
542 "\tnames: %.*s\n",
543 root->Version,
544 root->TimeDateStamp,
545 root->Age,
546 (unsigned)root->cbNames,
547 root->names);
549 /* Check for unknown versions */
550 switch (root->Version)
552 case 19950623: /* VC 4.0 */
553 case 19950814:
554 case 19960307: /* VC 5.0 */
555 case 19970604: /* VC 6.0 */
556 break;
557 default:
558 printf("-Unknown root block version %d\n", root->Version);
560 free(root);
562 else printf("-Unable to get root\n");
564 pdb_dump_types(&reader);
565 #if 0
566 /* segments info, index is unknown */
568 const void* segs = pdb_read_file(pdb, toc, 8); /* FIXME which index ??? */
569 const void* ptr = segs;
571 if (segs) while (ptr < segs + toc->file[8].size)
573 printf("Segment %s\n", (const char*)ptr);
574 ptr += (strlen(ptr) + 1 + 3) & ~3;
575 printf("\tdword[0]: %08lx\n", *(DWORD*)ptr); ptr += 4;
576 printf("\tdword[1]: %08lx\n", *(DWORD*)ptr); ptr += 4;
577 printf("\tdword[2]: %08lx\n", *(DWORD*)ptr); ptr += 4;
578 printf("\tdword[3]: %08lx\n", *(DWORD*)ptr); ptr += 4;
579 printf("\tdword[4]: %08lx\n", *(DWORD*)ptr); ptr += 4;
580 printf("\tdword[5]: %08lx\n", *(DWORD*)ptr); ptr += 4;
581 printf("\tdword[6]: %08lx\n", *(DWORD*)ptr); ptr += 4;
582 printf("\tdword[7]: %08lx\n", *(DWORD*)ptr); ptr += 4;
584 free(segs);
586 #endif
588 pdb_dump_symbols(&reader);
589 pdb_exit(&reader);
592 static void* pdb_ds_read(const struct PDB_DS_HEADER* header, const DWORD* block_list, int size)
594 int i, nBlocks;
595 BYTE* buffer;
597 if (!size) return NULL;
599 nBlocks = (size + header->block_size - 1) / header->block_size;
600 buffer = malloc(nBlocks * header->block_size);
602 for (i = 0; i < nBlocks; i++)
603 memcpy(buffer + i * header->block_size,
604 (const char*)header + block_list[i] * header->block_size, header->block_size);
606 return buffer;
609 static void* pdb_ds_read_file(struct pdb_reader* reader, DWORD file_number)
611 const DWORD* block_list;
612 DWORD i;
614 if (!reader->u.ds.toc || file_number >= reader->u.ds.toc->num_files) return NULL;
616 reader->file_used[file_number / 32] |= 1 << (file_number % 32);
617 if (reader->u.ds.toc->file_size[file_number] == 0 ||
618 reader->u.ds.toc->file_size[file_number] == 0xFFFFFFFF)
619 return NULL;
620 block_list = reader->u.ds.toc->file_size + reader->u.ds.toc->num_files;
621 for (i = 0; i < file_number; i++)
622 block_list += (reader->u.ds.toc->file_size[i] + reader->u.ds.header->block_size - 1) /
623 reader->u.ds.header->block_size;
625 return pdb_ds_read(reader->u.ds.header, block_list, reader->u.ds.toc->file_size[file_number]);
628 static BOOL pdb_ds_init(struct pdb_reader* reader)
630 reader->u.ds.header = PRD(0, sizeof(*reader->u.ds.header));
631 if (!reader->u.ds.header) return FALSE;
632 reader->read_file = pdb_ds_read_file;
633 reader->u.ds.toc = pdb_ds_read(reader->u.ds.header,
634 (const DWORD*)((const char*)reader->u.ds.header + reader->u.ds.header->toc_page * reader->u.ds.header->block_size),
635 reader->u.ds.header->toc_size);
636 memset(reader->file_used, 0, sizeof(reader->file_used));
637 return TRUE;
640 static const char pdb7[] = "Microsoft C/C++ MSF 7.00";
642 static void pdb_ds_dump(void)
644 struct pdb_reader reader;
645 struct PDB_DS_ROOT* root;
647 pdb_ds_init(&reader);
648 printf("Header (DS)\n"
649 "\tsignature: %.*s\n"
650 "\tblock_size: %08x\n"
651 "\tunknown1: %08x\n"
652 "\tnum_pages: %08x\n"
653 "\ttoc_size: %08x\n"
654 "\tunknown2: %08x\n"
655 "\ttoc_page: %08x\n",
656 (int)sizeof(pdb7) - 1, reader.u.ds.header->signature,
657 reader.u.ds.header->block_size,
658 reader.u.ds.header->unknown1,
659 reader.u.ds.header->num_pages,
660 reader.u.ds.header->toc_size,
661 reader.u.ds.header->unknown2,
662 reader.u.ds.header->toc_page);
664 /* files:
665 * 0: JG says old toc pages, I'd say free pages (tbc, low prio)
666 * 1: root structure
667 * 2: types
668 * 3: modules
670 root = reader.read_file(&reader, 1);
671 if (root)
673 const char* ptr;
675 printf("Root:\n"
676 "\tVersion: %u\n"
677 "\tTimeDateStamp: %08x\n"
678 "\tAge: %08x\n"
679 "\tguid %s\n"
680 "\tcbNames: %08x\n",
681 root->Version,
682 root->TimeDateStamp,
683 root->Age,
684 get_guid_str(&root->guid),
685 root->cbNames);
686 for (ptr = &root->names[0]; ptr < &root->names[0] + root->cbNames; ptr += strlen(ptr) + 1)
687 printf("\tString: %s\n", ptr);
688 /* follows an unknown list of DWORDs */
689 free(root);
691 else printf("-Unable to get root\n");
693 pdb_dump_types(&reader);
694 pdb_dump_symbols(&reader);
696 pdb_exit(&reader);
699 enum FileSig get_kind_pdb(void)
701 const char* head;
703 head = PRD(0, sizeof(pdb2) - 1);
704 if (head && !memcmp(head, pdb2, sizeof(pdb2) - 1))
705 return SIG_PDB;
706 head = PRD(0, sizeof(pdb7) - 1);
707 if (head && !memcmp(head, pdb7, sizeof(pdb7) - 1))
708 return SIG_PDB;
709 return SIG_UNKNOWN;
712 void pdb_dump(void)
714 const char* head;
716 /* init_types(); */
717 head = PRD(0, sizeof(pdb2) - 1);
718 if (head && !memcmp(head, pdb2, sizeof(pdb2) - 1))
720 pdb_jg_dump();
721 return;
723 head = PRD(0, sizeof(pdb7) - 1);
724 if (head && !memcmp(head, pdb7, sizeof(pdb7) - 1))
726 pdb_ds_dump();
727 return;
729 printf("Unrecognized header %s\n", head);