From: werme@alingo.zk3.dec.com (Eric Werme)
Subject: Re: cc -g3 -O
Date: 21 Jun 94 17:26:24 GMT [thread overview]
Message-ID: <werme.772219584@alingo.zk3.dec.com> (raw)
In-Reply-To: 2tl5ai$qm9@fermat.mayo.edu
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.
prev parent reply other threads:[~1994-06-21 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-06-14 20:52 cc -g3 -O Andrew Staniszewski
1994-06-15 12:37 ` Christopher Samuel
1994-06-21 17:26 ` Eric Werme [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox