This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

alpha-elf mdebug tweeks


The following simplifies the interface between the compiler
and assembler for deciding what sort of debug info to emit,
at the expense of no mdebug data at -g0.  But since that is
primarily OSF-style unwind information that we didn't use
anyway, this is no loss.

The scheme is to wait for the first .stabs directive to 
decide that mdebug is desired.  If debugging is enabled in
the compiler, this will be about line 3, well before we see
any procedure directives.


r~


        * dwarf2dbg.c (dwarf2_gen_line_info): Early out for no line number.
        * config/obj-elf.h (ECOFF_DEBUGGING) [TC_ALPHA]: Adjust for
        tri-state definition of alpha_flag_mdebug.
        * config/tc-alpha.c (alpha_flag_mdebug): Init to -1.
        (s_alpha_file): Store first .file directive.
        (s_alpha_stab): New.
        (md_pseudo_table): Add stabs and stabn.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.20
diff -c -p -d -r1.20 dwarf2dbg.c
*** dwarf2dbg.c	2000/11/17 08:47:51	1.20
--- dwarf2dbg.c	2000/11/17 18:04:01
*************** dwarf2_gen_line_info (addr, l)
*** 444,449 ****
--- 444,453 ----
      /* No filename, no filnum => no play.  */
      return;
  
+   /* Early out for as-yet incomplete location information.  */
+   if (l->line == 0)
+     return;
+ 
    /* Must save these before the subseg_new call, as that call will change
       them.  */
    saved_seg = now_seg;
Index: config/obj-elf.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.h,v
retrieving revision 1.10
diff -c -p -d -r1.10 obj-elf.h
*** obj-elf.h	2000/11/08 00:24:23	1.10
--- obj-elf.h	2000/11/17 18:04:01
***************
*** 42,48 ****
  #include "targ-cpu.h"
  
  #ifdef TC_ALPHA
! #define ECOFF_DEBUGGING alpha_flag_mdebug
  extern int alpha_flag_mdebug;
  #endif
  
--- 42,48 ----
  #include "targ-cpu.h"
  
  #ifdef TC_ALPHA
! #define ECOFF_DEBUGGING (alpha_flag_mdebug > 0)
  extern int alpha_flag_mdebug;
  #endif
  
Index: config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.14
diff -c -p -d -r1.14 tc-alpha.c
*** tc-alpha.c	2000/11/17 08:47:51	1.14
--- tc-alpha.c	2000/11/17 18:04:02
*************** static void s_alpha_frame PARAMS ((int))
*** 248,253 ****
--- 248,254 ----
  static void s_alpha_prologue PARAMS ((int));
  static void s_alpha_file PARAMS ((int));
  static void s_alpha_loc PARAMS ((int));
+ static void s_alpha_stab PARAMS ((int));
  static void s_alpha_coff_wrapper PARAMS ((int));
  #endif
  #ifdef OBJ_EVAX
*************** static int alpha_debug;
*** 435,441 ****
  
  #ifdef OBJ_ELF
  /* Whether we are emitting an mdebug section.  */
! int alpha_flag_mdebug = 1;
  #endif
  
  /* Don't fully resolve relocations, allowing code movement in the linker.  */
--- 436,442 ----
  
  #ifdef OBJ_ELF
  /* Whether we are emitting an mdebug section.  */
! int alpha_flag_mdebug = -1;
  #endif
  
  /* Don't fully resolve relocations, allowing code movement in the linker.  */
*************** s_alpha_prologue (ignore)
*** 4578,4587 ****
--- 4579,4607 ----
      }
  }
  
+ static char * first_file_directive;
+ 
  static void
  s_alpha_file (ignore)
       int ignore ATTRIBUTE_UNUSED;
  {
+   /* Save the first .file directive we see, so that we can change our
+      minds about whether ecoff debugging should or shouldn't be enabled.  */
+   if (alpha_flag_mdebug < 0 && ! first_file_directive)
+     {
+       char *start = input_line_pointer;
+       size_t len;
+ 
+       discard_rest_of_line ();
+ 
+       len = input_line_pointer - start;
+       first_file_directive = xmalloc (len + 1);
+       memcpy (first_file_directive, start, len);
+       first_file_directive[len] = '\0';
+ 
+       input_line_pointer = start;
+     }
+ 
    if (ECOFF_DEBUGGING)
      ecoff_directive_file (0);
    else
*************** s_alpha_loc (ignore)
*** 4599,4604 ****
--- 4619,4651 ----
  }
  
  static void
+ s_alpha_stab (n)
+      int n;
+ {
+   /* If we've been undecided about mdebug, make up our minds in favour.  */
+   if (alpha_flag_mdebug < 0)
+     {
+       segT sec = subseg_new(".mdebug", 0);
+       bfd_set_section_flags(stdoutput, sec, SEC_HAS_CONTENTS|SEC_READONLY);
+       bfd_set_section_alignment(stdoutput, sec, 3);
+ 
+       ecoff_read_begin_hook ();
+ 
+       if (first_file_directive)
+ 	{
+ 	  char *save_ilp = input_line_pointer;
+           input_line_pointer = first_file_directive;
+ 	  ecoff_directive_file (0);
+ 	  input_line_pointer = save_ilp;
+ 	  free (first_file_directive);
+ 	}
+ 
+       alpha_flag_mdebug = 1;
+     }
+   s_stab (n);
+ }
+ 
+ static void
  s_alpha_coff_wrapper (which)
       int which;
  {
*************** const pseudo_typeS md_pseudo_table[] =
*** 5474,5479 ****
--- 5521,5528 ----
    {"prologue", s_alpha_prologue, 0},
    {"file", s_alpha_file, 5},
    {"loc", s_alpha_loc, 9},
+   {"stabs", s_alpha_stab, 's'},
+   {"stabn", s_alpha_stab, 'n'},
    /* COFF debugging related pseudos.  */
    {"begin", s_alpha_coff_wrapper, 0},
    {"bend", s_alpha_coff_wrapper, 1},

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]