This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00


On Sep 27,  3:53pm, Joel Brobecker wrote:

> The GDB build on HPUX-11.00 failed in two places on hpux-thread.c. In
> both cases, this is because we tried to assign a pid (a number) inside
> a variable of type ptid_t (a struct). This pid needs to be converted
> to a ptid_t first, using pid_to_ptid ().
> 
> The following patch fixes that, although I haven't had time to test it
> at all. I just verified that it compiles. I'm sorry I can't go further
> with this, but I'm really time-short at the moment (preparing a trip to
> a customer's site next week). It seems obvious enough to be suggested as
> is, but if somebody else could try it out for me, that would be
> excellent.
> 
> 
> 2001-09-27  J. Brobecker <brobecker@gnat.com>
> 
>         * hpux-thread.c: fix two compilations errors caused by an attempt to
>         assign a pid (a number) into a variable of type ptid_t (a struct).
>         Convert the pids into ptid_t using pid_to_ptid () first.

Joel,

Thanks for looking into this.  Looking at your patch, my first
impulse was to declare your changes as obvious and tell you to
commit it.

But now that I've taken a closer look at find_active_thread(), I
see the following:

static int
find_active_thread (void)
{
  ...

  return (cma_thread_get_unique (&tcb.prolog.client_thread) << 16) 
         | PIDGET (main_ptid);
}

It appears to me that this code is still utilizing the old technique
of overloading a thread and a pid into the same 32-bit identifier.

So, find_active_thread() should probably be rewritten as follows:

static ptid_t
find_active_thread (void)
{
  ...

  return (ptid_build (PIDGET (main_ptid), 0, 
                      cma_thread_get_unique (&tcb.prolog.client_thread)));
}

My guess is that making the above change will allow hpux-thread.c to
compile, but that it won't really work right (or even at all) until
find_tcb() is rewritten.  I think that find_tcb should take a ptid_t
instead of an int as its thread argument.  It needs to fetch the thread
by invoking ptid_get_tid() instead of right shifting by 16.

Once this is done, hpux_pid_to_str() also needs to be revised to
call ptid_get_tid() instead of shifting the pid result right by 16.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]