This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/10112] do not stop on function


------- Additional Comments From dushistov at mail dot ru  2009-04-29 11:54 -------
(In reply to comment #1)
> > gcc -ggdb -Wall test.c -o test_gdb && gdb test_gdb
> 
> Most likely, the function wasn't called at all.  The
> compiler probably inlined it in main.  You can confirm
> that by looking at the disassembly of test_gdb.
> 
> Try recompiling, but this time, disabling optimizations:
>  gcc -O0 -ggdb -Wall test.c -o test_gdb && gdb test_gdb
>       ^^
> 

I don't think so, because of from documentation of gcc:
`-O0'
     Reduce compilation time and make debugging produce the expected
     results.  This is the default.

so it should be -O0 if no optimization parameters was used,
any way:

>gcc -O0 -ggdb -Wall test.c -o test_gdb && gdb test_gdb
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) br f
Breakpoint 1 at 0x80483f8: file test.c, line 6.
(gdb) r
Starting program: /var/tmp/test_gdb 
f was called

Program exited normally.
(gdb) 

the problem is place of breakpoint,
(gdb) info breakpoints
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x080483f8 in f at test.c:6

(gdb) li f
1       #include <stdio.h>
2
3       void f(int gwk, double gsec)
4       {
5               while (gsec < 0.0) {
6                       gwk--;


so as you can see I put breakpoin of "f", but gdb put breakpoint
into while loop, and never happened, because of this example gsec >= 0



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10112

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]