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]

patch to add DWARF2 support for COFF


Hello again,

This patch generalizes DWARF2 support and adds COFF support at the same time. In creating this 
patch, I also see that sec_to_styp_flags (and probably its counterpart) in coffcode.h is in 
serious need of an overhaul. Unless anyone objects, I plan to work on that after this patch is 
accepted.

bfd/Changelog:

2000-12-06  Mark Elbrecht  <snowball3@bigfoot.com>

	* Makefile.am (BFD32_BACKENDS): Move dwarf2.lo from here...
	  (BFD_LIBS): ...to here.
	  (BFD32_BACKENDS_CFILES): Move dwarf2.c from here...
	  (BFD_LIBS_CFILES): ...to here.
	* Makefile.in: Regenerate.
	* configure.in: Remove dwarf.lo from the elf shell variable.
	* configure: Regenerate.
	* libcoff-in.h (coff_tdata): Add pointer dwarf2_find_line_info.
	* libcoff.h: Regenerate.
	* coffgen.c (coff_find_nearest_line): Call 
	  _bfd_dwarf2_find_nearest_line.
	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Add parameter. Update
	  accordingly.
	  (read_abbrevs): Likewise
	  (decode_line_info): Likewise.
	  (parse_comp_unit): Likewise.
	  (comp_unit_find_nearest_line): Likewise.
	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
	* libbfd.h: Regenerate.
	* elf.c (_bfd_elf_find_nearest_line): Update call.
	* elf-bfd.h (elf_obj_tdata): Change dwarf2_find_line_info to type PTR.
	* dwarf2.c (concat_filename): Use IS_ABSOLUTE_PATH.
	* coffcode.h (STYP_XCOFF_DEBUG, STYP_DEBUG_INFO): New macros.
	  (sec_to_styp_flags): Use them. Handle DWARF2 sections.
	  (styp_to_sec_flags): Handle DWARF2 sections.

Index: src/bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.42
diff -c -p -r1.42 Makefile.am
*** Makefile.am	2000/11/30 19:16:54	1.42
--- Makefile.am	2000/12/06 05:44:00
*************** BFD_LIBS = \
*** 29,41 ****
  	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
  	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
  	section.lo syms.lo targets.lo hash.lo linker.lo \
! 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo
  
  BFD_LIBS_CFILES = \
  	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
  	format.c init.c libbfd.c opncls.c reloc.c \
  	section.c syms.c targets.c hash.c linker.c \
! 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c
  
  # This list is alphabetized to make it easier to keep in sync
  # with the decls and initializer in archures.c.
--- 29,43 ----
  	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
  	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
  	section.lo syms.lo targets.lo hash.lo linker.lo \
! 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
! 	dwarf2.lo
  
  BFD_LIBS_CFILES = \
  	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
  	format.c init.c libbfd.c opncls.c reloc.c \
  	section.c syms.c targets.c hash.c linker.c \
! 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
! 	dwarf2.c
  
  # This list is alphabetized to make it easier to keep in sync
  # with the decls and initializer in archures.c.
*************** BFD32_BACKENDS = \
*** 167,173 ****
  	coff-z8k.lo \
  	cofflink.lo \
  	dwarf1.lo \
- 	dwarf2.lo \
  	ecoff.lo \
  	ecofflink.lo \
  	efi-app-ia32.lo \
--- 169,174 ----
*************** BFD32_BACKENDS_CFILES = \
*** 306,312 ****
  	coff-z8k.c \
  	cofflink.c \
  	dwarf1.c \
- 	dwarf2.c \
  	ecoff.c \
  	ecofflink.c \
  	efi-app-ia32.c \
--- 307,312 ----
Index: src/bfd/Makefile.in
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.in,v
retrieving revision 1.49
diff -c -p -r1.49 Makefile.in
*** Makefile.in	2000/11/30 19:16:54	1.49
--- Makefile.in	2000/12/06 05:44:07
*************** BFD_LIBS = \
*** 148,162 ****
  	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
  	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
  	section.lo syms.lo targets.lo hash.lo linker.lo \
! 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo
  
- 
  BFD_LIBS_CFILES = \
  	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
  	format.c init.c libbfd.c opncls.c reloc.c \
  	section.c syms.c targets.c hash.c linker.c \
! 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c
! 
  
  # This list is alphabetized to make it easier to keep in sync
  # with the decls and initializer in archures.c.
--- 148,162 ----
  	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
  	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
  	section.lo syms.lo targets.lo hash.lo linker.lo \
! 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
! 	dwarf2.lo
  
  BFD_LIBS_CFILES = \
  	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
  	format.c init.c libbfd.c opncls.c reloc.c \
  	section.c syms.c targets.c hash.c linker.c \
! 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
! 	dwarf2.c
  
  # This list is alphabetized to make it easier to keep in sync
  # with the decls and initializer in archures.c.
*************** BFD32_BACKENDS = \
*** 290,296 ****
  	coff-z8k.lo \
  	cofflink.lo \
  	dwarf1.lo \
- 	dwarf2.lo \
  	ecoff.lo \
  	ecofflink.lo \
  	efi-app-ia32.lo \
--- 290,295 ----
*************** BFD32_BACKENDS_CFILES = \
*** 430,436 ****
  	coff-z8k.c \
  	cofflink.c \
  	dwarf1.c \
- 	dwarf2.c \
  	ecoff.c \
  	ecofflink.c \
  	efi-app-ia32.c \
--- 429,434 ----
*************** LTLIBRARIES =  $(lib_LTLIBRARIES)
*** 675,681 ****
  libbfd_la_OBJECTS =  archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
  corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
  syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo \
! ihex.lo stabs.lo stab-syms.lo
  CFLAGS = @CFLAGS@
  COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--- 673,679 ----
  libbfd_la_OBJECTS =  archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
  corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
  syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo \
! ihex.lo stabs.lo stab-syms.lo dwarf2.lo
  CFLAGS = @CFLAGS@
  COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Index: src/bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.9
diff -c -p -r1.9 libbfd-in.h
*** libbfd-in.h	2000/07/08 12:08:43	1.9
--- libbfd-in.h	2000/12/06 05:44:25
*************** extern boolean _bfd_dwarf1_find_nearest_
*** 365,371 ****
  /* Find the nearest line using DWARF 2 debugging information.  */
  extern boolean _bfd_dwarf2_find_nearest_line
    PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
! 	   const char **, unsigned int *, unsigned int));
  
  /* A routine to create entries for a bfd_link_hash_table.  */
  extern struct bfd_hash_entry *_bfd_link_hash_newfunc
--- 365,372 ----
  /* Find the nearest line using DWARF 2 debugging information.  */
  extern boolean _bfd_dwarf2_find_nearest_line
    PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
! 	   const char **, unsigned int *, unsigned int,
! 	   PTR *));
  
  /* A routine to create entries for a bfd_link_hash_table.  */
  extern struct bfd_hash_entry *_bfd_link_hash_newfunc
Index: src/bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.29
diff -c -p -r1.29 libbfd.h
*** libbfd.h	2000/11/30 19:16:54	1.29
--- libbfd.h	2000/12/06 05:44:37
*************** extern boolean _bfd_dwarf1_find_nearest_
*** 365,371 ****
  /* Find the nearest line using DWARF 2 debugging information.  */
  extern boolean _bfd_dwarf2_find_nearest_line
    PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
! 	   const char **, unsigned int *, unsigned int));
  
  /* A routine to create entries for a bfd_link_hash_table.  */
  extern struct bfd_hash_entry *_bfd_link_hash_newfunc
--- 365,372 ----
  /* Find the nearest line using DWARF 2 debugging information.  */
  extern boolean _bfd_dwarf2_find_nearest_line
    PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
! 	   const char **, unsigned int *, unsigned int,
! 	   PTR *));
  
  /* A routine to create entries for a bfd_link_hash_table.  */
  extern struct bfd_hash_entry *_bfd_link_hash_newfunc
Index: src/bfd/libcoff-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libcoff-in.h,v
retrieving revision 1.7
diff -c -p -r1.7 libcoff-in.h
*** libcoff-in.h	2000/11/27 12:45:17	1.7
--- libcoff-in.h	2000/12/06 05:44:43
*************** typedef struct coff_tdata
*** 100,105 ****
--- 100,108 ----
    /* Used by coff_find_nearest_line.  */
    PTR line_info;
  
+   /* A place to stash dwarf2 info for this bfd. */
+   PTR dwarf2_find_line_info;
+ 
    /* The timestamp from the COFF file header.  */
    long timestamp;
  
Index: src/bfd/libcoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libcoff.h,v
retrieving revision 1.14
diff -c -p -r1.14 libcoff.h
*** libcoff.h	2000/11/30 19:16:54	1.14
--- libcoff.h	2000/12/06 05:44:51
*************** typedef struct coff_tdata
*** 100,105 ****
--- 100,108 ----
    /* Used by coff_find_nearest_line.  */
    PTR line_info;
  
+   /* A place to stash dwarf2 info for this bfd. */
+   PTR dwarf2_find_line_info;
+ 
    /* The timestamp from the COFF file header.  */
    long timestamp;
  
Index: src/bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.37
diff -c -p -r1.37 configure.in
*** configure.in	2000/11/30 19:16:54	1.37
--- configure.in	2000/12/06 05:44:57
*************** selarchs="$f"
*** 448,454 ****
  # Target backend .o files.
  tb=
  
! elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
  
  for vec in $selvecs
  do
--- 448,454 ----
  # Target backend .o files.
  tb=
  
! elf="elf.lo elflink.lo dwarf1.lo"
  
  for vec in $selvecs
  do
Index: src/bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.50
diff -c -p -r1.50 configure
*** configure	2000/11/30 19:16:54	1.50
--- configure	2000/12/06 05:45:12
*************** selarchs="$f"
*** 5899,5905 ****
  # Target backend .o files.
  tb=
  
! elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
  
  for vec in $selvecs
  do
--- 5899,5905 ----
  # Target backend .o files.
  tb=
  
! elf="elf.lo elflink.lo dwarf1.lo"
  
  for vec in $selvecs
  do
Index: src/bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.16
diff -c -p -r1.16 dwarf2.c
*** dwarf2.c	2000/11/16 19:29:48	1.16
--- dwarf2.c	2000/12/06 05:45:27
*************** lookup_abbrev (number,abbrevs)
*** 402,420 ****
     in a hash table.  */
  
  static struct abbrev_info**
! read_abbrevs (abfd, offset)
       bfd * abfd;
       unsigned int offset;
  {
    struct abbrev_info **abbrevs;
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
-   struct dwarf2_debug *stash;
  
-   stash = elf_tdata(abfd)->dwarf2_find_line_info;
- 
    if (! stash->dwarf_abbrev_buffer)
      {
        asection *msec;
--- 402,418 ----
     in a hash table.  */
  
  static struct abbrev_info**
! read_abbrevs (abfd, offset, stash)
       bfd * abfd;
       unsigned int offset;
+      struct dwarf2_debug *stash;
  {
    struct abbrev_info **abbrevs;
    char *abbrev_ptr;
    struct abbrev_info *cur_abbrev;
    unsigned int abbrev_number, bytes_read, abbrev_name;
    unsigned int abbrev_form, hash_number;
  
    if (! stash->dwarf_abbrev_buffer)
      {
        asection *msec;
*************** concat_filename (table, file)
*** 701,707 ****
      }
  
    filename = table->files[file - 1].name;
!   if (*filename == '/')
      return filename;
  
    else
--- 699,705 ----
      }
  
    filename = table->files[file - 1].name;
!   if (IS_ABSOLUTE_PATH(filename))
      return filename;
  
    else
*************** arange_add (unit, low_pc, high_pc)
*** 761,771 ****
  /* Decode the line number information for UNIT.  */
  
  static struct line_info_table*
! decode_line_info (unit)
       struct comp_unit *unit;
  {
    bfd *abfd = unit->abfd;
-   struct dwarf2_debug *stash;
    struct line_info_table* table;
    char *line_ptr;
    char *line_end;
--- 759,769 ----
  /* Decode the line number information for UNIT.  */
  
  static struct line_info_table*
! decode_line_info (unit, stash)
       struct comp_unit *unit;
+      struct dwarf2_debug *stash;
  {
    bfd *abfd = unit->abfd;
    struct line_info_table* table;
    char *line_ptr;
    char *line_end;
*************** decode_line_info (unit)
*** 774,781 ****
    char *cur_file, *cur_dir;
    unsigned char op_code, extended_op, adj_opcode;
  
-   stash = elf_tdata (abfd)->dwarf2_find_line_info;
- 
    if (! stash->dwarf_line_buffer)
      {
        asection *msec;
--- 772,777 ----
*************** scan_unit_for_functions (unit)
*** 1233,1242 ****
     to get to the line number information for the compilation unit.  */
  
  static struct comp_unit *
! parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
       bfd* abfd;
!      char* info_ptr;
!      char* end_ptr;
       unsigned int abbrev_length;
  {
    struct comp_unit* unit;
--- 1229,1238 ----
     to get to the line number information for the compilation unit.  */
  
  static struct comp_unit *
! parse_comp_unit (abfd, stash, unit_length, abbrev_length)
       bfd* abfd;
!      struct dwarf2_debug *stash;
!      bfd_vma unit_length;
       unsigned int abbrev_length;
  {
    struct comp_unit* unit;
*************** parse_comp_unit (abfd, info_ptr, end_ptr
*** 1250,1255 ****
--- 1246,1254 ----
    struct abbrev_info *abbrev;
    struct attribute attr;
  
+   char *info_ptr = stash->info_ptr;
+   char *end_ptr = info_ptr + unit_length;
+   
    version = read_2_bytes (abfd, info_ptr);
    info_ptr += 2;
    BFD_ASSERT (abbrev_length == 0
*************** parse_comp_unit (abfd, info_ptr, end_ptr
*** 1287,1293 ****
      }
  
    /* Read the abbrevs for this compilation unit into a table.  */
!   abbrevs = read_abbrevs (abfd, abbrev_offset);
    if (! abbrevs)
        return 0;
  
--- 1286,1292 ----
      }
  
    /* Read the abbrevs for this compilation unit into a table.  */
!   abbrevs = read_abbrevs (abfd, abbrev_offset, stash);
    if (! abbrevs)
        return 0;
  
*************** comp_unit_contains_address (unit, addr)
*** 1400,1411 ****
  
  static boolean
  comp_unit_find_nearest_line (unit, addr,
! 			     filename_ptr, functionname_ptr, linenumber_ptr)
       struct comp_unit* unit;
       bfd_vma addr;
       const char **filename_ptr;
       const char **functionname_ptr;
       unsigned int *linenumber_ptr;
  {
    boolean line_p;
    boolean func_p;
--- 1399,1412 ----
  
  static boolean
  comp_unit_find_nearest_line (unit, addr,
! 			     filename_ptr, functionname_ptr, linenumber_ptr,
! 			     stash)
       struct comp_unit* unit;
       bfd_vma addr;
       const char **filename_ptr;
       const char **functionname_ptr;
       unsigned int *linenumber_ptr;
+      struct dwarf2_debug *stash;
  {
    boolean line_p;
    boolean func_p;
*************** comp_unit_find_nearest_line (unit, addr,
*** 1421,1427 ****
  	  return false;
  	}
  
!       unit->line_table = decode_line_info (unit);
  
        if (! unit->line_table)
  	{
--- 1422,1428 ----
  	  return false;
  	}
  
!       unit->line_table = decode_line_info (unit, stash);
  
        if (! unit->line_table)
  	{
*************** boolean
*** 1493,1499 ****
  _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  			       filename_ptr, functionname_ptr,
  			       linenumber_ptr,
! 			       addr_size)
       bfd *abfd;
       asection *section;
       asymbol **symbols ATTRIBUTE_UNUSED;
--- 1494,1500 ----
  _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  			       filename_ptr, functionname_ptr,
  			       linenumber_ptr,
! 			       addr_size, pinfo)
       bfd *abfd;
       asection *section;
       asymbol **symbols ATTRIBUTE_UNUSED;
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1502,1507 ****
--- 1503,1509 ----
       const char **functionname_ptr;
       unsigned int *linenumber_ptr;
       unsigned int addr_size;
+      PTR *pinfo;
  {
    /* Read each compilation unit from the section .debug_info, and check
       to see if it contains the address we are searching for.  If yes,
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1511,1517 ****
       We keep a list of all the previously read compilation units, and
       a pointer to the next un-read compilation unit.  Check the
       previously read units before reading more.  */
!   struct dwarf2_debug *stash = elf_tdata (abfd)->dwarf2_find_line_info;
  
    /* What address are we looking for?  */
    bfd_vma addr = offset + section->vma;
--- 1513,1519 ----
       We keep a list of all the previously read compilation units, and
       a pointer to the next un-read compilation unit.  Check the
       previously read units before reading more.  */
!   struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo;
  
    /* What address are we looking for?  */
    bfd_vma addr = offset + section->vma;
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1534,1550 ****
        unsigned long total_size;
        asection *msec;
  
!       stash = elf_tdata (abfd)->dwarf2_find_line_info =
  	(struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug));
        if (! stash)
  	return false;
  
        msec = find_debug_info (abfd, NULL);
        if (! msec)
  	/* No dwarf2 info.  Note that at this point the stash
  	   has been allocated, but contains zeros, this lets
  	   future calls to this function fail quicker.  */
! 	return false;
  
        /* There can be more than one DWARF2 info section in a BFD these days.
           Read them all in and produce one large stash.  We do this in two
--- 1536,1554 ----
        unsigned long total_size;
        asection *msec;
  
!       stash =
  	(struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug));
        if (! stash)
  	return false;
  
+       *pinfo = (PTR) stash;
+       
        msec = find_debug_info (abfd, NULL);
        if (! msec)
  	/* No dwarf2 info.  Note that at this point the stash
  	   has been allocated, but contains zeros, this lets
  	   future calls to this function fail quicker.  */
! 	 return false;
  
        /* There can be more than one DWARF2 info section in a BFD these days.
           Read them all in and produce one large stash.  We do this in two
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1606,1612 ****
    for (each = stash->all_comp_units; each; each = each->next_unit)
      if (comp_unit_contains_address (each, addr))
        return comp_unit_find_nearest_line (each, addr, filename_ptr,
! 					  functionname_ptr, linenumber_ptr);
  
    /* Read each remaining comp. units checking each as they are read.  */
    while (stash->info_ptr < stash->info_ptr_end)
--- 1610,1617 ----
    for (each = stash->all_comp_units; each; each = each->next_unit)
      if (comp_unit_contains_address (each, addr))
        return comp_unit_find_nearest_line (each, addr, filename_ptr,
! 					  functionname_ptr, linenumber_ptr,
! 					  stash);
  
    /* Read each remaining comp. units checking each as they are read.  */
    while (stash->info_ptr < stash->info_ptr_end)
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1623,1631 ****
  
        if (length > 0)
          {
! 	  each = parse_comp_unit (abfd, stash->info_ptr,
! 				  stash->info_ptr + length,
! 				  addr_size);
  	  stash->info_ptr += length;
  
  	  if (each)
--- 1628,1634 ----
  
        if (length > 0)
          {
! 	  each = parse_comp_unit (abfd, stash, length, addr_size);
  	  stash->info_ptr += length;
  
  	  if (each)
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1644,1657 ****
  		    return comp_unit_find_nearest_line (each, addr,
  						       filename_ptr,
  						       functionname_ptr,
! 						       linenumber_ptr);
  		}
  	      else
  		{
  		  found = comp_unit_find_nearest_line (each, addr,
  						       filename_ptr,
  						       functionname_ptr,
! 						       linenumber_ptr);
  		  if (found)
  		    return true;
  		}
--- 1647,1662 ----
  		    return comp_unit_find_nearest_line (each, addr,
  						       filename_ptr,
  						       functionname_ptr,
! 						       linenumber_ptr,
! 						       stash);
  		}
  	      else
  		{
  		  found = comp_unit_find_nearest_line (each, addr,
  						       filename_ptr,
  						       functionname_ptr,
! 						       linenumber_ptr,
! 						       stash);
  		  if (found)
  		    return true;
  		}
Index: src/bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.59
diff -c -p -r1.59 elf.c
*** elf.c	2000/11/30 19:16:54	1.59
--- elf.c	2000/12/06 05:45:47
*************** _bfd_elf_find_nearest_line (abfd,
*** 5003,5009 ****
  
    if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  				     filename_ptr, functionname_ptr,
! 				     line_ptr, 0))
      return true;
  
    if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
--- 5003,5010 ----
  
    if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  				     filename_ptr, functionname_ptr,
! 				     line_ptr, 0,
! 				     &elf_tdata (abfd)->dwarf2_find_line_info))
      return true;
  
    if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
Index: src/bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.28
diff -c -p -r1.28 elf-bfd.h
*** elf-bfd.h	2000/10/05 22:22:27	1.28
--- elf-bfd.h	2000/12/06 05:45:55
*************** struct elf_obj_tdata
*** 877,883 ****
    struct dwarf1_debug *dwarf1_find_line_info;
  
    /* A place to stash dwarf2 info for this bfd. */
!   struct dwarf2_debug *dwarf2_find_line_info;
  
    /* An array of stub sections indexed by symbol number, used by the
       MIPS ELF linker.  FIXME: We should figure out some way to only
--- 877,883 ----
    struct dwarf1_debug *dwarf1_find_line_info;
  
    /* A place to stash dwarf2 info for this bfd. */
!   PTR dwarf2_find_line_info;
  
    /* An array of stub sections indexed by symbol number, used by the
       MIPS ELF linker.  FIXME: We should figure out some way to only
Index: src/bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.15
diff -c -p -r1.15 coffgen.c
*** coffgen.c	2000/11/28 01:33:15	1.15
--- coffgen.c	2000/12/06 05:46:04
*************** coff_find_nearest_line (abfd, section, s
*** 2188,2196 ****
    if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
  					     &found, filename_ptr,
  					     functionname_ptr, line_ptr,
! 					     &coff_data (abfd)->line_info))
      return false;
!   if (found)
      return true;
  
    *filename_ptr = 0;
--- 2188,2204 ----
    if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
  					     &found, filename_ptr,
  					     functionname_ptr, line_ptr,
! 					     &coff_data(abfd)->line_info))
      return false;
! 
!   /* Also try examining DWARF2 debugging information.  */
!   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
! 				     filename_ptr, functionname_ptr,
! 				     line_ptr, 0,
! 				     &coff_data(abfd)->dwarf2_find_line_info))
!     return true;
! 
! if (found)
      return true;
  
    *filename_ptr = 0;
Index: src/bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.50
diff -c -p -r1.50 coffcode.h
*** coffcode.h	2000/11/28 21:42:16	1.50
--- coffcode.h	2000/12/06 05:46:23
*************** static PTR coff_mkobject_hook PARAMS ((b
*** 349,354 ****
--- 349,367 ----
  
  #ifndef COFF_WITH_PE
  
+ /* Macros for setting debugging flags.  */
+ #ifdef STYP_DEBUG
+ #define STYP_XCOFF_DEBUG STYP_DEBUG
+ #else
+ #define STYP_XCOFF_DEBUG STYP_INFO
+ #endif
+ 
+ #ifdef COFF_ALIGN_IN_S_FLAGS
+ #define STYP_DEBUG_INFO STYP_DSECT
+ #else
+ #define STYP_DEBUG_INFO STYP_INFO
+ #endif
+ 
  static long
  sec_to_styp_flags (sec_name, sec_flags)
       CONST char *sec_name;
*************** sec_to_styp_flags (sec_name, sec_flags)
*** 386,407 ****
        styp_flags = STYP_LIT;
  #endif /* _LIT */
      }
!   else if (!strcmp (sec_name, ".debug"))
      {
! #ifdef STYP_DEBUG
!       styp_flags = STYP_DEBUG;
! #else
!       styp_flags = STYP_INFO;
! #endif
      }
    else if (!strncmp (sec_name, ".stab", 5))
      {
! #ifdef COFF_ALIGN_IN_S_FLAGS
!       styp_flags = STYP_DSECT;
! #else
!       styp_flags = STYP_INFO;
! #endif
      }
  #ifdef RS6000COFF_C
    else if (!strcmp (sec_name, _PAD))
      {
--- 399,422 ----
        styp_flags = STYP_LIT;
  #endif /* _LIT */
      }
!   else if (!strncmp (sec_name, ".debug", 6))
      {
!       /* Handle the XCOFF debug section and DWARF2 debug sections.  */
!       if (!sec_name[6])
!         styp_flags = STYP_XCOFF_DEBUG;
!       else
!         styp_flags = STYP_DEBUG_INFO;
      }
    else if (!strncmp (sec_name, ".stab", 5))
      {
!       styp_flags = STYP_DEBUG_INFO;
!     }
! #ifdef COFF_LONG_SECTION_NAMES
!   else if (!strncmp (sec_name, ".gnu.linkonce.wi.", 17))
!     {
!       styp_flags = STYP_DEBUG_INFO;
      }
+ #endif
  #ifdef RS6000COFF_C
    else if (!strcmp (sec_name, _PAD))
      {
*************** styp_to_sec_flags (abfd, hdr, name, sect
*** 626,634 ****
  #endif
  	sec_flags |= SEC_ALLOC;
      }
!   else if (strcmp (name, ".debug") == 0
  #ifdef _COMMENT
  	   || strcmp (name, _COMMENT) == 0
  #endif
  	   || strncmp (name, ".stab", 5) == 0)
      {
--- 641,652 ----
  #endif
  	sec_flags |= SEC_ALLOC;
      }
!   else if (strncmp (name, ".debug", 6) == 0
  #ifdef _COMMENT
  	   || strcmp (name, _COMMENT) == 0
+ #endif
+ #ifdef COFF_LONG_SECTION_NAMES
+ 	   || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
  #endif
  	   || strncmp (name, ".stab", 5) == 0)
      {

Out,
Mark


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