From: qinwei@sunnorth.com.cn
To: gdb@sourceware.org
Subject: A question about program entry point
Date: Fri, 29 Dec 2006 03:24:00 -0000 [thread overview]
Message-ID: <OF814186D1.2AE324F7-ON48257253.000A162B-48257253.0012D5BA@sunnorth.com.cn> (raw)
Dears,
When printing a c++ class method using function "cp_print_class_method",
and the program entry point is
set over 0x80000000(for example 0xa0001000), gdb will treat the "addr" as
virtual address and finally
goes into the "else" branch at the following, so gdb will not print out
the correct class method.
common:
if (i < len)
{
char *demangled_name;
fprintf_filtered (stream, "&");
fputs_filtered (kind, stream);
demangled_name = cplus_demangle (TYPE_FN_FIELD_PHYSNAME (f, j),
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name %s>",
TYPE_FN_FIELD_PHYSNAME (f, j));
else
{
fputs_filtered (demangled_name, stream);
xfree (demangled_name);
}
}
else
{
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") %d", (int) addr >> 3);
}
I see some macros defined in "cp-support.h". Does that mean gdb support
printing class method
only if the program entry point is less than 0x80000000? Thanks!
/* Pointer to member function. Depends on compiler implementation. */
#define METHOD_PTR_IS_VIRTUAL(ADDR) ((ADDR) & 0x80000000)
#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))
#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))
Best regards,
Qinwei
Mail qinwei@sunnorth.com.cn
Phone +86-010-62981668-2708
Fax +86-010-62985972
next reply other threads:[~2006-12-29 3:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-29 3:24 qinwei [this message]
2006-12-29 3:30 ` 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=OF814186D1.2AE324F7-ON48257253.000A162B-48257253.0012D5BA@sunnorth.com.cn \
--to=qinwei@sunnorth.com.cn \
--cc=gdb@sourceware.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