From: Simon Marchi <simon.marchi@polymtl.ca>
To: Xavier Roirand <roirand@adacore.com>
Cc: gdb-patches@sourceware.org, brobecker@adacore.com
Subject: Re: [RFA 5/5] Darwin: fix SIGTRAP when debugging
Date: Wed, 22 Aug 2018 14:34:00 -0000 [thread overview]
Message-ID: <df88fba3fd0cab765ecd4165affe4d60@polymtl.ca> (raw)
In-Reply-To: <1534932677-9496-6-git-send-email-roirand@adacore.com>
On 2018-08-22 06:11, Xavier Roirand wrote:
> Debugging a program under Darwin does not work:
>
> (gdb) start
> Temporary breakpoint 1 at 0x100000fb4: file /tmp/helloworld.c, line 1.
> Starting program: /private/tmp/helloworld
> [New Thread 0x2903 of process 60326]
> During startup program terminated with signal SIGTRAP, Trace/breakpoint
> trap.
>
> Field signaled from darwin_thread_info is not initialized thus signal
> sent to
> the debuggee is considered as not sent by GDB whereas it should.
>
> This patch fixes this problem.
>
> gdb/ChangeLog:
>
> * darwin-nat.c (darwin_check_new_threads): Initialize signaled
> field.
>
> Change-Id: I02052473f1f8d28106cc343f440fa784b110bbf5
> ---
> gdb/darwin-nat.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
> index 9ad4a87..bbd2700 100644
> --- a/gdb/darwin-nat.c
> +++ b/gdb/darwin-nat.c
> @@ -341,6 +341,7 @@ darwin_check_new_threads (struct inferior *inf)
> /* A thread was created. */
> darwin_thread_info *pti = new darwin_thread_info;
>
> + pti->signaled = 0;
> pti->gdb_port = new_id;
> pti->msg_state = DARWIN_RUNNING;
Oh, good catch. Though instead, can we initialize the fields directly
in the class declaration, so if we ever create darwin_thread_info at
some other place, the object will be correctly initialized? In C++11,
you can initialize the fields directly like this:
unsigned char signaled = 0;
I think we might as well initialize all the fields to a sensible value,
and you could also change the "char" fields to "bool" at the same time.
Thanks,
Simon
next prev parent reply other threads:[~2018-08-22 14:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-22 10:11 [RFA 0/5] Fix some bugs on macOS Xavier Roirand
2018-08-22 10:11 ` [RFA 2/5] Darwin: Handle unrelocated dyld Xavier Roirand
2018-08-22 13:55 ` Simon Marchi
2018-09-18 21:22 ` Tom Tromey
2018-09-19 13:41 ` Joel Brobecker
2018-09-19 14:16 ` Simon Marchi
2018-09-19 14:28 ` Joel Brobecker
2018-09-19 14:36 ` Tom Tromey
2018-09-19 14:44 ` Simon Marchi
2018-09-19 15:32 ` Joel Brobecker
2018-09-19 19:15 ` Tom Tromey
2018-09-19 19:50 ` Simon Marchi
2018-09-28 13:31 ` Xavier Roirand
2018-09-28 17:22 ` Tom Tromey
2018-08-22 13:59 ` Simon Marchi
2018-09-18 21:23 ` Tom Tromey
2018-08-22 10:11 ` [RFA 5/5] Darwin: fix SIGTRAP when debugging Xavier Roirand
2018-08-22 14:34 ` Simon Marchi [this message]
2018-08-22 10:11 ` [RFA 4/5] Darwin: fix thread ptid started by fork_inferior Xavier Roirand
2018-08-22 14:30 ` Simon Marchi
2018-08-22 16:10 ` Pedro Alves
2018-08-22 18:14 ` Simon Marchi
2018-08-22 10:11 ` [RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later Xavier Roirand
2018-08-22 14:20 ` Simon Marchi
2018-08-22 14:37 ` Pedro Alves
2018-09-03 13:23 ` Xavier Roirand
2018-09-17 19:31 ` Tom Tromey
2018-08-22 10:11 ` [RFA 1/5] Darwin: fix bad loop incrementation Xavier Roirand
2018-08-22 13:14 ` Simon Marchi
2018-08-23 15:21 ` Simon Marchi
2018-09-17 20:57 ` [RFA 0/5] Fix some bugs on macOS Tom Tromey
2018-09-17 21:25 ` Joel Brobecker
2018-09-17 23:03 ` Tom Tromey
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=df88fba3fd0cab765ecd4165affe4d60@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=roirand@adacore.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