This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
A question about program entry point
- From: qinwei at sunnorth dot com dot cn
- To: gdb at sourceware dot org
- Date: Fri, 29 Dec 2006 11:26:33 +0800
- Subject: A question about program entry point
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