Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Jelmer Vernooij <jelmer@samba.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] -symbol-info-symbol and -symbol-list-functions
Date: Wed, 11 Sep 2002 12:30:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0209111217010.1407-100000@valrhona.uglyboxes.com> (raw)
In-Reply-To: <20020911191204.GA24463@vernstok.dyndns.org>

Just a quick comment or two...

On Wed, 11 Sep 2002, Jelmer Vernooij wrote:

> It's not meant to be committed already, but I'm just wondering whether
> I'm using the correct functions, coding style and output. Should I
> really use search_symbols for these kinds of things? It seems a little
> inefficient to use a function that does regex matching when supplying 
> a 'normal' symbol name (and it might have some issues as well with 
> names that contain special regex characters).

Why not allow regexp matching? It is much more useful than looking for an 
exact string. If the UI really wants an exact string match, it's easy 
enough for it to construct a regexp which will do this.

+      if (p->msymbol == NULL)
+        {
+          ui_out_field_string (uiout, "file", p->symtab->filename);
+          ui_out_field_int (uiout, "line", p->symbol->line);
+          ui_out_field_string (uiout, "name", p->symbol->ginfo.name);
+        }
+      else
+        {
+          ui_out_field_string (uiout, "name", p->msymbol->ginfo.name);
+        }

Does this work on an executable with no debug info? With Insight, this 
code is a lot more complicated... (In other words, couldn't any of these 
strings be NULL?)

Also, as I recall there are accessors for at least ginfo.name 
(SYMBOL_SOURCE_NAME). Also as I recall, this macro wasn't enough for C++. 
We modified it a little in insight, too, since SYMBOL_SOURCE_NAME could 
output mangled names, depending on user setting. We chose to override 
this:

/* A convenience macro for getting the demangled source names,
   regardless of the user's mangling style. */
#define GDBTK_SYMBOL_SOURCE_NAME(symbol) \
      (SYMBOL_DEMANGLED_NAME (symbol) != NULL \
       ? SYMBOL_DEMANGLED_NAME (symbol)       \
       : SYMBOL_NAME (symbol))

+enum mi_cmd_result
+mi_cmd_symbol_list_functions (char *command, char **argv, int argc)
+{
+  struct symbol_search *matches;
+  if (argc != 0)
+    error ("mi_cmd_symbol_list_functions doesn't require any arguments");

Why not allow an optional regexp argument to search for, just like the 
command line? (It could be "" by default, thus listing all functions.)

+  search_symbols (NULL, FUNCTIONS_NAMESPACE, 0, NULL, &matches);

The results of this function need to be deallocated. Suggest adding 
make_cleanup_free_search_symbols and do_cleanups whenever search_symbols 
is called.

For a working reference of a generic use of search_symbols, see 
gdb/gdbtk/generic/gdbtk-cmds.c (gdb_search) in the insight module. (You 
can get this by checking out the file 'src/gdb/gdbtk/generic/gdbtk-cmds.c' 
from sources.redhat.com.)

Keith


  reply	other threads:[~2002-09-11 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-11 12:12 Jelmer Vernooij
2002-09-11 12:30 ` Keith Seitz [this message]
2002-09-11 13:45 ` Elena Zannoni
2002-09-11 13:54   ` Michael Snyder

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=Pine.LNX.4.44.0209111217010.1407-100000@valrhona.uglyboxes.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jelmer@samba.org \
    /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