This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
symtab/1378: stabs on sparc64: stab values not properly sign-extended
- From: mattias at virtutech dot se
- To: gdb-gnats at sources dot redhat dot com
- Cc: gustav at virtutech dot se
- Date: 15 Sep 2003 16:07:55 -0000
- Subject: symtab/1378: stabs on sparc64: stab values not properly sign-extended
- Reply-to: mattias at virtutech dot se
>Number: 1378
>Category: symtab
>Synopsis: stabs on sparc64: stab values not properly sign-extended
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Sep 15 16:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: mattias@virtutech.se
>Release: 5.3
>Organization:
>Environment:
solaris 8
gdb built as 64-bit binary with either gcc 3.3 or Sun Forte 7 C 5.4
configured for host/target/build: sparcv9-sun-solaris2.8
>Description:
Stab value fields that are relative (like address offsets for local variables and parameters) should be treated as signed values (and sign-extended, since the value field is only 32 bits wide). Example:
int f(int x)
{
return x;
}
results in the following stab for the parameter x, when built with Sun's compiler (Forte 7):
.stabs "x:p(0,3)",N_PSYM,0x0,0x4,0xfffffffc
The stab value (0xfffffffc) is relative to the frame pointer (bias-corrected). GDB incorrectly zero-extends the value before adding, producing an erroneous address.
>How-To-Repeat:
Debug a 64-bit sparc binary (built with Sun's C compiler, without optimisation). Look at local variables or parameters; memory access error will result.
>Fix:
The attached patch fixes this for 'p' and 'l' stabs (that is, for stack parameters and locals). It assumes that sizeof(int)==4. Cursory testing shows no ill effects.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="patch-gdb-5.3"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="patch-gdb-5.3"
LS0tIGdkYi01LjMvZ2RiL3N0YWJzcmVhZC5jfglUaHUgQXVnICAxIDE5OjE4OjMyIDIwMDIKKysr
IGdkYi01LjMvZ2RiL3N0YWJzcmVhZC5jCU1vbiBTZXAgMTUgMTc6NTY6MDYgMjAwMwpAQCAtMTY3
Nyw3ICsxNjc3LDcgQEAKICAgICBjYXNlICdsJzoKICAgICAgIFNZTUJPTF9UWVBFIChzeW0pID0g
cmVhZF90eXBlICgmcCwgb2JqZmlsZSk7CiAgICAgICBTWU1CT0xfQ0xBU1MgKHN5bSkgPSBMT0Nf
TE9DQUw7Ci0gICAgICBTWU1CT0xfVkFMVUUgKHN5bSkgPSB2YWx1OworICAgICAgU1lNQk9MX1ZB
TFVFIChzeW0pID0gKGludCl2YWx1OwogICAgICAgU1lNQk9MX05BTUVTUEFDRSAoc3ltKSA9IFZB
Ul9OQU1FU1BBQ0U7CiAgICAgICBhZGRfc3ltYm9sX3RvX2xpc3QgKHN5bSwgJmxvY2FsX3N5bWJv
bHMpOwogICAgICAgYnJlYWs7CkBAIC0xNzAzLDcgKzE3MDMsNyBAQAogI2VuZGlmCiAKICAgICAg
IFNZTUJPTF9DTEFTUyAoc3ltKSA9IERCWF9QQVJNX1NZTUJPTF9DTEFTUyAodHlwZSk7Ci0gICAg
ICBTWU1CT0xfVkFMVUUgKHN5bSkgPSB2YWx1OworICAgICAgU1lNQk9MX1ZBTFVFIChzeW0pID0g
KGludCl2YWx1OwogICAgICAgU1lNQk9MX05BTUVTUEFDRSAoc3ltKSA9IFZBUl9OQU1FU1BBQ0U7
CiAgICAgICBhZGRfc3ltYm9sX3RvX2xpc3QgKHN5bSwgJmxvY2FsX3N5bWJvbHMpOwogCg==