[binutils-gdb] MIPS/Linux/native: Convert to `get_ptrace_pid' for PID extraction

Maciej W.Rozycki macro@sourceware.org
Fri Jul 20 16:28:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2d38991535ecfcd092f3c57da84844efc3d49877

commit 2d38991535ecfcd092f3c57da84844efc3d49877
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Fri Jul 20 17:28:08 2018 +0100

    MIPS/Linux/native: Convert to `get_ptrace_pid' for PID extraction
    
    Use `get_ptrace_pid' to get the ptrace PID from `inferior_ptid' rather
    than extracting it by hand.
    
    	gdb/
    	* mips-linux-nat.c (mips_linux_nat_target::read_description):
    	Call `get_ptrace_pid' rather than extracting the ptrace PID by
    	hand.

Diff:
---
 gdb/ChangeLog        | 6 ++++++
 gdb/mips-linux-nat.c | 6 +-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 197da25..d13c9ef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-20  Maciej W. Rozycki  <macro@mips.com>
+
+	* mips-linux-nat.c (mips_linux_nat_target::read_description):
+	Call `get_ptrace_pid' rather than extracting the ptrace PID by
+	hand.
+
 2018-07-20  Keith Seitz  <keiths@redhat.com>
 
 	* buildsym.h (struct buildsym_compunit) <m_objfile, m_subfiles,
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 21b1f58..e37fa4d 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -458,11 +458,7 @@ mips_linux_nat_target::read_description ()
 
   if (have_dsp < 0)
     {
-      int tid;
-
-      tid = inferior_ptid.lwp ();
-      if (tid == 0)
-	tid = inferior_ptid.pid ();
+      int tid = get_ptrace_pid (inferior_ptid);
 
       errno = 0;
       ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);



More information about the Gdb-cvs mailing list