🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #80

Why gdb 4.4 only works with gcc 2.1 with -O2?

#80
From: Steinar Bang
Date: Tue, 14 Apr 1992 19:46
31 lines
1818 bytes
Platform: Sun Sparc, sun os 4.x, gdb 4.4, gcc 2.1 (C++), GNU emacs 18.58

I had the following weird behavior, which I didn't find any
explanation for in the gdb TODO or README files:

 When compiling with the -O2 directive the compiled program seemed run
 fine under gdb, inside emacs.

 When I attempted to compile without any optimization (to get away
 from the weird jumps in the control flow) the following happened: o
 gdb under emacs didn't take the gdb-break command. When I attempted
 to run it using C-x SPC, or using M-x gdb-break nothing happened in
 the gdb buffer.  o After a while the entire gdb process coredumped,
 whether anything was happening or not.

 When I recompiled with -O2 it seemed to be working again (i.e. the
 gdb-break command worked, it didn't coredump by itself).

 The -O2 generated code was a bit smaller than the un-optimized code: 
   58xx xxx bytes vs. 59xx xxx
 The code were linked with two libraries compiled with -g -O2

 I was running with C++ code in .c files, which may have created some
 gdb mode problems.

If this is a known problem, can anyone please mail me the work-around.
If nobody else has seen these problems I can meddle around with this
to see if I can find what causes it and/or give a more complete bug
report (in the meanwhile I am debugging using -O2 generated code :-).

- Steinar
Technical Details
Message-ID: <STEINARB.92Apr14154603@gulltorn.idt.unit.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idt.unit.no!steinarb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idt.unit.no!steinarb
From: steinarb@idt.unit.no (Steinar Bang)
Subject: Why gdb 4.4 only works with gcc 2.1 with -O2?
Message-ID: <STEINARB.92Apr14154603@gulltorn.idt.unit.no>
Sender: gnulists@ai.mit.edu
Organization: Norwegian Institute of Technology, Trondheim, Norway
Distribution: gnu
Date: Tue, 14 Apr 1992 19:46:03 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 32