From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,ec55e359502b2501 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-06-21 10:41:23 PST Path: bga.com!news.sprintlink.net!hookup!swrinde!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!olivea!decwrl!pa.dec.com!nntpd.lkg.dec.com!alingo.zk3.dec.com!werme From: werme@alingo.zk3.dec.com (Eric Werme) Newsgroups: comp.unix.osf.osf1 Subject: Re: cc -g3 -O Date: 21 Jun 94 17:26:24 GMT Organization: Digital Equipment Corporation Message-ID: References: <2tl5ai$qm9@fermat.mayo.edu> Reply-To: werme@zk3.dec.com NNTP-Posting-Host: alingo.zk3.dec.com stan@chirpa.mayo.edu (Andrew Staniszewski) writes: >What exactly does the man pages for cc, c89 and cxx mean when they say >that use of the -g3 flag may make the debugger inacurate? That disables the code that leaves variables on the stack or wherever things must be left for dbx to track them down. The key things you lose are: 1) Any trace of local variables. (Though some people say you can believe some of them.) 2) A lot of the function arguments. If an argument gets passed several levels deep, you can sometime figure out which stack trace line has an accurate value. > What I have >actully witnessed is that use of this flag causes the debuger to: > A) not know where it is in the source code The source line numbers generally stay accurate, but beware of a lot of optimizations that restructure code, like strength reduction. Also, the instruction scheduler often interleaves code from nearby lines to reduce CPU waiting for data to come in from memory. If you type "main/40i" you'll get some idea of what's happening. > B) not be able to accurately report the value of a variable >is the -g3 flag at all usefull, and if so what for. Well, data structure definitions are still around, as are global variable. >BTW: when I try to use the -O -g1 flag I get an warning saying use -g3 Don't know about -g1 - I usually work on the kernel and that's -g3. The stack trace really annoys me, because I wrote one for the Intel i860 that could hunt down most arguments without help from dbx. It scanned each routine in the trace looking at where arguments were moved to and reported them. It had to emulate part of the i860 instruction set and execute backwards. Not easy code to write, but I sure miss it! -- Eric (Ric) Werme | werme@zk3.dec.com Digital Equipment Corp. | This space intentionally left blank.