This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: breakpoints/2331: gdb cannot break on entry point for staticallylinked binaries
- From: Philipp Kohlbecher <xt28 at gmx dot de>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 12 Oct 2007 12:48:01 -0000
- Subject: Re: breakpoints/2331: gdb cannot break on entry point for staticallylinked binaries
- Reply-to: Philipp Kohlbecher <xt28 at gmx dot de>
The following reply was made to PR breakpoints/2331; it has been noted by GNATS.
From: Philipp Kohlbecher <xt28@gmx.de>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: breakpoints/2331: gdb cannot break on entry point for statically
linked binaries
Date: Fri, 12 Oct 2007 14:42:03 +0200
Daniel Jacobowitz wrote:
> On Thu, Oct 11, 2007 at 09:32:23AM -0000, xt28@gmx.de wrote:
>
>> When debugging a statically linked binary, setting a breakpoint at
>> the program's entry point does not work, i.e. the breakpoint is set,
>> but execution does not stop at the breakpoint.
>>
>
> Unfortunately, this is a known problem. GDB does not check for
> breakpoints before the first resume.
>
I am not sure if that is the issue. Even if the program is running and
jumps back to its entry point, a breakpoint will not stop execution.
See the following transcript:
$ cat /tmp/helloloop.S
.text
.globl _start
_start:
movl $4, %eax # code for 'write(2)' syscall
movl $1, %ebx # fd = stdout
movl $message, %ecx # string to write
movl $len, %edx # length of that string
int $0x80 # syscall
jmp _start # loop forever
.data
message: .ascii "Hello, World!\n"
len = . - message
$ gdb/gdb /tmp/helloloop
GNU gdb 6.7.50_20071011
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) info files
Symbols from "/tmp/helloloop".
Local exec file:
`/tmp/helloloop', file type elf32-i386.
Entry point: 0x8048074
0x08048074 - 0x0804808f is .text
0x08049090 - 0x0804909e is .data
(gdb) break *0x8048074
Breakpoint 1 at 0x8048074
(gdb) run
Starting program: /tmp/helloloop
(no debugging symbols found)
Hello, World!
Hello, World!
[...]
Hello, World!
Program received signal SIGINT, Interrupt.
0x08048079 in _start ()
(gdb) quit
The program is running. Exit anyway? (y or n) y