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?
Debugging an i386 userspace on an amd64 target
Debugging an i386 userspace on an amd64 target
Last edited by ameame on Mon Aug 12, 2019 9:31 pm, edited 2 times in total.
-
- Member
- Posts: 797
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Debugging an i386 userspace on an amd64 target
Are you the fellow who asked the core dump question on Stackoverflow recently?
-
- Member
- Posts: 797
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Debugging an i386 userspace on an amd64 target
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
Nah, never posted to stackoverflow before.MichaelPetch wrote:Are you the fellow who asked the core dump question on Stackoverflow recently?
Oops, that was a mistake. I mean't ported my kernel to 64-bit. My processes run in compatibility mode.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?
-
- Member
- Posts: 797
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Debugging an i386 userspace on an amd64 target
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?
Last edited by MichaelPetch on Tue Aug 13, 2019 10:06 am, edited 1 time in total.
Re: Debugging an i386 userspace on an amd64 target
Thanks, it worked! I did have to do the disconnect trick and patch in some files so it's compatible with my glibc though.MichaelPetch wrote:Sounds like you are running into this issue that started becoming an issue 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?