From: Gary Funck <gary@intrepid.com>
To: GDB List <gdb@sources.redhat.com>
Subject: how to search for a global type?
Date: Mon, 31 Dec 2007 04:28:00 -0000 [thread overview]
Message-ID: <20071231042844.GA18814@intrepid.com> (raw)
To support UPC debugging, we need to be able to look up
runtime information. Case in point, we need to query
the structure of the target's shared pointer representation.
At preent, we're implmenting this query with the following
code (within gdb):
static
int
lookup_type_by_name (const char *type_name)
{
const struct symbol *sym;
const struct type *type;
int type_id;
sym = lookup_symbol_global (type_name, NULL, TYPES_DOMAIN, NULL);
if (!sym)
sym = lookup_symbol_global (type_name, NULL, STRUCT_DOMAIN, NULL);
if (!sym)
return 0;
type_id = get_type_id (SYMBOL_TYPE (sym));
return type_id;
}
This code doesn't find the type in question, in spite of the
fact that GDB has no problem finding the type from the
command line. For example,
(gdb) ptype upc_shared_ptr_t
type = struct shared_ptr_struct {
long unsigned int phase : 48;
short unsigned int thread : 16;
void *vaddr;
}
and
(gdb) info type upc_shared_ptr_t
All types matching regular expression "upc_shared_ptr_t":
File /upc/gcc-upc-4/src/libupc/smp/upc_access.c:
typedef shared_ptr_struct upc_shared_ptr_t;
File /upc/gcc-upc-4/src/libupc/smp/upc_barrier.c:
typedef shared_ptr_struct upc_shared_ptr_t;
[...]
I've added some simple debugging output to
lookup_symbol_global, to confirm that it is being
called with the expected parameters:
lookup_symbol_global(upc_shared_ptr_t, NULL, 6, NULL) called.
lookup_symbol_global(upc_shared_ptr_t, NULL, 2, NULL) called.
In both cases, the type can't be found.
What's the recommended way to perform this type lookup?
Thanks,
- Gary
configuration: x86_64, FC5, dwarf2 debugging info.
next reply other threads:[~2007-12-31 4:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-31 4:28 Gary Funck [this message]
2008-01-02 3:18 ` Daniel Jacobowitz
2008-01-02 5:16 ` Gary Funck
2008-01-02 13:12 ` Daniel Jacobowitz
2008-01-02 17:46 ` Gary Funck
2008-01-02 18:02 ` Daniel Jacobowitz
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=20071231042844.GA18814@intrepid.com \
--to=gary@intrepid.com \
--cc=gdb@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