[04/13] Get pid rather than lwpid

Message ID 86bndv1pif.fsf@gmail.com
State New, archived
Headers

Commit Message

Yao Qi Aug. 25, 2015, 1:11 p.m. UTC
  Pedro Alves <palves@redhat.com> writes:

> This doesn't really make sense to me.  We're changing debug registers
> of an LWP, so we should print the LWP's pid, not the thread group
> leader's pid.

Since the local variable is named 'pid' and the string literal in the
debugging output is 'pid' too, I thought pid should be printed.  This
patch renames the variable and prints lwpid rather than pid.
  

Comments

Pedro Alves Aug. 25, 2015, 1:33 p.m. UTC | #1
On 08/25/2015 02:11 PM, Yao Qi wrote:
> From f0dc39d1a71f6c05c1f09fe8c83e01e3187beec9 Mon Sep 17 00:00:00 2001
> From: Yao Qi <yao.qi@linaro.org>
> Date: Tue, 25 Aug 2015 14:08:45 +0100
> Subject: [PATCH] Print tid in debug output of debug_reg_change_callback
> 
> In debug_reg_change_callback, we change debug registers of each LWP.
> It makes more sense to print LWP's pid rather than group leader's pid.
> 
> gdb:
> 
> 2015-08-25  Yao Qi  <yao.qi@linaro.org>
> 
> 	* nat/aarch64-linux-hw-point.c (debug_reg_change_callback):
> 	Rename local variable pid to tid, and get lwpid of lwp.  Update
> 	debug output.
> 

Looks good to me.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index e4a2f8e..c3fe7dd 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -248,7 +248,7 @@  debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
 {
   struct aarch64_dr_update_callback_param *param_p
     = (struct aarch64_dr_update_callback_param *) ptr;
-  int pid = ptid_get_pid (ptid_of_lwp (lwp));
+  int tid = ptid_get_lwp (ptid_of_lwp (lwp));
   int idx = param_p->idx;
   int is_watchpoint = param_p->is_watchpoint;
   struct arch_lwp_info *info = lwp_arch_private_info (lwp);
@@ -264,8 +264,8 @@  debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
   if (show_debug_regs)
     {
       debug_printf ("debug_reg_change_callback: \n\tOn entry:\n");
-      debug_printf ("\tpid%d, dr_changed_bp=0x%s, "
-		    "dr_changed_wp=0x%s\n", pid,
+      debug_printf ("\ttid%d, dr_changed_bp=0x%s, "
+		    "dr_changed_wp=0x%s\n", tid,
 		    phex (info->dr_changed_bp, 8),
 		    phex (info->dr_changed_wp, 8));
     }
@@ -290,8 +290,8 @@  debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
 
   if (show_debug_regs)
     {
-      debug_printf ("\tOn exit:\n\tpid%d, dr_changed_bp=0x%s, "
-		    "dr_changed_wp=0x%s\n", pid,
+      debug_printf ("\tOn exit:\n\ttid%d, dr_changed_bp=0x%s, "
+		    "dr_changed_wp=0x%s\n", tid,
 		    phex (info->dr_changed_bp, 8),
 		    phex (info->dr_changed_wp, 8));
     }