From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12308 invoked by alias); 17 Feb 2004 00:05:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12300 invoked from network); 17 Feb 2004 00:05:49 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 17 Feb 2004 00:05:49 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id E750A1A448A; Mon, 16 Feb 2004 19:01:36 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16433.23008.848603.345992@localhost.redhat.com> Date: Tue, 17 Feb 2004 00:05:00 -0000 To: Adam Fedor Cc: GDB Patches Subject: Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols In-Reply-To: <3EE150E9.2080003@doc.com> References: <3EE150E9.2080003@doc.com> X-SW-Source: 2004-02/txt/msg00454.txt.bz2 Adam Fedor writes: > Fixes PR objc/1236 > > 2003-06-06 Adam Fedor > > 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.. + 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 > {