Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Petr Sorfa <petrs@caldera.com>
To: "gdb-patches@sources.redhat.com" <gdb-patches@sources.redhat.com>
Subject: [RFA] DWARF multiple comp unit header support - Revision - Part 1
Date: Fri, 12 Jul 2002 10:01:00 -0000	[thread overview]
Message-ID: <3D2F0E4F.DDCC4DE9@caldera.com> (raw)

Hi,

Following Jim's suggestion I have split my original rather large
multiple comp unit header patch into several parts. Here is the first
one which moves the DWARF abbreviation table into the comp unit header
structure with several relevant changes. Note that some changes may seem
overkill, but they are place makers for the subsequent parts.

2002-07-12 Petr Sorfa (petrs@caldera.com)

        *  dwarf2read.c (ABBREV_HASH_SIZE): moved definition
           forward in the code to be defined before
           struct comp_unit_head.
           (comp_unit_head): Added several new members,
           some are being used with this patch, some not.
           offset - Offset of the cu_header in .debug_info
           begin_offset - Base offset of cu_header into program
           next - Next comp unit head in program
           dwarf2_abbrevs - abbreviation tables associated with
           comp unit header.
           (dwarf2_abbrevs): Removed from global var space to
           comp unit header struct.
           (dwarf2_read_abbrevs): Now accepts a cu_header
           parameter and to handle the dwarf2_abbrevs inside
           the cu_header.
           (dwarf2_lookup_abbrev): Now accepts a cu_header
           parameter and handling of dwarf2_abbrevs inside
           the cu_header.
           (dwarf2_build_psymtabs_hard): Changed to support
           the new comp unit header.
           (psymtab_to_symtab_1): Changed to support the
           new comp unit header.
           (dwarf2_empty_abbrev_table): Now expects a ptr
           to a dwarf2_abbrev table to clean up.
           (read_partial_die): Now supports the call to the
            new dwarf2_lookup_abbrev.
           (read_full_die): Now supports the call to the
            new dwarf2_lookup_abbrev.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.61
diff -c -p -r1.61 dwarf2read.c
*** dwarf2read.c	12 Jul 2002 15:23:10 -0000	1.61
--- dwarf2read.c	12 Jul 2002 16:32:34 -0000
*************** unsigned int dwarf_eh_frame_size;
*** 162,167 ****
--- 162,172 ----
  
  /* local data types */
  
+ /* We hold several abbreviation tables at the same time in memory */
+ #ifndef ABBREV_HASH_SIZE
+ #define ABBREV_HASH_SIZE 121
+ #endif
+ 
  /* The data in a compilation unit header, after target2host
     translation, looks like this.  */
  struct comp_unit_head
*************** struct comp_unit_head
*** 174,179 ****
--- 179,194 ----
      unsigned int offset_size;	/* size of file offsets; either 4 or 8 */
      unsigned int initial_length_size; /* size of the length field; either
                                           4 or 12 */
+ 
+     /* New information for the comp unit head so as to keep a list
+        of available ones for a program. */
+     unsigned int offset; /* Offset of the cu_header in .debug_info */
+     char *base_offset; /* Base offset after cu_header into program */
+     char *begin_offset; /* Base offset of cu_header into program */
+     struct comp_unit_head *next; /* Next comp unit head in program */
+ 
+     struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE]; /* DWARF abbrev
+                                                              table */
    };
  
  /* The line number information for a compilation unit (found in the
*************** struct dwarf_block
*** 312,328 ****
      char *data;
    };
  
- /* We only hold one compilation unit's abbrevs in
-    memory at any one time.  */
- #ifndef ABBREV_HASH_SIZE
- #define ABBREV_HASH_SIZE 121
- #endif
  #ifndef ATTR_ALLOC_CHUNK
  #define ATTR_ALLOC_CHUNK 4
  #endif
  
- static struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE];
- 
  /* A hash table of die offsets for following references.  */
  #ifndef REF_HASH_SIZE
  #define REF_HASH_SIZE 1021
--- 327,336 ----
*************** static void psymtab_to_symtab_1 (struct 
*** 682,692 ****
  
  char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int);
  
! static void dwarf2_read_abbrevs (bfd *, unsigned int);
  
  static void dwarf2_empty_abbrev_table (PTR);
  
! static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int);
  
  static char *read_partial_die (struct partial_die_info *,
  			       bfd *, char *,
--- 690,701 ----
  
  char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int);
  
! static void dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header);
  
  static void dwarf2_empty_abbrev_table (PTR);
  
! static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int,
!                                          const struct comp_unit_head *cu_header);
  
  static char *read_partial_die (struct partial_die_info *,
  			       bfd *, char *,
*************** dwarf2_build_psymtabs_hard (struct objfi
*** 1201,1208 ****
  	  return;
  	}
        /* Read the abbrevs for this compilation unit into a table */
!       dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);
!       make_cleanup (dwarf2_empty_abbrev_table, NULL);
  
        /* Read the compilation unit die */
        info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr,
--- 1210,1221 ----
  	  return;
  	}
        /* Read the abbrevs for this compilation unit into a table */
!       dwarf2_read_abbrevs (abfd, &cu_header);
! 
!       cu_header.offset = beg_of_comp_unit - dwarf_info_buffer;
!       cu_header.base_offset = info_ptr;
!       cu_header.begin_offset = beg_of_comp_unit;
!       make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs);
  
        /* Read the compilation unit die */
        info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr,
*************** psymtab_to_symtab_1 (struct partial_symt
*** 1549,1556 ****
    info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
  
    /* Read the abbrevs for this compilation unit  */
!   dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);
!   make_cleanup (dwarf2_empty_abbrev_table, NULL);
  
    dies = read_comp_unit (info_ptr, abfd, &cu_header);
  
--- 1562,1569 ----
    info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
  
    /* Read the abbrevs for this compilation unit  */
!   dwarf2_read_abbrevs (abfd, &cu_header);
!   make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs);
  
    dies = read_comp_unit (info_ptr, abfd, &cu_header);
  
*************** dwarf2_read_section (struct objfile *obj
*** 3287,3306 ****
     in a hash table.  */
  
  static void
! dwarf2_read_abbrevs (bfd *abfd, unsigned int offset)
  {
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
  
!   /* empty the table */
!   dwarf2_empty_abbrev_table (NULL);
! 
!   abbrev_ptr = dwarf_abbrev_buffer + offset;
    abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
    abbrev_ptr += bytes_read;
  
    /* loop until we reach an abbrev number of 0 */
    while (abbrev_number)
      {
--- 3300,3320 ----
     in a hash table.  */
  
  static void
! dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header)
  {
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
  
!   abbrev_ptr = dwarf_abbrev_buffer + cu_header->abbrev_offset;
    abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
    abbrev_ptr += bytes_read;
  
+   /* Initialize dwarf2 abbrevs */
+   memset (cu_header->dwarf2_abbrevs, 0,
+           ABBREV_HASH_SIZE*sizeof (struct abbrev_info *));
+ 
    /* loop until we reach an abbrev number of 0 */
    while (abbrev_number)
      {
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3336,3343 ****
  	}
  
        hash_number = abbrev_number % ABBREV_HASH_SIZE;
!       cur_abbrev->next = dwarf2_abbrevs[hash_number];
!       dwarf2_abbrevs[hash_number] = cur_abbrev;
  
        /* Get next abbreviation.
           Under Irix6 the abbreviations for a compilation unit are not
--- 3350,3357 ----
  	}
  
        hash_number = abbrev_number % ABBREV_HASH_SIZE;
!       cur_abbrev->next = cu_header->dwarf2_abbrevs[hash_number];
!       cu_header->dwarf2_abbrevs[hash_number] = cur_abbrev;
  
        /* Get next abbreviation.
           Under Irix6 the abbreviations for a compilation unit are not
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3351,3357 ****
  	break;
        abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
        abbrev_ptr += bytes_read;
!       if (dwarf2_lookup_abbrev (abbrev_number) != NULL)
  	break;
      }
  }
--- 3365,3371 ----
  	break;
        abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
        abbrev_ptr += bytes_read;
!       if (dwarf2_lookup_abbrev (abbrev_number, cu_header) != NULL)
  	break;
      }
  }
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3360,3374 ****
  
  /* ARGSUSED */
  static void
! dwarf2_empty_abbrev_table (PTR ignore)
  {
    int i;
!   struct abbrev_info *abbrev, *next;
  
    for (i = 0; i < ABBREV_HASH_SIZE; ++i)
      {
        next = NULL;
!       abbrev = dwarf2_abbrevs[i];
        while (abbrev)
  	{
  	  next = abbrev->next;
--- 3374,3390 ----
  
  /* ARGSUSED */
  static void
! dwarf2_empty_abbrev_table (PTR ptr_to_abbrevs_table)
  {
    int i;
!   struct abbrev_info *abbrev, *next, **abbrevs;
! 
!   abbrevs = (struct abbrev_info **)ptr_to_abbrevs_table;
  
    for (i = 0; i < ABBREV_HASH_SIZE; ++i)
      {
        next = NULL;
!       abbrev = abbrevs[i];
        while (abbrev)
  	{
  	  next = abbrev->next;
*************** dwarf2_empty_abbrev_table (PTR ignore)
*** 3376,3395 ****
  	  xfree (abbrev);
  	  abbrev = next;
  	}
!       dwarf2_abbrevs[i] = NULL;
      }
  }
  
  /* Lookup an abbrev_info structure in the abbrev hash table.  */
  
  static struct abbrev_info *
! dwarf2_lookup_abbrev (unsigned int number)
  {
    unsigned int hash_number;
    struct abbrev_info *abbrev;
  
    hash_number = number % ABBREV_HASH_SIZE;
!   abbrev = dwarf2_abbrevs[hash_number];
  
    while (abbrev)
      {
--- 3392,3411 ----
  	  xfree (abbrev);
  	  abbrev = next;
  	}
!       abbrevs[i] = NULL;
      }
  }
  
  /* Lookup an abbrev_info structure in the abbrev hash table.  */
  
  static struct abbrev_info *
! dwarf2_lookup_abbrev (unsigned int number, const struct comp_unit_head *cu_header)
  {
    unsigned int hash_number;
    struct abbrev_info *abbrev;
  
    hash_number = number % ABBREV_HASH_SIZE;
!   abbrev = cu_header->dwarf2_abbrevs[hash_number];
  
    while (abbrev)
      {
*************** read_partial_die (struct partial_die_inf
*** 3421,3427 ****
    if (!abbrev_number)
      return info_ptr;
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number);
    if (!abbrev)
      {
        error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
--- 3437,3443 ----
    if (!abbrev_number)
      return info_ptr;
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
    if (!abbrev)
      {
        error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
*************** read_full_die (struct die_info **diep, b
*** 3552,3558 ****
        return info_ptr;
      }
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number);
    if (!abbrev)
      {
        error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
--- 3568,3574 ----
        return info_ptr;
      }
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
    if (!abbrev)
      {
        error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
From gdb-patches-return-16868-listarch-gdb-patches=sourceware.cygnus.com@sources.redhat.com Fri Jul 12 17:01:25 2002
Return-Path: <gdb-patches-return-16868-listarch-gdb-patches=sourceware.cygnus.com@sources.redhat.com>
Delivered-To: listarch-gdb-patches@sourceware.cygnus.com
Received: (qmail 2526 invoked by alias); 12 Jul 2002 17:01:24 -0000
Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm
Precedence: bulk
List-Subscribe: <mailto:gdb-patches-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sources.redhat.com>
List-Help: <mailto:gdb-patches-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: gdb-patches-owner@sources.redhat.com
Delivered-To: mailing list gdb-patches@sources.redhat.com
Received: (qmail 2518 invoked from network); 12 Jul 2002 17:01:23 -0000
Received: from unknown (HELO tetsuo.nj.caldera.com) (63.124.204.226)
  by sources.redhat.com with SMTP; 12 Jul 2002 17:01:23 -0000
Received: from caldera.com (localhost.localdomain [127.0.0.1])
	by tetsuo.nj.caldera.com (8.11.6/8.11.6) with ESMTP id g6CHDs405670;
	Fri, 12 Jul 2002 13:13:55 -0400
Message-ID: <3D2F0E4F.DDCC4DE9@caldera.com>
Date: Fri, 12 Jul 2002 10:16:00 -0000
From: Petr Sorfa <petrs@caldera.com>
Organization: Caldera
X-Accept-Language: en
MIME-Version: 1.0
To: "gdb-patches@sources.redhat.com" <gdb-patches@sources.redhat.com>
Subject: [RFA] DWARF multiple comp unit header support - Revision - Part 1
Content-Type: multipart/mixed;
 boundary="------------46A8242DC006F40E395AC509"
X-SW-Source: 2002-07/txt/msg00271.txt.bz2

This is a multi-part message in MIME format.
--------------46A8242DC006F40E395AC509
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-length: 1789

Hi,

Following Jim's suggestion I have split my original rather large
multiple comp unit header patch into several parts. Here is the first
one which moves the DWARF abbreviation table into the comp unit header
structure with several relevant changes. Note that some changes may seem
overkill, but they are place makers for the subsequent parts.

2002-07-12 Petr Sorfa (petrs@caldera.com)

        *  dwarf2read.c (ABBREV_HASH_SIZE): moved definition
           forward in the code to be defined before
           struct comp_unit_head.
           (comp_unit_head): Added several new members,
           some are being used with this patch, some not.
           offset - Offset of the cu_header in .debug_info
           begin_offset - Base offset of cu_header into program
           next - Next comp unit head in program
           dwarf2_abbrevs - abbreviation tables associated with
           comp unit header.
           (dwarf2_abbrevs): Removed from global var space to
           comp unit header struct.
           (dwarf2_read_abbrevs): Now accepts a cu_header
           parameter and to handle the dwarf2_abbrevs inside
           the cu_header.
           (dwarf2_lookup_abbrev): Now accepts a cu_header
           parameter and handling of dwarf2_abbrevs inside
           the cu_header.
           (dwarf2_build_psymtabs_hard): Changed to support
           the new comp unit header.
           (psymtab_to_symtab_1): Changed to support the
           new comp unit header.
           (dwarf2_empty_abbrev_table): Now expects a ptr
           to a dwarf2_abbrev table to clean up.
           (read_partial_die): Now supports the call to the
            new dwarf2_lookup_abbrev.
           (read_full_die): Now supports the call to the
            new dwarf2_lookup_abbrev.
--------------46A8242DC006F40E395AC509
Content-Type: text/plain; charset=us-ascii;
 name="cu_header_rev_part_1.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cu_header_rev_part_1.patch"
Content-length: 9834

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.61
diff -c -p -r1.61 dwarf2read.c
*** dwarf2read.c	12 Jul 2002 15:23:10 -0000	1.61
--- dwarf2read.c	12 Jul 2002 16:32:34 -0000
*************** unsigned int dwarf_eh_frame_size;
*** 162,167 ****
--- 162,172 ----
  
  /* local data types */
  
+ /* We hold several abbreviation tables at the same time in memory */
+ #ifndef ABBREV_HASH_SIZE
+ #define ABBREV_HASH_SIZE 121
+ #endif
+ 
  /* The data in a compilation unit header, after target2host
     translation, looks like this.  */
  struct comp_unit_head
*************** struct comp_unit_head
*** 174,179 ****
--- 179,194 ----
      unsigned int offset_size;	/* size of file offsets; either 4 or 8 */
      unsigned int initial_length_size; /* size of the length field; either
                                           4 or 12 */
+ 
+     /* New information for the comp unit head so as to keep a list
+        of available ones for a program. */
+     unsigned int offset; /* Offset of the cu_header in .debug_info */
+     char *base_offset; /* Base offset after cu_header into program */
+     char *begin_offset; /* Base offset of cu_header into program */
+     struct comp_unit_head *next; /* Next comp unit head in program */
+ 
+     struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE]; /* DWARF abbrev
+                                                              table */
    };
  
  /* The line number information for a compilation unit (found in the
*************** struct dwarf_block
*** 312,328 ****
      char *data;
    };
  
- /* We only hold one compilation unit's abbrevs in
-    memory at any one time.  */
- #ifndef ABBREV_HASH_SIZE
- #define ABBREV_HASH_SIZE 121
- #endif
  #ifndef ATTR_ALLOC_CHUNK
  #define ATTR_ALLOC_CHUNK 4
  #endif
  
- static struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE];
- 
  /* A hash table of die offsets for following references.  */
  #ifndef REF_HASH_SIZE
  #define REF_HASH_SIZE 1021
--- 327,336 ----
*************** static void psymtab_to_symtab_1 (struct 
*** 682,692 ****
  
  char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int);
  
! static void dwarf2_read_abbrevs (bfd *, unsigned int);
  
  static void dwarf2_empty_abbrev_table (PTR);
  
! static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int);
  
  static char *read_partial_die (struct partial_die_info *,
  			       bfd *, char *,
--- 690,701 ----
  
  char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int);
  
! static void dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header);
  
  static void dwarf2_empty_abbrev_table (PTR);
  
! static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int,
!                                          const struct comp_unit_head *cu_header);
  
  static char *read_partial_die (struct partial_die_info *,
  			       bfd *, char *,
*************** dwarf2_build_psymtabs_hard (struct objfi
*** 1201,1208 ****
  	  return;
  	}
        /* Read the abbrevs for this compilation unit into a table */
!       dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);
!       make_cleanup (dwarf2_empty_abbrev_table, NULL);
  
        /* Read the compilation unit die */
        info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr,
--- 1210,1221 ----
  	  return;
  	}
        /* Read the abbrevs for this compilation unit into a table */
!       dwarf2_read_abbrevs (abfd, &cu_header);
! 
!       cu_header.offset = beg_of_comp_unit - dwarf_info_buffer;
!       cu_header.base_offset = info_ptr;
!       cu_header.begin_offset = beg_of_comp_unit;
!       make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs);
  
        /* Read the compilation unit die */
        info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr,
*************** psymtab_to_symtab_1 (struct partial_symt
*** 1549,1556 ****
    info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
  
    /* Read the abbrevs for this compilation unit  */
!   dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);
!   make_cleanup (dwarf2_empty_abbrev_table, NULL);
  
    dies = read_comp_unit (info_ptr, abfd, &cu_header);
  
--- 1562,1569 ----
    info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
  
    /* Read the abbrevs for this compilation unit  */
!   dwarf2_read_abbrevs (abfd, &cu_header);
!   make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs);
  
    dies = read_comp_unit (info_ptr, abfd, &cu_header);
  
*************** dwarf2_read_section (struct objfile *obj
*** 3287,3306 ****
     in a hash table.  */
  
  static void
! dwarf2_read_abbrevs (bfd *abfd, unsigned int offset)
  {
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
  
!   /* empty the table */
!   dwarf2_empty_abbrev_table (NULL);
! 
!   abbrev_ptr = dwarf_abbrev_buffer + offset;
    abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
    abbrev_ptr += bytes_read;
  
    /* loop until we reach an abbrev number of 0 */
    while (abbrev_number)
      {
--- 3300,3320 ----
     in a hash table.  */
  
  static void
! dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header)
  {
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
  
!   abbrev_ptr = dwarf_abbrev_buffer + cu_header->abbrev_offset;
    abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
    abbrev_ptr += bytes_read;
  
+   /* Initialize dwarf2 abbrevs */
+   memset (cu_header->dwarf2_abbrevs, 0,
+           ABBREV_HASH_SIZE*sizeof (struct abbrev_info *));
+ 
    /* loop until we reach an abbrev number of 0 */
    while (abbrev_number)
      {
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3336,3343 ****
  	}
  
        hash_number = abbrev_number % ABBREV_HASH_SIZE;
!       cur_abbrev->next = dwarf2_abbrevs[hash_number];
!       dwarf2_abbrevs[hash_number] = cur_abbrev;
  
        /* Get next abbreviation.
           Under Irix6 the abbreviations for a compilation unit are not
--- 3350,3357 ----
  	}
  
        hash_number = abbrev_number % ABBREV_HASH_SIZE;
!       cur_abbrev->next = cu_header->dwarf2_abbrevs[hash_number];
!       cu_header->dwarf2_abbrevs[hash_number] = cur_abbrev;
  
        /* Get next abbreviation.
           Under Irix6 the abbreviations for a compilation unit are not
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3351,3357 ****
  	break;
        abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
        abbrev_ptr += bytes_read;
!       if (dwarf2_lookup_abbrev (abbrev_number) != NULL)
  	break;
      }
  }
--- 3365,3371 ----
  	break;
        abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
        abbrev_ptr += bytes_read;
!       if (dwarf2_lookup_abbrev (abbrev_number, cu_header) != NULL)
  	break;
      }
  }
*************** dwarf2_read_abbrevs (bfd *abfd, unsigned
*** 3360,3374 ****
  
  /* ARGSUSED */
  static void
! dwarf2_empty_abbrev_table (PTR ignore)
  {
    int i;
!   struct abbrev_info *abbrev, *next;
  
    for (i = 0; i < ABBREV_HASH_SIZE; ++i)
      {
        next = NULL;
!       abbrev = dwarf2_abbrevs[i];
        while (abbrev)
  	{
  	  next = abbrev->next;
--- 3374,3390 ----
  
  /* ARGSUSED */
  static void
! dwarf2_empty_abbrev_table (PTR ptr_to_abbrevs_table)
  {
    int i;
!   struct abbrev_info *abbrev, *next, **abbrevs;
! 
!   abbrevs = (struct abbrev_info **)ptr_to_abbrevs_table;
  
    for (i = 0; i < ABBREV_HASH_SIZE; ++i)
      {
        next = NULL;
!       abbrev = abbrevs[i];
        while (abbrev)
  	{
  	  next = abbrev->next;
*************** dwarf2_empty_abbrev_table (PTR ignore)
*** 3376,3395 ****
  	  xfree (abbrev);
  	  abbrev = next;
  	}
!       dwarf2_abbrevs[i] = NULL;
      }
  }
  
  /* Lookup an abbrev_info structure in the abbrev hash table.  */
  
  static struct abbrev_info *
! dwarf2_lookup_abbrev (unsigned int number)
  {
    unsigned int hash_number;
    struct abbrev_info *abbrev;
  
    hash_number = number % ABBREV_HASH_SIZE;
!   abbrev = dwarf2_abbrevs[hash_number];
  
    while (abbrev)
      {
--- 3392,3411 ----
  	  xfree (abbrev);
  	  abbrev = next;
  	}
!       abbrevs[i] = NULL;
      }
  }
  
  /* Lookup an abbrev_info structure in the abbrev hash table.  */
  
  static struct abbrev_info *
! dwarf2_lookup_abbrev (unsigned int number, const struct comp_unit_head *cu_header)
  {
    unsigned int hash_number;
    struct abbrev_info *abbrev;
  
    hash_number = number % ABBREV_HASH_SIZE;
!   abbrev = cu_header->dwarf2_abbrevs[hash_number];
  
    while (abbrev)
      {
*************** read_partial_die (struct partial_die_inf
*** 3421,3427 ****
    if (!abbrev_number)
      return info_ptr;
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number);
    if (!abbrev)
      {
        error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
--- 3437,3443 ----
    if (!abbrev_number)
      return info_ptr;
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
    if (!abbrev)
      {
        error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
*************** read_full_die (struct die_info **diep, b
*** 3552,3558 ****
        return info_ptr;
      }
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number);
    if (!abbrev)
      {
        error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
--- 3568,3574 ----
        return info_ptr;
      }
  
!   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
    if (!abbrev)
      {
        error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);

--------------46A8242DC006F40E395AC509--


             reply	other threads:[~2002-07-12 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 10:01 Petr Sorfa [this message]
2002-08-15 15:04 ` Jim Blandy
2002-08-16 12:00   ` Petr Sorfa
2002-09-11  9:58 jlw
2002-10-08 21:03 ` Jim Blandy
2002-10-08 21:47 ` Jim Blandy
2002-10-08 21:52   ` Christopher Faylor
2002-10-08 22:01     ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D2F0E4F.DDCC4DE9@caldera.com \
    --to=petrs@caldera.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox