* 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.
This commit is contained in:
Richard Henderson 1999-06-05 18:19:09 +00:00
parent 993142d5a4
commit 58b5739a4e
7 changed files with 92 additions and 28 deletions

View File

@ -1,3 +1,20 @@
1999-06-05 Richard Henderson <rth@cygnus.com>
* 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 <mklein@dis.com> 1999-06-04 Mark Klein <mklein@dis.com>
* config/tc-hppa.c (md_begin): Convert local symbol dummy_symbol * config/tc-hppa.c (md_begin): Convert local symbol dummy_symbol

View File

@ -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_byte(byte) FRAG_APPEND_1_CHAR(byte)
#define out_opcode(opc) (out_byte ((opc)), ++ls.opcode_hist[(opc) & 0xff]) #define out_opcode(opc) (out_byte ((opc)), ++ls.opcode_hist[(opc) & 0xff])
/* Output an unsigned "little-endian base 128" number. */ /* Output an unsigned "little-endian base 128" number. */
static void static void
out_uleb128 (bfd_vma value) out_uleb128 (value)
bfd_vma value;
{ {
unsigned char byte, more = 0x80; unsigned char byte, more = 0x80;
@ -168,7 +183,8 @@ out_uleb128 (bfd_vma value)
/* Output a signed "little-endian base 128" number. */ /* Output a signed "little-endian base 128" number. */
static void static void
out_sleb128 (bfd_signed_vma value) out_sleb128 (value)
bfd_signed_vma value;
{ {
unsigned char byte, more = 0x80; 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 Note that the line skip is signed, whereas the address skip is
unsigned. */ unsigned. */
static void 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; unsigned int tmp, opcode;
@ -231,7 +249,7 @@ gen_addr_line (int line_delta, bfd_vma addr_delta)
} }
static void static void
reset_state_machine (void) reset_state_machine ()
{ {
static const struct dwarf2_sm initial_state = { INITIAL_STATE }; 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): */ /* Set an absolute address (may results in a relocation entry): */
static void static void
out_set_addr (bfd_vma addr) out_set_addr (addr)
bfd_vma addr;
{ {
subsegT saved_subseg; subsegT saved_subseg;
segT saved_seg; segT saved_seg;
@ -268,7 +287,7 @@ out_set_addr (bfd_vma addr)
/* Emit DW_LNS_end_sequence and reset state machine. Does not /* Emit DW_LNS_end_sequence and reset state machine. Does not
preserve the current segment/sub-segment! */ preserve the current segment/sub-segment! */
static void static void
out_end_sequence (void) out_end_sequence ()
{ {
bfd_vma addr, delta; bfd_vma addr, delta;
@ -308,7 +327,9 @@ out_end_sequence (void)
precedence. If the filename cannot be found, it is added to the precedence. If the filename cannot be found, it is added to the
filetable the filenumber for the new entry is returned. */ filetable the filenumber for the new entry is returned. */
static int static int
get_filenum (int filenum, char *file) get_filenum (filenum, file)
int filenum;
char *file;
{ {
int i, last = filenum - 1; int i, last = filenum - 1;
char char0 = file[0]; char char0 = file[0];
@ -344,16 +365,17 @@ get_filenum (int filenum, char *file)
} }
void 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 filenum = l->filenum;
unsigned int any_output = 0; unsigned int any_output = 0;
subsegT saved_subseg; subsegT saved_subseg;
segT saved_seg; segT saved_seg;
char *frag;
if (flag_debug) 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); (long long) addr, l->filename, l->line, l->column, l->flags);
if (filenum > 0 && !l->filename) if (filenum > 0 && !l->filename)
@ -452,7 +474,7 @@ dwarf2_gen_line_info (bfd_vma addr, struct dwarf2_line_info *l)
} }
static void static void
gen_dir_list (void) gen_dir_list ()
{ {
char *str, *slash, *dir_list, *dp, *cp; char *str, *slash, *dir_list, *dp, *cp;
int i, j, num_dirs; int i, j, num_dirs;
@ -492,7 +514,7 @@ gen_dir_list (void)
} }
static void static void
gen_file_list (void) gen_file_list ()
{ {
size_t size; size_t size;
char *cp; char *cp;
@ -511,8 +533,9 @@ gen_file_list (void)
out_byte (0); /* terminate filename list */ out_byte (0); /* terminate filename list */
} }
void static void
print_stats (unsigned long total_size) print_stats (total_size)
unsigned long total_size;
{ {
static const char *opc_name[] = static const char *opc_name[] =
{ {
@ -554,10 +577,10 @@ print_stats (unsigned long total_size)
} }
void void
dwarf2_finish (void) dwarf2_finish ()
{ {
bfd_vma addr, body_size, total_size, prolog_size; bfd_vma body_size, total_size, prolog_size;
subsegT saved_subseg, line_prolog; subsegT saved_subseg;
segT saved_seg; segT saved_seg;
char *cp; char *cp;
@ -614,10 +637,19 @@ dwarf2_finish (void)
} }
void void
dwarf2_directive_file (int dummy) dwarf2_directive_file (dummy)
int dummy;
{ {
int len; 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; ls.any_dwarf2_directives = 1;
if (debug_type == DEBUG_NONE) if (debug_type == DEBUG_NONE)
@ -632,7 +664,8 @@ dwarf2_directive_file (int dummy)
} }
void void
dwarf2_directive_loc (int dummy) dwarf2_directive_loc (dummy)
int dummy;
{ {
ls.any_dwarf2_directives = 1; ls.any_dwarf2_directives = 1;
@ -652,14 +685,13 @@ dwarf2_directive_loc (int dummy)
} }
void void
dwarf2_where (struct dwarf2_line_info *line) dwarf2_where (line)
struct dwarf2_line_info *line;
{ {
if (ls.any_dwarf2_directives) if (ls.any_dwarf2_directives)
*line = ls.current; *line = ls.current;
else else
{ {
char *filename;
as_where (&line->filename, &line->line); as_where (&line->filename, &line->line);
line->filenum = 0; line->filenum = 0;
line->column = 0; line->column = 0;

View File

@ -28,11 +28,12 @@
ECOFF debugging information (e.g., MIPS ECOFF, MIPS ELF, Alpha ECOFF debugging information (e.g., MIPS ECOFF, MIPS ELF, Alpha
ECOFF). */ ECOFF). */
#include "ecoff.h"
#ifdef ECOFF_DEBUGGING #ifdef ECOFF_DEBUGGING
#include "coff/internal.h" #include "coff/internal.h"
#include "coff/symconst.h" #include "coff/symconst.h"
#include "ecoff.h"
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
#include <ctype.h> #include <ctype.h>

View File

@ -1863,9 +1863,13 @@ get_symbol_end ()
/* We accept \001 in a name in case this is being called with a /* We accept \001 in a name in case this is being called with a
constructed string. */ constructed string. */
if (is_name_beginner (c = *input_line_pointer++) || c == '\001') 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; *--input_line_pointer = 0;
return (c); return (c);
} }

View File

@ -89,6 +89,10 @@ die horribly;
#define LEX_QM 0 #define LEX_QM 0
#endif #endif
#ifndef LEX_HASH
#define LEX_HASH 0
#endif
#ifndef LEX_DOLLAR #ifndef LEX_DOLLAR
/* The a29k assembler does not permits labels to start with $. */ /* The a29k assembler does not permits labels to start with $. */
#define LEX_DOLLAR 3 #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, /* @ABCDEFGHIJKLMNO */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */ 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:;<=>? */ 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 */ 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[\]^_ */ 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; name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
S_SET_EXTERNAL (symbolP);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
S_SET_EXTERNAL (symbolP); c = *input_line_pointer;
if (c == ',') if (c == ',')
{ {
input_line_pointer++; input_line_pointer++;

View File

@ -35,11 +35,14 @@ extern char *input_line_pointer;/* -> char we are parsing now. */
#define LEX_NAME (1) /* may continue a name */ #define LEX_NAME (1) /* may continue a name */
#define LEX_BEGIN_NAME (2) /* may begin a name */ #define LEX_BEGIN_NAME (2) /* may begin a name */
#define LEX_END_NAME (4) /* ends a name */
#define is_name_beginner(c) \ #define is_name_beginner(c) \
( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME ) ( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME )
#define is_part_of_name(c) \ #define is_part_of_name(c) \
( lex_type[(unsigned char) (c)] & LEX_NAME ) ( lex_type[(unsigned char) (c)] & LEX_NAME )
#define is_name_ender(c) \
( lex_type[(unsigned char) (c)] & LEX_END_NAME )
#ifndef is_a_char #ifndef is_a_char
#define CHAR_MASK (0xff) #define CHAR_MASK (0xff)

View File

@ -84,6 +84,7 @@ extern valueT S_GET_VALUE PARAMS ((symbolS *));
extern void S_SET_VALUE PARAMS ((symbolS *, valueT)); extern void S_SET_VALUE PARAMS ((symbolS *, valueT));
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
extern int S_IS_FUNCTION PARAMS ((symbolS *));
extern int S_IS_EXTERNAL PARAMS ((symbolS *)); extern int S_IS_EXTERNAL PARAMS ((symbolS *));
extern int S_IS_WEAK PARAMS ((symbolS *)); extern int S_IS_WEAK PARAMS ((symbolS *));
extern int S_IS_COMMON PARAMS ((symbolS *)); extern int S_IS_COMMON PARAMS ((symbolS *));