* A question about program entry point
@ 2006-12-29 3:24 qinwei
2006-12-29 3:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: qinwei @ 2006-12-29 3:24 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: A question about program entry point
2006-12-29 3:24 A question about program entry point qinwei
@ 2006-12-29 3:30 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2006-12-29 3:30 UTC (permalink / raw)
To: qinwei; +Cc: gdb
On Fri, Dec 29, 2006 at 11:26:33AM +0800, qinwei@sunnorth.com.cn wrote:
> 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.
Take a look at the patch I just posted to gdb-patches. I deleted the
check that's causing you trouble.
> /* 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))
Note to myself. I meant to delete these macros with my patch but
forgot to do so. I deleted all the uses.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-12-29 3:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-29 3:24 A question about program entry point qinwei
2006-12-29 3:30 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox