OLD | NEW |
1 /* | 1 /* |
2 * CodeView debugging format - symbol and line information | 2 * CodeView debugging format - symbol and line information |
3 * | 3 * |
4 * Copyright (C) 2006-2007 Peter Johnson | 4 * Copyright (C) 2006-2007 Peter Johnson |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 10 matching lines...) Expand all Loading... |
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE | 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE |
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 * POSSIBILITY OF SUCH DAMAGE. | 28 * POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 #include <util.h> | 30 #include <util.h> |
31 /*@unused@*/ RCSID("$Id: cv-symline.c 2130 2008-10-07 05:38:11Z peter $"); | 31 /*@unused@*/ RCSID("$Id: cv-symline.c 2258 2010-01-03 01:04:18Z peter $"); |
32 | 32 |
33 #include <libyasm.h> | 33 #include <libyasm.h> |
34 | 34 |
35 #include "cv-dbgfmt.h" | 35 #include "cv-dbgfmt.h" |
36 | 36 |
37 enum cv8_symheadtype { | 37 enum cv8_symheadtype { |
38 CV8_DEBUG_SYMS = 0xF1, /* CV5 symbol information */ | 38 CV8_DEBUG_SYMS = 0xF1, /* CV5 symbol information */ |
39 CV8_LINE_NUMS = 0xF2, /* line numbers for a section */ | 39 CV8_LINE_NUMS = 0xF2, /* line numbers for a section */ |
40 CV8_FILE_STRTAB = 0xF3, /* filename string table */ | 40 CV8_FILE_STRTAB = 0xF3, /* filename string table */ |
41 CV8_FILE_INFO = 0xF4 /* source file info */ | 41 CV8_FILE_INFO = 0xF4 /* source file info */ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 cv8_linepair pairs[126]; | 127 cv8_linepair pairs[126]; |
128 size_t num_pairs; | 128 size_t num_pairs; |
129 } cv8_lineset; | 129 } cv8_lineset; |
130 | 130 |
131 typedef struct cv8_lineinfo { | 131 typedef struct cv8_lineinfo { |
132 STAILQ_ENTRY(cv8_lineinfo) link; | 132 STAILQ_ENTRY(cv8_lineinfo) link; |
133 const cv_filename *fn; /* filename associated with line numbers */ | 133 const cv_filename *fn; /* filename associated with line numbers */ |
134 yasm_section *sect; /* section line numbers are for */ | 134 yasm_section *sect; /* section line numbers are for */ |
135 yasm_symrec *sectsym; /* symbol for beginning of sect */ | 135 yasm_symrec *sectsym; /* symbol for beginning of sect */ |
136 unsigned long num_linenums; | 136 unsigned long num_linenums; |
137 STAILQ_HEAD(, cv8_lineset) linesets; | 137 STAILQ_HEAD(cv8_lineset_head, cv8_lineset) linesets; |
138 } cv8_lineinfo; | 138 } cv8_lineinfo; |
139 | 139 |
140 /* Symbols use a bit of meta-programming to encode formats: each character | 140 /* Symbols use a bit of meta-programming to encode formats: each character |
141 * of format represents the output generated, as follows: | 141 * of format represents the output generated, as follows: |
142 * 'b' : 1 byte value (integer) | 142 * 'b' : 1 byte value (integer) |
143 * 'h' : 2 byte value (integer) | 143 * 'h' : 2 byte value (integer) |
144 * 'w' : 4 byte value (integer) | 144 * 'w' : 4 byte value (integer) |
145 * 'Y' : symrec SECREL+SECTION (pointer) | 145 * 'Y' : symrec SECREL+SECTION (pointer) |
146 * 'T' : type index (integer) | 146 * 'T' : type index (integer) |
147 * 'S' : length-prefixed string (pointer) | 147 * 'S' : length-prefixed string (pointer) |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return bc; | 412 return bc; |
413 } | 413 } |
414 | 414 |
415 typedef struct cv_line_info { | 415 typedef struct cv_line_info { |
416 yasm_section *debug_symline; | 416 yasm_section *debug_symline; |
417 yasm_object *object; | 417 yasm_object *object; |
418 yasm_dbgfmt_cv *dbgfmt_cv; | 418 yasm_dbgfmt_cv *dbgfmt_cv; |
419 yasm_linemap *linemap; | 419 yasm_linemap *linemap; |
420 yasm_errwarns *errwarns; | 420 yasm_errwarns *errwarns; |
421 unsigned int num_lineinfos; | 421 unsigned int num_lineinfos; |
422 STAILQ_HEAD(, cv8_lineinfo) cv8_lineinfos; | 422 STAILQ_HEAD(cv8_lineinfo_head, cv8_lineinfo) cv8_lineinfos; |
423 /*@null@*/ cv8_lineinfo *cv8_cur_li; | 423 /*@null@*/ cv8_lineinfo *cv8_cur_li; |
424 /*@null@*/ cv8_lineset *cv8_cur_ls; | 424 /*@null@*/ cv8_lineset *cv8_cur_ls; |
425 } cv_line_info; | 425 } cv_line_info; |
426 | 426 |
427 static int | 427 static int |
428 cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) | 428 cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) |
429 { | 429 { |
430 cv_line_info *info = (cv_line_info *)d; | 430 cv_line_info *info = (cv_line_info *)d; |
431 yasm_dbgfmt_cv *dbgfmt_cv = info->dbgfmt_cv; | 431 yasm_dbgfmt_cv *dbgfmt_cv = info->dbgfmt_cv; |
432 size_t i; | 432 size_t i; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 yasm_internal_error(N_("unknown leaf format character")); | 1088 yasm_internal_error(N_("unknown leaf format character")); |
1089 } | 1089 } |
1090 ch++; | 1090 ch++; |
1091 } | 1091 } |
1092 | 1092 |
1093 *bufp = buf; | 1093 *bufp = buf; |
1094 | 1094 |
1095 yasm_intnum_destroy(cval); | 1095 yasm_intnum_destroy(cval); |
1096 return 0; | 1096 return 0; |
1097 } | 1097 } |
OLD | NEW |