This is the mail archive of the 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]

Re: break $function in coff/pe doesn't break exactly before the first statement?

Eli Zaretskii wrote:
Date: Sat, 18 Nov 2006 10:59:42 +0000
From: Pedro Alves <>

Breakpoint 1, main () at main.c:4
4       {

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 (cygwin-special)
and self-built:
 GNU gdb

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
 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

Breakpoint 2, function (a=21930) at main.c:6

Rings a bell?

Pedro Alves

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