From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3181 invoked by alias); 14 Oct 2003 21:30:15 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 3102 invoked from network); 14 Oct 2003 21:30:13 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 14 Oct 2003 21:30:13 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h9ELTxM03289; Tue, 14 Oct 2003 17:29:59 -0400 Received: from speedy.slc.redhat.com (vpn50-14.rdu.redhat.com [172.16.50.14]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h9ELTvr18773; Tue, 14 Oct 2003 17:29:58 -0400 Received: from redhat.com (law@localhost) by speedy.slc.redhat.com (8.12.10/8.12.8/Submit) with ESMTP id h9ELV4qp019497; Tue, 14 Oct 2003 15:31:05 -0600 Message-Id: <200310142131.h9ELV4qp019497@speedy.slc.redhat.com> X-Authentication-Warning: speedy.slc.redhat.com: law owned process doing -bs To: Daniel Grunblatt cc: gcc@gcc.gnu.org Reply-To: law@redhat.com Subject: Re: HPUX function address. In-Reply-To: Your message of "Tue, 14 Oct 2003 18:05:05 -0300." <200310141805.05520.daniel@grunblatt.com.ar> From: law@redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 14 Oct 2003 22:22:00 -0000 X-SW-Source: 2003-10/txt/msg00544.txt.bz2 In message <200310141805.05520.daniel@grunblatt.com.ar>, Daniel Grunblatt write s: >Hi, > I've found the following problem: > >spe170> cc -v >Reading specs from /usr/lib/gcc-lib/hppa-linux/3.0.4/specs >Configured with: ../src/configure -v --enable-languages=c,c++,f77,proto,objc >--prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared >--with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long >--enable-nls --without-included-gettext --disable-checking >--enable-threads=posix --with-cpp-install-dir=bin hppa-linux >Thread model: posix >gcc version 3.0.4 >spe170> cc -g -o func func.c >spe170> gdb func >GNU gdb 2002-04-01-cvs >Copyright 2002 Free Software Foundation, Inc. >GDB is free software, covered by the GNU General Public License, and you are >welcome to change it and/or distribute copies of it under certain conditions. >Type "show copying" to see the conditions. >There is absolutely no warranty for GDB. Type "show warranty" for details. >This GDB was configured as "hppa-linux"... >(gdb) l >3 int >4 func() >5 { >6 return; >7 } >8 >9 int >10 main() >11 { >12 printf("0x%x\n", (long)func); >(gdb) >13 } >(gdb) b 12 >Breakpoint 1 at 0x10524: file func.c, line 12. >(gdb) r >Starting program: /house/grunblat/hp-ux/c/func > >Breakpoint 1, main () at func.c:12 >12 printf("0x%x\n", (long)func); >(gdb) p func >$1 = {int ()} 0x104fc >(gdb) n >0x207ee > >Program exited with code 010. >(gdb) > >I think it should print 0x104fc, right? Nope. 0x207ee is the address of the procedure descriptor. 0x207ec will contain the function's actual address 0x207f0 will contain the function's DP value When you dereference the function you get a call to $$dyncall which extracts the DP value from the desciptor and stuffs it into $r27, then extracts the function's actual address and transfers control to that actual address. GDB does not construct procedure descriptors when you try to print a function's address. FWIW, similar schemes are found on IA-64 as well. >Is there a compiler switch I'm missing? >Should I just try another compiler version? Nope. This is how things are expected to work on PAs. jeff