This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb breakpoint problem
On Mon, Jun 11, 2007 at 12:59:57PM -0400, kdsfinger@gmail.com wrote:
> int *a; //line 24
> int i; //line 25
> a = (int *)malloc((argc - 1) * sizeof(int)); // line 26
> As you can see, the program did not stop at the breakpoint on line24.
> It stops at line26. If I add another breakpoint on line25, this 2nd
> breakpoint is skipped as well and the program stops at line26. Why is
> that? How can I correct it?
A variable declaration does not require any machine instructions. So
the compiler does not emit any, and there is nowhere that the program
can stop.
> On my own program which is rather big, it got the same problem. When I
> use info break xxx, it sometimes point to a different place in "What".
> For example, I placed the breakpoint in main line 100, but the "what"
> points to other functions in different line.
That is probably a bug in GDB, but we would need a test case to be
sure.
--
Daniel Jacobowitz
CodeSourcery