From: Luis Machado <lgustavo@codesourcery.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>,
Pedro Alves <palves@redhat.com>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH v2 4/6] Share parts of gdb/gdbthread.h with gdbserver
Date: Wed, 08 Feb 2017 09:07:00 -0000 [thread overview]
Message-ID: <f256c49f-140a-5966-d234-72ec96d8f8b0@codesourcery.com> (raw)
In-Reply-To: <87o9yd4o9c.fsf@redhat.com>
On 02/07/2017 04:41 PM, Sergio Durigan Junior wrote:
> On Wednesday, February 01 2017, Luis Machado wrote:
>
>> On 01/18/2017 09:36 AM, Sergio Durigan Junior wrote:
>>> Again, it was necessary to share a few functions declared on
>>> gdb/gdbthread.h with gdbserver, because they are needed by
>>> fork_inferior. I decided to implement them on
>>> gdb/gdbserver/inferiors.c because that's where the thread functions
>>> are also implemented on gdbserver. Some of these functions do not
>>> need to be implemented on gdbserver, or don't make sense there, so
>>> they are left blank and commented properly.
>>>
>>> gdb/ChangeLog:
>>> 2017-01-17 Sergio Durigan Junior <sergiodj@redhat.com>
>>>
>>> * Makefile.in (HFILES_NO_SRCDIR): Add "common/common-gdbthread.h".
>>> * common/common-gdbthread.h: New file, with parts from
>>> "gdb/gdbthread.h".
>>> * fork-child.c (fork_inferior): Update call of "set_executing".
>>> * gdbthread.h: Include "common-gdbthread.h".
>>> (init_thread_list): Moved to "common/common-gdbthread.h".
>>> (add_thread_silent): Likewise.
>>> (switch_to_thread): Likewise.
>>> (set_executing): Likewise.
>>> * thread.c (set_executing): Update function comment.
>>>
>>> gdb/gdbserver/ChangeLog:
>>> 2017-01-17 Sergio Durigan Junior <sergiodj@redhat.com>
>>>
>>> * inferiors.c (init_thread_list): New function.
>>> (switch_to_thread): Likewise.
>>> (set_executing): Likewise.
>>> (add_thread_silent): Likewise.
>>> * server.c (get_last_target_waitstatus): Likewise.
>>> * server.h (get_last_target_waitstatus): Likewise.
>>> ---
>>> gdb/Makefile.in | 1 +
>>> gdb/common/common-gdbthread.h | 45 +++++++++++++++++++++++++++++++++++++++++++
>>> gdb/gdbserver/inferiors.c | 41 +++++++++++++++++++++++++++++++++++++++
>>> gdb/gdbserver/server.c | 8 ++++++++
>>> gdb/gdbserver/server.h | 3 +++
>>> gdb/gdbthread.h | 20 +------------------
>>> gdb/thread.c | 2 ++
>>> 7 files changed, 101 insertions(+), 19 deletions(-)
>>> create mode 100644 gdb/common/common-gdbthread.h
>>>
>>> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
>>> index c0325d5..3e49e6e 100644
>>> --- a/gdb/Makefile.in
>>> +++ b/gdb/Makefile.in
>>> @@ -1467,6 +1467,7 @@ HFILES_NO_SRCDIR = \
>>> common/common-debug.h \
>>> common/common-defs.h \
>>> common/common-exceptions.h \
>>> + common/common-gdbthread.h \
>>> common/common-regcache.h \
>>> common/common-types.h \
>>> common/common-utils.h \
>>> diff --git a/gdb/common/common-gdbthread.h b/gdb/common/common-gdbthread.h
>>> new file mode 100644
>>> index 0000000..eb66de9
>>> --- /dev/null
>>> +++ b/gdb/common/common-gdbthread.h
>>> @@ -0,0 +1,45 @@
>>> +/* Common multi-process/thread control defs for GDB and gdbserver.
>>> + Copyright (C) 1987-2017 Free Software Foundation, Inc.
>>> + Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
>>> +
>>> +
>>> + This file is part of GDB.
>>> +
>>> + This program is free software; you can redistribute it and/or modify
>>> + it under the terms of the GNU General Public License as published by
>>> + the Free Software Foundation; either version 3 of the License, or
>>> + (at your option) any later version.
>>> +
>>> + This program is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> + GNU General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU General Public License
>>> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
>>> +
>>> +#ifndef COMMON_THREAD_H
>>> +#define COMMON_THREAD_H
>>> +
>>> +struct target_waitstatus;
>>> +
>>> +/* Create an empty thread list, or empty the existing one. */
>>> +extern void init_thread_list (void);
>>> +
>>> +/* Switch from one thread to another. */
>>> +extern void switch_to_thread (ptid_t ptid);
>>> +
>>> +/* Marks thread PTID as executing, or not. If PTID is minus_one_ptid,
>>> + marks all threads.
>>> +
>>> + Note that this is different from the running state. See the
>>> + description of state and executing fields of struct
>>> + thread_info. */
>>> +extern void set_executing (ptid_t ptid, int executing);
>>> +
>>> +/* Add a thread to the thread list and return the pointer to the new
>>> + thread. Caller may use this pointer to initialize the private
>>> + thread data. */
>>> +extern struct thread_info *add_thread_silent (ptid_t ptid);
>>> +
>>> +#endif /* ! COMMON_THREAD_H */
>>> diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
>>> index b65a726..441ec2c 100644
>>> --- a/gdb/gdbserver/inferiors.c
>>> +++ b/gdb/gdbserver/inferiors.c
>>> @@ -468,3 +468,44 @@ make_cleanup_restore_current_thread (void)
>>> {
>>> return make_cleanup (do_restore_current_thread_cleanup, current_thread);
>>> }
>>> +
>>> +/* See common/common-gdbthread.h. */
>>> +
>>> +void
>>> +init_thread_list (void)
>>> +{
>>> + /* To be implemented. */
>>> +}
>>> +
>>> +/* See common/common-gdbthread.h. */
>>> +
>>> +void
>>> +switch_to_thread (ptid_t ptid)
>>> +{
>>> + if (!ptid_equal (ptid, minus_one_ptid))
>>> + current_thread = find_thread_ptid (ptid);
>>> +}
>>> +
>>> +/* See common/common-gdbthread.h. */
>>> +
>>> +void
>>> +set_executing (ptid_t ptid ATTRIBUTE_UNUSED, int executing ATTRIBUTE_UNUSED)
>>> +{
>>> + gdb_assert (current_thread != NULL);
>>> + current_thread->last_resume_kind = resume_stop;
>>> + current_thread->last_status = get_last_target_waitstatus ();
>>> +}
>>> +
>>
>>
>> I'm still not sure about this particular function. But i'd like to
>> hear what other think.
>
> What are your concerns?
Having those parameters that are not actually used, as opposed to having
a function that is the same for both GDB and GDBserver.
next prev parent reply other threads:[~2017-02-08 9:07 UTC|newest]
Thread overview: 155+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 3:39 [PATCH 0/6] Implement the ability to start inferiors with a shell on gdbserver Sergio Durigan Junior
2016-12-23 3:39 ` [PATCH 1/6] Share gdb/environ.[ch] with gdbserver Sergio Durigan Junior
2016-12-26 21:34 ` Luis Machado
2016-12-23 3:39 ` [PATCH 2/6] Share parts of gdb/terminal.h " Sergio Durigan Junior
2016-12-26 21:35 ` Luis Machado
2017-01-03 21:14 ` Sergio Durigan Junior
2017-01-03 21:27 ` Luis Machado
2017-01-03 21:38 ` Sergio Durigan Junior
2016-12-23 3:39 ` [PATCH 3/6] Share parts of gdb/inflow.c " Sergio Durigan Junior
2016-12-26 21:34 ` Luis Machado
2017-01-03 21:16 ` Sergio Durigan Junior
2016-12-23 3:45 ` [PATCH 4/6] Share parts of gdb/gdbthread.h " Sergio Durigan Junior
2016-12-26 21:35 ` Luis Machado
2017-01-03 21:31 ` Sergio Durigan Junior
2016-12-23 3:45 ` [PATCH 5/6] Share fork_inferior et al " Sergio Durigan Junior
2017-01-03 23:32 ` Luis Machado
2017-01-05 20:11 ` Sergio Durigan Junior
2018-02-21 3:58 ` [RFC] "gdbserver ... BASENAME_EXE" no longer works (was: "[PATCH 5/6] Share fork_inferior et al with gdbserver") Joel Brobecker
2018-02-21 6:15 ` [RFC] "gdbserver ... BASENAME_EXE" no longer works Sergio Durigan Junior
2018-02-21 7:37 ` Joel Brobecker
2016-12-23 3:49 ` [PATCH 6/6] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2016-12-23 8:07 ` Eli Zaretskii
2017-01-03 20:48 ` Sergio Durigan Junior
2017-01-04 16:08 ` Eli Zaretskii
2017-01-05 20:12 ` Sergio Durigan Junior
2016-12-26 21:34 ` Luis Machado
2017-01-03 21:35 ` Sergio Durigan Junior
2016-12-27 0:26 ` Tom Tromey
2017-01-03 21:32 ` Sergio Durigan Junior
2016-12-23 7:50 ` [PATCH 0/6] Implement the ability to start inferiors with a shell " Eli Zaretskii
2017-01-03 20:23 ` Sergio Durigan Junior
2017-01-18 15:36 ` [PATCH v2] " Sergio Durigan Junior
2017-01-18 15:36 ` [PATCH v2 1/6] Share gdb/environ.[ch] with gdbserver Sergio Durigan Junior
2017-02-01 20:35 ` Luis Machado
2017-01-18 15:36 ` [PATCH v2 3/6] Share parts of gdb/inflow.c " Sergio Durigan Junior
2017-02-01 18:41 ` Luis Machado
2017-01-18 15:36 ` [PATCH v2 6/6] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-01-18 16:43 ` Eli Zaretskii
2017-02-01 19:07 ` Luis Machado
2017-01-18 15:36 ` [PATCH v2 2/6] Share parts of gdb/terminal.h with gdbserver Sergio Durigan Junior
2017-02-01 18:37 ` Luis Machado
2017-02-07 22:39 ` Sergio Durigan Junior
2017-01-18 15:42 ` [PATCH v2 4/6] Share parts of gdb/gdbthread.h " Sergio Durigan Junior
2017-02-01 18:54 ` Luis Machado
2017-02-07 22:42 ` Sergio Durigan Junior
2017-02-08 9:07 ` Luis Machado [this message]
2017-01-18 15:44 ` [PATCH v2 5/6] Share fork_inferior et al " Sergio Durigan Junior
2017-02-01 21:39 ` Luis Machado
2017-02-07 22:23 ` Sergio Durigan Junior
2017-01-26 22:47 ` [PATCH v2] Implement the ability to start inferiors with a shell on gdbserver Sergio Durigan Junior
2017-01-27 7:45 ` Eli Zaretskii
2017-01-27 17:59 ` Sergio Durigan Junior
2017-02-08 3:25 ` [PATCH v3 0/6] " Sergio Durigan Junior
2017-02-08 3:25 ` [PATCH v3 2/6] Share parts of gdb/terminal.h with gdbserver Sergio Durigan Junior
2017-02-15 15:54 ` Pedro Alves
2017-02-16 21:37 ` Sergio Durigan Junior
2017-02-08 3:25 ` [PATCH v3 1/6] Share gdb/environ.[ch] " Sergio Durigan Junior
2017-02-15 15:36 ` Pedro Alves
2017-03-07 20:50 ` Sergio Durigan Junior
2017-02-08 3:25 ` [PATCH v3 3/6] Share parts of gdb/inflow.c " Sergio Durigan Junior
2017-02-15 16:02 ` Pedro Alves
2017-02-16 22:06 ` Sergio Durigan Junior
2017-02-08 3:32 ` [PATCH v3 5/6] Share fork_inferior et al " Sergio Durigan Junior
2017-02-15 17:28 ` Pedro Alves
2017-02-16 12:23 ` Philipp Rudo
2017-02-16 12:26 ` Pedro Alves
2017-02-16 12:37 ` Philipp Rudo
[not found] ` <87bmtcg91v.fsf@redhat.com>
2017-03-13 15:34 ` Pedro Alves
2017-02-08 3:33 ` [PATCH v3 6/6] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-02-08 17:34 ` Eli Zaretskii
2017-02-09 0:02 ` Sergio Durigan Junior
2017-02-17 16:05 ` Pedro Alves
2017-02-17 16:27 ` Eli Zaretskii
2017-03-07 20:59 ` Sergio Durigan Junior
2017-03-13 15:12 ` Pedro Alves
2017-02-08 3:33 ` [PATCH v3 4/6] Share parts of gdb/gdbthread.h with gdbserver Sergio Durigan Junior
2017-02-15 16:15 ` Pedro Alves
2017-02-21 21:27 ` Sergio Durigan Junior
2017-02-13 19:50 ` [PATCH v3 0/6] Implement the ability to start inferiors with a shell on gdbserver Sergio Durigan Junior
2017-03-08 5:29 ` [PATCH v4 0/5] " Sergio Durigan Junior
2017-03-08 5:29 ` [PATCH v4 2/5] Share parts of gdb/inflow.c with gdbserver Sergio Durigan Junior
2017-03-08 5:29 ` [PATCH v4 4/5] Share fork_inferior et al " Sergio Durigan Junior
2017-03-13 17:04 ` Pedro Alves
2017-03-17 1:02 ` Sergio Durigan Junior
2017-03-17 10:27 ` Pedro Alves
2017-03-08 5:29 ` [PATCH v4 5/5] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-03-08 15:49 ` Eli Zaretskii
2017-03-13 17:26 ` Pedro Alves
2017-03-08 5:29 ` [PATCH v4 3/5] Share parts of gdb/gdbthread.h with gdbserver Sergio Durigan Junior
2017-03-08 5:29 ` [PATCH v4 1/5] Share parts of gdb/terminal.h " Sergio Durigan Junior
2017-03-30 1:50 ` [PATCH v5 0/5] Implement the ability to start inferiors with a shell on gdbserver Sergio Durigan Junior
2017-03-30 1:50 ` [PATCH v5 3/5] C++-fy and prepare for sharing fork_inferior Sergio Durigan Junior
2017-04-07 18:30 ` Pedro Alves
2017-04-12 0:24 ` Sergio Durigan Junior
2017-04-12 5:04 ` Sergio Durigan Junior
2017-04-12 5:19 ` [obv/commit] Fix build breakage from last commit (window-nat.c:windows_create_inferior) Sergio Durigan Junior
2017-04-12 10:14 ` [PATCH] fork-child.c: Avoid unnecessary heap-allocation / string copying (Re: [PATCH v5 3/5] C++-fy and prepare for sharing fork_inferior) Pedro Alves
2017-04-12 22:26 ` Sergio Durigan Junior
2017-04-13 3:42 ` Pedro Alves
2017-04-13 4:33 ` Sergio Durigan Junior
2017-04-13 10:51 ` Pedro Alves
2017-04-13 18:30 ` Sergio Durigan Junior
2017-04-14 1:03 ` [obv/commit] Fix build breakage on Cygwin (PR gdb/21385) Sergio Durigan Junior
2017-03-30 1:50 ` [PATCH v5 1/5] Move parts of inferior job control to common/ Sergio Durigan Junior
2017-03-31 17:11 ` Pedro Alves
2017-03-31 17:31 ` Sergio Durigan Junior
2017-03-31 18:21 ` Pedro Alves
2017-03-31 21:20 ` Sergio Durigan Junior
2017-04-07 17:51 ` Pedro Alves
2017-04-12 0:25 ` Sergio Durigan Junior
2017-04-12 1:17 ` [PATCH] Create gdb_termios.h (and cleanup gdb/{,gdbserver/}terminal.h) Sergio Durigan Junior
2017-04-12 10:28 ` Pedro Alves
2017-04-12 22:00 ` Sergio Durigan Junior
2017-03-30 1:50 ` [PATCH v5 2/5] Share parts of gdb/gdbthread.h with gdbserver Sergio Durigan Junior
2017-03-31 17:15 ` Pedro Alves
2017-04-07 2:53 ` Sergio Durigan Junior
2017-03-30 1:55 ` [PATCH v5 4/5] Share fork_inferior et al " Sergio Durigan Junior
2017-03-30 1:55 ` [PATCH v5 5/5] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-05-04 5:31 ` [PATCH v6 0/4] Implement the ability to start inferiors with a shell " Sergio Durigan Junior
2017-05-04 5:32 ` [PATCH v6 1/4] Move parts of inferior job control to common/ Sergio Durigan Junior
2017-05-04 5:32 ` [PATCH v6 2/4] Share parts of gdb/gdbthread.h with gdbserver Sergio Durigan Junior
2017-05-05 19:04 ` Pedro Alves
2017-05-06 14:15 ` Sergio Durigan Junior
2017-05-04 5:32 ` [PATCH v6 3/4] Share fork_inferior et al " Sergio Durigan Junior
2017-05-05 19:05 ` Pedro Alves
2017-05-31 3:43 ` Sergio Durigan Junior
2017-06-07 10:16 ` Pedro Alves
2017-06-07 12:23 ` Pedro Alves
2017-06-07 21:01 ` Sergio Durigan Junior
2017-06-07 21:06 ` Pedro Alves
2017-06-07 21:00 ` Sergio Durigan Junior
2017-05-04 5:38 ` [PATCH v6 4/4] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-05-05 19:21 ` Pedro Alves
2017-06-04 22:18 ` [PATCH v7 0/4] Implement the ability to start inferiors with a shell " Sergio Durigan Junior
2017-06-04 22:18 ` [PATCH v7 1/4] Move parts of inferior job control to common/ Sergio Durigan Junior
2017-06-04 22:18 ` [PATCH v7 4/4] Implement proper "startup-with-shell" support on gdbserver Sergio Durigan Junior
2017-06-05 2:31 ` Eli Zaretskii
2017-06-04 22:18 ` [PATCH v7 2/4] Share parts of gdb/gdbthread.h with gdbserver Sergio Durigan Junior
2017-06-04 22:18 ` [PATCH v7 3/4] Share fork_inferior et al " Sergio Durigan Junior
2017-06-07 12:29 ` Pedro Alves
2017-06-07 21:06 ` Sergio Durigan Junior
2017-06-07 21:41 ` Sergio Durigan Junior
2017-06-07 22:05 ` Pedro Alves
2017-06-07 22:08 ` Sergio Durigan Junior
2017-06-07 22:14 ` Pedro Alves
2017-06-07 22:15 ` Sergio Durigan Junior
2017-06-07 22:29 ` Pedro Alves
2017-06-08 0:00 ` Sergio Durigan Junior
2019-02-14 15:38 ` Thomas Schwinge
2017-06-08 16:40 ` Yao Qi
2017-06-08 18:49 ` Sergio Durigan Junior
2017-06-08 21:02 ` [commit/obvious] Fix possible bug when no args have been provided to the executable Sergio Durigan Junior
2017-06-09 22:19 ` [commit/obvious] Include <signal.h> on gdbserver/fork-child.c (and fix regressions) Sergio Durigan Junior
2017-06-21 17:01 ` [PATCH v7 3/4] Share fork_inferior et al with gdbserver Simon Marchi
2017-06-21 17:19 ` Sergio Durigan Junior
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=f256c49f-140a-5966-d234-72ec96d8f8b0@codesourcery.com \
--to=lgustavo@codesourcery.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=sergiodj@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