public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-absdir: TODO: compare_filenames_for_search search_len undo.
@ 2012-12-10  9:28 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2012-12-10  9:28 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-absdir has been updated
       via  9ecad747ab9f02b63ad9adb88fd4a2df7c8e9227 (commit)
       via  83579d984eba22cce8e108c14833862588527807 (commit)
      from  196c3453a81014284160c9bae0e3fd2e0c12f7ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 9ecad747ab9f02b63ad9adb88fd4a2df7c8e9227
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 10 09:50:00 2012 +0100

    TODO: compare_filenames_for_search search_len undo.

commit 83579d984eba22cce8e108c14833862588527807
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 10 09:18:22 2012 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 gdb/breakpoint.c |    6 +++++-
 gdb/dwarf2read.c |   12 ++++++++----
 gdb/psymtab.c    |    7 ++++---
 gdb/skip.c       |    3 ++-
 gdb/symtab.c     |   23 ++++++++++++++---------
 gdb/symtab.h     |    3 ++-
 6 files changed, 35 insertions(+), 19 deletions(-)

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1a7caaa..a2ac6e6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11845,6 +11845,8 @@ clear_command (char *arg, int from_tty)
   make_cleanup (VEC_cleanup (breakpoint_p), &found);
   for (i = 0; i < sals.nelts; i++)
     {
+      int sal_name_len;
+
       /* If exact pc given, clear bpts at that pc.
          If line given (pc == 0), clear all bpts on specified line.
          If defaulting, clear all bpts on default line
@@ -11858,6 +11860,7 @@ clear_command (char *arg, int from_tty)
          1              0             <can't happen> */
 
       sal = sals.sals[i];
+      sal_name_len = sal.symtab == NULL ? 0 : strlen (sal.symtab->filenamex);
 
       /* Find all matching breakpoints and add them to 'found'.  */
       ALL_BREAKPOINTS (b)
@@ -11886,7 +11889,8 @@ clear_command (char *arg, int from_tty)
 		      && loc->line_number == sal.line)
 		    {
 		      if (compare_filenames_for_search (loc->source_file,
-							sal.symtab->filenamex))
+							sal.symtab->filenamex,
+							sal_name_len))
 			line_match = 1;
 		    }
 
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b75cfb8..e992fa9 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3061,6 +3061,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
 {
   int i;
   const char *name_basename = lbasename (name);
+  int name_len = strlen (name);
 
   dw2_setup (objfile);
 
@@ -3085,7 +3086,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
 	{
 	  const char *this_name = file_data->file_names[j];
 
-	  if (compare_filenames_for_search (this_name, name))
+	  if (compare_filenames_for_search (this_name, name, name_len))
 	    {
 	      if (dw2_map_expand_apply (objfile, per_cu,
 					name, full_path, real_path,
@@ -3105,7 +3106,8 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
 							      file_data, j);
 
 	      if (this_real_name != NULL
-		  && compare_filenames_for_search (this_real_name, name))
+		  && compare_filenames_for_search (this_real_name, name,
+						   name_len))
 		{
 		  if (dw2_map_expand_apply (objfile, per_cu,
 					    name, full_path, real_path,
@@ -3120,7 +3122,8 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
 							      file_data, j);
 
 	      if (this_real_name != NULL
-		  && compare_filenames_for_search (this_real_name, name))
+		  && compare_filenames_for_search (this_real_name, name,
+						   name_len))
 		{
 		  if (dw2_map_expand_apply (objfile, per_cu,
 					    name, full_path, real_path,
@@ -3316,7 +3319,8 @@ dw2_expand_symtabs_with_filename (struct objfile *objfile,
 	{
 	  const char *this_name = file_data->file_names[j];
 
-	  if (compare_filenames_for_search (this_name, filename))
+	  if (compare_filenames_for_search (this_name, filename,
+					    strlen (filename)))
 	    {
 	      dw2_instantiate_symtab (per_cu);
 	      break;
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 37725aa..7eb931a 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -166,6 +166,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
 {
   struct partial_symtab *pst;
   const char *name_basename = lbasename (name);
+  int name_len = strlen (name);
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
   {
@@ -178,7 +179,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
     if (pst->anonymous)
       continue;
 
-    if (compare_filenames_for_search (pst->filename, name))
+    if (compare_filenames_for_search (pst->filename, name, name_len))
       {
 	if (partial_map_expand_apply (objfile, name, full_path, real_path,
 				      pst, callback, data))
@@ -197,7 +198,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
       {
 	psymtab_to_fullname (pst);
 	if (pst->fullname != NULL
-	    && compare_filenames_for_search (pst->fullname, name))
+	    && compare_filenames_for_search (pst->fullname, name, name_len))
 	  {
 	    if (partial_map_expand_apply (objfile, name, full_path, real_path,
 					  pst, callback, data))
@@ -210,7 +211,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
         const char *rp = psymtab_to_realname (pst);
 
 	if (rp != NULL
-	    && compare_filenames_for_search (real_path, name))
+	    && compare_filenames_for_search (real_path, name, name_len))
 	  {
 	    if (partial_map_expand_apply (objfile, name, full_path, real_path,
 					  pst, callback, data))
diff --git a/gdb/skip.c b/gdb/skip.c
index 25e7099..d53739e 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -421,7 +421,8 @@ function_name_is_marked_for_skip (const char *function_name,
 	      searched_for_fullname = 1;
 	    }
 	  if (fullname != NULL
-	      && compare_filenames_for_search (fullname, e->fullname))
+	      && compare_filenames_for_search (fullname, e->fullname,
+					       strlen (e->fullname)))
 	    return 1;
 	}
     }
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a8b2347..8d55618 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -151,10 +151,10 @@ const struct block *block_found;
    SEARCH_NAME.  Returns true if they match, false otherwise.  */
 
 int
-compare_filenames_for_search (const char *filename, const char *search_name)
+compare_filenames_for_search (const char *filename, const char *search_name,
+			      int search_len)
 {
-  size_t len = strlen (filename);
-  size_t search_len = strlen (search_name);
+  int len = strlen (filename);
 
   if (len < search_len)
     return 0;
@@ -193,10 +193,11 @@ iterate_over_some_symtabs (const char *name,
 {
   struct symtab *s = NULL;
   const char* base_name = lbasename (name);
+  int name_len = strlen (name);
 
   for (s = first; s != NULL && s != after_last; s = s->next)
     {
-      if (compare_filenames_for_search (s->filenamex, name))
+      if (compare_filenames_for_search (s->filenamex, name, name_len))
 	{
 	  if (callback (s, data))
 	    return 1;
@@ -221,7 +222,7 @@ iterate_over_some_symtabs (const char *name,
 	      return 1;
           }
 
-	if (fp != NULL && compare_filenames_for_search (fp, name))
+	if (fp != NULL && compare_filenames_for_search (fp, name, name_len))
 	  {
 	    if (callback (s, data))
 	      return 1;
@@ -243,7 +244,7 @@ iterate_over_some_symtabs (const char *name,
 		  return 1;
 	      }
 
-	    if (compare_filenames_for_search (rp, name))
+	    if (compare_filenames_for_search (rp, name, name_len))
 	      {
 		if (callback (s, data))
 		  return 1;
@@ -3263,7 +3264,7 @@ file_matches (const char *file, char *files[], int nfiles)
     {
       for (i = 0; i < nfiles; i++)
 	{
-	  if (compare_filenames_for_search (file, files[i]))
+	  if (compare_filenames_for_search (file, files[i], strlen (files[i])))
 	    return 1;
 	}
     }
@@ -4622,6 +4623,7 @@ struct add_partial_filename_data
   struct filename_seen_cache *filename_seen_cache;
   char *text;
   char *word;
+  int text_len;
   VEC (char_ptr) **list;
 };
 
@@ -4653,12 +4655,13 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
     {
       *fullname_shortener = '\0';
       
-      if (compare_filenames_for_search (fullname_shortened, data->text))
+      if (compare_filenames_for_search (fullname_shortened, data->text,
+					data->text_len))
 	{
 	  /* This file matches for a completion; add it to the
 	     current list of matches.  */
 	  add_filename_to_list ((fullname + strlen (fullname_shortened)
-				 - strlen (data->text)),
+				 - data->text_len),
 				data->text, data->word, data->list);
 	  break;
 	}
@@ -4677,6 +4680,7 @@ make_source_files_completion_list (char *text, char *word)
 {
   struct symtab *s;
   struct objfile *objfile;
+  size_t text_len = strlen (text);
   VEC (char_ptr) *list = NULL;
   const char *base_name;
   struct add_partial_filename_data datum;
@@ -4695,6 +4699,7 @@ make_source_files_completion_list (char *text, char *word)
   datum.filename_seen_cache = filename_seen_cache;
   datum.text = text;
   datum.word = word;
+  datum.text_len = text_len;
   datum.list = &list;
 
   ALL_SYMTABS (objfile, s)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index b09737d..5178680 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1286,7 +1286,8 @@ extern int symtab_create_debug;
 extern int basenames_may_differ;
 
 int compare_filenames_for_search (const char *filename,
-				  const char *search_name);
+				  const char *search_name,
+				  int search_len);
 
 int iterate_over_some_symtabs (const char *name,
 			       const char *full_path,


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-10  9:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-10  9:28 [SCM] archer-jankratochvil-absdir: TODO: compare_filenames_for_search search_len undo jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).