This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug exp/12281] New: Incorrect interpretation of returned point in64 bit platform
- From: "youngtsai at yahoo dot com.tw" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 2 Dec 2010 07:29:55 +0000
- Subject: [Bug exp/12281] New: Incorrect interpretation of returned point in64 bit platform
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12281
Summary: Incorrect interpretation of returned point in 64 bit
platform
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: exp
AssignedTo: unassigned@sourceware.org
ReportedBy: youngtsai@yahoo.com.tw
Environment
OS :
Linux spx919 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64
x86_64 GNU/Linux
g++ version:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3
--enable-libgcj-multifile --enable-languages=c,c++,java,f95
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
gdb version:
GNU gdb Red Hat Linux (6.3.0.0-1.153.el4rh)
Problem description -
Calling the funtion in gdb in 64 bit platform , the returned pointer will be
interpreted as 4 bytes (more like integer) if the program is not compiled with
-g. Following list the reproduced steps.
Reproduced steps -
1. g++ test.C (the source file is as following)
2. gdb a.out
(gdb) break main
Breakpoint 1 at 0x4005d4
(gdb) run
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Breakpoint 1, 0x00000000004005d4 in main ()
(gdb) print (char *)func2()
$1 = 0xffffffff9558c010 <Address 0xffffffff9558c010 out of bounds>
(gdb) print sizeof(func2())
$2 = 4
test.C
====================================================
#include <stdio.h>
#include <string.h>
char *func1()
{
static char str1[100]="abcde";
return str1;
}
char *func2()
{
char *str = new char[10000000000];
strcpy(str,"abc");
return str;
}
main()
{
func1();
func2();
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.