Bug 518712

Summary: gdb thinks sizeof(long)==4 on 64bit
Product: [Fedora] Fedora Reporter: Stas Sergeev <stsp2>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 11CC: jan.kratochvil
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-21 21:29:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stas Sergeev 2009-08-21 19:22:37 UTC
Description of problem:
gdb thinks sizeof(long)==4 on x86_64, but
(quite unfortunately) it is 8.

Version-Release number of selected component (if applicable):
gdb-6.8.50.20090302-37.fc11.x86_64

How reproducible:
Always

Steps to Reproduce:
1. gdb
2. p sizeof(long)
  
Actual results:
$1 = 4

Expected results:
$1 = 8

Additional info:
gcc-compiled program shows that sizeof(long)==8.

Comment 1 Jan Kratochvil 2009-08-21 21:29:00 UTC
Fedora GDB is built in biarch mode to properly support both 32-bit and 64-bit programs.  For some reason the default is 32-bit.  I do not find such choice to be important enough to need a fix, please provide more reasons if you think so.

$ gdb
GNU gdb (GDB) Fedora (6.8.50.20090302-37.fc11)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) p sizeof (long)
$1 = 4
(gdb) show architecture 
The target architecture is set automatically (currently i386)
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) p sizeof (long)
$2 = 8
(gdb) q