All of lore.kernel.org
 help / color / mirror / Atom feed
* Ideas to Improve GDB Stub in Qemu for i8086
@ 2024-12-19  1:35 Davidson Francis
  2024-12-19 16:51 ` Warner Losh
  2024-12-21  5:45 ` [PATCH] target/i386: Improve 16-bit/real mode debug support in GDB Davidson Francis
  0 siblings, 2 replies; 6+ messages in thread
From: Davidson Francis @ 2024-12-19  1:35 UTC (permalink / raw)
  To: QEMU Development; +Cc: Davidson Francis

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.



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

end of thread, other threads:[~2025-03-07 19:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19  1:35 Ideas to Improve GDB Stub in Qemu for i8086 Davidson Francis
2024-12-19 16:51 ` 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

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.