From: Tristan Gingold <gingold@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: Jack Howarth <howarth@bromo.med.uc.edu>, gdb@sourceware.org
Subject: Re: PR13901
Date: Mon, 02 Apr 2012 14:07:00 -0000 [thread overview]
Message-ID: <54AC9EED-A577-41CA-B09D-3ED879877D0C@adacore.com> (raw)
In-Reply-To: <4F79AFF4.9000704@redhat.com>
On Apr 2, 2012, at 3:56 PM, Pedro Alves wrote:
> On 04/02/2012 12:57 PM, Tristan Gingold wrote:
>
>> On Apr 2, 2012, at 12:44 PM, Tristan Gingold wrote:
>>>> On Mar 30, 2012, at 3:42 PM, Jack Howarth wrote:
>
>>>>>> (gdb) break main
>
>>>>>> Breakpoint 1 at 0xd80: file himenoBMTxpa.c, line 71.
>>>>>> (gdb) r
>>>>>> Starting program: /Users/howarth/a.out
>>>>>> darwin_set_sstep: unknown flavour: 4
>>>>>> Error calling thread_get_state for GP registers for thread 0x8451lxwarning:
>>>>>> Mach error at "i386-darwin-nat.c:118" in function
>>>>>> "i386_darwin_fetch_inferior_registers": (os/kern) invalid argument (0x4)
>
>
>>>> I now understand the issue:
>>>>
>>>> gdb spawns bash to run the program, but the bash spawned is 64 bits, which is not understood by gdb...
>> Fixed by this patch (committed on trunk):
>
>
> <disclaimer>I don't know much about darwin/osx</disclaimer>
>
> This assumes there's even a 32-bit version of the user's whatever $SHELL.
> Not sure we can claim that's always true? It also doesn't feel right
> to force a different $SHELL version/build of the shell that runs if GDB
> is not involved. Very unlikely to cause problems, but still...
Indeed, this is very unlikely, but I understand the concern.
> Why does GDB need to touch the shell's registers at all in the first place?
I haven't checked why.
> If we can't skip darwin_set_sstep for all continues that are not single-steps,
> we could at least skip those while starting up (when continuing the shell
> until we see enough execs). That'd suggest a new flag like
> darwin-nat.h:struct private_inferior->starting_up, set and cleared in
> darwin_create_inferior, and then making darwin_resume_thread do:
>
> - /* Set single step. */
> - inferior_debug (4, _("darwin_set_sstep (thread=%x, enable=%d)\n"),
> - thread->gdb_port, step);
> - darwin_set_sstep (thread->gdb_port, step);
> + /* Avoid touching the $SHELL process, and go straight to resuming it. */
> + gdb_assert (!inf->private->starting_up || !step);
> + if (!inf->private->starting_up)
> + {
> + /* Set single step. */
> + inferior_debug (4, _("darwin_set_sstep (thread=%x, enable=%d)\n"),
> + thread->gdb_port, step);
> + darwin_set_sstep (thread->gdb_port, step);
>
> WDYT?
Yes, it might be cleaner.
Honestly, I'd prefer to get rid of the shell step and directly execute the user program - or at least have an option to do that. I think I also understand the cons of this approach.
Tristan.
next prev parent reply other threads:[~2012-04-02 14:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 13:42 PR13901 Jack Howarth
2012-03-30 14:19 ` PR13901 Tristan Gingold
2012-04-02 10:44 ` PR13901 Tristan Gingold
2012-04-02 11:57 ` PR13901 Tristan Gingold
2012-04-02 13:17 ` PR13901 Jack Howarth
2012-04-02 13:22 ` PR13901 Tristan Gingold
2012-04-02 13:56 ` PR13901 Pedro Alves
2012-04-02 14:07 ` Tristan Gingold [this message]
2012-04-02 14:17 ` PR13901 Pedro Alves
2012-04-02 14:25 ` PR13901 Tristan Gingold
2012-04-02 14:59 ` PR13901 Andreas Schwab
2012-04-02 15:08 ` PR13901 Tristan Gingold
2012-04-02 15:23 ` PR13901 Pedro Alves
2012-04-02 16:22 ` PR13901 Andreas Schwab
2012-04-02 16:31 ` PR13901 Pedro Alves
2012-04-02 17:28 ` PR13901 Andreas Schwab
2012-04-03 7:28 ` PR13901 John Gilmore
2012-04-04 14:23 ` PR13901 Pedro Alves
2012-04-04 14:47 ` PR13901 Tristan Gingold
2012-04-04 15:01 ` PR13901 Pedro Alves
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=54AC9EED-A577-41CA-B09D-3ED879877D0C@adacore.com \
--to=gingold@adacore.com \
--cc=gdb@sourceware.org \
--cc=howarth@bromo.med.uc.edu \
--cc=palves@redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).