X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f In-Reply-To: <200612082106.kB8L6gBW001006@envy.delorie.com> Subject: Re: Profiling with -pg and arguments to main() - GCC 4.1.0 To: dj AT delorie DOT com Cc: djgpp AT delorie DOT com X-Mailer: Lotus Notes Release 6.5.4 CCH5 September 12, 2005 Message-ID: From: Gordon DOT Schumacher AT seagate DOT com Date: Fri, 8 Dec 2006 15:54:24 -0700 X-MIMETrack: Serialize by Router on SV-GW1/Seagate Internet(Release 7.0.1 HF29|March 07, 2006) at 12/08/2006 02:54:28 PM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Proofpoint-FWRule: outbound2 X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.5446:2.3.11,1.2.37,4.0.164 definitions=2006-12-08_07:2006-12-08,2006-12-08,2006-12-08 signatures=0 Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk DJ Delorie wrote on 12/08/2006 02:06:42 PM: # > So I'm not quite sure where to go from here in debugging... ideas? # # Disassemble your main.o and see if the stack is getting corrupted. # Profiling adds code to the beginning of each function to record the # call graphs, usually with a call to _mcount. Stepping over that and # watching bp/sp might give some clues. Well, I think (with the aid of a co-worker - I'm no expert in x86 assembly!) we've caught what's going on... The first several lines of assembly set up the stack frames and then push the EBX and ECX registers. It then does a mov of some constant into EDX and then calls _mcount, as you say. It's not BP/SP that's getting corrupted, it's ECX. The next statement is to move ECX into EBX, which it then uses as the address of the parameters. (This worked before the _mcount call.) I'm not sure where mcount lives or how to go about fixing that, though... :)