public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Retrieve segment registers on Windows amd64
@ 2015-02-20 12:59 Jon TURNEY
  2015-02-26  9:23 ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Jon TURNEY @ 2015-02-20 12:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon TURNEY

For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems to be
needed to retrieve all the segment registers.  Add it explicitly, with a little
de-cruftification.

The value of the segment registers isn't terribly useful on amd64, but at least
this makes the output of 'info registers' correct.

before:

(gdb)  i r cs ss ds es fs gs
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0

after:

(gdb) i r cs ss ds es fs gs
cs             0x33     51
ss             0x2b     43
ds             0x2b     43
es             0x2b     43
fs             0x53     83
gs             0x2b     43

gdb/ChangeLog

2015-02-19  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* windows-nat.c (CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.
---
 gdb/windows-nat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 9c2dca1..ec11822 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -130,7 +130,6 @@ static CONTEXT saved_context;	/* Containes the saved context from a
 enum
   {
     FLAG_TRACE_BIT = 0x100,
-    CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
   };
 #endif
 
@@ -140,8 +139,8 @@ enum
 #define CONTEXT_EXTENDED_REGISTERS 0
 #endif
 
-#define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \
-	| CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
+        | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS
 
 static uintptr_t dr[8];
 static int debug_registers_changed;
-- 
2.1.4

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

* Re: [PATCH] Retrieve segment registers on Windows amd64
  2015-02-20 12:59 [PATCH] Retrieve segment registers on Windows amd64 Jon TURNEY
@ 2015-02-26  9:23 ` Joel Brobecker
  2015-02-26 13:59   ` Jon TURNEY
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2015-02-26  9:23 UTC (permalink / raw)
  To: Jon TURNEY; +Cc: gdb-patches

Jon,

> For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems to be
> needed to retrieve all the segment registers.  Add it explicitly, with
> a little de-cruftification.
> 
> The value of the segment registers isn't terribly useful on amd64, but
> at least this makes the output of 'info registers' correct.
> 
> before:
> 
> (gdb)  i r cs ss ds es fs gs
> cs             0x33     51
> ss             0x2b     43
> ds             0x0      0
> es             0x0      0
> fs             0x0      0
> gs             0x0      0
> 
> after:
> 
> (gdb) i r cs ss ds es fs gs
> cs             0x33     51
> ss             0x2b     43
> ds             0x2b     43
> es             0x2b     43
> fs             0x53     83
> gs             0x2b     43
> 
> gdb/ChangeLog
> 
> 2015-02-19  Jon TURNEY  <jon.turney@dronecode.org.uk>
> 
> 	* windows-nat.c (CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.

Thanks for the patch.

The patch looks good to me.
The ChangeLog needs to identify all the changes were made, and in
particular, it needs to mention the fact that CONTEXT_DEBUGGER's
declaration was removed.

Do you have a GDB copyright assignment on file. The patch is small
enough that we can take it as a "tiny patch", but if you have other
patches in the pipeline, then you'll eventually need to fill one out.
Let me know if you'd like to get started on the process, it takes
a few weeks to complete, as I understand it.

-- 
Joel

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

* Re: [PATCH] Retrieve segment registers on Windows amd64
  2015-02-26  9:23 ` Joel Brobecker
@ 2015-02-26 13:59   ` Jon TURNEY
  2015-02-27  8:49     ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Jon TURNEY @ 2015-02-26 13:59 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On 26/02/2015 09:23, Joel Brobecker wrote:
> Thanks for the patch.
>
> The patch looks good to me.
> The ChangeLog needs to identify all the changes were made, and in
> particular, it needs to mention the fact that CONTEXT_DEBUGGER's
> declaration was removed.

Thanks for taking a look.

Patch with ChangeLog amended as you suggest attached.

> Do you have a GDB copyright assignment on file. The patch is small
> enough that we can take it as a "tiny patch", but if you have other
> patches in the pipeline, then you'll eventually need to fill one out.
> Let me know if you'd like to get started on the process, it takes
> a few weeks to complete, as I understand it.

Hopefully, I will have a few more patches, so yes please.


[-- Attachment #2: 0001-Retrieve-segment-registers-on-Windows-amd64.patch --]
[-- Type: text/plain, Size: 1952 bytes --]

From 38c4a0ebd50cbcb2630d50be633ab1f9c9107100 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Wed, 18 Feb 2015 23:13:47 +0000
Subject: [PATCH] Retrieve segment registers on Windows amd64

For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems to be
needed to retrieve all the segment registers.  Add it explicitly, with a little
de-cruftification.

The value of the segment registers isn't terribly useful on amd64, but at least
this makes the output of 'info registers' correct.

before:

(gdb)  i r cs ss ds es fs gs
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0

after:

(gdb) i r cs ss ds es fs gs
cs             0x33     51
ss             0x2b     43
ds             0x2b     43
es             0x2b     43
fs             0x53     83
gs             0x2b     43

gdb/ChangeLog

2015-02-26  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* windows-nat.c (CONTEXT_DEBUGGER): Remove.
	(CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.  Incorporate flags
	from CONTEXT_DEBUGGER.
---
 gdb/windows-nat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 9c2dca1..ec11822 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -130,7 +130,6 @@ static CONTEXT saved_context;	/* Containes the saved context from a
 enum
   {
     FLAG_TRACE_BIT = 0x100,
-    CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
   };
 #endif
 
@@ -140,8 +139,8 @@ enum
 #define CONTEXT_EXTENDED_REGISTERS 0
 #endif
 
-#define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \
-	| CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
+        | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS
 
 static uintptr_t dr[8];
 static int debug_registers_changed;
-- 
2.1.4


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

* Re: [PATCH] Retrieve segment registers on Windows amd64
  2015-02-26 13:59   ` Jon TURNEY
@ 2015-02-27  8:49     ` Joel Brobecker
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2015-02-27  8:49 UTC (permalink / raw)
  To: Jon TURNEY; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

> Thanks for taking a look.
> 
> Patch with ChangeLog amended as you suggest attached.

Excellent. Checked in with a small adjustment, as I noticed
that one of the lines ended up being too long, and I missed
that during the first review (I was more worried about the
portability across Windows versions)...

Attached is what I just pushed.

> Hopefully, I will have a few more patches, so yes please.

I'll send it to you privately.

-- 
Joel

[-- Attachment #2: 0001-Retrieve-segment-registers-on-Windows-amd64.patch --]
[-- Type: text/x-diff, Size: 2485 bytes --]

From f0666312fd86272e0234d5f7c92d8f65d5c6505e Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Wed, 18 Feb 2015 23:13:47 +0000
Subject: [PATCH] Retrieve segment registers on Windows amd64

For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems
to be needed to retrieve all the segment registers.  Add it explicitly,
with a little de-cruftification.

The value of the segment registers isn't terribly useful on amd64, but
at least this makes the output of 'info registers' correct.

Before:

    (gdb)  i r cs ss ds es fs gs
    cs             0x33     51
    ss             0x2b     43
    ds             0x0      0
    es             0x0      0
    fs             0x0      0
    gs             0x0      0

After:

    (gdb) i r cs ss ds es fs gs
    cs             0x33     51
    ss             0x2b     43
    ds             0x2b     43
    es             0x2b     43
    fs             0x53     83
    gs             0x2b     43

gdb/ChangeLog

2015-02-27  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* windows-nat.c (CONTEXT_DEBUGGER): Remove.
	(CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.  Incorporate flags
	from CONTEXT_DEBUGGER.
---
 gdb/ChangeLog     | 6 ++++++
 gdb/windows-nat.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fac8b37..ff0e72d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-27  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
+	* windows-nat.c (CONTEXT_DEBUGGER): Remove.
+	(CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.  Incorporate flags
+	from CONTEXT_DEBUGGER.
+
 2015-02-26  Doug Evans  <dje@google.com>
 
 	* gdbtypes.c (internal_type_vptr_fieldno): Add missing call to
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 9c2dca1..107bdf2 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -130,7 +130,6 @@ static CONTEXT saved_context;	/* Containes the saved context from a
 enum
   {
     FLAG_TRACE_BIT = 0x100,
-    CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
   };
 #endif
 
@@ -140,8 +139,9 @@ enum
 #define CONTEXT_EXTENDED_REGISTERS 0
 #endif
 
-#define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \
-	| CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
+        | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
+        | CONTEXT_EXTENDED_REGISTERS
 
 static uintptr_t dr[8];
 static int debug_registers_changed;
-- 
1.9.1


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

end of thread, other threads:[~2015-02-27  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 12:59 [PATCH] Retrieve segment registers on Windows amd64 Jon TURNEY
2015-02-26  9:23 ` Joel Brobecker
2015-02-26 13:59   ` Jon TURNEY
2015-02-27  8:49     ` 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).