All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidson Francis <davidsondfgl@gmail.com>
To: QEMU Development <qemu-devel@nongnu.org>
Cc: Davidson Francis <davidsondfgl@gmail.com>
Subject: Ideas to Improve GDB Stub in Qemu for i8086
Date: Wed, 18 Dec 2024 22:35:35 -0300	[thread overview]
Message-ID: <20241219013535.GB4298@darkstar> (raw)

Hi,
Some time ago, I wrote a Gist [1] outlining what I believe to be the 
ideal environment for debugging 16-bit code in real mode on Qemu. Based 
on the feedback I've received, I decided to share it here to gather more 
opinions.

It is commonly known that Qemu does not handle real/16-bit mode well with 
GDB. To work around this, there are various hacks available, most of 
which involve GDB scripts to make debugging less painful.

Basically, my idea involves two small and specific changes to the GDB 
stub:
1) Returning the correct CPU mode as "i8086" or "i386" depending on the 
current CPU mode (on x86_gdb_arch_name), instead of always returning 
"i386".

2) Translating segmented memory to linear if in real mode, i.e., 
returning CS*0x10+EIP instead of just EIP, and similarly for ESP, etc.

Originally, I considered submitting a patch directly, but I wanted to get 
your thoughts first. I understand that Bochs and similar tools have 
sufficiently good debuggers, but it would be interesting if Qemu had some 
improvements in this area.

I also acknowledge that my solution might not help in all scenarios, such 
as CPU mode switches, so its effectiveness would be limited.

Ref:
[1]: https://gist.github.com/Theldus/4e1efc07ec13fb84fa10c2f3d054dccd

Kind regards,
Davidson Francis.



             reply	other threads:[~2024-12-19  1:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19  1:35 Davidson Francis [this message]
2024-12-19 16:51 ` Ideas to Improve GDB Stub in Qemu for i8086 Warner Losh
2024-12-20  0:34   ` Davidson Francis
2024-12-20 11:14     ` Bernhard Beschow
2024-12-21  5:45 ` [PATCH] target/i386: Improve 16-bit/real mode debug support in GDB Davidson Francis
2025-03-07 19:26   ` Bernhard Beschow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241219013535.GB4298@darkstar \
    --to=davidsondfgl@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.