symtab/2252: GNU/Linux, Cygwin, GCC, C, C++
Wed Apr 11 07:58:00 GMT 2007

>Number:         2252
>Category:       symtab
>Synopsis:       GNU/Linux, Cygwin, GCC, C, C++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 11 08:58:01 BST 2007
>Release:        6.6
CYGWIN_NT-5.0 SI46227 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
gcc-Version 3.4.4 (mingw special)
This GDB was configured as "i686-pc-cygwin"
GDB could not determine the right size of arrays. Only observed by dwarf-2 debug format. If an array is referenced with [] or with wrong size this behaviour could be seen.
  int8_t au8[2];
  extern int8_t au8[];

At the "How-To-Repeat" section the output of the command "ptype au8" is the important thing. If the "info variables" command is called first "ptype au8" returns always right thing. 
With linux and a newer gcc I have seen the same behaviour.
tar -xzf src.tar.gz
gcc -g3 -gdwarf-2 -I. def.c main.c ref.c -o test.exe
gdb test.exe
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) ptype au8
type = signed char [2]
(gdb) ptype refS
type = struct {
    int8_t a_i8;
    uint32_t b_u32;
} [4]
(gdb) ptype au8
type = signed char [0]
(gdb) info variables 
All defined variables:

File ref.c:
int8_t au8[0];
ref_t refS[4];
uint16_t ref_au16[3];

File def.c:
int8_t au8[2];

Non-debugging symbols:
0x00402000  __cygwin_crt0_bp
0x00402000  _bss_start__
0x00402010  _fmode
0x00402014  environ
0x00402080  _bss_end__
(gdb) quit

Content-Type: application/x-gzip; name="src.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="src.tar.gz"


More information about the Gdb-prs mailing list