Page 1 of 1
Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 8:13 pm
by ameame
I recently ported my x86 kernel to support x64 and I'm having a problem debugging applications in gdb+qemu. Before I would load the kernel into gdb, pause execution then load the userland application and execute it. Now because of architecture mixing gdb can't change the debug architecture to 32-bit and it can't backtrace or display local variables correctly.
Is there at least a better way to debug applications than this?
Re: Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 9:25 pm
by MichaelPetch
Are you the fellow who asked the core dump question on Stackoverflow recently?
Re: Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 9:27 pm
by MichaelPetch
If you ported your OS to 64-bit then why would it be running 32-bit code? Do you switch tom 32-bit compatibility mode to execute 32-bit userland (ring 3) code?
Re: Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 9:29 pm
by ameame
MichaelPetch wrote:Are you the fellow who asked the core dump question on Stackoverflow recently?
Nah, never posted to stackoverflow before.
MichaelPetch wrote:If you ported your OS to 64-bit then why would it be running 32-bit code? Do you switch tom 32-bit compatibility mode to execute 32-bit userland code?
Oops, that was a mistake. I mean't ported my kernel to 64-bit. My processes run in compatibility mode.
Re: Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 9:59 pm
by MichaelPetch
Sounds like you are running into this issue that started becoming a problem as of 2.9 of QEMU:
https://bugs.launchpad.net/qemu/+bug/1686170 . Any chance you could build 2.8.1 of QEMU and try?
Re: Debugging an i386 userspace on an amd64 target
Posted: Mon Aug 12, 2019 10:51 pm
by ameame
Thanks, it worked! I did have to do the disconnect trick and patch in some files so it's compatible with my glibc though.