This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

exp/1256: [ia64] Can't call functions in inferior


>Number:         1256
>Category:       exp
>Synopsis:       [ia64] Can't call functions in inferior
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 25 09:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Schwab
>Release:        5.3.90_2003-06-23-cvs
>Organization:
>Environment:
host=target=ia64-suse-linux
>Description:
GDB apparently does not correctly set up the gp when calling a function in the inferior.  Almost all such occurences in the testsuite cause a segv.  On ia64 the caller must set up the gp.
>How-To-Repeat:
$ cat hello.c
#include <stdio.h>
#include <string.h>

int
main ()
{
  char hello[] = "Hello world\n";
  int i, j;

  for (i = 0; i < 1000; i++)
    for (j = 0; j < strlen (hello); j++)
      hello[j] ^= i;

  printf ("%s", hello);
  return 0;
}
$ gdb hello
GNU gdb 5.3.90_2003-06-23-cvs
Copyright 2003 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 "ia64-linux"...
(gdb) b main
Breakpoint 1 at 0x40000000000006b2: file hello.c, line 6.
(gdb) r
Starting program: /suse/schwab/test/hello 

Breakpoint 1, main () at hello.c:6
6       {
(gdb) p hello
$1 = "Hello world\n"
(gdb) p printf(hello)

Program received signal SIGSEGV, Segmentation fault.
0x2000000000107740 in printf () from /lib/libc.so.6.1
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (printf) will be abandoned.
(gdb) x/i $pc
0x2000000000107740 <printf+64>: [MMI]       ld8 r14=[r15]
(gdb) x/i printf
0x2000000000107700 <printf>:    [MII]       alloc r41=ar.pfs,15,12,0
(gdb) 
0x2000000000107706 <printf+6>:              adds r16=8,r12
(gdb) 
0x200000000010770c <printf+12>:             mov r17=r12
(gdb) 
0x2000000000107710 <printf+16>: [MMI]       adds r12=-64,r12;;
(gdb) 
0x2000000000107716 <printf+22>:             addl r15=409696,r1
(gdb) i reg r1
r1             0x6000000000000db8       6917529027641085368
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]