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/13018] New: Can't set Break point after C loop


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

           Summary: Can't set Break point after C loop
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: mostafa_alshrief@yahoo.com


Created attachment 5856
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5856
the program that i'm trying to debug using gdb

hello every one ..

i'm having a problem debugging a c program using GDB

the problem is i can't set a break point in source code after a for loop for
example the following code

1 //simple programe that counts from 1 to 3 and print Finished then Exit
2 //it's written to test a problem in GDB
3  
4 #include <stdio.h>
5 
6 void main()
7 {
8        int i = 0;
9        printf("Count from 1 to 3\n");
10 
11        for(i=0;i<3;i++)
12        {
13                printf("%i\n",i);
14        }
15 
16        printf("Finished\n");
17        printf("Now to Exit\n");
18 }


when i try to set a break point at line 16 printf("Finished\n"); (or any after
line 11) ,i get the following message :

No line 16 in file "loops_and_gdb.c".

i compile using gcc like that:
gcc loops_and_gdb.c -g -o loops_and_gdb.exe


info line 16 says : Line number 16 is out of range for "loops_and_gdb.c".

info source: (after break main and run) says :
Current source file is loops_and_gdb.c
Compilation directory is /home/mostafa/Documents/problem/loops_and_gdb
Located in /home/mostafa/Documents/problem/loops_and_gdb/loops_and_gdb.c
Contains 18 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.

a screen-shot for Insight debugger it shows the same problem
http://i53.tinypic.com/2l89c8g.jpg

i have built the Insight Debugger from source so it might indeed
missed up the GDB pakages...
i got it from
http://www.tech.dmu.ac.uk/~glapworth/src/insight/insight-6.8-1-gl.tar.gz

when i set a break point at line 11 for(i=0;i<3;i++) ,then run then step the
code continues to the end and i get :
0xb7724c2e in __libc_start_main () from /lib/libc.so.6

when i do step again i get :
Single stepping until exit from function __libc_start_main, 
which has no line number information.

Program exited with code 014.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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