From: Jeffrey Walton <noloader@gmail.com>
To: "Ben L. Titzer" <ben.titzer@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Break at address on darwin
Date: Tue, 02 Aug 2011 19:00:00 -0000 [thread overview]
Message-ID: <CAH8yC8mgg=HTf8frmEV_LH8ticBvpsT08d4vNdgUxvCzUZra5w@mail.gmail.com> (raw)
In-Reply-To: <CAL9pw=_BKUYDX_Bd0WGV796A6az9Wuw20gayb24Zuqxuw5RjSA@mail.gmail.com>
Hi Ben,
On Tue, Aug 2, 2011 at 12:46 PM, Ben L. Titzer <ben.titzer@gmail.com> wrote:
> I am generating very simple Mach-O binaries by hand without symbol
> information and trying to debug them with gdb by setting breakpoints
> at various addresses. However, the breakpoints I set do not fire,
> though I am certain those addresses are being executed (program runs
> to completion, I can put in illegal instructions and they trap in gdb,
> my program makes system calls that output to stdout, etc).
Are you certain you are setting a breakpoint on an address (eg, b
0x40000000)? Or is it a symbolic name (b main)?
> When I debug other binaries (e.g. generated by gcc), I am able to set
> breakpoints at various addresses and they fire in gdb no problem.
>
> Even though my binaries load and run correctly, producing the correct
> output, gdb breakpoints don't work. If I explicitly insert an int3
> instruction, a gdb breakpoint does occur.
> I have a feeling that I am missing some step that is required by gdb,
> such as setting an attribute or adding an extra section to my binary,
> but I don't know what.
>
> [SNIP]
When I have issues, it typically is because I have optimizations
enabled and I set a symbolic breakpoint which is never hit (despite
what the result of the break command states). Taking optimizations
back to -O0 usually resolves the issue for me.
For what its worth, I don't find this sort of thing to be an Apple/Mac
OS X issue. It can happen anywhere the optimizer works its magic.
Jeff
next prev parent reply other threads:[~2011-08-02 19:00 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 [this message]
2011-08-02 19:19 ` Ben L. Titzer
2011-08-02 20:31 ` Jonas Maebe
2011-08-02 21:51 ` Ben L. Titzer
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='CAH8yC8mgg=HTf8frmEV_LH8ticBvpsT08d4vNdgUxvCzUZra5w@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=ben.titzer@gmail.com \
--cc=gdb@sourceware.org \
/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