This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: break $function in coff/pe doesn't break exactly before the first statement?
- From: Pedro Alves <pedro_alves at portugalmail dot pt>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb at sourceware dot org
- Date: Sat, 18 Nov 2006 12:10:45 +0000
- Subject: Re: break $function in coff/pe doesn't break exactly before the first statement?
- References: <455EE79E.6000109@portugalmail.pt> <uveldatp9.fsf@gnu.org>
Eli Zaretskii wrote:
Date: Sat, 18 Nov 2006 10:59:42 +0000
From: Pedro Alves <pedro_alves@portugalmail.pt>
Breakpoint 1, main () at main.c:4
4 {
(gdb)
While on i686-linux, the breakpoint stops at:
5 printf ("hello world!\n");
So on coff targets, an extra 'next' is required to get to the first
statement of the function.
I can confirm that I see the same with MinGW and GDB 6.3.
However, for the record, please tell what versions of GCC you used on
both platforms. I used GCC 3.3.5 on GNU/Linux and the MinGW port of
GCC 3.4.2 on Windows.
On Cygwin:
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
with both:
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
and self-built:
GNU gdb 6.5.50.20061115-cvs
On GNU/linux (kubuntu 6.06):
GNU gdb 6.4-debian
GCC version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
On arm-wince:
GNU gdb 6.5.50.20061115-cvs
GCC 4.1.0 (with lots of local changes)
---
It seems it only happens on 'main'.
1 #include <stdio.h>
2
3 int
4 function (int a)
5 {
6 printf ("function %d\n", a);
7 return 0;
8 }
9
10 int
11 main (int argc, char** argv)
12 {
13 printf ("hello world!\n");
14 function (0x55aa);
15 return 0;
16 }
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n)
Starting program:
/cygdrive/d/cegccsf/cegcc/cegcc/src/build-gdb_server/gdb/test/main.exe
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
Breakpoint 1, main (argc=1, argv=0x662f90) at main.c:12
(gdb) c
Continuing.
Breakpoint 2, function (a=21930) at main.c:6
(gdb)
Rings a bell?
Cheers,
Pedro Alves