Back to index

cell-binutils  2.17cvs20070401
Classes | Typedefs | Enumerations | Functions | Variables
dwarf.h File Reference
#include "bfd.h"
#include "elf/dwarf2.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dwarf_section
struct  dwarf_section_display
struct  debug_info

Typedefs

typedef unsigned long dwarf_vma
typedef unsigned long dwarf_size_type

Enumerations

enum  dwarf_section_display_enum {
  abbrev = 0, aranges, frame, info,
  line, pubnames, eh_frame, macinfo,
  str, loc, pubtypes, ranges,
  static_func, static_vars, types, weaknames,
  max
}

Functions

dwarf_vma byte_get_little_endian (unsigned char *, int)
dwarf_vma byte_get_big_endian (unsigned char *, int)
int load_debug_section (enum dwarf_section_display_enum, void *)
void free_debug_section (enum dwarf_section_display_enum)
void free_debug_memory (void)
void * cmalloc (size_t, size_t)
void * xcmalloc (size_t, size_t)
void * xcrealloc (void *, size_t, size_t)
void error (const char *,...) ATTRIBUTE_PRINTF_1
void warn (const char *,...) ATTRIBUTE_PRINTF_1

Variables

dwarf_vma(* byte_get )(unsigned char *, int)
dwarf_vma eh_addr_size
int is_relocatable
int do_debug_info
int do_debug_abbrevs
int do_debug_lines
int do_debug_pubnames
int do_debug_aranges
int do_debug_ranges
int do_debug_frames
int do_debug_frames_interp
int do_debug_macinfo
int do_debug_str
int do_debug_loc

Class Documentation

struct dwarf_section

Definition at line 34 of file dwarf.h.

Class Members
dwarf_vma address
const char * name
dwarf_size_type size
unsigned char * start
struct debug_info

Definition at line 76 of file dwarf.h.

Class Members
unsigned long base_address
unsigned long cu_offset
int * have_frame_base
unsigned long * loc_offsets
unsigned int max_loc_offsets
unsigned int max_range_lists
unsigned int num_loc_offsets
unsigned int num_range_lists
unsigned int pointer_size
unsigned long * range_lists

Typedef Documentation

Definition at line 31 of file dwarf.h.

Definition at line 30 of file dwarf.h.


Enumeration Type Documentation

Enumerator:
abbrev 
aranges 
frame 
info 
line 
pubnames 
eh_frame 
macinfo 
str 
loc 
pubtypes 
ranges 
static_func 
static_vars 
types 
weaknames 
max 

Definition at line 52 of file dwarf.h.


Function Documentation

Definition at line 99 of file dwarf.c.

{
  switch (size)
    {
    case 1:
      return *field;

    case 2:
      return ((unsigned int) (field[1])) | (((int) (field[0])) << 8);

    case 4:
      return ((unsigned long) (field[3]))
       |   (((unsigned long) (field[2])) << 8)
       |   (((unsigned long) (field[1])) << 16)
       |   (((unsigned long) (field[0])) << 24);

    case 8:
      if (sizeof (dwarf_vma) == 8)
       return ((dwarf_vma) (field[7]))
         |   (((dwarf_vma) (field[6])) << 8)
         |   (((dwarf_vma) (field[5])) << 16)
         |   (((dwarf_vma) (field[4])) << 24)
         |   (((dwarf_vma) (field[3])) << 32)
         |   (((dwarf_vma) (field[2])) << 40)
         |   (((dwarf_vma) (field[1])) << 48)
         |   (((dwarf_vma) (field[0])) << 56);
      else if (sizeof (dwarf_vma) == 4)
       {
         /* Although we are extracing data from an 8 byte wide field,
            we are returning only 4 bytes of data.  */
         field += 4;
         return ((unsigned long) (field[3]))
           |   (((unsigned long) (field[2])) << 8)
           |   (((unsigned long) (field[1])) << 16)
           |   (((unsigned long) (field[0])) << 24);
       }

    default:
      error (_("Unhandled data length: %d\n"), size);
      abort ();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file dwarf.c.

{
  switch (size)
    {
    case 1:
      return *field;

    case 2:
      return  ((unsigned int) (field[0]))
       |    (((unsigned int) (field[1])) << 8);

    case 4:
      return  ((unsigned long) (field[0]))
       |    (((unsigned long) (field[1])) << 8)
       |    (((unsigned long) (field[2])) << 16)
       |    (((unsigned long) (field[3])) << 24);

    case 8:
      if (sizeof (dwarf_vma) == 8)
       return  ((dwarf_vma) (field[0]))
         |    (((dwarf_vma) (field[1])) << 8)
         |    (((dwarf_vma) (field[2])) << 16)
         |    (((dwarf_vma) (field[3])) << 24)
         |    (((dwarf_vma) (field[4])) << 32)
         |    (((dwarf_vma) (field[5])) << 40)
         |    (((dwarf_vma) (field[6])) << 48)
         |    (((dwarf_vma) (field[7])) << 56);
      else if (sizeof (dwarf_vma) == 4)
       /* We want to extract data from an 8 byte wide field and
          place it into a 4 byte wide field.  Since this is a little
          endian source we can just use the 4 byte extraction code.  */
       return  ((unsigned long) (field[0]))
         |    (((unsigned long) (field[1])) << 8)
         |    (((unsigned long) (field[2])) << 16)
         |    (((unsigned long) (field[3])) << 24);

    default:
      error (_("Unhandled data length: %d\n"), size);
      abort ();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* cmalloc ( size_t  ,
size_t   
)

Definition at line 3681 of file dwarf.c.

{
  /* Check for overflow.  */
  if (nmemb >= ~(size_t) 0 / size)
    return NULL;
  else
    return malloc (nmemb * size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void error ( const char *  ,
  ... 
)

Definition at line 3711 of file dwarf.c.

{
  va_list args;

  va_start (args, message);
  fprintf (stderr, _("%s: Error: "), program_name);
  vfprintf (stderr, message, args);
  va_end (args);
}

Here is the call graph for this function:

void free_debug_memory ( void  )

Definition at line 3733 of file dwarf.c.

{
  enum dwarf_section_display_enum i;

  free_abbrevs ();

  for (i = 0; i < max; i++)
    free_debug_section (i);

  if (debug_information)
    {
      for (i = 0; i < num_debug_info_entries; i++)
       {
         if (!debug_information [i].max_loc_offsets)
           {
             free (debug_information [i].loc_offsets);
             free (debug_information [i].have_frame_base);
           }
         if (!debug_information [i].max_range_lists)
           free (debug_information [i].range_lists);
       }
      free (debug_information);
      debug_information = NULL;
      num_debug_info_entries = 0;
    }

}

Here is the call graph for this function:

Here is the caller graph for this function:

void free_debug_section ( enum  dwarf_section_display_enum)

Definition at line 2000 of file objdump.c.

{
  struct dwarf_section *section = &debug_displays [debug].section;

  if (section->start == NULL)
    return;

  free ((char *) section->start);
  section->start = NULL;
  section->address = 0;
  section->size = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int load_debug_section ( enum  dwarf_section_display_enum,
void *   
)

Definition at line 1960 of file objdump.c.

{
  struct dwarf_section *section = &debug_displays [debug].section;
  bfd *abfd = file;
  asection *sec;
  bfd_boolean ret;

  /* If it is already loaded, do nothing.  */
  if (section->start != NULL)
    return 1;

  /* Locate the debug section.  */
  sec = bfd_get_section_by_name (abfd, section->name);
  if (sec == NULL)
    return 0;

  section->address = bfd_get_section_vma (abfd, sec);
  section->size = bfd_get_section_size (sec);
  section->start = xmalloc (section->size);

  if (is_relocatable && debug_displays [debug].relocate)
    ret = bfd_simple_get_relocated_section_contents (abfd,
                                               sec,
                                               section->start,
                                               syms) != NULL;
  else
    ret = bfd_get_section_contents (abfd, sec, section->start, 0,
                                section->size);

  if (!ret)
    {
      free_debug_section (debug);
      printf (_("\nCan't get contents for section '%s'.\n"),
             section->name);
    }

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void warn ( const char *  ,
  ... 
)

Definition at line 3722 of file dwarf.c.

{
  va_list args;

  va_start (args, message);
  fprintf (stderr, _("%s: Warning: "), program_name);
  vfprintf (stderr, message, args);
  va_end (args);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* xcmalloc ( size_t  ,
size_t   
)

Definition at line 3691 of file dwarf.c.

{
  /* Check for overflow.  */
  if (nmemb >= ~(size_t) 0 / size)
    return NULL;
  else
    return xmalloc (nmemb * size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* xcrealloc ( void *  ,
size_t  ,
size_t   
)

Definition at line 3701 of file dwarf.c.

{
  /* Check for overflow.  */
  if (nmemb >= ~(size_t) 0 / size)
    return NULL;
  else
    return xrealloc (ptr, nmemb * size);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 53 of file dwarf.c.

Definition at line 42 of file dwarf.c.

Definition at line 45 of file dwarf.c.

Definition at line 47 of file dwarf.c.

Definition at line 48 of file dwarf.c.

Definition at line 41 of file dwarf.c.

Definition at line 43 of file dwarf.c.

Definition at line 51 of file dwarf.c.

Definition at line 49 of file dwarf.c.

Definition at line 44 of file dwarf.c.

Definition at line 46 of file dwarf.c.

Definition at line 50 of file dwarf.c.

Definition at line 38 of file dwarf.c.

Definition at line 39 of file dwarf.c.