Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Ben L. Titzer" <ben.titzer@gmail.com>
To: Jonas Maebe <jonas.maebe@elis.ugent.be>
Cc: gdb@sourceware.org
Subject: Re: Break at address on darwin
Date: Tue, 02 Aug 2011 21:51:00 -0000	[thread overview]
Message-ID: <CAL9pw=-KOMv=LbE8X1_mvaucsGeGJp2xNroCUmXch+_kCYBMEQ@mail.gmail.com> (raw)
In-Reply-To: <5456BE39-F808-4255-B327-334CBC46B068@elis.ugent.be>

[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]

On Tue, Aug 2, 2011 at 1:31 PM, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:
>
> On 02 Aug 2011, at 21:19, Ben L. Titzer wrote:
>
>> On Tue, Aug 2, 2011 at 12:00 PM, Jeffrey Walton <noloader@gmail.com> wrote:
>>> Are you certain you are setting a breakpoint on an address (eg, b
>>> 0x40000000)? Or is it a symbolic name (b main)?
>
> Just to make sure: to put a breakpoint on an address, it's "b *0x40000000" (i.e., with an extra "*"; but you'd notice if you used the wrong syntax, since gdb would complain that it can't find a symbol with that name).

Yes, I am using the correct syntax and gdb will list the breakpoints I
have added.

>
>> It's an address. I ænow for sure it's being executed because it's the
>> first instruction in the binary.
>
> Actually, I've noticed on many platforms that breakpoints on the very first instruction don't work. Did you also try other instructions?
>

Doesn't matter, no breakpoints work.

I've attached a sample binary and gdb session.

-------------------
% gdb /tmp/add01
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)
Copyright 2004 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 "x86_64-apple-darwin"...
(gdb) break *0x1114
Breakpoint 1 at 0x1114
(gdb) run
Starting program: /private/tmp/add01

Program exited with code 04.
(gdb) disass 0x1114 0x1140
Dump of assembler code from 0x1114 to 0x1140:
0x00001114:	mov    (%esp),%ebx
0x00001117:	mov    $0x0,%eax
0x0000111c:	mov    0x1121(,%ebx,4),%edx
0x00001123:	jmp    0x1129
0x00001125:	add    %al,(%eax)
0x00001127:	add    %al,(%eax)
0x00001129:	call   0x1148
0x0000112e:	push   %eax
0x0000112f:	mov    %esp,%ebx
0x00001131:	push   $0x4
0x00001133:	push   %ebx
0x00001134:	push   $0x1
0x00001136:	push   $0x0
0x00001138:	mov    $0x4,%eax
0x0000113d:	int    $0x80
0x0000113f:	push   %eax
End of assembler dump.
(gdb) break 01148
No symbol table is loaded.  Use the "file" command.
(gdb) break *0x1148
Breakpoint 2 at 0x1148
(gdb) run
Starting program: /private/tmp/add01

Program exited with code 04.
(gdb) info breakpoints
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x00001114
2   breakpoint     keep y   0x00001148
(gdb)

[-- Attachment #2: add01 --]
[-- Type: application/octet-stream, Size: 4152 bytes --]

  reply	other threads:[~2011-08-02 21:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 16:47 Ben L. Titzer
2011-08-02 19:00 ` Jeffrey Walton
2011-08-02 19:19   ` Ben L. Titzer
2011-08-02 20:31     ` Jonas Maebe
2011-08-02 21:51       ` Ben L. Titzer [this message]
2011-08-03  8:09         ` Tristan Gingold
2011-08-03  9:00         ` Pedro Alves
2011-08-03  9:05           ` Jonas Maebe
2011-08-03 13:45             ` Ben L. Titzer
2011-08-03 14:06               ` Pedro Alves
2011-08-03 21:00                 ` Ben L. Titzer
2011-08-04  7:19                   ` Tristan Gingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL9pw=-KOMv=LbE8X1_mvaucsGeGJp2xNroCUmXch+_kCYBMEQ@mail.gmail.com' \
    --to=ben.titzer@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=jonas.maebe@elis.ugent.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox