Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
@ 2001-09-27  6:53 Joel Brobecker
  2001-09-27 10:05 ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2001-09-27  6:53 UTC (permalink / raw)
  To: gdb-patches

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.

<<
Index: hpux-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpux-thread.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 hpux-thread.c
*** hpux-thread.c	2001/05/06 22:22:02	1.10
--- hpux-thread.c	2001/09/27 13:41:05
*************** hpux_thread_wait (ptid_t ptid, struct ta
*** 216,222 ****
  
    rtnval = child_ops.to_wait (ptid, ourstatus);
  
!   rtnval = find_active_thread ();
  
    do_cleanups (old_chain);
  
--- 216,222 ----
  
    rtnval = child_ops.to_wait (ptid, ourstatus);
  
!   rtnval = pid_to_ptid (find_active_thread ());
  
    do_cleanups (old_chain);
  
*************** hpux_thread_create_inferior (char *exec_
*** 445,451 ****
  
        push_target (&hpux_thread_ops);
  
!       inferior_ptid = find_active_thread ();
  
        add_thread (inferior_ptid);
      }
--- 445,451 ----
  
        push_target (&hpux_thread_ops);
  
!       inferior_ptid = pid_to_ptid (find_active_thread ());
  
        add_thread (inferior_ptid);
      }
>>

Thanks.
-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
  2001-09-27  6:53 [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00 Joel Brobecker
@ 2001-09-27 10:05 ` Kevin Buettner
  2001-09-28 14:31   ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2001-09-27 10:05 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
  2001-09-27 10:05 ` Kevin Buettner
@ 2001-09-28 14:31   ` Joel Brobecker
  2001-10-01 11:40     ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2001-09-28 14:31 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> 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,

  thanks for your feedback. I have tried to implement your suggestions,
but it is a bit hard for me, because I don't have the knowledge on how
the data structures are organised. I tried to guess as best as I could
and came up with the following patch. I made the changes in emergency
mode because I'm off on a trip the entire next week. You'll have to
excuse me if I don't respond to your comments.

  As a side note, I tried to run the GDB I obtained and did not have
much luck. Setting breakpoints seems ok, although I haven't double
checked the pc addresses. However, when I try to run, GDB prints
"Starting program ..." and then just sits there. The inferior is never
spawned but I get 2 gdb processes for the price of one. I haven't had
time to investigate more, and I'm not sure if this is because of my
changes or not.

Anyway, I'm attaching the patch, awaiting your comments. There is one
static variable that was probably intended to be used as a cache. It was
never assigned a value, so I deleted it for now. I could submit this
obvious change as a separate patch if necessary.

2001-09-28  J. Brobecker <brobecker@gnat.com>

	* hpux-thread.c: rewrite find_active_thread() and find_tcb()
	to use ptid_t, instead of overloading the thread and the pid
        into the same 32-bit value. Make associated necessary adaptations.
        Also remove unused variable cached_active_thread.

Thanks,
-- 
Joel
From brobecker@act-europe.fr Fri Sep 28 14:38:00 2001
From: Joel Brobecker <brobecker@act-europe.fr>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Fix compilation failure in bfd/som.c under HPUX 11.00
Date: Fri, 28 Sep 2001 14:38:00 -0000
Message-id: <20010928233841.B24896@act-europe.fr>
References: <20010927160703.G21075@act-europe.fr> <3BB370B3.3020904@cygnus.com>
X-SW-Source: 2001-09/msg00440.html
Content-length: 284

> > 2001-09-27  J. Brobecker <brobecker@gnat.com> * som.c (som_write_symbol_strings): Fix incorrect type of
> >         current_offset to match the function definition. Fixes a build
> >         failure on HPUX-11.00
> >         
> > 
> 
> Fine with me.

Thanks, commited.

-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
  2001-09-28 14:31   ` Joel Brobecker
@ 2001-10-01 11:40     ` Kevin Buettner
  2001-10-01 12:12       ` Andrew Cagney
  2001-10-08 13:50       ` Joel Brobecker
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Buettner @ 2001-10-01 11:40 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Sep 28, 11:31pm, Joel Brobecker wrote:

>   As a side note, I tried to run the GDB I obtained and did not have
> much luck. Setting breakpoints seems ok, although I haven't double
> checked the pc addresses. However, when I try to run, GDB prints
> "Starting program ..." and then just sits there. The inferior is never
> spawned but I get 2 gdb processes for the price of one. I haven't had
> time to investigate more, and I'm not sure if this is because of my
> changes or not.

FWIW, I think this has been a problem for quite some time.  I did
actually try to build/run on HPUX at the time I was working on the
initial ptid_t changes (over a year ago now) and HPUX didn't work
then either.  It'd be really nice if someone would volunteer to be
the HPUX maintainer.

> Anyway, I'm attaching the patch, awaiting your comments. There is one
> static variable that was probably intended to be used as a cache. It was
> never assigned a value, so I deleted it for now. I could submit this
> obvious change as a separate patch if necessary.

I have no problem with this change being rolled into your present
patch.

> 2001-09-28  J. Brobecker <brobecker@gnat.com>
> 
> 	* hpux-thread.c: rewrite find_active_thread() and find_tcb()
> 	to use ptid_t, instead of overloading the thread and the pid
>         into the same 32-bit value. Make associated necessary adaptations.
>         Also remove unused variable cached_active_thread.

I've reviewed your patch and it looks right to me.  Since HPUX doesn't
have a maintainer, and you're fixing build problems, I think it's okay
for you to commit your changes.  (I think this is as close to saying
"Approved" as I can get without being the actual maintainer of the
code.)

Thanks,

Kevin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
  2001-10-01 11:40     ` Kevin Buettner
@ 2001-10-01 12:12       ` Andrew Cagney
  2001-10-08 13:50       ` Joel Brobecker
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2001-10-01 12:12 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: Joel Brobecker, gdb-patches

>> 2001-09-28  J. Brobecker <brobecker@gnat.com>
>> 
>> * hpux-thread.c: rewrite find_active_thread() and find_tcb()
>> to use ptid_t, instead of overloading the thread and the pid
>> into the same 32-bit value. Make associated necessary adaptations.
>> Also remove unused variable cached_active_thread.
> 
> 
> I've reviewed your patch and it looks right to me.  Since HPUX doesn't
> have a maintainer, and you're fixing build problems, I think it's okay
> for you to commit your changes.  (I think this is as close to saying
> "Approved" as I can get without being the actual maintainer of the
> code.)

For an unmaintained target, I having someone review it (properly) and 
then having no one raise an objection is sufficient for me.

Yes, fine.

Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00
  2001-10-01 11:40     ` Kevin Buettner
  2001-10-01 12:12       ` Andrew Cagney
@ 2001-10-08 13:50       ` Joel Brobecker
  1 sibling, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2001-10-08 13:50 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> I've reviewed your patch and it looks right to me.  Since HPUX doesn't
> have a maintainer, and you're fixing build problems, I think it's okay
> for you to commit your changes.  (I think this is as close to saying
> "Approved" as I can get without being the actual maintainer of the
> code.)

Thanks for reviewing the changes. They are now committed in both the main
branch and the 5.1 branch. This fixes the last build problem I had on
HPUX 11. Hopefully, we will find some time to investigate the other
run-time problems.

-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-10-08 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-27  6:53 [RFA] Fix compilation failure in hpux-thread.c under HPUX 11.00 Joel Brobecker
2001-09-27 10:05 ` Kevin Buettner
2001-09-28 14:31   ` Joel Brobecker
2001-10-01 11:40     ` Kevin Buettner
2001-10-01 12:12       ` Andrew Cagney
2001-10-08 13:50       ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox