This is the mail archive of the gdb-patches@sources.redhat.com 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]

[RFA]: Fix objc/1236 - printing non-debuggable symbols


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.

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
     {

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