From: frazer AT noneofyourbusiness DOT com (Scott Frazer) Newsgroups: comp.os.msdos.djgpp Subject: Re: GDB and static variables Date: Thu, 23 Jan 1997 19:42:46 GMT Organization: Ericsson Data Services Americas Lines: 33 Message-ID: <5c849s$rer@cnn.exu.ericsson.se> References: NNTP-Posting-Host: pc340.rtp.ericsson.se To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Eli Zaretskii wrote: >On Wed, 22 Jan 1997 frazer AT rtp DOT ericsson DOT se wrote: >> I am having problems with GDB and static variables. GDB seems >> to have problems with debugging information for uninitialized >> static variables. Here is a test program which exhibits the >> strangeness: >[snip] >> Now I compile with DJGPP v2.01 and GCC 2.7.2.1: >> >> C:\TEST>gcc -c -m486 -Wall -g -o main.o main.c >Does the same happen if you compile without -m486? Maybe that switch >causes gcc to optimize the code, whereby it's OK if the code isn't >exactly like the source. Yes, the same thing happens without the "-m486". I have found that if I declare things like: static int a_variable = { }; static struct a_struct_type a_struct = { { } }; GDB will have the proper debugging information. While this is both a pain and ugly, it allows me to continue development. I downloaded the sources for GDB and looked around in the source code hoping for something obvious to be wrong, but didn't have any luck. Maybe someone else can step up to the plate ... Scott