public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Re: kgdb internet/ethernet support and {gcc or gdb} bug on test addresses on ia64 port
Date: Thu, 03 Jan 2002 03:30:04 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590698805731@msgid-missing> (raw)

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°

(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°




                 reply	other threads:[~2002-01-03  3:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=marc-linux-ia64-105590698805731@msgid-missing \
    --to=kaos@ocs.com.au \
    --cc=linux-ia64@vger.kernel.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