[Converted from Gnats 2236]
On GNU/Linux (Intel 386), the symbol "_start" labels the first machine instruction to be executed. If the program is pure assembler (no C or C library startup code), and I put a breakpoint at _start, the break does not happen.
Oddly enough, if _start is in the C library's startup code (start.S), the break *does* happen.
Linux jp 2.6.18-1-686 #1 SMP Fri Sep 29 16:25:40 UTC 2006 i686 GNU/Linux
GNU assembler 2.17 Debian GNU/Linux
This GDB was configured as "i486-linux-gnu".
Here is the full assembler program in file "hello.s":
# Output "hello world" message.
mov $4, %eax # 4 = write
mov $1, %ebx # stdout
mov $msg, %ecx
mov $len, %edx
# Exit from program.
xor %ebx, %ebx
mov $1, %eax
msg: .ascii "Hello world"
.equiv len, .-msg
Assemble and link it with:
as --gdwarf-2 -o hello.o hello.s && ld -o hello hello.o
Here is a transcript of the GDB session:
$ gdb add
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) b _start
Breakpoint 1 at 0x8048074: file add.s, line 6.
Starting program: /home/steve/src/smf/add
Failed to read a valid object file image from memory.
Program exited normally.
Notice the program proceeds to output "Hello world" despite the breakpoint on its first instruction.
Workaround: put the first breakpoint somewhere else.
*** This bug has been marked as a duplicate of 9436 ***
* infcmd.c (run_command_1): Call proceed with regcache_read_pc address.
* config/djgpp/fnchange.lst: Add translation for break-entry.exp.
* gdb.base/break-entry.exp: New.