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]

symtab/1789: Stack pointers on Solaris 8 64bit are not handled correctly


>Number:         1789
>Category:       symtab
>Synopsis:       Stack pointers on Solaris 8 64bit are not handled correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 11 14:38:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Steffen
>Release:        gdb 6.2.1 (latest release)
>Organization:
>Environment:
Solaris 8 in 64bit mode
>Description:
When I try to get the address of an automatic variable, the returned value shows only the lower 32bits of the address. Maybe the stack frame is not interpreted correctly, or the stack pointer is casted to the wrong format.

I have compiled gdb on Solaris 8 02/02 with 

export CC='cc -xarch=v9b'
./configure sparc64-sun-solaris2.8
make

which seems to work fine.

However, for the following program:

int *p;
main (int n) {
  int a=1;
  p = &a;
}

compiled with

cc -xarch=v9b -o a -xs -g a.c

I get the following debugging result:

(gdb) break main
Breakpoint 1 at 0x1000008a0: file a.c, line 4.
(gdb) run a
Starting program: /home/tst/tmp/a

Breakpoint 1, main (n=Cannot access memory at address 0x7ffff8ec
) at a.c:4
4         p = &a;
(gdb) step
5       }
(gdb) print &a
$1 = (int *) 0x7ffff8e4
(gdb) print p
$2 = (int *) 0xffffffff7ffff8e4
(gdb) print a
Cannot access memory at address 0x7ffff8e4
(gdb) print *p
$3 = 1

A program compiled with gcc works fine. I suppose that automatic variables are defined using negative addresses, and reading the sun debugging format has a wrong cast or sign extension somewhere. Since everything else seems to work, I wonder whether only a small switch or patch is required.

And BTW, compiling gdb for Solaris 64bit should be documented. I found lots of questions regarding this both in the bug database and in several forums, but very few answers. I hope that my approach is correct. 
>How-To-Repeat:

>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]