This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH RFC] process/thread/lwp id patch - phase 3
- To: gdb-patches at sources dot redhat dot com
- Subject: Re: [PATCH RFC] process/thread/lwp id patch - phase 3
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Mon, 14 May 2001 17:07:35 -0700
- Cc: Trond Eivind Glomsrød <teg at redhat dot com>
- References: <1010504090641.ZM7298@ocotillo.lan>
On May 4, 2:06am, Kevin Buettner wrote:
> I plan to wait a week for review and discussion before committing this
> patch (or something like it). I happen to like the representation for
> ptid_t that I've chosen, but I am willing to implement the "opacity
> through obscurity" approach if there is a consensus that this is a
> better approach. Please note that I've attempted to ward off poor
> coding habits by documenting the ptid manipulation functions at the
> point at which struct ptid is defined (in defs.h). (I'll also add
> something to gdbint.texinfo once the dust settles.)
>
> Finally, I'll note that the representation of ptid_t is not cast
> in stone. Since we're using a typedef, we can easily change
> the represenation in the future.
>
> * inferior.h (null_ptid, minus_one_ptid): New variable declarations.
> (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
> (ptid_get_tid, ptid_equal): New function declarations.
> * infrun.c (null_ptid, minus_one_ptid): New variables.
> (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
> (ptid_get_tid, ptid_equal): New functions.
> (_initialize_infrun): Initialize null_ptid, minus_one_ptid,
> inferior_ptid, and target_last_wait_ptid.
>
> * defs.h (ptid_t): Redefine to be a struct rather than an int.
> (pid_to_ptid, null_ptid, ptid_equal): Delete these macros.
> (PIDGET, TIDGET, MERGEPID): Redefine these macros using the
> new ptid accessors and constructor.
>
> * config/i386/tm-i386v42mp.h (PIDGET, TIDGET, LIDGET, MERGEPID,
> MKLID, MKTID, ISTID): Provide new definitions for these macros.
> The old macros are retained, but disabled via #if 0 in order
> to aid in future restructuring. See FIXME.
>
> * arm-linux-nat.c (PIDGET, TIDGET): Delete macro definitions.
> * config/i386/tm-i386sol2.h (PIDGET0, PIDGET, TIDGET, MERGEPID):
> Likewise.
> * config/sparc/tm-sun4sol2.h (PIDGET0, PIDGET, TIDGET, MERGEPID):
> Likewise.
> * i386-linux-nat.c (PIDGET, TIDGET): Likewise.
> * infptrace.c (PIDGET, TIDGET): Likewise.
> * lin-lwp.c (PIDGET0, PIDGET, TIDGET, MERGEPID): Likewise.
> * lin-thread.c (PIDGET0, PIDGET, TIDGET, MERGEPID): Likewise.
> * proc-service.c (MERGEPID): Likewise.
> * procfs.c (PIDGET, TIDGET, MERGEPID): Likewise.
> * thread-db.c (PIDGET0, PIDGET, TIDGET, MERGEPID): Likewise.
>
> * lin-lwp.c (THREAD_FLAG): Delete macro definition.
> (GET_LWP): Redefine in terms of ptid_get_lwp().
> (GET_PID): Redefine in terms of ptid_get_pid().
> (is_lwp): Redefine without the need for THREAD_FLAG.
> (BUILD_LWP): Redefine in terms of ptid_build().
> * lin-thread.c (THREAD_FLAG): Delete macro definition.
> (GET_LWP): Redefine in terms of ptid_get_lwp().
> (GET_PID): Redefine in terms of ptid_get_pid().
> (GET_THREAD): Redefine in terms of ptid_get_tid().
> (BUILD_THREAD, BUILD_LWP): Redefine in terms of ptid_build().
> (is_lwp, is_thread): Redefine.
> (linux_child_wait, check_all_signal_numbers)
> (linuxthreads_discard_global_state, attach_thread): Declare these
> functions to squash warnings about missing declarations.
> * sol-thread.c (THREAD_FLAG): Delete macro definition.
> (GET_PID): Redefine in terms of ptid_get_pid().
> (GET_LWP): Redefine in terms of ptid_get_lwp().
> (GET_THREAD): Redefine in terms of ptid_get_tid().
> (BUILD_THREAD, BUILD_LWP): Redefine in terms of ptid_build().
> (is_lwp, is_thread): Redefine.
> * thread-db.c (THREAD_FLAG): Delete macro definition.
> (GET_PID): Redefine in terms of ptid_get_pid().
> (GET_LWP): Redefine in terms of ptid_get_lwp().
> (GET_THREAD): Redefine in terms of ptid_get_tid().
> (BUILD_THREAD, BUILD_LWP): Redefine in terms of ptid_build().
> (is_lwp, is_thread): Redefine.
>
> * corelow.c (add_to_thread_list, get_core_register_section):
> Eliminate hacks needed to prevent regressions when inferior_ptid
> wasn't wide enough to hold the core file thread id in the pid
> component of inferior_ptid.
Committed.
There are a few warnings that result when compiling lin-lwp.c as a result
of this patch. I will commit the necessary changes shortly to eliminate
those warnings.
Kevin