Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: Fix objc/1236 - printing non-debuggable symbols
@ 2003-06-07  2:41 Adam Fedor
  2003-06-17  3:30 ` Adam Fedor
  2004-02-17  0:05 ` Elena Zannoni
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Fedor @ 2003-06-07  2:41 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 20 bytes --]

Fixes PR objc/1236


[-- Attachment #2: debugover.patch --]
[-- Type: text/plain, Size: 3825 bytes --]

2003-06-06  Adam Fedor  <fedor@gnu.org>

	Fix objc/1236.
	* gdb/linespec.c (decode_line_2): Print non-debuggable (minimal)
	symbols.
	(decode_objc): Update for change in arguments to decode_line_2
	(find_methods): Likewise.

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.48
diff -u -p -r1.48 linespec.c
--- linespec.c	3 Jun 2003 02:56:04 -0000	1.48
+++ linespec.c	7 Jun 2003 02:30:50 -0000
@@ -94,7 +94,7 @@ static void build_canonical_line_spec (s
 static char *find_toplevel_char (char *s, char c);
 
 static struct symtabs_and_lines decode_line_2 (struct symbol *[],
-					       int, int, char ***);
+					       int, int, int, char ***);
 
 static struct symtab *symtab_from_filename (char **argptr,
 					    char *p, int is_quote_enclosed);
@@ -442,13 +442,19 @@ find_toplevel_char (char *s, char c)
   return 0;
 }
 
-/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
-   operate on (ask user if necessary).
-   If CANONICAL is non-NULL return a corresponding array of mangled names
-   as canonical line specs there.  */
+/* Given a list of NSYM symbols in SYM_ARR, return a list of lines to
+   operate on (ask user if necessary).  After processing the first
+   NELTS symbols in sym_arr, continue processing entries until you
+   find a NULL entry -- but treat these entries as minimal_symbols
+   instead of full symbols.  This allows us to add functions to the
+   list from non-debugging modules.  So, sym_arr will now contain:
+   sym_arr[0..NELTS-1]: struct symbol * sym_arr[NELTS..<first NULL
+   entry>]: struct minimal_symbol.  If CANONICAL is non-NULL return a
+   corresponding array of mangled names as canonical line specs
+   there.  */
 
 static struct symtabs_and_lines
-decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
+decode_line_2 (struct symbol *sym_arr[], int nelts, int nsym, int funfirstline,
 	       char ***canonical)
 {
   struct symtabs_and_lines values, return_values;
@@ -475,7 +481,7 @@ decode_line_2 (struct symbol *sym_arr[],
 
   i = 0;
   printf_unfiltered ("[0] cancel\n[1] all\n");
-  while (i < nelts)
+  for (i = 0; i < nsym; i++)
     {
       init_sal (&return_values.sals[i]);	/* Initialize to zeroes.  */
       init_sal (&values.sals[i]);
@@ -489,10 +495,28 @@ decode_line_2 (struct symbol *sym_arr[],
 			     values.sals[i].line);
 	}
       else
-	printf_unfiltered ("?HERE\n");
-      i++;
+	printf_filtered ("[%d]    %s\n",
+			 (i + 2),
+			 SYMBOL_PRINT_NAME (sym_arr[i]) ?
+			 SYMBOL_PRINT_NAME (sym_arr[i]) : "?HERE?");
     }
-
+  
+  if (nelts != nsym)
+    printf_filtered ("\nNon-debugging symbols:\n");
+  
+  /* handle minimal_symbols */
+  for (i = nsym; i < nelts; i++)
+    {
+      /* assert (sym_arr[i] != NULL); */
+      values.sals[i].symtab = 0;
+      values.sals[i].line = 0;
+      values.sals[i].end = 0;
+      values.sals[i].pc = SYMBOL_VALUE_ADDRESS (sym_arr[i]);
+      printf_filtered ("[%d]    %s\n",
+		       (i + 2),
+		       SYMBOL_PRINT_NAME (sym_arr[i]));
+    }
+ 
   prompt = getenv ("PS2");
   if (prompt == NULL)
     {
@@ -1095,7 +1119,7 @@ decode_objc (char **argptr, int funfirst
   if (i1 > 1)
     {
       /* More than one match. The user must choose one or more.  */
-      return decode_line_2 (sym_arr, i2, funfirstline, canonical);
+      return decode_line_2 (sym_arr, i1, i2, funfirstline, canonical);
     }
 
   return values;
@@ -1335,7 +1359,7 @@ find_method (int funfirstline, char ***c
     {
       /* There is more than one field with that name
 	 (overloaded).  Ask the user which one to use.  */
-      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+      return decode_line_2 (sym_arr, i1, i1, funfirstline, canonical);
     }
   else
     {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols
  2003-06-07  2:41 [RFA]: Fix objc/1236 - printing non-debuggable symbols Adam Fedor
@ 2003-06-17  3:30 ` Adam Fedor
  2004-02-17  0:05 ` Elena Zannoni
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Fedor @ 2003-06-17  3:30 UTC (permalink / raw)
  To: GDB Patches



Adam Fedor wrote:
> Fixes PR objc/1236
> 
> 
> ------------------------------------------------------------------------
> 
> 2003-06-06  Adam Fedor  <fedor@gnu.org>
> 
> 	Fix objc/1236.
> 	* gdb/linespec.c (decode_line_2): Print non-debuggable (minimal)
> 	symbols.
> 	(decode_objc): Update for change in arguments to decode_line_2
> 	(find_methods): Likewise.
> 


I haven't seen any response to this. It would be nice to get this in 
before the branch (or know why not...)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols
  2003-06-07  2:41 [RFA]: Fix objc/1236 - printing non-debuggable symbols Adam Fedor
  2003-06-17  3:30 ` Adam Fedor
@ 2004-02-17  0:05 ` Elena Zannoni
  2004-02-24 15:56   ` Adam Fedor
  1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2004-02-17  0:05 UTC (permalink / raw)
  To: Adam Fedor; +Cc: GDB Patches

Adam Fedor writes:
 > Fixes PR objc/1236
 > 
 > 2003-06-06  Adam Fedor  <fedor@gnu.org>
 > 
 > 	Fix objc/1236.
 > 	* gdb/linespec.c (decode_line_2): Print non-debuggable (minimal)
 > 	symbols.
 > 	(decode_objc): Update for change in arguments to decode_line_2
 > 	(find_methods): Likewise.
 > 


sorry for the delay, this got lost in my pile.  I see what you are
doing, but could you have 2 separate arrays of symbol pointers and of
msymbol pointers instead of concatenating the two? This way you would
also simplify the find_imps code (no need to swap the symbols and the
msymbols) and also the call to decode_line_2 in the c++ code would
look less weird, it could just pass NULL's.

elena

 > Index: linespec.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/linespec.c,v
 > retrieving revision 1.48
 > diff -u -p -r1.48 linespec.c
 > --- linespec.c	3 Jun 2003 02:56:04 -0000	1.48
 > +++ linespec.c	7 Jun 2003 02:30:50 -0000
 > @@ -94,7 +94,7 @@ static void build_canonical_line_spec (s
 >  static char *find_toplevel_char (char *s, char c);
 >  
 >  static struct symtabs_and_lines decode_line_2 (struct symbol *[],
 > -					       int, int, char ***);
 > +					       int, int, int, char ***);
 >  
 >  static struct symtab *symtab_from_filename (char **argptr,
 >  					    char *p, int is_quote_enclosed);
 > @@ -442,13 +442,19 @@ find_toplevel_char (char *s, char c)
 >    return 0;
 >  }
 >  
 > -/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
 > -   operate on (ask user if necessary).
 > -   If CANONICAL is non-NULL return a corresponding array of mangled names
 > -   as canonical line specs there.  */
 > +/* Given a list of NSYM symbols in SYM_ARR, return a list of lines to
 > +   operate on (ask user if necessary).  After processing the first
 > +   NELTS symbols in sym_arr, continue processing entries until you
 > +   find a NULL entry -- but treat these entries as minimal_symbols
 > +   instead of full symbols.  This allows us to add functions to the
 > +   list from non-debugging modules.  So, sym_arr will now contain:
 > +   sym_arr[0..NELTS-1]: struct symbol * sym_arr[NELTS..<first NULL
 > +   entry>]: struct minimal_symbol.  If CANONICAL is non-NULL return a
 > +   corresponding array of mangled names as canonical line specs
 > +   there.  */
 >  
 >  static struct symtabs_and_lines
 > -decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
 > +decode_line_2 (struct symbol *sym_arr[], int nelts, int nsym, int funfirstline,
 >  	       char ***canonical)
 >  {
 >    struct symtabs_and_lines values, return_values;
 > @@ -475,7 +481,7 @@ decode_line_2 (struct symbol *sym_arr[],
 >  
 >    i = 0;
 >    printf_unfiltered ("[0] cancel\n[1] all\n");
 > -  while (i < nelts)
 > +  for (i = 0; i < nsym; i++)
 >      {
 >        init_sal (&return_values.sals[i]);	/* Initialize to zeroes.  */
 >        init_sal (&values.sals[i]);
 > @@ -489,10 +495,28 @@ decode_line_2 (struct symbol *sym_arr[],
 >  			     values.sals[i].line);
 >  	}
 >        else
 > -	printf_unfiltered ("?HERE\n");
 > -      i++;
 > +	printf_filtered ("[%d]    %s\n",
 > +			 (i + 2),
 > +			 SYMBOL_PRINT_NAME (sym_arr[i]) ?
 > +			 SYMBOL_PRINT_NAME (sym_arr[i]) : "?HERE?");
 >      }
 > -
 > +  
 > +  if (nelts != nsym)
 > +    printf_filtered ("\nNon-debugging symbols:\n");
 > +  
 > +  /* handle minimal_symbols */
 > +  for (i = nsym; i < nelts; i++)
 > +    {
 > +      /* assert (sym_arr[i] != NULL); */
 > +      values.sals[i].symtab = 0;
 > +      values.sals[i].line = 0;
 > +      values.sals[i].end = 0;
 > +      values.sals[i].pc = SYMBOL_VALUE_ADDRESS (sym_arr[i]);
 > +      printf_filtered ("[%d]    %s\n",
 > +		       (i + 2),
 > +		       SYMBOL_PRINT_NAME (sym_arr[i]));
 > +    }
 > + 
 >    prompt = getenv ("PS2");
 >    if (prompt == NULL)
 >      {
 > @@ -1095,7 +1119,7 @@ decode_objc (char **argptr, int funfirst
 >    if (i1 > 1)
 >      {
 >        /* More than one match. The user must choose one or more.  */
 > -      return decode_line_2 (sym_arr, i2, funfirstline, canonical);
 > +      return decode_line_2 (sym_arr, i1, i2, funfirstline, canonical);
 >      }
 >  
 >    return values;
 > @@ -1335,7 +1359,7 @@ find_method (int funfirstline, char ***c
 >      {
 >        /* There is more than one field with that name
 >  	 (overloaded).  Ask the user which one to use.  */
 > -      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
 > +      return decode_line_2 (sym_arr, i1, i1, funfirstline, canonical);
 >      }
 >    else
 >      {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols
  2004-02-17  0:05 ` Elena Zannoni
@ 2004-02-24 15:56   ` Adam Fedor
  2004-03-22  4:30     ` Adam Fedor
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Fedor @ 2004-02-24 15:56 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

On Mon, 2004-02-16 at 17:01, Elena Zannoni wrote:
> Adam Fedor writes:
>  > Fixes PR objc/1236
>  > 
>  > 2003-06-06  Adam Fedor  <fedor@gnu.org>
>  > 
>  > 	Fix objc/1236.
>  > 	* gdb/linespec.c (decode_line_2): Print non-debuggable (minimal)
>  > 	symbols.
>  > 	(decode_objc): Update for change in arguments to decode_line_2
>  > 	(find_methods): Likewise.
>  > 
> 
> 
> sorry for the delay, this got lost in my pile.  I see what you are
> doing, but could you have 2 separate arrays of symbol pointers and of
> msymbol pointers instead of concatenating the two? This way you would
> also simplify the find_imps code (no need to swap the symbols and the
> msymbols) and also the call to decode_line_2 in the c++ code would
> look less weird, it could just pass NULL's.
> 

Well I looked into doing this, but splitting up the arrays looks pretty
ugly and more error prone than the other approach. Plus the arrays have
to be combined eventually in decode_line_2 anyway. 




[-- Attachment #2: splitdebugover.patch --]
[-- Type: text/x-patch, Size: 11089 bytes --]

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.56
diff -u -p -r1.56 linespec.c
--- linespec.c	11 Feb 2004 18:04:14 -0000	1.56
+++ linespec.c	24 Feb 2004 15:54:21 -0000
@@ -96,8 +96,9 @@ static char *find_toplevel_char (char *s
 
 static int is_objc_method_format (const char *s);
 
-static struct symtabs_and_lines decode_line_2 (struct symbol *[],
-					       int, int, char ***);
+static struct symtabs_and_lines decode_line_2 (struct symbol *[], int,
+					       struct minimal_symbol *[], int,
+					       int, char ***);
 
 static struct symtab *symtab_from_filename (char **argptr,
 					    char *p, int is_quote_enclosed,
@@ -467,13 +468,16 @@ is_objc_method_format (const char *s)
 }
 
 /* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
-   operate on (ask user if necessary).
+   operate on (ask user if necessary).  After processing the symbols,
+   process the minimal_symbols as well (if any). This allows us to add
+   functions to the list from non-debugging modules.
    If CANONICAL is non-NULL return a corresponding array of mangled names
    as canonical line specs there.  */
 
 static struct symtabs_and_lines
-decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
-	       char ***canonical)
+decode_line_2 (struct symbol *sym_arr[], int nelts, 
+	       struct minimal_symbol *msym_arr[], int nmsym,
+	       int funfirstline, char ***canonical)
 {
   struct symtabs_and_lines values, return_values;
   char *args, *arg1;
@@ -484,9 +488,9 @@ decode_line_2 (struct symbol *sym_arr[],
   char **canonical_arr = (char **) NULL;
 
   values.sals = (struct symtab_and_line *)
-    alloca (nelts * sizeof (struct symtab_and_line));
+    alloca ((nelts+nmsym) * sizeof (struct symtab_and_line));
   return_values.sals = (struct symtab_and_line *)
-    xmalloc (nelts * sizeof (struct symtab_and_line));
+    xmalloc ((nelts+nmsym) * sizeof (struct symtab_and_line));
   old_chain = make_cleanup (xfree, return_values.sals);
 
   if (canonical)
@@ -523,7 +527,21 @@ decode_line_2 (struct symbol *sym_arr[],
 	printf_unfiltered ("?HERE\n");
       i++;
     }
-
+  
+  /* handle minimal_symbols */
+  if (nmsym > 0)
+    printf_filtered ("\nNon-debugging symbols:\n");  
+  for (i = 0; i < nmsym; i++)
+    {
+      values.sals[nelts+i].symtab = 0;
+      values.sals[nelts+i].line = 0;
+      values.sals[nelts+i].end = 0;
+      values.sals[nelts+i].pc = SYMBOL_VALUE_ADDRESS (msym_arr[i]);
+      printf_filtered ("[%d]    %s\n",
+                      (nelts + i + 2),
+                      SYMBOL_PRINT_NAME (msym_arr[i]));
+    }
+ 
   prompt = getenv ("PS2");
   if (prompt == NULL)
     {
@@ -553,7 +571,7 @@ decode_line_2 (struct symbol *sym_arr[],
 	{
 	  if (canonical_arr)
 	    {
-	      for (i = 0; i < nelts; i++)
+	      for (i = 0; i < (nelts+nmsym); i++)
 		{
 		  if (canonical_arr[i] == NULL)
 		    {
@@ -563,13 +581,13 @@ decode_line_2 (struct symbol *sym_arr[],
 		}
 	    }
 	  memcpy (return_values.sals, values.sals,
-		  (nelts * sizeof (struct symtab_and_line)));
-	  return_values.nelts = nelts;
+		  ((nelts+nmsym) * sizeof (struct symtab_and_line)));
+	  return_values.nelts = (nelts+nmsym);
 	  discard_cleanups (old_chain);
 	  return return_values;
 	}
 
-      if (num >= nelts + 2)
+      if (num >= (nelts+nmsym) + 2)
 	{
 	  printf_unfiltered ("No choice number %d.\n", num);
 	}
@@ -1075,6 +1093,7 @@ decode_objc (char **argptr, int funfirst
 {
   struct symtabs_and_lines values;
   struct symbol **sym_arr = NULL;
+  struct minimal_symbol **msym_arr = NULL;
   struct symbol *sym = NULL;
   char *copy = NULL;
   struct block *block = NULL;
@@ -1089,25 +1108,29 @@ decode_objc (char **argptr, int funfirst
   else
     block = get_selected_block (0);
     
-  copy = find_imps (file_symtab, block, *argptr, NULL, &i1, &i2); 
+  copy = find_imps (file_symtab, block, *argptr, NULL, &i1, NULL, &i2); 
     
   if (i1 > 0)
     {
-      sym_arr = (struct symbol **) alloca ((i1 + 1) * sizeof (struct symbol *));
+      sym_arr = (struct symbol **) 
+	alloca ((i1 + 1) * sizeof (struct symbol *));
       sym_arr[i1] = 0;
-
-      copy = find_imps (file_symtab, block, *argptr, sym_arr, &i1, &i2); 
+    }
+  if (i2 > 0)
+    {
+      msym_arr = (struct minimal_symbol **) 
+	alloca ((i2 + 1) * sizeof (struct minimal_symbol *));
+      msym_arr[i2] = 0;
+    }
+  if (i1 > 0 || i2 > 0)
+    {
+      copy = find_imps (file_symtab, block, *argptr, sym_arr, &i1, msym_arr, &i2); 
       *argptr = copy;
     }
 
-  /* i1 now represents the TOTAL number of matches found.
-     i2 represents how many HIGH-LEVEL (struct symbol) matches,
-     which will come first in the sym_arr array.  Any low-level
-     (minimal_symbol) matches will follow those.  */
-      
-  if (i1 == 1)
+  if ((i1+i2) == 1)
     {
-      if (i2 > 0)
+      if (i1 > 0)
 	{
 	  /* Already a struct symbol.  */
 	  sym = sym_arr[0];
@@ -1142,10 +1165,10 @@ decode_objc (char **argptr, int funfirst
       return values;
     }
 
-  if (i1 > 1)
+  if ((i1+i2) > 1)
     {
       /* More than one match. The user must choose one or more.  */
-      return decode_line_2 (sym_arr, i2, funfirstline, canonical);
+      return decode_line_2 (sym_arr, i1, msym_arr, i2, funfirstline, canonical);
     }
 
   return values;
@@ -1433,7 +1456,7 @@ find_method (int funfirstline, char ***c
     {
       /* There is more than one field with that name
 	 (overloaded).  Ask the user which one to use.  */
-      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+      return decode_line_2 (sym_arr, i1, NULL, 0, funfirstline, canonical);
     }
   else
     {
Index: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.34
diff -u -p -r1.34 objc-lang.c
--- objc-lang.c	18 Feb 2004 04:22:35 -0000	1.34
+++ objc-lang.c	24 Feb 2004 15:54:22 -0000
@@ -1277,7 +1277,8 @@ static void
 find_methods (struct symtab *symtab, char type, 
 	      const char *class, const char *category, 
 	      const char *selector, struct symbol **syms, 
-	      unsigned int *nsym, unsigned int *ndebug)
+	      unsigned int *ndebug, struct minimal_symbol **msyms,
+	      unsigned int *nsym)
 {
   struct objfile *objfile = NULL;
   struct minimal_symbol *msymbol = NULL;
@@ -1361,10 +1362,8 @@ find_methods (struct symtab *symtab, cha
                  lower part of sym_arr (below num_debuggable).  */
               if (syms != NULL)
                 {
-                  syms[csym] = syms[cdebug];
                   syms[cdebug] = sym;
                 }
-              csym++;
               cdebug++;
             }
           else
@@ -1372,16 +1371,16 @@ find_methods (struct symtab *symtab, cha
               warning (
 "debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring",
                        newsymname, symname);
-              if (syms != NULL)
-                syms[csym] = (struct symbol *) msymbol;
+              if (msyms != NULL)
+                msyms[csym] = msymbol;
               csym++;
             }
         }
       else 
 	{
 	  /* Found a non-debuggable method symbol.  */
-	  if (syms != NULL)
-	    syms[csym] = (struct symbol *) msymbol;
+	  if (msyms != NULL)
+	    msyms[csym] = msymbol;
 	  csym++;
 	}
     }
@@ -1394,7 +1393,8 @@ find_methods (struct symtab *symtab, cha
 
 char *find_imps (struct symtab *symtab, struct block *block,
 		 char *method, struct symbol **syms, 
-		 unsigned int *nsym, unsigned int *ndebug)
+		 unsigned int *ndebug, struct minimal_symbol **msyms,
+		 unsigned int *nsym)
 {
   char type = '\0';
   char *class = NULL;
@@ -1437,8 +1437,7 @@ char *find_imps (struct symtab *symtab, 
     if (sym != NULL) 
       {
 	if (syms)
-	  syms[csym] = sym;
-	csym++;
+	  syms[cdebug] = sym;
 	cdebug++;
       }
 
@@ -1447,51 +1446,23 @@ char *find_imps (struct symtab *symtab, 
 
     if (msym != NULL) 
       {
-	if (syms)
-	  syms[csym] = (struct symbol *)msym;
+	if (msyms)
+	  msyms[csym] = msym;
 	csym++;
       }
   }
 
-  if (syms != NULL)
+  if (syms != NULL || msyms != NULL)
     find_methods (symtab, type, class, category, selector, 
-		  syms + csym, &ncsym, &ncdebug);
+		  syms + cdebug, &ncdebug, msyms + csym, &ncsym);
   else
     find_methods (symtab, type, class, category, selector, 
-		  NULL, &ncsym, &ncdebug);
+		  NULL, &ncdebug, NULL, &ncsym);
 
   /* If we didn't find any methods, just return.  */
   if (ncsym == 0 && ncdebug == 0)
     return method;
 
-  /* Take debug symbols from the second batch of symbols and swap them
-   * with debug symbols from the first batch.  Repeat until either the
-   * second section is out of debug symbols or the first section is
-   * full of debug symbols.  Either way we have all debug symbols
-   * packed to the beginning of the buffer.  
-   */
-
-  if (syms != NULL) 
-    {
-      while ((cdebug < csym) && (ncdebug > 0))
-	{
-	  struct symbol *s = NULL;
-	  /* First non-debugging symbol.  */
-	  unsigned int i = cdebug;
-	  /* Last of second batch of debug symbols.  */
-	  unsigned int j = csym + ncdebug - 1;
-
-	  s = syms[j];
-	  syms[j] = syms[i];
-	  syms[i] = s;
-
-	  /* We've moved a symbol from the second debug section to the
-             first one.  */
-	  cdebug++;
-	  ncdebug--;
-	}
-    }
-
   csym += ncsym;
   cdebug += ncdebug;
 
@@ -1500,23 +1471,20 @@ char *find_imps (struct symtab *symtab, 
   if (ndebug != NULL)
     *ndebug = cdebug;
 
-  if (syms == NULL)
+  if (syms == NULL && msyms == NULL)
     return method + (tmp - buf);
 
-  if (csym > 1)
-    {
-      /* Sort debuggable symbols.  */
-      if (cdebug > 1)
-	qsort (syms, cdebug, sizeof (struct minimal_symbol *), 
-	       compare_classes);
+  /* Sort debuggable symbols.  */
+  if (cdebug > 1)
+    qsort (syms, cdebug, sizeof (struct minimal_symbol *), compare_classes);
       
-      /* Sort minimal_symbols.  */
-      if ((csym - cdebug) > 1)
-	qsort (&syms[cdebug], csym - cdebug, 
-	       sizeof (struct minimal_symbol *), compare_classes);
-    }
-  /* Terminate the sym_arr list.  */
-  syms[csym] = 0;
+  /* Sort minimal_symbols.  */
+  if (csym > 1)
+    qsort (msyms, csym, sizeof (struct minimal_symbol *), compare_classes);
+
+  /* Terminate the sym_arr lists.  */
+  syms[cdebug] = 0;
+  msyms[csym] = 0;
 
   return method + (tmp - buf);
 }
Index: objc-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.h,v
retrieving revision 1.11
diff -u -p -r1.11 objc-lang.h
--- objc-lang.h	18 Feb 2004 04:22:35 -0000	1.11
+++ objc-lang.h	24 Feb 2004 15:54:22 -0000
@@ -53,7 +53,8 @@ extern char *parse_method (char *method,
 
 extern char *find_imps (struct symtab *symtab, struct block *block,
 			char *method, struct symbol **syms, 
-			unsigned int *nsym, unsigned int *ndebug);
+			unsigned int *ndebug, struct minimal_symbol **msyms,
+			unsigned int *nsym);
 
 extern struct value *value_nsstring (char *ptr, int len);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols
  2004-02-24 15:56   ` Adam Fedor
@ 2004-03-22  4:30     ` Adam Fedor
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Fedor @ 2004-03-22  4:30 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: GDB Patches

On Tue, 2004-02-24 at 08:56, Adam Fedor wrote:
> On Mon, 2004-02-16 at 17:01, Elena Zannoni wrote:
> > Adam Fedor writes:
> >  > Fixes PR objc/1236
> >  > 
> >  > 2003-06-06  Adam Fedor  <fedor@gnu.org>
> >  > 
> >  > 	Fix objc/1236.
> >  > 	* gdb/linespec.c (decode_line_2): Print non-debuggable (minimal)
> >  > 	symbols.
> >  > 	(decode_objc): Update for change in arguments to decode_line_2
> >  > 	(find_methods): Likewise.
> >  > 
> > 
> > 
> > sorry for the delay, this got lost in my pile.  I see what you are
> > doing, but could you have 2 separate arrays of symbol pointers and of
> > msymbol pointers instead of concatenating the two? This way you would
> > also simplify the find_imps code (no need to swap the symbols and the
> > msymbols) and also the call to decode_line_2 in the c++ code would
> > look less weird, it could just pass NULL's.
> > 
> 
> Well I looked into doing this, but splitting up the arrays looks pretty
> ugly and more error prone than the other approach. Plus the arrays have
> to be combined eventually in decode_line_2 anyway. 

Ping.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-03-22  4:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-07  2:41 [RFA]: Fix objc/1236 - printing non-debuggable symbols Adam Fedor
2003-06-17  3:30 ` Adam Fedor
2004-02-17  0:05 ` Elena Zannoni
2004-02-24 15:56   ` Adam Fedor
2004-03-22  4:30     ` Adam Fedor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox