[Linux-ia64] Re: kgdb internet/ethernet support and {gcc or gdb} bug on test addresses on ia64 port on SGI SN1

From: Keith Owens <kaos_at_ocs.com.au>
Date: 2002-01-03 14:30:04
On Wed, 2 Jan 2002 16:27:14 -0800, 
Piet/Pete Delaney <piet@sgi.com> wrote:
>#include <stdio.h>
>
>
>typedef struct disassemble_info {
>        void (*fprintf_func)();
>} disassemble_info_t;
>
>disassemble_info_t disinfo;
>
>void my_printf(void)
>{
>        (void) printf("Hello World\n");
>}
>
>main(void)
>{
>        disinfo.fprintf_func = my_printf;
>        printf("my_printf is at 0x%llx.\n", my_printf);
>        printf("disinfo is at 0x%llx.\n", &disinfo);
>        disinfo.fprintf_func();
>}

You are printing the address of the ia64 function descriptor, not the
function itself.

        printf("&my_printf is at 0x%llx.\n", &my_printf);
	printf("my_printf is at 0x%llx.\n", ((unsigned long *)(&my_printf))[0]);

&my_printf is at 0x40000000000009f0.
my_printf is at 0x4000000000000690.
disinfo is at 0x6000000000000dd8.
Hello World

(gdb) disassemble my_printf
Dump of assembler code for function my_printf:
0x4000000000000690 <my_printf>: [MII]       alloc r34=ar.pfs,5,4,0
0x4000000000000691 <my_printf+1>:                   mov r35=r12
0x4000000000000692 <my_printf+2>:                   mov r33=b0

(gdb) disassemble 0x4000000000000690 
Dump of assembler code for function my_printf:
0x4000000000000690 <my_printf>: [MII]       alloc r34=ar.pfs,5,4,0
0x4000000000000691 <my_printf+1>:                   mov r35=r12
0x4000000000000692 <my_printf+2>:                   mov r33=b0
Received on Wed Jan 02 19:30:39 2002

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:06 EST