qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: gdbserver: Return CS:IP as EIP on 16-bit mode
@ 2015-07-14 18:43 Ismael Luceno
  2015-07-23 18:35 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Ismael Luceno @ 2015-07-14 18:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ismael Luceno

While far from ideal, that seems to be what GDB and most other debuggers expect.

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 target-i386/gdbstub.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target-i386/gdbstub.c b/target-i386/gdbstub.c
index ff99cfb..754ea77 100644
--- a/target-i386/gdbstub.c
+++ b/target-i386/gdbstub.c
@@ -70,8 +70,11 @@ int x86_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
         case IDX_IP_REG:
             if (TARGET_LONG_BITS == 64 && env->hflags & HF_CS64_MASK) {
                 return gdb_get_reg64(mem_buf, env->eip);
-            } else {
+            } else if (env->hflags & HF_PE_MASK) {
                 return gdb_get_reg32(mem_buf, env->eip);
+            } else {
+                return gdb_get_reg32(mem_buf, (env->segs[R_CS].selector << 4)
+                                              + env->eip);
             }
         case IDX_FLAGS_REG:
             return gdb_get_reg32(mem_buf, env->eflags);
-- 
2.4.5

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

* Re: [Qemu-devel] [PATCH] target-i386: gdbserver: Return CS:IP as EIP on 16-bit mode
  2015-07-14 18:43 [Qemu-devel] [PATCH] target-i386: gdbserver: Return CS:IP as EIP on 16-bit mode Ismael Luceno
@ 2015-07-23 18:35 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2015-07-23 18:35 UTC (permalink / raw)
  To: Ismael Luceno, qemu-devel

On 07/14/2015 11:43 AM, Ismael Luceno wrote:
> While far from ideal, that seems to be what GDB and most other debuggers expect.

If so, you'd surely want a similar change to the write side, then.


r~

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

end of thread, other threads:[~2015-07-23 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 18:43 [Qemu-devel] [PATCH] target-i386: gdbserver: Return CS:IP as EIP on 16-bit mode Ismael Luceno
2015-07-23 18:35 ` Richard Henderson

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 NNTP newsgroup(s).