Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Enumerations | Functions | Variables
dwarf2dbg.h File Reference
#include "as.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dwarf2_line_info

Defines

#define DWARF2_FLAG_IS_STMT   (1 << 0)
#define DWARF2_FLAG_BASIC_BLOCK   (1 << 1)
#define DWARF2_FLAG_PROLOGUE_END   (1 << 2)
#define DWARF2_FLAG_EPILOGUE_BEGIN   (1 << 3)

Enumerations

enum  dwarf2_format { dwarf2_format_32bit, dwarf2_format_64bit, dwarf2_format_64bit_irix }

Functions

char * dwarf2_directive_file (int dummy)
void dwarf2_directive_loc (int dummy)
void dwarf2_directive_loc_mark_labels (int dummy)
void dwarf2_where (struct dwarf2_line_info *l)
void dwarf2_set_isa (unsigned int isa)
void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l)
void dwarf2_emit_insn (int)
void dwarf2_emit_label (symbolS *)
void dwarf2_finish (void)
int dwarf2dbg_estimate_size_before_relax (fragS *)
int dwarf2dbg_relax_frag (fragS *)
void dwarf2dbg_convert_frag (fragS *)

Variables

bfd_boolean dwarf2_loc_mark_labels

Class Documentation

struct dwarf2_line_info

Definition at line 31 of file dwarf2dbg.h.

Class Members
unsigned int column
unsigned int filenum
unsigned int flags
unsigned int isa
unsigned int line

Define Documentation

#define DWARF2_FLAG_BASIC_BLOCK   (1 << 1)

Definition at line 27 of file dwarf2dbg.h.

#define DWARF2_FLAG_EPILOGUE_BEGIN   (1 << 3)

Definition at line 29 of file dwarf2dbg.h.

#define DWARF2_FLAG_IS_STMT   (1 << 0)

Definition at line 26 of file dwarf2dbg.h.

#define DWARF2_FLAG_PROLOGUE_END   (1 << 2)

Definition at line 28 of file dwarf2dbg.h.


Enumeration Type Documentation

Enumerator:
dwarf2_format_32bit 
dwarf2_format_64bit 
dwarf2_format_64bit_irix 

Definition at line 91 of file dwarf2dbg.h.

                   {
  /* 32-bit format: the initial length field is 4 bytes long.  */
  dwarf2_format_32bit,
  /* DWARF3 64-bit format: the representation of the initial length
     (of a DWARF section) is 0xffffffff (4 bytes) followed by eight
     bytes indicating the actual length.  */
  dwarf2_format_64bit,
  /* SGI extension to DWARF2: The initial length is eight bytes.  */
  dwarf2_format_64bit_irix
};

Function Documentation

char* dwarf2_directive_file ( int  dummy)

Definition at line 531 of file dwarf2dbg.c.

{
  offsetT num;
  char *filename;
  int filename_len;

  /* Continue to accept a bare string and pass it off.  */
  SKIP_WHITESPACE ();
  if (*input_line_pointer == '"')
    {
      s_app_file (0);
      return NULL;
    }

  num = get_absolute_expression ();
  filename = demand_copy_C_string (&filename_len);
  if (filename == NULL)
    return NULL;
  demand_empty_rest_of_line ();

  if (num < 1)
    {
      as_bad (_("file number less than one"));
      return NULL;
    }

  if (num < (int) files_in_use && files[num].filename != 0)
    {
      as_bad (_("file number %ld already allocated"), (long) num);
      return NULL;
    }

  get_filenum (filename, num);

  return filename;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dwarf2_directive_loc ( int  dummy)

Definition at line 569 of file dwarf2dbg.c.

{
  offsetT filenum, line;

  filenum = get_absolute_expression ();
  SKIP_WHITESPACE ();
  line = get_absolute_expression ();

  if (filenum < 1)
    {
      as_bad (_("file number less than one"));
      return;
    }
  if (filenum >= (int) files_in_use || files[filenum].filename == 0)
    {
      as_bad (_("unassigned file number %ld"), (long) filenum);
      return;
    }

  current.filenum = filenum;
  current.line = line;

#ifndef NO_LISTING
  if (listing)
    {
      if (files[filenum].dir)
       {
         size_t dir_len = strlen (dirs[files[filenum].dir]);
         size_t file_len = strlen (files[filenum].filename);
         char *cp = (char *) alloca (dir_len + 1 + file_len + 1);

         memcpy (cp, dirs[files[filenum].dir], dir_len);
         INSERT_DIR_SEPARATOR (cp, dir_len);
         memcpy (cp + dir_len + 1, files[filenum].filename, file_len);
         cp[dir_len + file_len + 1] = '\0';
         listing_source_file (cp);
       }
      else
       listing_source_file (files[filenum].filename);
      listing_source_line (line);
    }
#endif

  SKIP_WHITESPACE ();
  if (ISDIGIT (*input_line_pointer))
    {
      current.column = get_absolute_expression ();
      SKIP_WHITESPACE ();
    }

  while (ISALPHA (*input_line_pointer))
    {
      char *p, c;
      offsetT value;

      p = input_line_pointer;
      c = get_symbol_end ();

      if (strcmp (p, "basic_block") == 0)
       {
         current.flags |= DWARF2_FLAG_BASIC_BLOCK;
         *input_line_pointer = c;
       }
      else if (strcmp (p, "prologue_end") == 0)
       {
         current.flags |= DWARF2_FLAG_PROLOGUE_END;
         *input_line_pointer = c;
       }
      else if (strcmp (p, "epilogue_begin") == 0)
       {
         current.flags |= DWARF2_FLAG_EPILOGUE_BEGIN;
         *input_line_pointer = c;
       }
      else if (strcmp (p, "is_stmt") == 0)
       {
         *input_line_pointer = c;
         value = get_absolute_expression ();
         if (value == 0)
           current.flags &= ~DWARF2_FLAG_IS_STMT;
         else if (value == 1)
           current.flags |= DWARF2_FLAG_IS_STMT;
         else
           {
             as_bad (_("is_stmt value not 0 or 1"));
             return;
           }
       }
      else if (strcmp (p, "isa") == 0)
       {
          *input_line_pointer = c;
         value = get_absolute_expression ();
         if (value >= 0)
           current.isa = value;
         else
           {
             as_bad (_("isa number less than zero"));
             return;
           }
       }
      else
       {
         as_bad (_("unknown .loc sub-directive `%s'"), p);
          *input_line_pointer = c;
         return;
       }

      SKIP_WHITESPACE ();
    }

  demand_empty_rest_of_line ();
  loc_directive_seen = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 683 of file dwarf2dbg.c.

{
  offsetT value = get_absolute_expression ();

  if (value != 0 && value != 1)
    {
      as_bad (_("expected 0 or 1"));
      ignore_rest_of_line ();
    }
  else
    {
      dwarf2_loc_mark_labels = value != 0;
      demand_empty_rest_of_line ();
    }
}

Here is the call graph for this function:

void dwarf2_emit_insn ( int  )

Definition at line 364 of file dwarf2dbg.c.

{
  struct dwarf2_line_info loc;

  if (loc_directive_seen)
    {
      /* Use the last location established by a .loc directive, not
        the value returned by dwarf2_where().  That calls as_where()
        which will return either the logical input file name (foo.c)
       or the physical input file name (foo.s) and not the file name
       specified in the most recent .loc directive (eg foo.h).  */
      loc = current;

      /* Unless we generate DWARF2 debugging information for each
        assembler line, we only emit one line symbol for one LOC.  */
      if (debug_type != DEBUG_DWARF2)
       loc_directive_seen = FALSE;
    }
  else if (debug_type != DEBUG_DWARF2)
    return;
  else
    dwarf2_where (&loc);

  dwarf2_gen_line_info (frag_now_fix () - size, &loc);

  current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
                   | DWARF2_FLAG_PROLOGUE_END
                   | DWARF2_FLAG_EPILOGUE_BEGIN);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dwarf2_emit_label ( symbolS *  )

Definition at line 398 of file dwarf2dbg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void dwarf2_finish ( void  )

Definition at line 1644 of file dwarf2dbg.c.

{
  segT line_seg;
  struct line_seg *s;
  segT info_seg;
  int emit_other_sections = 0;

  info_seg = bfd_get_section_by_name (stdoutput, ".debug_info");
  emit_other_sections = info_seg == NULL || !seg_not_empty_p (info_seg);

  if (!all_segs && emit_other_sections)
    /* There is no line information and no non-empty .debug_info
       section.  */
    return;

  /* Calculate the size of an address for the target machine.  */
  sizeof_address = DWARF2_ADDR_SIZE (stdoutput);

  /* Create and switch to the line number section.  */
  line_seg = subseg_new (".debug_line", 0);
  bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY | SEC_DEBUGGING);

  /* For each subsection, chain the debug entries together.  */
  for (s = all_segs; s; s = s->next)
    {
      struct line_subseg *ss = s->head;
      struct line_entry **ptail = ss->ptail;

      while ((ss = ss->next) != NULL)
       {
         *ptail = ss->head;
         ptail = ss->ptail;
       }
    }

  out_debug_line (line_seg);

  /* If this is assembler generated line info, and there is no
     debug_info already, we need .debug_info and .debug_abbrev
     sections as well.  */
  if (emit_other_sections)
    {
      segT abbrev_seg;
      segT aranges_seg;
      segT ranges_seg;

      assert (all_segs);
      
      info_seg = subseg_new (".debug_info", 0);
      abbrev_seg = subseg_new (".debug_abbrev", 0);
      aranges_seg = subseg_new (".debug_aranges", 0);

      bfd_set_section_flags (stdoutput, info_seg,
                          SEC_READONLY | SEC_DEBUGGING);
      bfd_set_section_flags (stdoutput, abbrev_seg,
                          SEC_READONLY | SEC_DEBUGGING);
      bfd_set_section_flags (stdoutput, aranges_seg,
                          SEC_READONLY | SEC_DEBUGGING);

      record_alignment (aranges_seg, ffs (2 * sizeof_address) - 1);

      if (all_segs->next == NULL)
       ranges_seg = NULL;
      else
       {
         ranges_seg = subseg_new (".debug_ranges", 0);
         bfd_set_section_flags (stdoutput, ranges_seg, 
                             SEC_READONLY | SEC_DEBUGGING);
         record_alignment (ranges_seg, ffs (2 * sizeof_address) - 1);
         out_debug_ranges (ranges_seg);
       }

      out_debug_aranges (aranges_seg, info_seg);
      out_debug_abbrev (abbrev_seg);
      out_debug_info (info_seg, abbrev_seg, line_seg, ranges_seg);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 302 of file dwarf2dbg.c.

{
  static unsigned int line = -1;
  static unsigned int filenum = -1;

  symbolS *sym;

  /* Early out for as-yet incomplete location information.  */
  if (loc->filenum == 0 || loc->line == 0)
    return;

  /* Don't emit sequences of line symbols for the same line when the
     symbols apply to assembler code.  It is necessary to emit
     duplicate line symbols when a compiler asks for them, because GDB
     uses them to determine the end of the prologue.  */
  if (debug_type == DEBUG_DWARF2
      && line == loc->line && filenum == loc->filenum)
    return;

  line = loc->line;
  filenum = loc->filenum;

  sym = symbol_temp_new (now_seg, ofs, frag_now);
  dwarf2_gen_line_info_1 (sym, loc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dwarf2_set_isa ( unsigned int  isa)

Definition at line 353 of file dwarf2dbg.c.

{
  current.isa = isa;
}

Definition at line 334 of file dwarf2dbg.c.

{
  if (debug_type == DEBUG_DWARF2)
    {
      char *filename;
      as_where (&filename, &line->line);
      line->filenum = get_filenum (filename, 0);
      line->column = 0;
      line->flags = DWARF2_FLAG_IS_STMT;
      line->isa = current.isa;
    }
  else
    *line = current;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dwarf2dbg_convert_frag ( fragS *  )

Definition at line 1096 of file dwarf2dbg.c.

{
  offsetT addr_diff;

  addr_diff = resolve_symbol_value (frag->fr_symbol);

  /* fr_var carries the max_chars that we created the fragment with.
     fr_subtype carries the current expected length.  We must, of
     course, have allocated enough memory earlier.  */
  assert (frag->fr_var >= (int) frag->fr_subtype);

  emit_inc_line_addr (frag->fr_offset, addr_diff,
                    frag->fr_literal + frag->fr_fix, frag->fr_subtype);

  frag->fr_fix += frag->fr_subtype;
  frag->fr_type = rs_fill;
  frag->fr_var = 0;
  frag->fr_offset = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1063 of file dwarf2dbg.c.

{
  offsetT addr_delta;
  int size;

  addr_delta = resolve_symbol_value (frag->fr_symbol);
  size = size_inc_line_addr (frag->fr_offset, addr_delta);

  frag->fr_subtype = size;

  return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int dwarf2dbg_relax_frag ( fragS *  )

Definition at line 1081 of file dwarf2dbg.c.

{
  int old_size, new_size;

  old_size = frag->fr_subtype;
  new_size = dwarf2dbg_estimate_size_before_relax (frag);

  return new_size - old_size;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 81 of file dwarf2dbg.h.