OLD | NEW |
1 /* Read the export table symbols from a portable executable and | 1 /* Read the export table symbols from a portable executable and |
2 convert to internal format, for GDB. Used as a last resort if no | 2 convert to internal format, for GDB. Used as a last resort if no |
3 debugging symbols recognized. | 3 debugging symbols recognized. |
4 | 4 |
5 Copyright (C) 2003, 2007-2012 Free Software Foundation, Inc. | 5 Copyright (C) 2003-2013 Free Software Foundation, Inc. |
6 | 6 |
7 This file is part of GDB. | 7 This file is part of GDB. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 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 | 10 it under the terms of the GNU General Public License as published by |
11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
12 (at your option) any later version. | 12 (at your option) any later version. |
13 | 13 |
14 This program is distributed in the hope that it will be useful, | 14 This program is distributed in the hope that it will be useful, |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 GNU General Public License for more details. | 17 GNU General Public License for more details. |
18 | 18 |
19 You should have received a copy of the GNU General Public License | 19 You should have received a copy of the GNU General Public License |
20 along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | 21 |
22 Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */ | 22 Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */ |
23 | 23 |
| 24 #include "defs.h" |
| 25 |
24 #include "coff-pe-read.h" | 26 #include "coff-pe-read.h" |
25 | 27 |
26 #include "defs.h" | |
27 #include "bfd.h" | 28 #include "bfd.h" |
28 #include "gdbtypes.h" | 29 #include "gdbtypes.h" |
29 | 30 |
| 31 #include "command.h" |
| 32 #include "gdbcmd.h" |
30 #include "symtab.h" | 33 #include "symtab.h" |
31 #include "symfile.h" | 34 #include "symfile.h" |
32 #include "objfiles.h" | 35 #include "objfiles.h" |
| 36 #include "common/common-utils.h" |
| 37 #include "coff/internal.h" |
| 38 |
| 39 #include <ctype.h> |
33 | 40 |
34 /* Internal section information */ | 41 /* Internal section information */ |
35 | 42 |
| 43 /* Coff PE read debugging flag: |
| 44 default value is 0, |
| 45 value 1 outputs problems encountered while parsing PE file, |
| 46 value above 1 also lists all generated minimal symbols. */ |
| 47 static unsigned int debug_coff_pe_read; |
| 48 |
36 struct read_pe_section_data | 49 struct read_pe_section_data |
37 { | 50 { |
38 CORE_ADDR vma_offset; /* Offset to loaded address of section. */ | 51 CORE_ADDR vma_offset; /* Offset to loaded address of section. */ |
39 unsigned long rva_start; /* Start offset within the pe. */ | 52 unsigned long rva_start; /* Start offset within the pe. */ |
40 unsigned long rva_end; /* End offset within the pe. */ | 53 unsigned long rva_end; /* End offset within the pe. */ |
41 enum minimal_symbol_type ms_type; /* Type to assign symbols in | 54 enum minimal_symbol_type ms_type; /* Type to assign symbols in |
42 section. */ | 55 section. */ |
| 56 char *section_name; /* Recorded section name. */ |
43 }; | 57 }; |
44 | 58 |
| 59 #define IMAGE_SCN_CNT_CODE 0x20 |
| 60 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40 |
| 61 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80 |
45 #define PE_SECTION_INDEX_TEXT 0 | 62 #define PE_SECTION_INDEX_TEXT 0 |
46 #define PE_SECTION_INDEX_DATA 1 | 63 #define PE_SECTION_INDEX_DATA 1 |
47 #define PE_SECTION_INDEX_BSS 2 | 64 #define PE_SECTION_INDEX_BSS 2 |
48 #define PE_SECTION_TABLE_SIZE 3 | 65 #define PE_SECTION_TABLE_SIZE 3 |
49 #define PE_SECTION_INDEX_INVALID -1 | 66 #define PE_SECTION_INDEX_INVALID -1 |
50 | 67 |
51 | 68 |
52 /* Get the index of the named section in our own array, which contains | 69 /* Get the index of the named section in our own array, which contains |
53 text, data and bss in that order. Return PE_SECTION_INDEX_INVALID | 70 text, data and bss in that order. Return PE_SECTION_INDEX_INVALID |
54 if passed an unrecognised section name. */ | 71 if passed an unrecognised section name. */ |
(...skipping 11 matching lines...) Expand all Loading... |
66 return PE_SECTION_INDEX_DATA; | 83 return PE_SECTION_INDEX_DATA; |
67 } | 84 } |
68 | 85 |
69 else if (strcmp (section_name, ".bss") == 0) | 86 else if (strcmp (section_name, ".bss") == 0) |
70 { | 87 { |
71 return PE_SECTION_INDEX_BSS; | 88 return PE_SECTION_INDEX_BSS; |
72 } | 89 } |
73 | 90 |
74 else | 91 else |
75 { | 92 { |
error: old chunk mismatch |
None
OLD | NEW |