From: Richard Henderson Date: Sat, 5 Jun 1999 18:19:09 +0000 (+0000) Subject: * dwarf2dbg.c (*): Convert to K&R + prototypes. X-Git-Tag: gdb-1999-06-07~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58b5739a4e998799ab1b3bf8bb7720d176f50b72;p=external%2Fbinutils.git * dwarf2dbg.c (*): Convert to K&R + prototypes. (dwarf2_gen_line_info): Kill unused variables. (dwarf2_finish): Likewise. (dwarf2_where): Likewise. (dwarf2_directive_file): If we've only got a string, hand off to s_app_file. * ecoff.c: Move the include of ecoff.h. * symbols.h (S_IS_FUNCTION): Prototype. * read.c (LEX_HASH): Supply a default. (lex_type): Use it. (s_globl): Update `c' after skipping whitespace. * read.h (LEX_END_NAME, is_name_ender): New. * expr.c (get_symbol_end): Respect it. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 684f4d9..7b0dae0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,20 @@ +1999-06-05 Richard Henderson + + * dwarf2dbg.c (*): Convert to K&R + prototypes. + (dwarf2_gen_line_info): Kill unused variables. + (dwarf2_finish): Likewise. + (dwarf2_where): Likewise. + (dwarf2_directive_file): If we've only got a string, + hand off to s_app_file. + * ecoff.c: Move the include of ecoff.h. + * symbols.h (S_IS_FUNCTION): Prototype. + + * read.c (LEX_HASH): Supply a default. + (lex_type): Use it. + (s_globl): Update `c' after skipping whitespace. + * read.h (LEX_END_NAME, is_name_ender): New. + * expr.c (get_symbol_end): Respect it. + 1999-06-04 Mark Klein * config/tc-hppa.c (md_begin): Convert local symbol dummy_symbol diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 3c223e8..c23b7f6 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -146,12 +146,27 @@ ls = }, }; + +/* Function prototypes: */ +static void out_uleb128 PARAMS ((bfd_vma)); +static void out_sleb128 PARAMS ((bfd_signed_vma)); +static void gen_addr_line PARAMS ((int, bfd_vma)); +static void reset_state_machine PARAMS ((void)); +static void out_set_addr PARAMS ((bfd_vma)); +static void out_end_sequence PARAMS ((void)); +static int get_filenum PARAMS ((int, char *)); +static void gen_dir_list PARAMS ((void)); +static void gen_file_list PARAMS ((void)); +static void print_stats PARAMS ((unsigned long)); + + #define out_byte(byte) FRAG_APPEND_1_CHAR(byte) #define out_opcode(opc) (out_byte ((opc)), ++ls.opcode_hist[(opc) & 0xff]) /* Output an unsigned "little-endian base 128" number. */ static void -out_uleb128 (bfd_vma value) +out_uleb128 (value) + bfd_vma value; { unsigned char byte, more = 0x80; @@ -168,7 +183,8 @@ out_uleb128 (bfd_vma value) /* Output a signed "little-endian base 128" number. */ static void -out_sleb128 (bfd_signed_vma value) +out_sleb128 (value) + bfd_signed_vma value; { unsigned char byte, more = 0x80; @@ -188,7 +204,9 @@ out_sleb128 (bfd_signed_vma value) Note that the line skip is signed, whereas the address skip is unsigned. */ static void -gen_addr_line (int line_delta, bfd_vma addr_delta) +gen_addr_line (line_delta, addr_delta) + int line_delta; + bfd_vma addr_delta; { unsigned int tmp, opcode; @@ -231,7 +249,7 @@ gen_addr_line (int line_delta, bfd_vma addr_delta) } static void -reset_state_machine (void) +reset_state_machine () { static const struct dwarf2_sm initial_state = { INITIAL_STATE }; @@ -240,7 +258,8 @@ reset_state_machine (void) /* Set an absolute address (may results in a relocation entry): */ static void -out_set_addr (bfd_vma addr) +out_set_addr (addr) + bfd_vma addr; { subsegT saved_subseg; segT saved_seg; @@ -268,7 +287,7 @@ out_set_addr (bfd_vma addr) /* Emit DW_LNS_end_sequence and reset state machine. Does not preserve the current segment/sub-segment! */ static void -out_end_sequence (void) +out_end_sequence () { bfd_vma addr, delta; @@ -308,7 +327,9 @@ out_end_sequence (void) precedence. If the filename cannot be found, it is added to the filetable the filenumber for the new entry is returned. */ static int -get_filenum (int filenum, char *file) +get_filenum (filenum, file) + int filenum; + char *file; { int i, last = filenum - 1; char char0 = file[0]; @@ -344,16 +365,17 @@ get_filenum (int filenum, char *file) } void -dwarf2_gen_line_info (bfd_vma addr, struct dwarf2_line_info *l) +dwarf2_gen_line_info (addr, l) + bfd_vma addr; + struct dwarf2_line_info *l; { unsigned int filenum = l->filenum; unsigned int any_output = 0; subsegT saved_subseg; segT saved_seg; - char *frag; if (flag_debug) - fprintf (stderr, "line: addr %llx file `%s' line %u col %u flags %lx\n", + fprintf (stderr, "line: addr %llx file `%s' line %u col %u flags %x\n", (long long) addr, l->filename, l->line, l->column, l->flags); if (filenum > 0 && !l->filename) @@ -452,7 +474,7 @@ dwarf2_gen_line_info (bfd_vma addr, struct dwarf2_line_info *l) } static void -gen_dir_list (void) +gen_dir_list () { char *str, *slash, *dir_list, *dp, *cp; int i, j, num_dirs; @@ -492,7 +514,7 @@ gen_dir_list (void) } static void -gen_file_list (void) +gen_file_list () { size_t size; char *cp; @@ -511,8 +533,9 @@ gen_file_list (void) out_byte (0); /* terminate filename list */ } -void -print_stats (unsigned long total_size) +static void +print_stats (total_size) + unsigned long total_size; { static const char *opc_name[] = { @@ -554,10 +577,10 @@ print_stats (unsigned long total_size) } void -dwarf2_finish (void) +dwarf2_finish () { - bfd_vma addr, body_size, total_size, prolog_size; - subsegT saved_subseg, line_prolog; + bfd_vma body_size, total_size, prolog_size; + subsegT saved_subseg; segT saved_seg; char *cp; @@ -614,10 +637,19 @@ dwarf2_finish (void) } void -dwarf2_directive_file (int dummy) +dwarf2_directive_file (dummy) + int dummy; { int len; + /* Continue to accept a bare string and pass it off. */ + SKIP_WHITESPACE (); + if (*input_line_pointer == '"') + { + s_app_file (0); + return; + } + ls.any_dwarf2_directives = 1; if (debug_type == DEBUG_NONE) @@ -632,7 +664,8 @@ dwarf2_directive_file (int dummy) } void -dwarf2_directive_loc (int dummy) +dwarf2_directive_loc (dummy) + int dummy; { ls.any_dwarf2_directives = 1; @@ -652,14 +685,13 @@ dwarf2_directive_loc (int dummy) } void -dwarf2_where (struct dwarf2_line_info *line) +dwarf2_where (line) + struct dwarf2_line_info *line; { if (ls.any_dwarf2_directives) *line = ls.current; else { - char *filename; - as_where (&line->filename, &line->line); line->filenum = 0; line->column = 0; diff --git a/gas/ecoff.c b/gas/ecoff.c index 310d667..436c8c4 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -28,11 +28,12 @@ ECOFF debugging information (e.g., MIPS ECOFF, MIPS ELF, Alpha ECOFF). */ +#include "ecoff.h" + #ifdef ECOFF_DEBUGGING #include "coff/internal.h" #include "coff/symconst.h" -#include "ecoff.h" #include "aout/stab_gnu.h" #include diff --git a/gas/expr.c b/gas/expr.c index 6e74bfa..c50e2c2 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -1863,9 +1863,13 @@ get_symbol_end () /* We accept \001 in a name in case this is being called with a constructed string. */ if (is_name_beginner (c = *input_line_pointer++) || c == '\001') - while (is_part_of_name (c = *input_line_pointer++) - || c == '\001') - ; + { + while (is_part_of_name (c = *input_line_pointer++) + || c == '\001') + ; + if (is_name_ender (c)) + c = *input_line_pointer++; + } *--input_line_pointer = 0; return (c); } diff --git a/gas/read.c b/gas/read.c index ecf2c57..6d34511 100644 --- a/gas/read.c +++ b/gas/read.c @@ -89,6 +89,10 @@ die horribly; #define LEX_QM 0 #endif +#ifndef LEX_HASH +#define LEX_HASH 0 +#endif + #ifndef LEX_DOLLAR /* The a29k assembler does not permits labels to start with $. */ #define LEX_DOLLAR 3 @@ -104,7 +108,7 @@ char lex_type[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */ - 0, 0, 0, 0, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */ + 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */ LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */ @@ -1789,9 +1793,11 @@ s_globl (ignore) name = input_line_pointer; c = get_symbol_end (); symbolP = symbol_find_or_make (name); + S_SET_EXTERNAL (symbolP); + *input_line_pointer = c; SKIP_WHITESPACE (); - S_SET_EXTERNAL (symbolP); + c = *input_line_pointer; if (c == ',') { input_line_pointer++; diff --git a/gas/read.h b/gas/read.h index 61e2017..ae3b103 100644 --- a/gas/read.h +++ b/gas/read.h @@ -35,11 +35,14 @@ extern char *input_line_pointer;/* -> char we are parsing now. */ #define LEX_NAME (1) /* may continue a name */ #define LEX_BEGIN_NAME (2) /* may begin a name */ +#define LEX_END_NAME (4) /* ends a name */ #define is_name_beginner(c) \ ( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME ) #define is_part_of_name(c) \ ( lex_type[(unsigned char) (c)] & LEX_NAME ) +#define is_name_ender(c) \ + ( lex_type[(unsigned char) (c)] & LEX_END_NAME ) #ifndef is_a_char #define CHAR_MASK (0xff) diff --git a/gas/symbols.h b/gas/symbols.h index bd7604e..f3b73af 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -84,6 +84,7 @@ extern valueT S_GET_VALUE PARAMS ((symbolS *)); extern void S_SET_VALUE PARAMS ((symbolS *, valueT)); #ifdef BFD_ASSEMBLER +extern int S_IS_FUNCTION PARAMS ((symbolS *)); extern int S_IS_EXTERNAL PARAMS ((symbolS *)); extern int S_IS_WEAK PARAMS ((symbolS *)); extern int S_IS_COMMON PARAMS ((symbolS *));