View | Details | Raw Unified
Collapse All | Expand All

(-) gdb-6.2.1-orig/gdb/dwarf2read.c (-13 / +22 lines)
 Lines 762-768    Link Here 
static void dwarf_decode_lines (struct line_header *, char *, bfd *,
static void dwarf_decode_lines (struct line_header *, char *, bfd *,
				struct dwarf2_cu *, struct partial_symtab *);
				struct dwarf2_cu *, struct partial_symtab *);
static void dwarf2_start_subfile (char *, char *);
static void dwarf2_start_subfile (char *, char *, char *);
static struct symbol *new_symbol (struct die_info *, struct type *,
static struct symbol *new_symbol (struct die_info *, struct type *,
				  struct dwarf2_cu *);
				  struct dwarf2_cu *);
 Lines 5951-5962    Link Here 
	     directory and file name numbers in the statement program
	     directory and file name numbers in the statement program
	     are 1-based.  */
	     are 1-based.  */
          struct file_entry *fe = &lh->file_names[file - 1];
          struct file_entry *fe = &lh->file_names[file - 1];
          char *dir;
          char *dir = NULL;
          if (fe->dir_index)
          if (fe->dir_index)
            dir = lh->include_dirs[fe->dir_index - 1];
            dir = lh->include_dirs[fe->dir_index - 1];
          else
	  dwarf2_start_subfile (fe->name, dir, comp_dir);
            dir = comp_dir;
	  dwarf2_start_subfile (fe->name, dir);
	}
	}
      /* Decode the table. */
      /* Decode the table. */
 Lines 6044-6060    Link Here 
                   but the directory and file name numbers in the
                   but the directory and file name numbers in the
                   statement program are 1-based.  */
                   statement program are 1-based.  */
                struct file_entry *fe;
                struct file_entry *fe;
                char *dir;
                char *dir = NULL;
                file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
                file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
                line_ptr += bytes_read;
                line_ptr += bytes_read;
                fe = &lh->file_names[file - 1];
                fe = &lh->file_names[file - 1];
                fe->included_p = 1;
                fe->included_p = 1;
                if (fe->dir_index)
                if (fe->dir_index)
                  dir = lh->include_dirs[fe->dir_index - 1];
                  dir = lh->include_dirs[fe->dir_index - 1];
                else
                  dir = comp_dir;
                if (!decode_for_pst_p)
                if (!decode_for_pst_p)
                  dwarf2_start_subfile (fe->name, dir);
                  dwarf2_start_subfile (fe->name, dir, comp_dir);
              }
              }
	      break;
	      break;
	    case DW_LNS_set_column:
	    case DW_LNS_set_column:
 Lines 6112-6118    Link Here 
/* Start a subfile for DWARF.  FILENAME is the name of the file and
/* Start a subfile for DWARF.  FILENAME is the name of the file and
   DIRNAME the name of the source directory which contains FILENAME
   DIRNAME the name of the source directory which contains FILENAME
   or NULL if not known.
   or NULL if not known.  COMP_DIR is the value of DW_AT_comp_dir.  If
   DIRNAME specifies a relative path, it is appended to COMP_DIR.
   This routine tries to keep line numbers from identical absolute and
   This routine tries to keep line numbers from identical absolute and
   relative file names in a common subfile.
   relative file names in a common subfile.
 Lines 6131-6138    Link Here 
   subfile, so that `break /srcdir/list0.c:1' works as expected.  */
   subfile, so that `break /srcdir/list0.c:1' works as expected.  */
static void
static void
dwarf2_start_subfile (char *filename, char *dirname)
dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir)
{
{
  struct cleanup *back_to = make_cleanup (null_cleanup, 0);
  /* If we have a relative dirname, append it to comp_dir.  */
  if (dirname != NULL && !IS_ABSOLUTE_PATH (dirname) && comp_dir != NULL)
    {
      dirname = concat (comp_dir, "/", dirname, NULL);
      make_cleanup (xfree, dirname);
    }
  else if (dirname == NULL)
    dirname = comp_dir;
  /* If the filename isn't absolute, try to match an existing subfile
  /* If the filename isn't absolute, try to match an existing subfile
     with the full pathname.  */
     with the full pathname.  */
 Lines 6140-6158    Link Here 
    {
    {
      struct subfile *subfile;
      struct subfile *subfile;
      char *fullname = concat (dirname, "/", filename, NULL);
      char *fullname = concat (dirname, "/", filename, NULL);
      make_cleanup (xfree, fullname);
      for (subfile = subfiles; subfile; subfile = subfile->next)
      for (subfile = subfiles; subfile; subfile = subfile->next)
	{
	{
	  if (FILENAME_CMP (subfile->name, fullname) == 0)
	  if (FILENAME_CMP (subfile->name, fullname) == 0)
	    {
	    {
	      current_subfile = subfile;
	      current_subfile = subfile;
	      xfree (fullname);
	      do_cleanups (back_to);
	      return;
	      return;
	    }
	    }
	}
	}
      xfree (fullname);
    }
    }
  start_subfile (filename, dirname);
  start_subfile (filename, dirname);
  do_cleanups (back_to);
}
}
static void
static void