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: [RFA] Linux Checkpoints, take 3


> Date: Fri, 23 Dec 2005 14:41:50 -0800
> From: Michael Snyder <msnyder@redhat.com>
> 
> Fixups per Daniel and Eli.

Thanks.  I have a few comments, below.

> +   for (fp = fork_list; fp; fp = fp->next)
> +     {
> +       if (ptid_equal (fp->ptid, inferior_ptid))
> + 	{
> + 	  printf_filtered ("* ");
> + 	  pc = read_pc ();
> + 	}
> +       else
> + 	{
> + 	  printf_filtered ("  ");
> + 	  pc = fp->pc;
> + 	}
> +       printf_filtered ("%d %s", fp->num, target_pid_to_str (fp->ptid));
> +       if (fp->num == 0)
> + 	printf_filtered (_(" (main process)"));
> +       printf_filtered (_(" at "));
> +       deprecated_print_address_numeric (pc, 1, gdb_stdout);
> + 
> +       sal = find_pc_line (pc, 0);
> +       if (sal.symtab)
> + 	{
> + 	  char *tmp = strrchr (sal.symtab->filename, '/');
> + 
> + 	  if (tmp)
> + 	    printf_filtered (_(", file %s"), tmp + 1);
> + 	  else
> + 	    printf_filtered (_(", file %s"), sal.symtab->filename);
> + 	}
> +       if (sal.line)
> + 	printf_filtered (_(", line %d"), sal.line);
> +       if (!sal.symtab && !sal.line)
> + 	{
> + 	  struct minimal_symbol *msym;
> + 
> + 	  msym = lookup_minimal_symbol_by_pc (pc);
> + 	  if (msym)
> + 	    printf_filtered (", <%s>", SYMBOL_LINKAGE_NAME (msym));
> + 	}
> + 
> +       putchar_filtered ('\n');
> +     }
> + }

This function produces text in chunks, which is bad for translation
(since each partial string will be a separate string in the message
catalog, and the translators will have no easy way of finding out that
they all are parts of the same phrase).

The solution to this is either (1) to rewrite the code so that it uses
complete phrases, even if that means have several strings that are
partially identical; or (2) have an i18n comment before each line that
shows the full phrase (this comment will then be shown in the message
catalog, where the translators will see it when they translate the
parts).  I prefer solution (1), unless it makes the code really
monstrously complex/ugly/unmaintainable.  For a suggestion how to use
technique (1) see:
   http://sourceware.org/ml/gdb-patches/2004-12/msg00135.html.
For an example of (2), see the function aix-thread.c:state2str.

> *************** child_follow_fork (struct target_ops *op
> *** 363,377 ****
>   	 also, but they'll be reinserted below.  */
>         detach_breakpoints (child_pid);
>   
> !       if (debug_linux_nat)
>   	{
> ! 	  target_terminal_ours ();
> ! 	  fprintf_unfiltered (gdb_stdlog,
> ! 			      "Detaching after fork from child process %d.\n",
> ! 			      child_pid);
> ! 	}
>   
> !       ptrace (PTRACE_DETACH, child_pid, 0, 0);
>   
>         if (has_vforked)
>   	{
> --- 370,397 ----
>   	 also, but they'll be reinserted below.  */
>         detach_breakpoints (child_pid);
>   
> !       /* Detach new forked process?  */
> !       if (detach_fork)
>   	{
> ! 	  if (debug_linux_nat)
> ! 	    {
> ! 	      target_terminal_ours ();
> ! 	      fprintf_filtered (gdb_stdlog,
> ! 				"Detaching after fork from child process %d.\n",
> ! 				child_pid);
> ! 	    }

Might as well mark strings with _(), as long as we are changing the
code.

> + @cindex debugging multiple processes
> + On Linux, if you want to debug both the parent and child processes, use the

GNU/Linux, please.


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