Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/yasm/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c

Issue 11364046: Update Yasm to 1.2.0 (Yasm Part 1/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Stabs debugging format 2 * Stabs debugging format
3 * 3 *
4 * Copyright (C) 2003-2007 Michael Urman 4 * Copyright (C) 2003-2007 Michael Urman
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.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 #include <util.h> 27 #include <util.h>
28 /*@unused@*/ RCSID("$Id: stabs-dbgfmt.c 2130 2008-10-07 05:38:11Z peter $");
29 28
30 #include <libyasm.h> 29 #include <libyasm.h>
31 30
32 typedef enum { 31 typedef enum {
33 N_UNDF = 0x00, /* Undefined */ 32 N_UNDF = 0x00, /* Undefined */
34 N_GSYM = 0x20, /* Global symbol */ 33 N_GSYM = 0x20, /* Global symbol */
35 N_FNAME = 0x22, /* Function name (BSD Fortran) */ 34 N_FNAME = 0x22, /* Function name (BSD Fortran) */
36 N_FUN = 0x24, /* Function name or Text segment variable */ 35 N_FUN = 0x24, /* Function name or Text segment variable */
37 N_STSYM = 0x26, /* Data segment file-scope variable */ 36 N_STSYM = 0x26, /* Data segment file-scope variable */
38 N_LCSYM = 0x28, /* BSS segment file-scope variable */ 37 N_LCSYM = 0x28, /* BSS segment file-scope variable */
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } stabs_stab; 111 } stabs_stab;
113 112
114 /* Bytecode callback function prototypes */ 113 /* Bytecode callback function prototypes */
115 114
116 static void stabs_bc_str_destroy(void *contents); 115 static void stabs_bc_str_destroy(void *contents);
117 static void stabs_bc_str_print(const void *contents, FILE *f, int 116 static void stabs_bc_str_print(const void *contents, FILE *f, int
118 indent_level); 117 indent_level);
119 static int stabs_bc_str_calc_len 118 static int stabs_bc_str_calc_len
120 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); 119 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data);
121 static int stabs_bc_str_tobytes 120 static int stabs_bc_str_tobytes
122 (yasm_bytecode *bc, unsigned char **bufp, void *d, 121 (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d,
123 yasm_output_value_func output_value, 122 yasm_output_value_func output_value,
124 /*@null@*/ yasm_output_reloc_func output_reloc); 123 /*@null@*/ yasm_output_reloc_func output_reloc);
125 124
126 static void stabs_bc_stab_destroy(void *contents); 125 static void stabs_bc_stab_destroy(void *contents);
127 static void stabs_bc_stab_print(const void *contents, FILE *f, int 126 static void stabs_bc_stab_print(const void *contents, FILE *f, int
128 indent_level); 127 indent_level);
129 static int stabs_bc_stab_calc_len 128 static int stabs_bc_stab_calc_len
130 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); 129 (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data);
131 static int stabs_bc_stab_tobytes 130 static int stabs_bc_stab_tobytes
132 (yasm_bytecode *bc, unsigned char **bufp, void *d, 131 (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d,
133 yasm_output_value_func output_value, 132 yasm_output_value_func output_value,
134 /*@null@*/ yasm_output_reloc_func output_reloc); 133 /*@null@*/ yasm_output_reloc_func output_reloc);
135 134
136 /* Bytecode callback structures */ 135 /* Bytecode callback structures */
137 136
138 static const yasm_bytecode_callback stabs_bc_str_callback = { 137 static const yasm_bytecode_callback stabs_bc_str_callback = {
139 stabs_bc_str_destroy, 138 stabs_bc_str_destroy,
140 stabs_bc_str_print, 139 stabs_bc_str_print,
141 yasm_bc_finalize_common, 140 yasm_bc_finalize_common,
142 NULL, 141 NULL,
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 stab->other = 0; 397 stab->other = 0;
399 if (info.stabcount > 0xffff) { 398 if (info.stabcount > 0xffff) {
400 yasm_warn_set(YASM_WARN_GENERAL, N_("over 65535 stabs")); 399 yasm_warn_set(YASM_WARN_GENERAL, N_("over 65535 stabs"));
401 yasm_errwarn_propagate(errwarns, 0); 400 yasm_errwarn_propagate(errwarns, 0);
402 stab->desc = 0xffff; 401 stab->desc = 0xffff;
403 } else 402 } else
404 stab->desc = (unsigned short)info.stabcount; 403 stab->desc = (unsigned short)info.stabcount;
405 } 404 }
406 405
407 static int 406 static int
408 stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, 407 stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp,
408 unsigned char *bufstart, void *d,
409 yasm_output_value_func output_value, 409 yasm_output_value_func output_value,
410 yasm_output_reloc_func output_reloc) 410 yasm_output_reloc_func output_reloc)
411 { 411 {
412 /* This entire function, essentially the core of rendering stabs to a file, 412 /* This entire function, essentially the core of rendering stabs to a file,
413 * needs to become endian aware. Size appears not to be an issue, as known 413 * needs to become endian aware. Size appears not to be an issue, as known
414 * 64-bit systems use truncated values in 32-bit fields. */ 414 * 64-bit systems use truncated values in 32-bit fields. */
415 415
416 const stabs_stab *stab = (const stabs_stab *)bc->contents; 416 const stabs_stab *stab = (const stabs_stab *)bc->contents;
417 unsigned char *buf = *bufp; 417 unsigned char *buf = *bufp;
418 418
(...skipping 13 matching lines...) Expand all
432 } 432 }
433 else { 433 else {
434 YASM_WRITE_32_L(buf, stab->value); 434 YASM_WRITE_32_L(buf, stab->value);
435 } 435 }
436 436
437 *bufp = buf; 437 *bufp = buf;
438 return 0; 438 return 0;
439 } 439 }
440 440
441 static int 441 static int
442 stabs_bc_str_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, 442 stabs_bc_str_tobytes(yasm_bytecode *bc, unsigned char **bufp,
443 unsigned char *bufstart, void *d,
443 yasm_output_value_func output_value, 444 yasm_output_value_func output_value,
444 yasm_output_reloc_func output_reloc) 445 yasm_output_reloc_func output_reloc)
445 { 446 {
446 const char *str = (const char *)bc->contents; 447 const char *str = (const char *)bc->contents;
447 unsigned char *buf = *bufp; 448 unsigned char *buf = *bufp;
448 449
449 strcpy((char *)buf, str); 450 strcpy((char *)buf, str);
450 buf += strlen(str)+1; 451 buf += strlen(str)+1;
451 452
452 *bufp = buf; 453 *bufp = buf;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 502
502 /* Define dbgfmt structure -- see dbgfmt.h for details */ 503 /* Define dbgfmt structure -- see dbgfmt.h for details */
503 yasm_dbgfmt_module yasm_stabs_LTX_dbgfmt = { 504 yasm_dbgfmt_module yasm_stabs_LTX_dbgfmt = {
504 "Stabs debugging format", 505 "Stabs debugging format",
505 "stabs", 506 "stabs",
506 NULL, /* no directives */ 507 NULL, /* no directives */
507 stabs_dbgfmt_create, 508 stabs_dbgfmt_create,
508 stabs_dbgfmt_destroy, 509 stabs_dbgfmt_destroy,
509 stabs_dbgfmt_generate 510 stabs_dbgfmt_generate
510 }; 511 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698