From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Eiler, James A." Newsgroups: gmane.os.tru64.managers Subject: oddity with debugger and sprintf( ) Date: Thu, 12 Aug 2004 18:21:35 -0400 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <5CE3000C0721A24F9575EA3F4F1B691C040FA2E0@noaadc-mxu25.noa.alcoa.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: sea.gmane.org 1092349336 25824 80.91.224.253 (12 Aug 2004 22:22:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 Aug 2004 22:22:16 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri Aug 13 00:22:08 2004 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1BvNxX-0002mR-00 for ; Fri, 13 Aug 2004 00:22:08 +0200 Original-Received: (qmail 22618 invoked by uid 5); 12 Aug 2004 22:21:55 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 22603 invoked by uid 49501); 12 Aug 2004 22:21:54 -0000 Original-Received: from James.Eiler@alcoa.com by sws1 by uid 49491 with qmail-scanner-1.21 (clamdscan: 0.70-rc. iscan: v3.1/v5.600-1011/847/50540. spamassassin: 2.63. Clear:RC:0(160.91.4.119):SA:0(-4.9/5.0):. Processed in 0.612824 secs); 12 Aug 2004 22:21:54 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 12 Aug 2004 22:21:54 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0I2C003C4U4GEA@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 12 Aug 2004 18:21:53 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute1.cind.ornl.gov by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) id <0I2C00E02U42LQ@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 12 Aug 2004 18:21:39 -0400 (EDT) Original-Received: from NOAADC-MSW03.NOA.Alcoa.com (noaadc-msw03.noa.alcoa.com [147.154.9.220]) by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0I2C00DI2U41SJ@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 12 Aug 2004 18:21:38 -0400 (EDT) Original-Received: from NOAADC-MXI02.NOA.Alcoa.com (unverified [147.154.9.24]) by NOAADC-MSW03.NOA.Alcoa.com (Content Technologies SMTPRS 4.3.14) with ESMTP id for ; Thu, 12 Aug 2004 18:21:35 -0400 Original-Received: by noaadc-mxi02.noa.alcoa.com with Internet Mail Service (5.5.2657.72) id ; Thu, 12 Aug 2004 18:21:35 -0400 Content-return: allowed Original-To: "'tru64-unix-managers@ornl.gov'" X-Mailer: Internet Mail Service (5.5.2657.72) Xref: main.gmane.org gmane.os.tru64.managers:7438 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:7438 All, I've tried the following on several Alphas with different versions of T64 (4.0G, 5.1A, 5.1B) (and different versions of dbx and ladebug) and got the same result every time. My little C program is as follows: 1 #include 2 #include 3 4 main( ) 5 { 6 char sName [ 16 ]; 7 char sString[ 256 ]; 8 int iStatus; 9 10 strcpy( sName, "bar" ); 11 12 iStatus = 1; 13 14 sprintf( sString, "%s %s %s %s %s %s %s", 15 sName, sName, sName, sName, sName, sName, sName ); 16 17 } If I compile it and run it with the debugger (dbx or ladebug), set a breakpoint at line 12, then run it to the breakpoint, then goto line 14, then do a next, I get a segmentation violation: alpha1-mst> cc jaetest.c -g2 -o jaetest alpha1-mst> dbx jaetest dbx version 5.1 Type 'help' for help. main: 10 strcpy( sName, "bar" ); (dbx) b 12 [2] stop at "jaetest.c":12 (dbx) r [2] stopped at [main:12 ,0x12000118c] iStatus = 1; (dbx) goto 14 (dbx) n signal Segmentation fault at >*[strlen, 0x3ff800d27e0] ldq_u t0, 0(a0) However, if I just run it (from the command prompt), it runs just fine. And if I run in from the debugger and just "next" through it, it also works just fine. Lastly, if I change the sprintf( ) to have less than 5 "%s" conversion strings, it also works just fine! I stumbled across this quite by accident while trying to debug one of my programs, and this is the essence of what I was running into. Has anyone seen anything like this before? Thanks! Jim