www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/20/14:56:54

Message-Id: <m0vb50S-000S1fC@natacha.inti.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT natacha DOT inti DOT edu DOT ar>
To: zager AT post DOT comstar DOT ru, djgpp AT delorie DOT com
Date: Fri, 20 Dec 1996 16:37:10 +0000
MIME-Version: 1.0
Subject: Re: Debugging in RHIDE

Hi Dim:
> 
> I discover the odd problem with DEBUGGING in RHIDE
> (unfortunately i'm too stupid to use GDB :-(   )
I guess that you are lazy not stupid ;-).
If you try to use GDB you'll find just the same problems because 
RHIDE uses GDB.
> So, when i use -O3 and -g under Windows 3.11 
> some local variables are not accessible for watching
> (<var name> : not available) and
> some lines are not accessible for stepping into 
> (There is no code generated for this line).
That's normal, and logic.

> 
> Info page say:
> "Unlike most other C compilers, GNU CC allows you to use `-g' with
> `-O'.  The shortcuts taken by optimized code may occasionally
> produce surprising results: some variables you declared may not
                                           ^^^^^^ Just your problem.
> exist at all; flow of control may briefly move where you did not
> expect it; some statements may not be executed because they
   ^^^^ due to the code moving or reuse.
> compute constant results or their values were already at hand;
> some statements may execute in different places because they were
> moved out of loops.
> 
> Nevertheless it proves possible to debug optimized output.  This
> makes it reasonable to use the optimizer for programs that might
> have bugs."
> 
> Is this broblem occure due to Windows 3.11 or i'm misunderstanding
> somethig important in info text?
  Is not a Windows problem, is just what INFO says and is just what 
you'll see in other compilers. If you use -Ox you'll loose some debug 
features. For example:

  if (a>10)
    { int b; for (b=1; b<10; b++) a++; }
     
  b will be optimized in the 90% of the cases and you'll not be able 
to watch the b contents because is in a CPU register.

 Or:
 switch (a)
   {
    case 1: a+=2; break;
    case 2: b+=2; a+=2; break;
   }
             
  If you step in the case 2 you'll see that the debugger will go to 
the case 1!, that very logic because the compiler will reuse the a+=2 
code, or you want 2 copies of the same code?

SET 
--------------- 0 --------------------------------
Salvador Eduardo Tropea (SET).
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019