public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] minor windows-nat changes
@ 2019-10-14 14:57 Tom Tromey
  2019-10-14 14:57 ` [PATCH 1/2] Rename pid -> tid in windows-nat.c Tom Tromey
  2019-10-14 14:57 ` [PATCH 2/2] Use %x when printing the TID Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2019-10-14 14:57 UTC (permalink / raw)
  To: gdb-patches

While working on PR gdb/22992, I wrote these two small patches to
change some minor things in windows-nat.c.  I'm sending them
separately since they are simple to review, and because, while I have
a fix for the gdb side of this PR, I haven't yet written the gdbserver
parts.

Tested using the AdaCore internal test suite, though if you read the
patches you'll see this hardly matters.

Tom


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

* [PATCH 2/2] Use %x when printing the TID
  2019-10-14 14:57 [PATCH 0/2] minor windows-nat changes Tom Tromey
  2019-10-14 14:57 ` [PATCH 1/2] Rename pid -> tid in windows-nat.c Tom Tromey
@ 2019-10-14 14:57 ` Tom Tromey
  2019-10-15 15:55   ` Joel Brobecker
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-10-14 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

One spot in windows-nat.c uses %ld to print the TID, but all other
spots use %x, as does the infrun logging.  This makes it unnecessarily
hard to tell which other log messages correspond to this one.  This
patch changes the one outlier to use %x.

gdb/ChangeLog
2019-10-14  Tom Tromey  <tromey@adacore.com>

	* windows-nat.c (windows_nat_target::resume): Use %x when logging
	TID.
---
 gdb/ChangeLog     | 5 +++++
 gdb/windows-nat.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index df44994c95a..a756913cabf 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1447,8 +1447,8 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 
   last_sig = GDB_SIGNAL_0;
 
-  DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
-	       ptid.pid (), ptid.tid (), step, sig));
+  DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=0x%x, step=%d, sig=%d);\n",
+	       ptid.pid (), (unsigned) ptid.tid (), step, sig));
 
   /* Get context for currently selected thread.  */
   th = thread_rec (inferior_ptid.tid (), FALSE);
-- 
2.20.1

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

* [PATCH 1/2] Rename pid -> tid in windows-nat.c
  2019-10-14 14:57 [PATCH 0/2] minor windows-nat changes Tom Tromey
@ 2019-10-14 14:57 ` Tom Tromey
  2019-10-15 15:55   ` Joel Brobecker
  2019-10-14 14:57 ` [PATCH 2/2] Use %x when printing the TID Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-10-14 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

A couple of spots in windows-nat.c used the name "pid" to refer to the
thread ID.  I found this confusing, so this patch changes the names.

gdb/ChangeLog
2019-10-14  Tom Tromey  <tromey@adacore.com>

	* windows-nat.c (windows_nat_target::fetch_registers)
	(windows_nat_target::store_registers): Rename "pid" to "tid".
---
 gdb/ChangeLog     | 5 +++++
 gdb/windows-nat.c | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 607b2e8cb97..df44994c95a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -590,8 +590,8 @@ windows_fetch_one_register (struct regcache *regcache,
 void
 windows_nat_target::fetch_registers (struct regcache *regcache, int r)
 {
-  DWORD pid = regcache->ptid ().tid ();
-  windows_thread_info *th = thread_rec (pid, TRUE);
+  DWORD tid = regcache->ptid ().tid ();
+  windows_thread_info *th = thread_rec (tid, TRUE);
 
   /* Check if TH exists.  Windows sometimes uses a non-existent
      thread id in its events.  */
@@ -660,8 +660,8 @@ windows_store_one_register (const struct regcache *regcache,
 void
 windows_nat_target::store_registers (struct regcache *regcache, int r)
 {
-  DWORD pid = regcache->ptid ().tid ();
-  windows_thread_info *th = thread_rec (pid, TRUE);
+  DWORD tid = regcache->ptid ().tid ();
+  windows_thread_info *th = thread_rec (tid, TRUE);
 
   /* Check if TH exists.  Windows sometimes uses a non-existent
      thread id in its events.  */
-- 
2.20.1

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

* Re: [PATCH 2/2] Use %x when printing the TID
  2019-10-14 14:57 ` [PATCH 2/2] Use %x when printing the TID Tom Tromey
@ 2019-10-15 15:55   ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2019-10-15 15:55 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Mon, Oct 14, 2019 at 08:57:44AM -0600, Tom Tromey wrote:
> One spot in windows-nat.c uses %ld to print the TID, but all other
> spots use %x, as does the infrun logging.  This makes it unnecessarily
> hard to tell which other log messages correspond to this one.  This
> patch changes the one outlier to use %x.
> 
> gdb/ChangeLog
> 2019-10-14  Tom Tromey  <tromey@adacore.com>
> 
> 	* windows-nat.c (windows_nat_target::resume): Use %x when logging
> 	TID.

This is OK as well, Tom. Thank you.

> ---
>  gdb/ChangeLog     | 5 +++++
>  gdb/windows-nat.c | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index df44994c95a..a756913cabf 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -1447,8 +1447,8 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
>  
>    last_sig = GDB_SIGNAL_0;
>  
> -  DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
> -	       ptid.pid (), ptid.tid (), step, sig));
> +  DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=0x%x, step=%d, sig=%d);\n",
> +	       ptid.pid (), (unsigned) ptid.tid (), step, sig));
>  
>    /* Get context for currently selected thread.  */
>    th = thread_rec (inferior_ptid.tid (), FALSE);
> -- 
> 2.20.1

-- 
Joel

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

* Re: [PATCH 1/2] Rename pid -> tid in windows-nat.c
  2019-10-14 14:57 ` [PATCH 1/2] Rename pid -> tid in windows-nat.c Tom Tromey
@ 2019-10-15 15:55   ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2019-10-15 15:55 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> A couple of spots in windows-nat.c used the name "pid" to refer to the
> thread ID.  I found this confusing, so this patch changes the names.
> 
> gdb/ChangeLog
> 2019-10-14  Tom Tromey  <tromey@adacore.com>
> 
> 	* windows-nat.c (windows_nat_target::fetch_registers)
> 	(windows_nat_target::store_registers): Rename "pid" to "tid".

I've reviewed this internally at AdaCore, and this seems sufficiently
straightforward that I'll approve again here. Go ahead, Tom.

> ---
>  gdb/ChangeLog     | 5 +++++
>  gdb/windows-nat.c | 8 ++++----
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 607b2e8cb97..df44994c95a 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -590,8 +590,8 @@ windows_fetch_one_register (struct regcache *regcache,
>  void
>  windows_nat_target::fetch_registers (struct regcache *regcache, int r)
>  {
> -  DWORD pid = regcache->ptid ().tid ();
> -  windows_thread_info *th = thread_rec (pid, TRUE);
> +  DWORD tid = regcache->ptid ().tid ();
> +  windows_thread_info *th = thread_rec (tid, TRUE);
>  
>    /* Check if TH exists.  Windows sometimes uses a non-existent
>       thread id in its events.  */
> @@ -660,8 +660,8 @@ windows_store_one_register (const struct regcache *regcache,
>  void
>  windows_nat_target::store_registers (struct regcache *regcache, int r)
>  {
> -  DWORD pid = regcache->ptid ().tid ();
> -  windows_thread_info *th = thread_rec (pid, TRUE);
> +  DWORD tid = regcache->ptid ().tid ();
> +  windows_thread_info *th = thread_rec (tid, TRUE);
>  
>    /* Check if TH exists.  Windows sometimes uses a non-existent
>       thread id in its events.  */
> -- 
> 2.20.1

-- 
Joel

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

end of thread, other threads:[~2019-10-15 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 14:57 [PATCH 0/2] minor windows-nat changes Tom Tromey
2019-10-14 14:57 ` [PATCH 1/2] Rename pid -> tid in windows-nat.c Tom Tromey
2019-10-15 15:55   ` Joel Brobecker
2019-10-14 14:57 ` [PATCH 2/2] Use %x when printing the TID Tom Tromey
2019-10-15 15:55   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).