Add --gdwarf2 support to ARM toolchain

This commit is contained in:
Nick Clifton 2000-10-25 19:15:34 +00:00
parent c56a7a95d1
commit 85a3969410
11 changed files with 433 additions and 377 deletions

View File

@ -1,3 +1,29 @@
2000-10-25 Nick Clifton <nickc@redhat.com>
* dwarf2out.c (dwarf2_generate_asm_lineno): New function: Generate
a DWARF2 line number information sequence.
*dwarf2out.h: Add prototype for dwarf2_generate_asm_lineno.
* read.c (generate_lineno_debug): Update comment describing why
DWARF2 line number debug information is not generated
automatically by this function.
* doc/as.texinfo: Note that --gdwarf2 only works on some targets,
not all.
* config/tc-arm.h (md_end): Define.
(DWARF2_LINE_MIN_INSN_LENGTH): Define.
* config/tc-arm.c (output_inst): Call dwarf2_generate_asm_lineno
if generating DWARF2 line numbers.
(arm_end_of_source): New function. Call dwarf2_finish if
necessary.
* config/tc-hppa.c (md_assemble): Use dwarf2_generate_asm_lineno.
* config/tc-m68hc11.c (m68hc11_new_insn): Use dwarf2_generate_asm_lineno.
* config/tc-sh.c (md_assemble): Use dwarf2_generate_asm_lineno.
2000-10-25 Diego Novillo <dnovillo@cygnus.com>
* tc-i386.c: Fix prototype declarations for functions taking no

View File

@ -3095,7 +3095,7 @@ ldst_extend (str, hwse)
static void
do_ldst (str, flags)
char *str;
char * str;
unsigned long flags;
{
int halfword = 0;
@ -6380,7 +6380,10 @@ output_inst PARAMS ((void))
fix_new_arm (frag_now, to - frag_now->fr_literal,
inst.size, & inst.reloc.exp, inst.reloc.pc_rel,
inst.reloc.type);
#ifdef OBJ_ELF
if (debug_type == DEBUG_DWARF2)
dwarf2_generate_asm_lineno (inst.size);
#endif
return;
}
@ -7256,14 +7259,14 @@ arm_adjust_symtab ()
}
#endif
#ifdef OBJ_ELF
symbolS *sym;
char bind;
symbolS * sym;
char bind;
for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
{
if (ARM_IS_THUMB (sym))
{
elf_symbol_type *elf_sym;
elf_symbol_type * elf_sym;
elf_sym = elf_symbol (symbol_get_bfdsym (sym));
bind = ELF_ST_BIND (elf_sym);
@ -7297,7 +7300,7 @@ arm_data_in_code ()
char *
arm_canonicalize_symbol_name (name)
char *name;
char * name;
{
int len;
@ -7310,7 +7313,7 @@ arm_canonicalize_symbol_name (name)
boolean
arm_validate_fix (fixP)
fixS *fixP;
fixS * fixP;
{
/* If the destination of the branch is a defined symbol which does not have
the THUMB_FUNC attribute, then we must be calling a function which has
@ -7344,7 +7347,7 @@ arm_validate_fix (fixP)
boolean
arm_fix_adjustable (fixP)
fixS *fixP;
fixS * fixP;
{
if (fixP->fx_addsy == NULL)
return 1;
@ -7475,7 +7478,7 @@ s_arm_elf_cons (nbytes)
expression (& exp);
if (exp.X_op == O_symbol
&& *input_line_pointer == '('
&& * input_line_pointer == '('
&& (reloc = arm_parse_reloc ()) != BFD_RELOC_UNUSED)
{
reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, reloc);
@ -7503,4 +7506,13 @@ s_arm_elf_cons (nbytes)
demand_empty_rest_of_line ();
}
/* Stuff to do after assembling all of the source file. */
void
arm_end_of_source ()
{
if (debug_type == DEBUG_DWARF2)
dwarf2_finish ();
}
#endif /* OBJ_ELF */

View File

@ -210,3 +210,10 @@ void armelf_frob_symbol PARAMS ((symbolS *, int *));
#else
#define GLOBAL_OFFSET_TABLE_NAME "__GLOBAL_OFFSET_TABLE_"
#endif
#ifdef OBJ_ELF
#define md_end() arm_end_of_source ()
extern void arm_end_of_source PARAMS ((void));
#define DWARF2_LINE_MIN_INSN_LENGTH 2
#endif

View File

@ -42,7 +42,6 @@ error only one of OBJ_ELF and OBJ_SOM can be defined
then we want to use the assembler support for compact line numbers. */
#ifdef OBJ_ELF
#include "dwarf2dbg.h"
struct dwarf2_line_info debug_line;
/* A "convient" place to put object file dependencies which do
not need to be seen outside of tc-hppa.c. */
@ -1493,19 +1492,7 @@ md_assemble (str)
#ifdef OBJ_ELF
if (debug_type == DEBUG_DWARF2)
{
bfd_vma addr;
/* First update the notion of the current source line. */
dwarf2_where (&debug_line);
/* We want the offset of the start of this instruction within the
the current frag. */
addr = frag_now->fr_address + frag_now_fix () - 4;
/* And record the information. */
dwarf2_gen_line_info (addr, &debug_line);
}
dwarf2_generate_asm_lineno (4);
#endif
}

View File

@ -26,8 +26,6 @@
#include "opcode/m68hc11.h"
#include "dwarf2dbg.h"
struct dwarf2_line_info debug_line;
const char comment_chars[] = ";!";
const char line_comment_chars[] = "#*";
const char line_separator_chars[] = "";
@ -1375,13 +1373,8 @@ m68hc11_new_insn (size)
/* Emit line number information in dwarf2 debug sections. */
if (debug_type == DEBUG_DWARF2)
{
bfd_vma addr;
dwarf2_generate_asm_lineno (size);
dwarf2_where (&debug_line);
addr = frag_now->fr_address + frag_now_fix () - size;
dwarf2_gen_line_info (addr, &debug_line);
}
return f;
}

View File

@ -34,7 +34,6 @@
#endif
#include "dwarf2dbg.h"
struct dwarf2_line_info debug_line;
const char comment_chars[] = "!";
const char line_separator_chars[] = ";";
@ -1931,19 +1930,7 @@ md_assemble (str)
}
if (debug_type == DEBUG_DWARF2)
{
bfd_vma addr;
/* First update the notion of the current source line. */
dwarf2_where (&debug_line);
/* We want the offset of the start of this instruction within the
the current frag. may be used later */
addr = frag_now->fr_address + frag_now_fix () - size;
/* And record the information. */
dwarf2_gen_line_info (addr, &debug_line);
}
dwarf2_generate_asm_lineno (size);
}
/* This routine is called each time a label definition is seen. It

View File

@ -338,7 +338,8 @@ may help debugging assembler code, if the debugger can handle it.
@item --gdwarf2
Generate DWARF2 debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it.
may help debugging assembler code, if the debugger can handle it. Note - this
option is only supported by some targets, not all of them.
@item --help
Print a summary of the command line options and exit.

View File

@ -772,3 +772,25 @@ dwarf2_where (line)
line->flags = DWARF2_FLAG_BEGIN_STMT;
}
}
/* Generate a DWARF2 line statement for an
instruction of SIZE bytes in length. */
void
dwarf2_generate_asm_lineno (size)
int size;
{
bfd_vma addr;
static struct dwarf2_line_info debug_line;
/* First update the notion of the current source line. */
dwarf2_where (& debug_line);
/* We want the offset of the start of this
instruction within the the current frag. */
addr = frag_now->fr_address + frag_now_fix () - size;
/* And record the information. */
dwarf2_gen_line_info (addr, & debug_line);
}

View File

@ -65,4 +65,6 @@ extern void dwarf2_gen_line_info PARAMS ((addressT addr,
.debug_line section. */
extern void dwarf2_finish PARAMS ((void));
extern void dwarf2_generate_asm_lineno PARAMS ((int));
#endif /* AS_DWARF2DBG_H */

File diff suppressed because it is too large Load Diff

View File

@ -5002,7 +5002,14 @@ generate_lineno_debug ()
break;
case DEBUG_DWARF:
case DEBUG_DWARF2:
/* FIXME. */
/* This cannot safely be done in a generic manner. A single
binary instruction word may span mutliple lines of assembler
source and may occupy a variable number of bytes. Instead,
if a port wishes to support DWARF2 line number generation by
the assembler, it should add a call to dwarf2_generate_asm_lineno
inside md_assemble() at whatever point is appropriate. Note,
such a port should also define md_end and make sure that
dwarf2_finish is called, to emit the accumulated line information. */
break;
}
}