From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ff6a39316ae3a1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 20 Feb 2006 15:50:21 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <8VQGf.150321$7l4.51461@trnddc05> <172dv1lppbvgnqcbvvh5mvuk58h8t13ha4@4ax.com> Subject: Re: GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?) Date: Mon, 20 Feb 2006 15:55:12 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-bd1HgtmbNiqDnkKhOq+a/FmrWnzE0jBOW8MPjEqTz2pf0sl6FABUrcCAXfRk2TJlCjtThibIW8CsYBk!iG/moevhONA3INsFIp9m7CC0fcSUqGBSg8OgyoiRYvNKfANX25S9od2hMCkxiWvprjY8fz9k1VJe!O6ZqthSksJog/g== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3025 Date: 2006-02-20T15:55:12-06:00 List-Id: "Anonymous Coward" wrote in message news:lyIJf.284$gh4.197@trnddc06... ... > My problem is that the debugger will not break on a definition for a > constant, and in some cases it will not allow me to override a > constant value. It appears that the compiler may be doing some kind > of optimization, though I'm using the -O0 switch. This isn't an optimization; it's essentially required by the Ada definition. That is, "static expressions" have to be evaluated at compile-time. Once that's done, there is no reason to store the constant in memory; the value is used wherever it is referenced. A compiler that wastes memory for static values would be pretty silly; I doubt that there are any that do that. (Janus/Ada is pretty conservative about our code generation with the optimizer off, but we don't use memory that we don't need.) That probably means that there is no chance to break on it, because it has no presence in memory. I can't speak for GDB, but certainly Janus/Ada and our debugger can't break on a constant's definition, because nothing whatsoever is generated for it. It would be like trying to break on "2". Marking the constant as "aliased" requires that it has a machine address, so the compiler will generate a variable for it. Then you probably can break on it. Randy.