This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: Restore GNU/Hurd functionality


Hello!

On Mon, Jul 20, 2009 at 11:22:34AM +0100, Pedro Alves wrote:
> I've had the patch below here for months already (I think I wrote it
> around the the time of the solaris changes), but,
> since I had borked by GNU/Hurd setup and hadn't found the energy
> yet to restore it, I completelly forgot about it.  :-(

Well, thanks to you for helping with maintining GDB's Hurd port!  If you
need help with a new Hurd image, or want shell access to a system
(<http://www.gnu.org/software/hurd/public_hurd_boxen.html>), please just
speak up.  (Likewise everyone else who is interested, of course!)

> It does some house cleaning on the gnu target (by making it inherit from
> the inf-child target), and ends up up making those functions static
> (while at the same time, getting the port a bit more into shape for
> a future !x86 Hurd port).
> 
> What do you think about it?  Could you try it if you like it?

I did review it and did some testing in the areas that could most likely
be touched by it and found no problems.  I only had to do three very
minor corrections:

> Index: src/gdb/gnu-nat.c

> @@ -2082,6 +2080,7 @@ gnu_create_inferior (struct target_ops *
>  		     int from_tty)
>  {
>    struct inf *inf = cur_inf ();
> +  int pid;
>  
>    void trace_me ()
>    {
> @@ -2090,34 +2089,31 @@ gnu_create_inferior (struct target_ops *
>      if (ptrace (PTRACE_TRACEME) != 0)
>        error (_("ptrace (PTRACE_TRACEME) failed!"));
>    }
> -  void attach_to_child (int pid)
> -  {
> -    /* Attach to the now stopped child, which is actually a shell...  */
> -    inf_debug (inf, "attaching to child: %d", pid);
>  
> -    inf_attach (inf, pid);
> +  inf_debug (inf, "creating inferior");
>  
> -    push_target (&gnu_ops);
> +  pid = fork_inferior (exec_file, allargs, env, trace_me, NULL, NULL, NULL);
> [...]

Whether it is better to do it the old way ( have a nested function
attach_to_child that will be passed to and called from within
fork_inferior), or do it like your patch does (inline the former
attach_to_child to be executed after fork_inferior has returned) -- I
have no idea, so I'll leave that to you.

> +/* Create a prototype generic GNU/Hurd target.  The client can
> +   override it with local methods.  */
> +
> +struct target_ops *
> +gnu_target (void)
> +{
> +  struct target_ops *t = inf_child_target ();

That one needs ``#include "inf-child.h"''.

> +  t->to_can_run = gnu_can_run;

This statement should be removed: the default value (as set by
inf_child_target) is alright and you removed gnu_can_run just above.

> +  t->to_thread_alive = gnu_thread_alive;
> +  t->to_pid_to_str = gnu_pid_to_str;
> +  t->to_stop = gnu_stop;
> +}

``return t;'' is missing.


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


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