This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/12034] New: lookup_symtab(), possible performance improvement


function lookup_symtab() in file symtab.c, may repeat same, possibly time
expensive (disk access may be involved) operation in calling
symtab_to_fullname() twice with same input data.

Some performance might be gained by refactoring so that call is only made once
and the result referenced by both the "full_path" and "real_path" branches
inside the for loop.

This same code is also present in version 7.1.

Following is one possible form the code might take (the comment is in original
source, as included here, for location reference):
    /* If the user gave us an absolute path, try to find the file in
       this symtab and use its absolute path.  */

    if(full_path || real_path)
	  fn = symtab_to_fullname(s) ;

    if ((full_path != NULL) && fn)
    {
        if (FILENAME_CMP (full_path, fn) == 0)
	{
            return s;
	}
    }


    if ((real_path != NULL) && fn)
    {
	  char *rp = gdb_realpath (fn);
	  make_cleanup (xfree, rp);
	  if (FILENAME_CMP (real_path, rp) == 0)
	  {
	      return s;
	  }
    }

-- 
           Summary: lookup_symtab(), possible performance improvement
           Product: gdb
           Version: 7.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: contributor at users dot sourceforge dot net
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=12034

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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