| OLD | NEW |
| 1 /* | 1 /* |
| 2 * CodeView debugging format - type information | 2 * CodeView debugging format - type 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-type.c 2130 2008-10-07 05:38:11Z peter $"); | |
| 32 | 31 |
| 33 #include <libyasm.h> | 32 #include <libyasm.h> |
| 34 | 33 |
| 35 #include "cv-dbgfmt.h" | 34 #include "cv-dbgfmt.h" |
| 36 | 35 |
| 37 enum cv_reservedtype { | 36 enum cv_reservedtype { |
| 38 /* Bitfields representation - type */ | 37 /* Bitfields representation - type */ |
| 39 CV_TYPE_SPECIAL = 0x00<<4, /* Special */ | 38 CV_TYPE_SPECIAL = 0x00<<4, /* Special */ |
| 40 CV_TYPE_SIGNED = 0x01<<4, /* Signed integral value */ | 39 CV_TYPE_SIGNED = 0x01<<4, /* Signed integral value */ |
| 41 CV_TYPE_UNSIGNED = 0x02<<4, /* Unsigned integral value */ | 40 CV_TYPE_UNSIGNED = 0x02<<4, /* Unsigned integral value */ |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 size_t num_leaves; | 475 size_t num_leaves; |
| 477 /*@null@*/ /*@only@*/ cv_leaf **leaves; | 476 /*@null@*/ /*@only@*/ cv_leaf **leaves; |
| 478 } cv_type; | 477 } cv_type; |
| 479 | 478 |
| 480 /* Bytecode callback function prototypes */ | 479 /* Bytecode callback function prototypes */ |
| 481 static void cv_type_bc_destroy(void *contents); | 480 static void cv_type_bc_destroy(void *contents); |
| 482 static void cv_type_bc_print(const void *contents, FILE *f, int indent_level); | 481 static void cv_type_bc_print(const void *contents, FILE *f, int indent_level); |
| 483 static int cv_type_bc_calc_len | 482 static int cv_type_bc_calc_len |
| 484 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); | 483 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); |
| 485 static int cv_type_bc_tobytes | 484 static int cv_type_bc_tobytes |
| 486 (yasm_bytecode *bc, unsigned char **bufp, void *d, | 485 (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, |
| 487 yasm_output_value_func output_value, | 486 yasm_output_value_func output_value, |
| 488 /*@null@*/ yasm_output_reloc_func output_reloc); | 487 /*@null@*/ yasm_output_reloc_func output_reloc); |
| 489 | 488 |
| 490 /* Bytecode callback structures */ | 489 /* Bytecode callback structures */ |
| 491 static const yasm_bytecode_callback cv_type_bc_callback = { | 490 static const yasm_bytecode_callback cv_type_bc_callback = { |
| 492 cv_type_bc_destroy, | 491 cv_type_bc_destroy, |
| 493 cv_type_bc_print, | 492 cv_type_bc_print, |
| 494 yasm_bc_finalize_common, | 493 yasm_bc_finalize_common, |
| 495 NULL, | 494 NULL, |
| 496 cv_type_bc_calc_len, | 495 cv_type_bc_calc_len, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 bc->len += cv_leaf_size(type->leaves[i]); | 724 bc->len += cv_leaf_size(type->leaves[i]); |
| 726 | 725 |
| 727 /* Pad to multiple of 4 */ | 726 /* Pad to multiple of 4 */ |
| 728 if (bc->len & 0x3) | 727 if (bc->len & 0x3) |
| 729 bc->len += 4-(bc->len & 0x3); | 728 bc->len += 4-(bc->len & 0x3); |
| 730 | 729 |
| 731 return 0; | 730 return 0; |
| 732 } | 731 } |
| 733 | 732 |
| 734 static int | 733 static int |
| 735 cv_type_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, | 734 cv_type_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, |
| 735 unsigned char *bufstart, void *d, |
| 736 yasm_output_value_func output_value, | 736 yasm_output_value_func output_value, |
| 737 yasm_output_reloc_func output_reloc) | 737 yasm_output_reloc_func output_reloc) |
| 738 { | 738 { |
| 739 yasm_object *object = yasm_section_get_object(bc->section); | 739 yasm_object *object = yasm_section_get_object(bc->section); |
| 740 cv_type *type = (cv_type *)bc->contents; | 740 cv_type *type = (cv_type *)bc->contents; |
| 741 unsigned char *buf = *bufp; | 741 unsigned char *buf = *bufp; |
| 742 yasm_intnum *cval; | 742 yasm_intnum *cval; |
| 743 size_t i; | 743 size_t i; |
| 744 unsigned long reclen = bc->len - 2; | 744 unsigned long reclen = bc->len - 2; |
| 745 | 745 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 769 YASM_WRITE_8(buf, CV_LF_PAD1); | 769 YASM_WRITE_8(buf, CV_LF_PAD1); |
| 770 case 0: | 770 case 0: |
| 771 break; | 771 break; |
| 772 } | 772 } |
| 773 | 773 |
| 774 *bufp = buf; | 774 *bufp = buf; |
| 775 | 775 |
| 776 yasm_intnum_destroy(cval); | 776 yasm_intnum_destroy(cval); |
| 777 return 0; | 777 return 0; |
| 778 } | 778 } |
| OLD | NEW |