Article View: gnu.gcc.help
Article #6762 problems: dbx support & alignment of doubles in structs
From: Mark Glasser
Date: Sat, 21 Nov 1992 00:47
Date: Sat, 21 Nov 1992 00:47
58 lines
3282 bytes
3282 bytes
I've just installed gcc-2.3.1. I'm having difficulties on two fronts:
1. The generated code does not seem to be able to be debugged with dbx.
2. Assigning to a double that is a member of a dynamically allocated
structure is problematic. Doubles seem to have different alignment
requirements than with the compiler shipped with the OS.
The particulars:
I'm running on a Sun sparc with SunOS 4.1.1. The "other" compiler is the
Sun C compiler shipped with the system (We got these machines prior to
unbundling). Gcc is configured as
#!/bin/sh
# GCC was configured as follows:
./configure --target=sparc-sun-sunos4.1
echo host=sparc-sun-sunos4.1 target=sparc-sun-sunos4.1 build=sparc-sun-sunos4.1
With -g my unserstanding is gcc generates dbx debugging info with gdb
extensions. Debugging with gdb works fine. Dbx crashes. I recompiled and
replaced -g with -gdbx. The compiler complains that -gdbx is not supported.
A quick perusal through the compiler source reveals that -gstabs enables dbx
debugging output without the gdb extensions. I recompile and try again. No
success. My program has a section that is dynamically linked (i.e. compiled
with -fpic). Could this have anything to do with the problem?
The problem with doubles is a little more subtle. Assigning to a double
that is the member of a structure causes a bus error.
I'm using an in-house memory allocation package that piggybacks off of
malloc and provides memory analysis and debugging capabilities. This
packages has been in use for several years in a number of projects. It's
very stable and I have good confidence in it.
The memory package guarantees that all memory blocks returned are aligned on
4 byte boundaries. Everything works fine with Sun C. With GNUC bus errors
ensue unless I change the memory package to align to 8 byte boundaries.
What's the problem here? Is Sun C "smarter" about padding the strucutre
properly so that sizeof does the right thing and the proper alignments are
enforced? Maybe the real question is: why did it operate proplery under Sun
C? Since doubles require 8 byte alignments it shouldn't have worked.
Are there any known bugs relating to these issues? Am I doing something
wrong?
Thank you in advance for any light you can shed on these problems
Mark Glasser
------------------------------------------------------------------------
markg@nextwave.com Nextwave Design Automation
450 San Antonio Road #27
Palo Alto, CA 94306
(voice) 415.855.9795
(fax) 415.855.9792
------------------------------------------------------------------------
Technical Details
Message-ID:
<9211210047.AA15779@shasta.nextwave.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!shasta.nextwave.COM!markgShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!shasta.nextwave.COM!markg From: markg@shasta.nextwave.COM (Mark Glasser) Subject: 2 problems: dbx support & alignment of doubles in structs Message-ID: <9211210047.AA15779@shasta.nextwave.com> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 21 Nov 1992 00:47:20 GMT Lines: 58