Ranga Rao Ravuri wrote:

> I have a line in 'c' code like
> 
>         10      int port;
>         11      .
>         12      .
>         13      .
> >>>>    14      x = htons(x);
>         15      .
>         16      .
>         17
> If I run this part of code on sun sparc with SunOs 5.7
> the htons is defined like
> 
> #define htons(x) (x)
> 
> How do I break on line 14 and see what is happening ? It never breaks on
> 14, rather it does on 15.
> All statements (x) = (x) are ignored by gdb.For each such a case the
> break point was set on next source statement.
> Is that gcc which optimizes the expressions like 'x=x' by removing from
> the code.
> 
> Why so . In above case really I hppened to dig the header file why gdb
> is not breaking on line: 14

Have you looked at the generated code to see if any code got produced
for that line?  If you are compiling with any level of optimization, I
wouldn't be surprised to find that the line got totally optimized out.
In GDB, try "info line 14" and see what it says.  You could try making
the variable static and volative and see what the compiler does.

Art

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to