Bug 518712 - gdb thinks sizeof(long)==4 on 64bit
Summary: gdb thinks sizeof(long)==4 on 64bit
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 11
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2009-08-21 19:22 UTC by Stas Sergeev
Modified: 2009-08-21 21:29 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-08-21 21:29:00 UTC

Attachments (Terms of Use)

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):

How reproducible:

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 (
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:
(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

Note You need to log in before you can comment on or make changes to this bug.