Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Elena Zannoni <ezannoni@redhat.com>
To: Adam Fedor <fedor@doc.com>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [RFA]: Fix objc/1236 - printing non-debuggable symbols
Date: Tue, 17 Feb 2004 00:05:00 -0000	[thread overview]
Message-ID: <16433.23008.848603.345992@localhost.redhat.com> (raw)
In-Reply-To: <3EE150E9.2080003@doc.com>

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
 >      {


  parent reply	other threads:[~2004-02-17  0:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-07  2:41 Adam Fedor
2003-06-17  3:30 ` Adam Fedor
2004-02-17  0:05 ` Elena Zannoni [this message]
2004-02-24 15:56   ` Adam Fedor
2004-03-22  4:30     ` Adam Fedor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16433.23008.848603.345992@localhost.redhat.com \
    --to=ezannoni@redhat.com \
    --cc=fedor@doc.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox